2024-12-30 23:50:15 +01:00
|
|
|
import React, {useEffect, useState} from 'react'
|
2024-12-31 13:55:42 +01:00
|
|
|
import type { Statistics} from '../utils/api'
|
|
|
|
|
import {getStatistics} from '../utils/api'
|
2025-10-31 23:39:08 +01:00
|
|
|
import {Card, Col, Divider, Flex, Row, Statistic, Tooltip} from 'antd'
|
2024-12-30 23:50:15 +01:00
|
|
|
import {t} from 'ttag'
|
2024-08-22 19:26:34 +02:00
|
|
|
import {
|
2024-12-30 23:50:15 +01:00
|
|
|
AimOutlined,
|
|
|
|
|
CompassOutlined,
|
|
|
|
|
DatabaseOutlined,
|
|
|
|
|
FieldTimeOutlined,
|
|
|
|
|
NotificationOutlined
|
|
|
|
|
} from '@ant-design/icons'
|
2024-08-22 19:26:34 +02:00
|
|
|
|
|
|
|
|
export default function StatisticsPage() {
|
|
|
|
|
const [stats, setStats] = useState<Statistics>()
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
getStatistics().then(setStats)
|
|
|
|
|
}, [])
|
|
|
|
|
|
2024-12-30 23:50:15 +01:00
|
|
|
const successRate = stats !== undefined
|
2025-11-02 12:10:33 +01:00
|
|
|
? (stats?.domainPurchased === 0 ? undefined : ((stats?.domainPurchased ?? 0) - (stats?.domainPurchaseFailed ?? 0)) / stats?.domainPurchased)
|
2024-08-22 19:26:34 +02:00
|
|
|
: undefined
|
|
|
|
|
|
2024-12-30 23:50:15 +01:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Card bordered={false}>
|
|
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
|
|
|
|
prefix={<CompassOutlined/>}
|
|
|
|
|
title={t`RDAP queries`}
|
|
|
|
|
value={stats?.rdapQueries}
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Card bordered={false}>
|
|
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
|
|
|
|
title={t`Alerts sent`}
|
|
|
|
|
prefix={<NotificationOutlined/>}
|
|
|
|
|
value={stats?.alertSent}
|
|
|
|
|
valueStyle={{color: 'violet'}}
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Divider/>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Card bordered={false}>
|
|
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
|
|
|
|
title={t`Domain names in database`}
|
|
|
|
|
prefix={<DatabaseOutlined/>}
|
|
|
|
|
value={stats?.domainCountTotal}
|
|
|
|
|
valueStyle={{color: 'orange'}}
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Card bordered={false}>
|
2024-08-22 19:26:34 +02:00
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
2024-12-30 23:50:15 +01:00
|
|
|
title={t`Tracked domain names`}
|
|
|
|
|
prefix={<AimOutlined/>}
|
|
|
|
|
value={stats?.domainTracked}
|
|
|
|
|
valueStyle={{color: 'violet'}}
|
2024-08-22 19:26:34 +02:00
|
|
|
/>
|
2024-12-30 23:50:15 +01:00
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Divider/>
|
|
|
|
|
<Row gutter={16}>
|
|
|
|
|
<Col span={12}>
|
2024-08-22 19:47:52 +02:00
|
|
|
<Card bordered={false}>
|
|
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
2024-12-30 23:50:15 +01:00
|
|
|
title={t`Purchased domain names`}
|
|
|
|
|
prefix={<FieldTimeOutlined/>}
|
2025-11-02 23:15:16 +01:00
|
|
|
value={(stats?.domainPurchased??0) - (stats?.domainPurchaseFailed??0)}
|
2024-12-30 23:50:15 +01:00
|
|
|
valueStyle={{color: 'green'}}
|
2024-08-22 19:47:52 +02:00
|
|
|
/>
|
|
|
|
|
</Card>
|
2024-12-30 23:50:15 +01:00
|
|
|
</Col>
|
|
|
|
|
<Col span={12}>
|
|
|
|
|
<Card bordered={false}>
|
|
|
|
|
<Tooltip
|
|
|
|
|
title={t`This value is based on the status code of the HTTP response from the providers following the domain order.`}
|
|
|
|
|
>
|
|
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
|
|
|
|
title={t`Success rate`}
|
2025-11-01 18:52:41 +01:00
|
|
|
value={successRate === undefined ? '-' : (successRate * 100).toFixed(2)}
|
2024-12-30 23:50:15 +01:00
|
|
|
suffix='%'
|
|
|
|
|
valueStyle={{color: successRate === undefined ? 'grey' : successRate >= 0.5 ? 'darkgreen' : 'orange'}}
|
|
|
|
|
/>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
</Card>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Divider/>
|
2025-10-31 23:39:08 +01:00
|
|
|
<Flex gap={16} wrap justify='center' align='middle'>
|
2024-12-30 23:50:15 +01:00
|
|
|
{stats?.domainCount
|
|
|
|
|
.sort((a, b) => b.domain - a.domain)
|
2025-10-31 23:39:08 +01:00
|
|
|
.map(({domain, tld}) =>
|
|
|
|
|
<Card key={tld} bordered={false}>
|
2024-12-30 23:50:15 +01:00
|
|
|
<Statistic
|
|
|
|
|
loading={stats === undefined}
|
2025-03-31 13:27:46 +02:00
|
|
|
title={tld ? tld : t`TLD`}
|
2024-12-30 23:50:15 +01:00
|
|
|
value={domain}
|
|
|
|
|
valueStyle={{color: 'darkorange'}}
|
|
|
|
|
/>
|
2025-10-31 23:39:08 +01:00
|
|
|
</Card>)}
|
|
|
|
|
</Flex>
|
2024-12-30 23:50:15 +01:00
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|