From 2e8bcc09e6e33955a00c6c0b6a8a48af6a21cc79 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 8 Jul 2025 12:15:53 +0800 Subject: [PATCH] fix: Fix dashboard refresh exception issue (#9455) --- backend/init/migration/migrations/v_1_10.go | 2 +- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/ja.ts | 1 + frontend/src/lang/modules/ko.ts | 1 + frontend/src/lang/modules/ms.ts | 1 + frontend/src/lang/modules/pt-br.ts | 1 + frontend/src/lang/modules/ru.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/views/home/index.vue | 20 +++++++++++++++----- 10 files changed, 24 insertions(+), 6 deletions(-) diff --git a/backend/init/migration/migrations/v_1_10.go b/backend/init/migration/migrations/v_1_10.go index 5a3c66a15..27a16664d 100644 --- a/backend/init/migration/migrations/v_1_10.go +++ b/backend/init/migration/migrations/v_1_10.go @@ -489,7 +489,7 @@ var AddPbootCMSPHPExtensions = &gormigrate.Migration{ var DeleteV2Openresty = &gormigrate.Migration{ ID: "20250701-delete-v2-openresty", Migrate: func(tx *gorm.DB) error { - return tx.Delete(&model.AppDetail{}).Where("version = '1.27.1.2-0-1-focal'").Error + return tx.Where("version = '1.27.1.2-0-1-focal'").Delete(&model.AppDetail{}).Error }, } diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 64847895a..e472fee78 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -333,6 +333,7 @@ const message = { ssl: 'Certificate | Certificates', database: 'Database | Databases', ai_tools: 'AI', + mcp: 'MCP', container: 'Container | Containers', cronjob: 'Cron Job | Cron Jobs', host: 'Host | Hosts', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 154c6a53e..12bd872d3 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -333,6 +333,7 @@ const message = { ssl: '証明書|証明書', database: 'データベース|データベース', ai_tools: 'AI', + mcp: 'MCP', container: 'コンテナ|コンテナ', cronjob: 'クロンジョブ|クロンの仕事', host: 'ホスト|ホスト', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 3e7ec6d4b..1d403aab7 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -334,6 +334,7 @@ const message = { ssl: '인증서 | 인증서들', database: '데이터베이스 | 데이터베이스들', ai_tools: 'AI', + mcp: 'MCP', container: '컨테이너 | 컨테이너들', cronjob: '크론 작업 | 크론 작업들', host: '호스트 | 호스트들', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index e477305f6..74e4cba4e 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -340,6 +340,7 @@ const message = { ssl: 'Certificate | Certificates', database: 'Database | Databases', ai_tools: 'AI', + mcp: 'MCP', container: 'Container | Containers', cronjob: 'Cron Job | Cron Jobs', host: 'Host | Hosts', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index 04b49e237..342f570de 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -338,6 +338,7 @@ const message = { ssl: 'Certificado | Certificados', database: 'Banco de Dados | Bancos de Dados', ai_tools: 'AI', + mcp: 'MCP', container: 'Container | Containers', cronjob: 'Tarefa Cron | Tarefas Cron', host: 'Host | Hosts', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 937c2da42..79ab9428b 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -334,6 +334,7 @@ const message = { ssl: 'Сертификат | Сертификаты', database: 'База данных | Базы данных', ai_tools: 'AI', + mcp: 'MCP', container: 'Контейнер | Контейнеры', cronjob: 'Cron | Задачи Cron', host: 'Хост | Хосты', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 3263f6d9b..1e64c8b59 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -327,6 +327,7 @@ const message = { ssl: '證書', database: '資料庫', ai_tools: 'AI', + mcp: 'MCP', container: '容器', cronjob: '計劃任務', host: '主機', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 4ac8475dc..9cba95502 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -326,6 +326,7 @@ const message = { ssl: '证书', database: '数据库', ai_tools: 'AI', + mcp: 'MCP', container: '容器', cronjob: '计划任务', host: '主机', diff --git a/frontend/src/views/home/index.vue b/frontend/src/views/home/index.vue index b746aecb9..0ce0c819b 100644 --- a/frontend/src/views/home/index.vue +++ b/frontend/src/views/home/index.vue @@ -289,6 +289,7 @@ const chartOption = ref('network'); let timer: NodeJS.Timer | null = null; let isInit = ref(true); let isActive = ref(true); +let isCurrentActive = ref(true); const ioReadBytes = ref>([]); const ioWriteBytes = ref>([]); @@ -426,12 +427,20 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => { currentInfo.value.uptime = resData.uptime; loadAppCurrentInfo(); - statusRef.value.acceptParams(currentInfo.value, baseInfo.value); - appRef.value.acceptParams(); + statusRef.value?.acceptParams(currentInfo.value, baseInfo.value); + appRef.value?.acceptParams(); if (isInit) { timer = setInterval(async () => { - if (isActive.value && !globalStore.isOnRestart) { - loadAppCurrentInfo(); + try { + if (!isCurrentActive.value) { + throw new Error('jump out'); + } + if (isActive.value && !globalStore.isOnRestart) { + await loadAppCurrentInfo(); + } + } catch { + clearInterval(Number(timer)); + timer = null; } }, 3000); } @@ -439,7 +448,7 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => { const loadAppCurrentInfo = async () => { await Promise.all([onLoadCurrentInfo('gpu'), onLoadCurrentInfo('basic'), onLoadCurrentInfo('ioNet')]); - statusRef.value.acceptParams(currentInfo.value, baseInfo.value); + statusRef.value?.acceptParams(currentInfo.value, baseInfo.value); }; const onLoadCurrentInfo = async (scope: string) => { @@ -661,6 +670,7 @@ onMounted(() => { onBeforeUnmount(() => { window.removeEventListener('focus', onFocus); window.removeEventListener('blur', onBlur); + isCurrentActive.value = false; clearInterval(Number(timer)); timer = null; });