mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-30 21:21:42 +03:00
+ client: add multiple fields client form
This commit is contained in:
parent
fd26af2677
commit
a6d6e9ec9e
10 changed files with 220 additions and 135 deletions
client/src/helpers
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue