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:
parent
1e939703e5
commit
418c830e53
|
@ -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,
|
||||
|
|
|
@ -239,7 +239,6 @@ const Dashboard = ({
|
|||
<div className="col-lg-6">
|
||||
<UpstreamResponses
|
||||
subtitle={subtitle}
|
||||
dnsQueries={stats.numDnsQueries}
|
||||
topUpstreamsResponses={stats.topUpstreamsResponses}
|
||||
refreshButton={refreshButton}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue