2018-08-30 14:25:33 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-05-22 14:06:05 +00:00
|
|
|
import { Trans, withTranslation } from 'react-i18next';
|
2019-08-22 13:10:47 +00:00
|
|
|
import round from 'lodash/round';
|
2018-08-30 14:25:33 +00:00
|
|
|
|
|
|
|
import Card from '../ui/Card';
|
|
|
|
import Tooltip from '../ui/Tooltip';
|
2020-03-17 12:15:19 +00:00
|
|
|
import { formatNumber } from '../../helpers/helpers';
|
2018-08-30 14:25:33 +00:00
|
|
|
|
2018-10-08 15:55:30 +00:00
|
|
|
const tooltipType = 'tooltip-custom--narrow';
|
|
|
|
|
2019-08-22 13:10:47 +00:00
|
|
|
const Counters = (props) => {
|
|
|
|
const {
|
|
|
|
t,
|
|
|
|
interval,
|
|
|
|
refreshButton,
|
|
|
|
subtitle,
|
|
|
|
dnsQueries,
|
|
|
|
blockedFiltering,
|
|
|
|
replacedSafebrowsing,
|
|
|
|
replacedParental,
|
|
|
|
replacedSafesearch,
|
|
|
|
avgProcessingTime,
|
|
|
|
} = props;
|
|
|
|
|
2020-05-22 14:06:05 +00:00
|
|
|
const tooltipTitle = interval === 1
|
|
|
|
? t('number_of_dns_query_24_hours')
|
|
|
|
: t('number_of_dns_query_days', { count: interval });
|
2019-08-22 13:10:47 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Card
|
|
|
|
title={t('general_statistics')}
|
|
|
|
subtitle={subtitle}
|
|
|
|
bodyType="card-table"
|
|
|
|
refresh={refreshButton}
|
|
|
|
>
|
|
|
|
<table className="table card-table">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Trans>dns_query</Trans>
|
|
|
|
<Tooltip text={tooltipTitle} type={tooltipType} />
|
|
|
|
</td>
|
|
|
|
<td className="text-right">
|
2020-03-17 12:15:19 +00:00
|
|
|
<span className="text-muted">
|
|
|
|
{formatNumber(dnsQueries)}
|
|
|
|
</span>
|
2019-08-22 13:10:47 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
2019-08-27 13:43:58 +00:00
|
|
|
<Trans components={[<a href="#filters" key="0">link</a>]}>
|
|
|
|
blocked_by
|
|
|
|
</Trans>
|
2019-08-22 13:10:47 +00:00
|
|
|
<Tooltip
|
|
|
|
text={t('number_of_dns_query_blocked_24_hours')}
|
|
|
|
type={tooltipType}
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
<td className="text-right">
|
2020-03-17 12:15:19 +00:00
|
|
|
<span className="text-muted">
|
|
|
|
{formatNumber(blockedFiltering)}
|
|
|
|
</span>
|
2019-08-22 13:10:47 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Trans>stats_malware_phishing</Trans>
|
|
|
|
<Tooltip
|
|
|
|
text={t('number_of_dns_query_blocked_24_hours_by_sec')}
|
|
|
|
type={tooltipType}
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
<td className="text-right">
|
2020-03-17 12:15:19 +00:00
|
|
|
<span className="text-muted">
|
|
|
|
{formatNumber(replacedSafebrowsing)}
|
|
|
|
</span>
|
2019-08-22 13:10:47 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Trans>stats_adult</Trans>
|
|
|
|
<Tooltip
|
|
|
|
text={t('number_of_dns_query_blocked_24_hours_adult')}
|
|
|
|
type={tooltipType}
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
<td className="text-right">
|
2020-03-17 12:15:19 +00:00
|
|
|
<span className="text-muted">
|
|
|
|
{formatNumber(replacedParental)}
|
|
|
|
</span>
|
2019-08-22 13:10:47 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Trans>enforced_save_search</Trans>
|
|
|
|
<Tooltip
|
|
|
|
text={t('number_of_dns_query_to_safe_search')}
|
|
|
|
type={tooltipType}
|
|
|
|
/>
|
|
|
|
</td>
|
|
|
|
<td className="text-right">
|
2020-03-17 12:15:19 +00:00
|
|
|
<span className="text-muted">
|
|
|
|
{formatNumber(replacedSafesearch)}
|
|
|
|
</span>
|
2019-08-22 13:10:47 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
<Trans>average_processing_time</Trans>
|
|
|
|
<Tooltip text={t('average_processing_time_hint')} type={tooltipType} />
|
|
|
|
</td>
|
|
|
|
<td className="text-right">
|
|
|
|
<span className="text-muted">
|
2019-09-03 08:03:47 +00:00
|
|
|
{avgProcessingTime ? `${round(avgProcessingTime)} ms` : 0}
|
2019-08-22 13:10:47 +00:00
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|
2018-08-30 14:25:33 +00:00
|
|
|
|
|
|
|
Counters.propTypes = {
|
|
|
|
dnsQueries: PropTypes.number.isRequired,
|
|
|
|
blockedFiltering: PropTypes.number.isRequired,
|
|
|
|
replacedSafebrowsing: PropTypes.number.isRequired,
|
|
|
|
replacedParental: PropTypes.number.isRequired,
|
|
|
|
replacedSafesearch: PropTypes.number.isRequired,
|
|
|
|
avgProcessingTime: PropTypes.number.isRequired,
|
2018-10-12 13:02:01 +00:00
|
|
|
refreshButton: PropTypes.node.isRequired,
|
2019-08-22 13:10:47 +00:00
|
|
|
subtitle: PropTypes.string.isRequired,
|
|
|
|
interval: PropTypes.number.isRequired,
|
2018-12-26 08:22:15 +00:00
|
|
|
t: PropTypes.func.isRequired,
|
2018-08-30 14:25:33 +00:00
|
|
|
};
|
|
|
|
|
2020-05-22 14:06:05 +00:00
|
|
|
export default withTranslation()(Counters);
|