- client: Count client requests correctly

Close #2037

Squashed commit of the following:

commit f19b5f5919ab0c9c31e03728a0def04f02b8d7db
Merge: b51cf160 06594bde
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Tue Sep 8 13:18:39 2020 +0300

    Merge branch 'master' into fix/2037

commit b51cf16008f516bfeed6d8212d27902514d3251c
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Sep 4 18:06:17 2020 +0300

    - client: Count client requests correctly
This commit is contained in:
Artem Baskal
2020-09-08 14:05:26 +03:00
parent 06594bde8f
commit c5ca2e60c6
4 changed files with 140 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ import { Trans, withTranslation } from 'react-i18next';
import ReactTable from 'react-table';
import { MODAL_TYPE } from '../../../helpers/constants';
import { splitByNewLine } from '../../../helpers/helpers';
import { splitByNewLine, countClientsStatistics } from '../../../helpers/helpers';
import Card from '../../ui/Card';
import Modal from './Modal';
import CellWrap from '../../ui/CellWrap';
@@ -204,7 +204,10 @@ class ClientsTable extends Component {
{
Header: this.props.t('requests_count'),
id: 'statistics',
accessor: (row) => this.props.normalizedTopClients.configured[row.name] || 0,
accessor: (row) => countClientsStatistics(
row.ids,
this.props.normalizedTopClients.auto,
),
sortMethod: (a, b) => b - a,
minWidth: 120,
Cell: (row) => {