badguardhome/client/src/components/Dashboard/Counters.js

99 lines
3.8 KiB
JavaScript
Raw Normal View History

2018-08-30 14:25:33 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import { Trans, withNamespaces } from 'react-i18next';
2018-08-30 14:25:33 +00:00
import Card from '../ui/Card';
import Tooltip from '../ui/Tooltip';
2018-10-08 15:55:30 +00:00
const tooltipType = 'tooltip-custom--narrow';
2018-08-30 14:25:33 +00:00
const Counters = props => (
2018-11-09 06:51:28 +00:00
<Card title={ props.t('general_statistics') } subtitle={ props.t('for_last_24_hours') } bodyType="card-table" refresh={props.refreshButton}>
2018-08-30 14:25:33 +00:00
<table className="table card-table">
<tbody>
<tr>
<td>
2018-11-09 06:51:28 +00:00
<Trans>dns_query</Trans>
<Tooltip text={ props.t('number_of_dns_query_24_hours') } type={tooltipType} />
2018-08-30 14:25:33 +00:00
</td>
<td className="text-right">
<span className="text-muted">
{props.dnsQueries}
</span>
</td>
</tr>
<tr>
<td>
2018-12-26 08:42:55 +00:00
<a href="#filters">
<Trans>blocked_by</Trans>
</a>
2018-11-09 06:51:28 +00:00
<Tooltip text={ props.t('number_of_dns_query_blocked_24_hours') } type={tooltipType} />
2018-08-30 14:25:33 +00:00
</td>
<td className="text-right">
<span className="text-muted">
{props.blockedFiltering}
</span>
</td>
</tr>
<tr>
<td>
2018-11-09 06:51:28 +00:00
<Trans>stats_malware_phishing</Trans>
<Tooltip text={ props.t('number_of_dns_query_blocked_24_hours_by_sec') } type={tooltipType} />
2018-08-30 14:25:33 +00:00
</td>
<td className="text-right">
<span className="text-muted">
{props.replacedSafebrowsing}
</span>
</td>
</tr>
<tr>
<td>
2018-11-09 06:51:28 +00:00
<Trans>stats_adult</Trans>
<Tooltip text={ props.t('number_of_dns_query_blocked_24_hours_adult') } type={tooltipType} />
2018-08-30 14:25:33 +00:00
</td>
<td className="text-right">
<span className="text-muted">
{props.replacedParental}
</span>
</td>
</tr>
<tr>
<td>
2018-11-09 06:51:28 +00:00
<Trans>enforced_save_search</Trans>
<Tooltip text={ props.t('number_of_dns_query_to_safe_search') } type={tooltipType} />
2018-08-30 14:25:33 +00:00
</td>
<td className="text-right">
<span className="text-muted">
{props.replacedSafesearch}
</span>
</td>
</tr>
<tr>
<td>
2018-11-09 06:51:28 +00:00
<Trans>average_processing_time</Trans>
<Tooltip text={ props.t('average_processing_time_hint') } type={tooltipType} />
2018-08-30 14:25:33 +00:00
</td>
<td className="text-right">
<span className="text-muted">
{props.avgProcessingTime}
</span>
</td>
</tr>
</tbody>
</table>
</Card>
);
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,
t: PropTypes.func.isRequired,
2018-08-30 14:25:33 +00:00
};
export default withNamespaces()(Counters);