feat(Connections): Display rulePayload if possible (#655)

This commit is contained in:
tkhaos 2021-12-23 23:44:56 +08:00 committed by GitHub
parent e21d558996
commit 05691cc829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ function formatConnectionDataItem(
prevKv: Record<string, { upload: number; download: number }>, prevKv: Record<string, { upload: number; download: number }>,
now: number now: number
): FormattedConn { ): FormattedConn {
const { id, metadata, upload, download, start, chains, rule } = i; const { id, metadata, upload, download, start, chains, rule, rulePayload } = i;
const { host, destinationPort, destinationIP, network, type, sourceIP, sourcePort } = metadata; const { host, destinationPort, destinationIP, network, type, sourceIP, sourcePort } = metadata;
// host could be an empty string if it's direct IP connection // host could be an empty string if it's direct IP connection
let host2 = host; let host2 = host;
@ -88,7 +88,7 @@ function formatConnectionDataItem(
download, download,
start: now - new Date(start).valueOf(), start: now - new Date(start).valueOf(),
chains: chains.reverse().join(' / '), chains: chains.reverse().join(' / '),
rule, rule: (rulePayload == null | rulePayload === '') ? rule : (`${rule}(${rulePayload})`),
...metadata, ...metadata,
host: `${host2}:${destinationPort}`, host: `${host2}:${destinationPort}`,
type: `${type}(${network})`, type: `${type}(${network})`,