Merge in DNS/adguard-home from ADG-8813 to master
Squashed commit of the following:
commit ce36a973aed56960aa20720ab576ced9cc3a51b8
Merge: de0ea6edd 5c2ecfaa4
Author: Igor Lobanov <bniwredyc@gmail.com>
Date: Mon Jul 22 11:05:59 2024 +0200
Merge remote-tracking branch 'origin/master' into ADG-8813
commit de0ea6eddf3e409d0caabf4dbcd4e4dcce47c969
Author: Igor Lobanov <bniwredyc@gmail.com>
Date: Thu Jul 18 16:27:00 2024 +0200
changelog fix
commit 598e3ce1748a1f5e10ef31bbac002ff2579fb849
Author: Igor Lobanov <bniwredyc@gmail.com>
Date: Thu Jul 18 16:24:16 2024 +0200
fixed changelog
commit c4378e31a58a1a291e5933c854a39724e90a720d
Author: Igor Lobanov <bniwredyc@gmail.com>
Date: Thu Jul 18 16:18:35 2024 +0200
changelog
commit f9608325e869f7fa0798b46e041c30b100df3a3e
Author: Igor Lobanov <bniwredyc@gmail.com>
Date: Wed Jul 17 16:12:11 2024 +0200
query log client column style fix
75 lines
2.3 KiB
TypeScript
75 lines
2.3 KiB
TypeScript
import React from 'react';
|
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
import { normalizeWhois } from './helpers';
|
|
import { WHOIS_ICONS } from './constants';
|
|
|
|
const getFormattedWhois = (whois: any) => {
|
|
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={whoisInfo[key]}>
|
|
{icon && (
|
|
<>
|
|
<svg className="logs__whois-icon icons icon--18">
|
|
<use xlinkHref={`#${icon}`} />
|
|
</svg>
|
|
|
|
</>
|
|
)}
|
|
{whoisInfo[key]}
|
|
</span>
|
|
);
|
|
});
|
|
};
|
|
|
|
/**
|
|
* @param {string} value
|
|
* @param {object} info
|
|
* @param {string} info.name
|
|
* @param {object} info.whois_info
|
|
* @param {boolean} [isDetailed]
|
|
* @param {boolean} [isLogs]
|
|
* @returns {JSXElement}
|
|
*/
|
|
export const renderFormattedClientCell = (value: any, info: any, isDetailed = false, isLogs = false) => {
|
|
let whoisContainer = null;
|
|
let nameContainer = value;
|
|
|
|
if (info) {
|
|
const { name, whois_info } = info;
|
|
const whoisAvailable = whois_info && Object.keys(whois_info).length > 0;
|
|
|
|
if (name) {
|
|
const nameValue = (
|
|
<div
|
|
className="logs__text logs__text--link logs__text--nowrap logs__text--client"
|
|
title={`${name} (${value})`}>
|
|
{name} <small>{`(${value})`}</small>
|
|
</div>
|
|
);
|
|
|
|
if (!isLogs) {
|
|
nameContainer = nameValue;
|
|
} else {
|
|
nameContainer = !whoisAvailable && isDetailed ? <small title={value}>{value}</small> : nameValue;
|
|
}
|
|
}
|
|
|
|
if (whoisAvailable && isDetailed) {
|
|
whoisContainer = (
|
|
<div className="logs__text logs__text--wrap logs__text--whois">{getFormattedWhois(whois_info)}</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="logs__text logs__text--client mw-100" title={value}>
|
|
<Link to={`logs?search="${encodeURIComponent(value)}"`}>{nameContainer}</Link>
|
|
{whoisContainer}
|
|
</div>
|
|
);
|
|
};
|