From 418c830e534a0c9a71ea07cb734288bc3a623e63 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Wed, 9 Aug 2023 18:44:42 +0300 Subject: [PATCH] Pull request 1957: 1453-fix-stats-table Updates #1453. Squashed commit of the following: commit 81105a53a588e6c5d3e16e8ded955b6462a94b7c Author: Ainar Garipov Date: Wed Aug 9 17:51:42 2023 +0300 client: fix total for upstream table --- client/src/components/Dashboard/UpstreamResponses.js | 11 ++++++++--- client/src/components/Dashboard/index.js | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/src/components/Dashboard/UpstreamResponses.js b/client/src/components/Dashboard/UpstreamResponses.js index af98c3ba..658d7de8 100644 --- a/client/src/components/Dashboard/UpstreamResponses.js +++ b/client/src/components/Dashboard/UpstreamResponses.js @@ -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, }) => ( requests_count, 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, diff --git a/client/src/components/Dashboard/index.js b/client/src/components/Dashboard/index.js index efbe5865..c0c88a0e 100644 --- a/client/src/components/Dashboard/index.js +++ b/client/src/components/Dashboard/index.js @@ -239,7 +239,6 @@ const Dashboard = ({