mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-14 18:35:34 +08:00
fix(connections): table close conn
This commit is contained in:
parent
b04b20f8f0
commit
d0c7c1569d
@ -94,7 +94,7 @@ export default () => {
|
|||||||
<div class="flex h-4 items-center">
|
<div class="flex h-4 items-center">
|
||||||
<Button
|
<Button
|
||||||
class="btn-circle btn-xs"
|
class="btn-circle btn-xs"
|
||||||
onClick={() => onCloseConnection(row.id)}
|
onClick={() => onCloseConnection(row.original.id)}
|
||||||
>
|
>
|
||||||
<IconCircleX size="16" />
|
<IconCircleX size="16" />
|
||||||
</Button>
|
</Button>
|
||||||
@ -105,45 +105,50 @@ export default () => {
|
|||||||
header: () => t('ID'),
|
header: () => t('ID'),
|
||||||
enableGrouping: false,
|
enableGrouping: false,
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ID,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ID,
|
||||||
accessorFn: (row) => row.id,
|
accessorFn: (original) => original.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('type'),
|
header: () => t('type'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Type,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Type,
|
||||||
accessorFn: (row) => `${row.metadata.type}(${row.metadata.network})`,
|
accessorFn: (original) =>
|
||||||
|
`${original.metadata.type}(${original.metadata.network})`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('process'),
|
header: () => t('process'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Process,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Process,
|
||||||
accessorFn: (row) =>
|
accessorFn: (original) =>
|
||||||
row.metadata.process ||
|
original.metadata.process ||
|
||||||
row.metadata.processPath.replace(/^.*[/\\](.*)$/, '$1') ||
|
original.metadata.processPath.replace(/^.*[/\\](.*)$/, '$1') ||
|
||||||
'-',
|
'-',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('host'),
|
header: () => t('host'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Host,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Host,
|
||||||
accessorFn: (row) =>
|
accessorFn: (original) =>
|
||||||
`${
|
`${
|
||||||
row.metadata.host ? row.metadata.host : row.metadata.destinationIP
|
original.metadata.host
|
||||||
}:${row.metadata.destinationPort}`,
|
? original.metadata.host
|
||||||
|
: original.metadata.destinationIP
|
||||||
|
}:${original.metadata.destinationPort}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('rules'),
|
header: () => t('rules'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Rule,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Rule,
|
||||||
accessorFn: (row) =>
|
accessorFn: (original) =>
|
||||||
!row.rulePayload ? row.rule : `${row.rule} :: ${row.rulePayload}`,
|
!original.rulePayload
|
||||||
|
? original.rule
|
||||||
|
: `${original.rule} :: ${original.rulePayload}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('chains'),
|
header: () => t('chains'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Chains,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Chains,
|
||||||
accessorFn: (row) => row.chains.slice().reverse().join(' :: '),
|
accessorFn: (original) => original.chains.slice().reverse().join(' :: '),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('connectTime'),
|
header: () => t('connectTime'),
|
||||||
enableGrouping: false,
|
enableGrouping: false,
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime,
|
||||||
accessorFn: (row) => formatTimeFromNow(row.start),
|
accessorFn: (original) => formatTimeFromNow(original.start),
|
||||||
sortingFn: (prev, next) =>
|
sortingFn: (prev, next) =>
|
||||||
dayjs(prev.original.start).valueOf() -
|
dayjs(prev.original.start).valueOf() -
|
||||||
dayjs(next.original.start).valueOf(),
|
dayjs(next.original.start).valueOf(),
|
||||||
@ -152,7 +157,7 @@ export default () => {
|
|||||||
header: () => t('dlSpeed'),
|
header: () => t('dlSpeed'),
|
||||||
enableGrouping: false,
|
enableGrouping: false,
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.DlSpeed,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.DlSpeed,
|
||||||
accessorFn: (row) => `${byteSize(row.downloadSpeed)}/s`,
|
accessorFn: (original) => `${byteSize(original.downloadSpeed)}/s`,
|
||||||
sortingFn: (prev, next) =>
|
sortingFn: (prev, next) =>
|
||||||
prev.original.downloadSpeed - next.original.downloadSpeed,
|
prev.original.downloadSpeed - next.original.downloadSpeed,
|
||||||
},
|
},
|
||||||
@ -160,7 +165,7 @@ export default () => {
|
|||||||
header: () => t('ulSpeed'),
|
header: () => t('ulSpeed'),
|
||||||
enableGrouping: false,
|
enableGrouping: false,
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ULSpeed,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.ULSpeed,
|
||||||
accessorFn: (row) => `${byteSize(row.uploadSpeed)}/s`,
|
accessorFn: (original) => `${byteSize(original.uploadSpeed)}/s`,
|
||||||
sortingFn: (prev, next) =>
|
sortingFn: (prev, next) =>
|
||||||
prev.original.uploadSpeed - next.original.uploadSpeed,
|
prev.original.uploadSpeed - next.original.uploadSpeed,
|
||||||
},
|
},
|
||||||
@ -168,7 +173,7 @@ export default () => {
|
|||||||
header: () => t('dl'),
|
header: () => t('dl'),
|
||||||
enableGrouping: false,
|
enableGrouping: false,
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Download,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Download,
|
||||||
accessorFn: (row) => byteSize(row.download),
|
accessorFn: (original) => byteSize(original.download),
|
||||||
sortingFn: (prev, next) =>
|
sortingFn: (prev, next) =>
|
||||||
prev.original.download - next.original.download,
|
prev.original.download - next.original.download,
|
||||||
},
|
},
|
||||||
@ -176,26 +181,26 @@ export default () => {
|
|||||||
header: () => t('ul'),
|
header: () => t('ul'),
|
||||||
enableGrouping: false,
|
enableGrouping: false,
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Upload,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Upload,
|
||||||
accessorFn: (row) => byteSize(row.upload),
|
accessorFn: (original) => byteSize(original.upload),
|
||||||
sortingFn: (prev, next) => prev.original.upload - next.original.upload,
|
sortingFn: (prev, next) => prev.original.upload - next.original.upload,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('sourceIP'),
|
header: () => t('sourceIP'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.SourceIP,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.SourceIP,
|
||||||
accessorFn: (row) => row.metadata.sourceIP,
|
accessorFn: (original) => original.metadata.sourceIP,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('sourcePort'),
|
header: () => t('sourcePort'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.SourcePort,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.SourcePort,
|
||||||
accessorFn: (row) => row.metadata.sourcePort,
|
accessorFn: (original) => original.metadata.sourcePort,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: () => t('destination'),
|
header: () => t('destination'),
|
||||||
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Destination,
|
accessorKey: CONNECTIONS_TABLE_ACCESSOR_KEY.Destination,
|
||||||
accessorFn: (row) =>
|
accessorFn: (original) =>
|
||||||
row.metadata.remoteDestination ||
|
original.metadata.remoteDestination ||
|
||||||
row.metadata.destinationIP ||
|
original.metadata.destinationIP ||
|
||||||
row.metadata.host,
|
original.metadata.host,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user