6296 fix charts and custom retention labels

Updates #6296

Squashed commit of the following:

commit e6a36f107b7bdd17fe4141b035fe5c1f6edd5c6c
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Oct 13 17:42:41 2023 +0300

    changelog

commit 96f11f2090d2aff600f6dcd6ca601e25cd857530
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Oct 13 16:01:27 2023 +0300

    changelog

commit 136fb14f61dcb2bdec3bc9b8943a05544752a606
Author: Ildar Kamalov <ik@adguard.com>
Date:   Fri Oct 13 15:20:14 2023 +0300

    ADG-7598 fix charts and custom retention labels
This commit is contained in:
Ildar Kamalov
2023-10-16 10:06:37 +03:00
parent 506d71310c
commit 733d6c1fca
7 changed files with 46 additions and 21 deletions

View File

@@ -4,9 +4,9 @@ import { Trans, useTranslation } from 'react-i18next';
import round from 'lodash/round';
import { shallowEqual, useSelector } from 'react-redux';
import Card from '../ui/Card';
import { formatNumber } from '../../helpers/helpers';
import { formatNumber, msToDays, msToHours } from '../../helpers/helpers';
import LogsSearchLink from '../ui/LogsSearchLink';
import { RESPONSE_FILTER, DAY } from '../../helpers/constants';
import { RESPONSE_FILTER, TIME_UNITS } from '../../helpers/constants';
import Tooltip from '../ui/Tooltip';
const Row = ({
@@ -52,14 +52,19 @@ const Counters = ({ refreshButton, subtitle }) => {
numReplacedParental,
numReplacedSafesearch,
avgProcessingTime,
timeUnits,
} = useSelector((state) => state.stats, shallowEqual);
const { t } = useTranslation();
const days = interval / DAY;
const dnsQueryTooltip = timeUnits === TIME_UNITS.HOURS
? t('number_of_dns_query_hours', { count: msToHours(interval) })
: t('number_of_dns_query_days', { count: msToDays(interval) });
const rows = [
{
label: 'dns_query',
count: numDnsQueries,
tooltipTitle: days === 1 ? 'number_of_dns_query_24_hours' : t('number_of_dns_query_days', { count: days }),
tooltipTitle: dnsQueryTooltip,
response_status: RESPONSE_FILTER.ALL.QUERY,
},
{