From cc6ea1acc6f5f3823a87f6a1830f5d2d8f6cd8e6 Mon Sep 17 00:00:00 2001 From: zxr <271055687@qq.com> Date: Sun, 5 Jul 2026 21:21:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=20snmp=E9=93=BE=E8=B7=AF=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .kilocode/rules-architect/AGENTS.md | 4 + .kilocode/rules-code/AGENTS.md | 4 + AGENTS.md | 4 + pnpm-workspace.yaml | 8 +- src/components/message-box/index.vue | 8 ++ src/components/navbar/index.vue | 6 +- src/hooks/useNotificationSocket.ts | 126 ++++++++++++++++++ .../dc/network/components/FormDialog.vue | 56 +++++--- .../ops/pages/dc/server/config/columns.ts | 6 + src/views/ops/pages/dc/server/index.vue | 7 + .../pages/monitor/virtualization/index.vue | 17 ++- 11 files changed, 223 insertions(+), 23 deletions(-) create mode 100644 src/hooks/useNotificationSocket.ts diff --git a/.kilocode/rules-architect/AGENTS.md b/.kilocode/rules-architect/AGENTS.md index ad1b0e5..635a0dd 100644 --- a/.kilocode/rules-architect/AGENTS.md +++ b/.kilocode/rules-architect/AGENTS.md @@ -1,5 +1,9 @@ # Architect Mode Rules (Non-Obvious Only) +## Development Constraints + +- Code is not deployed yet; do not spend effort preserving backward compatibility with old code. + ## Architecture Overview - Vue 3 SPA with dynamic route loading from server diff --git a/.kilocode/rules-code/AGENTS.md b/.kilocode/rules-code/AGENTS.md index 6cb63b5..143652b 100644 --- a/.kilocode/rules-code/AGENTS.md +++ b/.kilocode/rules-code/AGENTS.md @@ -1,5 +1,9 @@ # Code Mode Rules (Non-Obvious Only) +## Development Constraints + +- Code is not deployed yet; do not spend effort preserving backward compatibility with old code. + ## API Layer - Two axios instances exist: [`request.ts`](src/api/request.ts) (custom with workspace header) and [`interceptor.ts`](src/api/interceptor.ts) (global with Bearer token). Choose based on whether you need workspace support. diff --git a/AGENTS.md b/AGENTS.md index 5ba390b..be11f74 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,6 +13,10 @@ This file provides guidance to agents when working with code in this repository. ## Critical Architecture Notes +### Development Constraints + +- Code is not deployed yet; do not spend effort preserving backward compatibility with old code. + ### Vite Config Location Config files are in `config/` directory, NOT root. All vite commands reference `./config/vite.config.*.ts`. diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b205f4b..ee60993 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,5 @@ allowBuilds: - esbuild: set this to true or false - less: set this to true or false - unrs-resolver: set this to true or false - vue-demi: set this to true or false + esbuild: true + less: true + unrs-resolver: true + vue-demi: true diff --git a/src/components/message-box/index.vue b/src/components/message-box/index.vue index 0add560..7f71ce1 100644 --- a/src/components/message-box/index.vue +++ b/src/components/message-box/index.vue @@ -48,6 +48,7 @@ import { setMessageStatus, } from '@/api/message' import useLoading from '@/hooks/loading' +import useNotificationSocket from '@/hooks/useNotificationSocket' import { Message } from '@arco-design/web-vue' import { computed, reactive, ref, toRefs } from 'vue' import { useI18n } from 'vue-i18n' @@ -111,6 +112,9 @@ async function fetchSourceData() { setLoading(false) } } +const upsertMessageToTop = (message: MessageRecord) => { + messageData.messageList = [message, ...messageData.messageList.filter((item) => item.id !== message.id)] +} async function readMessage(data: MessageListType) { const ids = data.map((item) => item.id) await setMessageStatus({ ids }) @@ -190,6 +194,10 @@ const emptyList = () => { messageData.messageList = [] } fetchSourceData() +useNotificationSocket({ + onNotification: upsertMessageToTop, + onReconnectAfter: fetchSourceData, +})