Pull request 1957: 1453-fix-stats-table

Updates #1453.

Squashed commit of the following:

commit 81105a53a588e6c5d3e16e8ded955b6462a94b7c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Aug 9 17:51:42 2023 +0300

    client: fix total for upstream table
This commit is contained in:
Ainar Garipov 2023-08-09 18:44:42 +03:00
parent 1e939703e5
commit 418c830e53
2 changed files with 8 additions and 4 deletions

View File

@ -25,11 +25,17 @@ const CountCell = (totalBlocked) => (
}
);
const getTotalUpstreamRequests = (stats) => {
let total = 0;
stats.forEach(({ count }) => { total += count; });
return total;
};
const UpstreamResponses = ({
t,
refreshButton,
topUpstreamsResponses,
dnsQueries,
subtitle,
}) => (
<Card
@ -53,7 +59,7 @@ const UpstreamResponses = ({
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: CountCell(dnsQueries),
Cell: CountCell(getTotalUpstreamRequests(topUpstreamsResponses)),
},
]}
showPagination={false}
@ -67,7 +73,6 @@ const UpstreamResponses = ({
UpstreamResponses.propTypes = {
topUpstreamsResponses: PropTypes.array.isRequired,
dnsQueries: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired,
subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired,

View File

@ -239,7 +239,6 @@ const Dashboard = ({
<div className="col-lg-6">
<UpstreamResponses
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topUpstreamsResponses={stats.topUpstreamsResponses}
refreshButton={refreshButton}
/>