- client: fix logic of top clients normalization

This commit is contained in:
Artem Baskal
2020-01-13 17:41:59 +03:00
parent 3b9d758510
commit fb8d23f51b
4 changed files with 26 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ class AutoClients extends Component {
},
{
Header: this.props.t('requests_count'),
accessor: row => this.props.normalizedTopClients[row.ip] || 0,
accessor: row => this.props.normalizedTopClients.auto[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics',
minWidth: COLUMN_MIN_WIDTH,

View File

@@ -40,6 +40,7 @@ class ClientsTable extends Component {
} else {
this.handleFormAdd(config);
}
this.props.getStats();
};
getClient = (name, clients) => {
@@ -64,6 +65,7 @@ class ClientsTable extends Component {
// eslint-disable-next-line no-alert
if (window.confirm(this.props.t('client_confirm_delete', { key: data.name }))) {
this.props.deleteClient(data);
this.props.getStats();
}
};
@@ -161,7 +163,7 @@ class ClientsTable extends Component {
{
Header: this.props.t('requests_count'),
id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
accessor: row => this.props.normalizedTopClients.configured[row.name] || 0,
sortMethod: (a, b) => b - a,
minWidth: 120,
Cell: (row) => {
@@ -305,6 +307,7 @@ ClientsTable.propTypes = {
processingAdding: PropTypes.bool.isRequired,
processingDeleting: PropTypes.bool.isRequired,
processingUpdating: PropTypes.bool.isRequired,
getStats: PropTypes.func.isRequired,
};
export default withNamespaces()(ClientsTable);

View File

@@ -23,6 +23,7 @@ class Clients extends Component {
updateClient,
deleteClient,
toggleClientModal,
getStats,
} = this.props;
return (
@@ -44,6 +45,7 @@ class Clients extends Component {
processingAdding={clients.processingAdding}
processingDeleting={clients.processingDeleting}
processingUpdating={clients.processingUpdating}
getStats={getStats}
/>
<AutoClients
autoClients={dashboard.autoClients}