diff options
| author | yaling888 <[email protected]> | 2021-07-30 11:59:49 +0800 |
|---|---|---|
| committer | yaling888 <[email protected]> | 2021-07-30 11:59:49 +0800 |
| commit | 96c16b0ae5562cbe16b311da0ed9f839da172c4e (patch) | |
| tree | 51c3d5cde30b6124b4199ca056fd6399fdc935e8 /src/components | |
| parent | 1d4ce87c5eb2fc675857355efc539785eb0bd288 (diff) | |
feat: add process name to metadata
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/ConnectionTable.module.scss | 2 | ||||
| -rw-r--r-- | src/components/ConnectionTable.tsx | 3 | ||||
| -rw-r--r-- | src/components/Connections.tsx | 8 | ||||
| -rw-r--r-- | src/components/about/About.tsx | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/components/ConnectionTable.module.scss b/src/components/ConnectionTable.module.scss index 80a8432..a14904f 100644 --- a/src/components/ConnectionTable.module.scss +++ b/src/components/ConnectionTable.module.scss @@ -1,7 +1,7 @@ .tr { display: grid; /* grid-template-columns: repeat(11, minmax(max-content, 1fr)); */ - grid-template-columns: repeat(11, minmax(max-content, auto)); + grid-template-columns: repeat(12, minmax(max-content, auto)); } .th { diff --git a/src/components/ConnectionTable.tsx b/src/components/ConnectionTable.tsx index 2323e2e..f2e70a4 100644 --- a/src/components/ConnectionTable.tsx +++ b/src/components/ConnectionTable.tsx @@ -12,6 +12,7 @@ const sortDescFirst = true; const columns = [ { accessor: 'id', show: false }, { Header: 'Host', accessor: 'host' }, + { Header: 'Process', accessor: 'process' }, { Header: 'DL', accessor: 'download', sortDescFirst }, { Header: 'UL', accessor: 'upload', sortDescFirst }, { Header: 'DL Speed', accessor: 'downloadSpeedCurr', sortDescFirst }, @@ -88,7 +89,7 @@ function Table({ data }) { className={cx( s.td, i % 2 === 0 ? s.odd : false, - j >= 1 && j <= 4 ? s.du : false + j >= 2 && j <= 5 ? s.du : false )} > {renderCell(cell)} diff --git a/src/components/Connections.tsx b/src/components/Connections.tsx index c9dffc5..ff38004 100644 --- a/src/components/Connections.tsx +++ b/src/components/Connections.tsx @@ -46,6 +46,7 @@ type FormattedConn = { host: string; type: string; network: string; + process: string; downloadSpeedCurr?: number; uploadSpeedCurr?: number; }; @@ -67,6 +68,7 @@ function filterConns(conns: FormattedConn[], keyword: string) { conn.rule, conn.type, conn.network, + conn.process, ].some((field) => hasSubstring(field, keyword)) ); } @@ -76,7 +78,7 @@ function formatConnectionDataItem( prevKv: Record<string, { upload: number; download: number }>, now: number ): FormattedConn { - const { id, metadata, upload, download, start, chains, rule } = i; + const { id, metadata, upload, download, start, chains, rule, rulePayload } = i; const { host, destinationPort, @@ -85,6 +87,7 @@ function formatConnectionDataItem( type, sourceIP, sourcePort, + process, } = metadata; // host could be an empty string if it's direct IP connection let host2 = host; @@ -96,13 +99,14 @@ function formatConnectionDataItem( download, start: now - new Date(start).valueOf(), chains: chains.reverse().join(' / '), - rule, + rule: rule === 'GeoSite' || rule === 'GeoIP' || rule === 'RuleSet' ? `${rule} (${rulePayload})` : rule, ...metadata, host: `${host2}:${destinationPort}`, type: `${type}(${network})`, source: `${sourceIP}:${sourcePort}`, downloadSpeedCurr: download - (prev ? prev.download : 0), uploadSpeedCurr: upload - (prev ? prev.upload : 0), + process, }; return ret; } diff --git a/src/components/about/About.tsx b/src/components/about/About.tsx index 6ed01ad..a164501 100644 --- a/src/components/about/About.tsx +++ b/src/components/about/About.tsx @@ -53,13 +53,13 @@ function AboutImpl(props: Props) { <Version name="Clash" version={version.version} - link="https://github.com/Dreamacro/clash" + link="https://github.com/yaling888/clash" /> ) : null} <Version name="Yacd" version={__VERSION__} - link="https://github.com/haishanh/yacd" + link="https://github.com/yaling888/yacd" /> </> ); |
