- client: Clear input field when switching from logs page

Close 

Squashed commit of the following:

commit 9ae9b0e480c2ec6bd835faf4caccacd8c1fdfe9f
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Jul 3 17:56:34 2020 +0300

    Setup babel and apply everywhere nullish coalescing and optional chaining operators

commit 0966063842a79078e1d61a54c271e18c9427b2b1
Merge: 42a54f2b 21dfb5ff
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Jul 3 16:59:34 2020 +0300

    Merge branch 'master' into fix/1523

commit 42a54f2ba0d8f5f4e4c04f16abc507b5d9009035
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Jul 3 13:30:25 2020 +0300

    Center mobile tooltip buttons

commit 9cdd501a863b596f1d903f8dd3c449ffbe4c1604
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Jul 3 13:21:37 2020 +0300

    Add cross icon to clear input on click

commit 1308b93c42ffea2ffb7457c34aef96e5cdaccaf2
Merge: 265fec7c da546790
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Mon Jun 29 19:42:04 2020 +0300

    Merge branch 'master' of ssh://bit.adguard.com:7999/dns/adguard-home

commit 265fec7c72656b0c4738623cb470f1c14736230a
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Mon Jun 29 19:41:37 2020 +0300

    - client: Clear input field when switching from logs page
This commit is contained in:
Artem Baskal 2020-07-03 19:17:58 +03:00
parent 21dfb5ffe8
commit 6b134469d4
22 changed files with 144 additions and 91 deletions
client/src/helpers

View file

@ -142,7 +142,7 @@ export const addClientInfo = (data, clients, param) => (
const info = clients.find((item) => item[clientIp]) || '';
return {
...row,
info: (info && info[clientIp]) || '',
info: info?.[clientIp] ?? '',
};
})
);
@ -342,7 +342,7 @@ export const normalizeTopClients = (topClients) => topClients.reduce(
export const getClientInfo = (clients, ip) => {
const client = clients
.find((item) => item.ip_addrs && item.ip_addrs.find((clientIp) => clientIp === ip));
.find((item) => item.ip_addrs?.find((clientIp) => clientIp === ip));
if (!client) {
return '';
@ -403,7 +403,7 @@ export const secondsToMilliseconds = (seconds) => {
return seconds;
};
export const normalizeRulesTextarea = (text) => text && text.replace(/^\n/g, '')
export const normalizeRulesTextarea = (text) => text?.replace(/^\n/g, '')
.replace(/\n\s*\n/g, '\n');
export const isVersionGreater = (currentVersion, previousVersion) => (
@ -415,7 +415,7 @@ export const normalizeWhois = (whois) => {
const {
city, country, ...values
} = whois;
let location = (country && country) || '';
let location = country || '';
if (city && location) {
location = `${location}, ${city}`;
@ -483,7 +483,7 @@ export const checkParental = (reason) => reason === FILTERED_STATUS.FILTERED_PAR
export const checkBlockedService = (reason) => reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
export const getCurrentFilter = (url, filters) => {
const filter = filters && filters.find((item) => url === item.url);
const filter = filters?.find((item) => url === item.url);
if (filter) {
const { enabled, name, url } = filter;