Merge branch 'master' into 1587-cache-settings

This commit is contained in:
ArtemBaskal
2020-07-03 22:30:56 +03:00
27 changed files with 313 additions and 95 deletions

View File

@@ -175,7 +175,7 @@ export const renderSelectField = ({
</label>
{!disabled
&& touched
&& (error && <span className="form__message form__message--error">{error}</span>)}
&& error && <span className="form__message form__message--error">{error}</span>}
</Fragment>;
renderSelectField.propTypes = {

View File

@@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import React from 'react';
import { normalizeWhois } from './helpers';
import { WHOIS_ICONS } from './constants';
@@ -11,12 +11,12 @@ const getFormattedWhois = (whois, t) => {
return (
<span className="logs__whois text-muted" key={key} title={t(key)}>
{icon && (
<Fragment>
<>
<svg className="logs__whois-icon icons">
<use xlinkHref={`#${icon}`} />
</svg>
&nbsp;
</Fragment>
</>
)}{whoisInfo[key]}
</span>
);

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;