Merge: - client: fix names of clients in the top clients list

Closes #1893

Squashed commit of the following:

commit e5de0c4f53558e1ad89dc0069192e534f244f120
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Jul 20 14:29:23 2020 +0300

    - client: fix names of clients in the top clients list
This commit is contained in:
Ildar Kamalov 2020-07-20 15:25:28 +03:00
parent 87789679f5
commit c131ac445a
2 changed files with 21 additions and 9 deletions

View File

@ -62,7 +62,7 @@ const clientCell = (t, toggleClientStatus, processing, disallowedClients) => fun
return (
<>
<div className="logs__row logs__row--overflow logs__row--column">
{formatClientCell(row, true)}
{formatClientCell(row, true, false)}
</div>
{ipMatchListStatus !== IP_MATCH_LIST_STATUS.CIDR
&& renderBlockingButton(ipMatchListStatus, value, toggleClientStatus, processing)}

View File

@ -24,7 +24,7 @@ const getFormattedWhois = (whois) => {
);
};
export const formatClientCell = (row, isDetailed = false) => {
export const formatClientCell = (row, isDetailed = false, isLogs = true) => {
const { value, original: { info } } = row;
let whoisContainer = '';
let nameContainer = value;
@ -33,13 +33,25 @@ export const formatClientCell = (row, isDetailed = false) => {
const { name, whois_info } = info;
if (name) {
nameContainer = !whois_info && isDetailed
? <small title={value}>{value}</small>
: <div className="logs__text logs__text--nowrap" title={`${name} (${value})`}>
{name}
{' '}
<small>{`(${value})`}</small>
</div>;
if (isLogs) {
nameContainer = !whois_info && isDetailed
? (
<small title={value}>{value}</small>
) : (
<div className="logs__text logs__text--nowrap" title={`${name} (${value})`}>
{name}&nbsp;<small>{`(${value})`}</small>
</div>
);
} else {
nameContainer = (
<div
className="logs__text logs__text--nowrap"
title={`${name} (${value})`}
>
{name}&nbsp;<small>{`(${value})`}</small>
</div>
);
}
}
if (whois_info && isDetailed) {