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 = ({
|
const UpstreamResponses = ({
|
||||||
t,
|
t,
|
||||||
refreshButton,
|
refreshButton,
|
||||||
topUpstreamsResponses,
|
topUpstreamsResponses,
|
||||||
dnsQueries,
|
|
||||||
subtitle,
|
subtitle,
|
||||||
}) => (
|
}) => (
|
||||||
<Card
|
<Card
|
||||||
|
@ -53,7 +59,7 @@ const UpstreamResponses = ({
|
||||||
Header: <Trans>requests_count</Trans>,
|
Header: <Trans>requests_count</Trans>,
|
||||||
accessor: 'count',
|
accessor: 'count',
|
||||||
maxWidth: 190,
|
maxWidth: 190,
|
||||||
Cell: CountCell(dnsQueries),
|
Cell: CountCell(getTotalUpstreamRequests(topUpstreamsResponses)),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
showPagination={false}
|
showPagination={false}
|
||||||
|
@ -67,7 +73,6 @@ const UpstreamResponses = ({
|
||||||
|
|
||||||
UpstreamResponses.propTypes = {
|
UpstreamResponses.propTypes = {
|
||||||
topUpstreamsResponses: PropTypes.array.isRequired,
|
topUpstreamsResponses: PropTypes.array.isRequired,
|
||||||
dnsQueries: PropTypes.number.isRequired,
|
|
||||||
refreshButton: PropTypes.node.isRequired,
|
refreshButton: PropTypes.node.isRequired,
|
||||||
subtitle: PropTypes.string.isRequired,
|
subtitle: PropTypes.string.isRequired,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
|
|
|
@ -239,7 +239,6 @@ const Dashboard = ({
|
||||||
<div className="col-lg-6">
|
<div className="col-lg-6">
|
||||||
<UpstreamResponses
|
<UpstreamResponses
|
||||||
subtitle={subtitle}
|
subtitle={subtitle}
|
||||||
dnsQueries={stats.numDnsQueries}
|
|
||||||
topUpstreamsResponses={stats.topUpstreamsResponses}
|
topUpstreamsResponses={stats.topUpstreamsResponses}
|
||||||
refreshButton={refreshButton}
|
refreshButton={refreshButton}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue