From 35a8dc99d1483522eaffc6284d490cb3f1ded01f Mon Sep 17 00:00:00 2001 From: Zephyruso <176294927+Zephyruso@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:18:36 +0800 Subject: [PATCH] feat: host label map & log style --- .../connections/ConnectionTable.vue | 4 +- src/components/settings/SourceIPLabels.vue | 68 +++++++++++++++++++ src/components/sidebar/ConnectionCtrl.vue | 28 +++++--- src/i18n/en.ts | 1 + src/i18n/zh.ts | 1 + src/store/settings.ts | 2 +- src/views/LogsPage.vue | 2 +- src/views/SettingsPage.vue | 2 + 8 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 src/components/settings/SourceIPLabels.vue diff --git a/src/components/connections/ConnectionTable.vue b/src/components/connections/ConnectionTable.vue index fd4d5a9d..ea5db224 100644 --- a/src/components/connections/ConnectionTable.vue +++ b/src/components/connections/ConnectionTable.vue @@ -114,7 +114,7 @@ import { disconnectByIdAPI } from '@/api' import { CONNECTIONS_TABLE_ACCESSOR_KEY } from '@/config' import { fromNow, prettyBytesHelper } from '@/helper' import { renderConnections } from '@/store/connections' -import { connectionTableColumns } from '@/store/settings' +import { connectionTableColumns, sourceIPLabelMap } from '@/store/settings' import type { Connection } from '@/types' import { ArrowDownCircleIcon, @@ -262,7 +262,7 @@ const columns: ColumnDef[] = [ header: () => t('sourceIP'), id: CONNECTIONS_TABLE_ACCESSOR_KEY.SourceIP, accessorFn: (original) => { - return original.metadata.sourceIP + return sourceIPLabelMap.value[original.metadata.sourceIP] || original.metadata.sourceIP }, }, { diff --git a/src/components/settings/SourceIPLabels.vue b/src/components/settings/SourceIPLabels.vue new file mode 100644 index 00000000..d0763db8 --- /dev/null +++ b/src/components/settings/SourceIPLabels.vue @@ -0,0 +1,68 @@ + + + diff --git a/src/components/sidebar/ConnectionCtrl.vue b/src/components/sidebar/ConnectionCtrl.vue index a6d76951..b88c682a 100644 --- a/src/components/sidebar/ConnectionCtrl.vue +++ b/src/components/sidebar/ConnectionCtrl.vue @@ -55,10 +55,10 @@ label="all" >