From ffa244760f639309c64f0a41b721921a4b57e558 Mon Sep 17 00:00:00 2001 From: kunish Date: Fri, 22 Sep 2023 00:56:18 +0800 Subject: [PATCH] feat(connection): filter connections with sourceIP, closes #246 --- src/pages/Connections.tsx | 57 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/src/pages/Connections.tsx b/src/pages/Connections.tsx index 7d8376c..a865e8a 100644 --- a/src/pages/Connections.tsx +++ b/src/pages/Connections.tsx @@ -28,6 +28,7 @@ import { } from '@tanstack/solid-table' import byteSize from 'byte-size' import dayjs from 'dayjs' +import { uniq } from 'lodash' import { For, Index, createMemo, createSignal } from 'solid-js' import { twMerge } from 'tailwind-merge' import { closeAllConnectionsAPI, closeSingleConnectionAPI } from '~/apis' @@ -39,6 +40,7 @@ import { import { CONNECTIONS_TABLE_ACCESSOR_KEY, MODAL } from '~/constants' import { formatTimeFromNow } from '~/helpers' import { + allConnections, clientSourceIPTags, connectionsTableColumnOrder, connectionsTableColumnVisibility, @@ -286,6 +288,12 @@ export default () => { getCoreRowModel: getCoreRowModel(), }) + const sourceIPHeader = createMemo(() => + table + .getFlatHeaders() + .find(({ id }) => id === CONNECTIONS_TABLE_ACCESSOR_KEY.SourceIP), + ) + const tabs = createMemo(() => [ { type: ActiveTab.activeConnections, @@ -302,21 +310,40 @@ export default () => { return (
-
- - {(tab) => ( - - )} - +
+
+ + {(tab) => ( + + )} + +
+ +