8a417604a9
Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb2759d81a
Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48ca33164bf
Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues
63 lines
1.8 KiB
JavaScript
63 lines
1.8 KiB
JavaScript
import React from 'react';
|
|
import { normalizeWhois } from './helpers';
|
|
import { WHOIS_ICONS } from './constants';
|
|
|
|
const getFormattedWhois = (whois, t) => {
|
|
const whoisInfo = normalizeWhois(whois);
|
|
return (
|
|
Object.keys(whoisInfo)
|
|
.map((key) => {
|
|
const icon = WHOIS_ICONS[key];
|
|
return (
|
|
<span className="logs__whois text-muted" key={key} title={t(key)}>
|
|
{icon && (
|
|
<>
|
|
<svg className="logs__whois-icon icons">
|
|
<use xlinkHref={`#${icon}`} />
|
|
</svg>
|
|
|
|
</>
|
|
)}{whoisInfo[key]}
|
|
</span>
|
|
);
|
|
})
|
|
);
|
|
};
|
|
|
|
export const formatClientCell = (row, t, isDetailed = false) => {
|
|
const { value, original: { info } } = row;
|
|
let whoisContainer = '';
|
|
let nameContainer = value;
|
|
|
|
if (info) {
|
|
const { name, whois_info } = info;
|
|
|
|
if (name) {
|
|
nameContainer = isDetailed
|
|
? <small title={value}>{value}</small>
|
|
: <div className="logs__text logs__text--nowrap" title={`${name} (${value})`}>
|
|
{name}
|
|
{' '}
|
|
<small>{`(${value})`}</small>
|
|
</div>;
|
|
}
|
|
|
|
if (whois_info) {
|
|
whoisContainer = (
|
|
<div className="logs__text logs__text--wrap logs__text--whois">
|
|
{getFormattedWhois(whois_info, t)}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="logs__text mw-100" title={value}>
|
|
<>
|
|
{nameContainer}
|
|
{whoisContainer}
|
|
</>
|
|
</div>
|
|
);
|
|
};
|