+ client: add multiple fields client form

This commit is contained in:
Ildar Kamalov 2019-11-28 14:47:06 +03:00 committed by Simon Zolin
parent fd26af2677
commit a6d6e9ec9e
10 changed files with 220 additions and 135 deletions
client/src/helpers

View file

@ -248,6 +248,20 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => {
export const normalizeTextarea = text => text && text.replace(/[;, ]/g, '\n').split('\n').filter(n => n);
export const getClientInfo = (clients, ip) => {
const client = clients
.find(item => item.ip_addrs && item.ip_addrs.find(clientIp => clientIp === ip));
if (!client) {
return '';
}
const { name, whois_info } = client;
const whois = Object.keys(whois_info).length > 0 ? whois_info : '';
return { name, whois };
};
export const getAutoClientInfo = (clients, ip) => {
const client = clients.find(item => ip === item.ip);
if (!client) {