- client: sort clients table by requests count by default

This commit is contained in:
Artem Baskal 2019-12-20 14:15:57 +03:00
parent b54bf94697
commit 57c031c1c6
5 changed files with 40 additions and 35 deletions
client/src/helpers

View file

@ -261,6 +261,13 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => {
export const normalizeTextarea = text => text && text.replace(/[;, ]/g, '\n').split('\n').filter(n => n);
export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
export const getClientInfo = (clients, ip) => {
const client = clients
.find(item => item.ip_addrs && item.ip_addrs.find(clientIp => clientIp === ip));