- client: Fix query logs UI issues

Close 

Squashed commit of the following:

commit a3955c989a939866c6772b147547344b3f8769c4
Merge: c91c41cb 2759d81a
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: af31f48c a33164bf
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
This commit is contained in:
Artem Baskal 2020-07-13 15:23:13 +03:00
parent 2759d81afe
commit 8a417604a9
9 changed files with 76 additions and 51 deletions
client/src/helpers

View file

@ -86,18 +86,16 @@ export const normalizeLogs = (logs) => logs.map((log) => {
const { host: domain, type } = question;
const response = answer ? answer.map((response) => {
const processResponse = (data) => (data ? data.map((response) => {
const { value, type, ttl } = response;
return `${type}: ${value} (ttl=${ttl})`;
}) : [];
const tracker = getTrackerData(domain);
}) : []);
return {
time,
domain,
type,
response,
response: processResponse(answer),
reason,
client,
client_proto,
@ -106,7 +104,8 @@ export const normalizeLogs = (logs) => logs.map((log) => {
status,
serviceName: service_name,
originalAnswer: original_answer,
tracker,
originalResponse: processResponse(original_answer),
tracker: getTrackerData(domain),
answer_dnssec,
elapsedMs,
upstream,
@ -618,3 +617,8 @@ export const selectCompletedFields = (values) => Object.entries(values)
}
return acc;
}, {});
export const processContent = (content) => (Array.isArray(content)
? content.filter(([, value]) => value)
.flat() : content);