+ client: handle per-client settings

This commit is contained in:
Ildar Kamalov 2019-05-22 17:59:57 +03:00 committed by Simon Zolin
parent 22c7efd2d1
commit 22d3c38df2
16 changed files with 863 additions and 40 deletions
client/src/helpers

View file

@ -208,3 +208,21 @@ export const getClientName = (clients, ip) => {
const client = clients.find(item => ip === item.ip);
return (client && client.name) || '';
};
export const sortClients = (clients) => {
const compare = (a, b) => {
const nameA = a.name.toUpperCase();
const nameB = b.name.toUpperCase();
let comparison = 0;
if (nameA > nameB) {
comparison = 1;
} else if (nameA < nameB) {
comparison = -1;
}
return comparison;
};
return clients.sort(compare);
};