From c93d229bae2a38220b7d4754082a83c8ebab6cb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=98=AD?= <81747598+lan-yonghui@users.noreply.github.com> Date: Wed, 2 Apr 2025 18:23:53 +0800 Subject: [PATCH] feat: Agent nodes offline, alert through the main node (#8303) --- agent/constant/alert.go | 3 ++- frontend/package.json | 3 ++- frontend/src/lang/modules/en.ts | 10 ++++++++++ frontend/src/lang/modules/ja.ts | 10 ++++++++++ frontend/src/lang/modules/ko.ts | 9 +++++++++ frontend/src/lang/modules/ms.ts | 11 +++++++++++ frontend/src/lang/modules/pt-br.ts | 11 +++++++++++ frontend/src/lang/modules/ru.ts | 11 +++++++++++ frontend/src/lang/modules/zh-Hant.ts | 9 +++++++++ frontend/src/lang/modules/zh.ts | 11 ++++++++++- frontend/src/store/interface/index.ts | 1 + frontend/src/store/modules/global.ts | 1 + 12 files changed, 87 insertions(+), 3 deletions(-) diff --git a/agent/constant/alert.go b/agent/constant/alert.go index c3efc44b0..b5bef212a 100644 --- a/agent/constant/alert.go +++ b/agent/constant/alert.go @@ -4,8 +4,9 @@ const ( AlertEnable = "Enable" AlertDisable = "Disable" AlertSuccess = "Success" + AlertPushing = "Pushing" AlertError = "Error" AlertSyncError = "SyncError" AlertPushError = "PushError" AlertPushSuccess = "PushSuccess" -) \ No newline at end of file +) diff --git a/frontend/package.json b/frontend/package.json index 081212ef8..d6e000b12 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -38,7 +38,7 @@ "codemirror": "^6.0.1", "crypto-js": "^4.2.0", "echarts": "^5.5.0", - "element-plus": "^2.7.5", + "element-plus": "^2.9.7", "fit2cloud-ui-plus": "^1.2.0", "highlight.js": "^11.9.0", "js-base64": "^3.7.7", @@ -62,6 +62,7 @@ }, "devDependencies": { "@types/node": "^20.14.8", + "@types/uuid": "^10.0.0", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.22.0", "@vitejs/plugin-vue": "^5.0.5", diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index da737c7ab..efbcada3f 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -3359,6 +3359,8 @@ const message = { pushSuccess: 'Push Successful', syncError: 'Sync Failed', success: 'Alert Successful', + pushing: 'Pushing...', + error: 'Alert Failed', cleanLog: 'Clean Logs', cleanAlertLogs: 'Clean Alert Logs', daily: 'Daily Alert Count: {0}', @@ -3415,6 +3417,14 @@ const message = { defaultPhone: 'Default to license-bound account phone number', noticeAlert: 'Notice Alert', resourceAlert: 'Resource Alert', + syncToNode: 'Sync to Node', + syncToNodeHelper: 'Sync alert settings to other nodes', + nodes: 'Node', + selectNode: 'Select Node', + selectNodeError: 'Please select a node', + syncToNodeClose: 'After closing, set the async alert settings to another node. Do you want to continue?', + agentOfflineAlertHelper: + 'The child node offline alert will be scanned and executed by the main node every 30 minutes', }, theme: { lingXiaGold: 'Ling Xia Gold', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 3916dc821..03efe6085 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -3210,6 +3210,8 @@ const message = { pushSuccess: 'プッシュ成功', syncError: '同期失敗', success: 'アラート成功', + pushing: 'プッシュ中...', + error: 'アラート失敗', cleanLog: 'ログをクリア', cleanAlertLogs: 'アラートログをクリア', daily: '1日のアラート数:{0}', @@ -3266,6 +3268,14 @@ const message = { defaultPhone: 'ライセンスに紐付けられたアカウントの電話番号をデフォルトにする', noticeAlert: '通知アラート', resourceAlert: 'リソースアラート', + syncToNode: '子ノードに同期', + syncToNodeHelper: '他のノードにアラート設定を同期', + nodes: 'ノード', + selectNode: 'ノードを選択', + selectNodeError: 'ノードを選択してください', + syncToNodeClose: '閉じると他のノードへのアラート設定は同期されません。続行しますか?', + agentOfflineAlertHelper: + '子ノードのオフラインアラートは、メインノードが 30 分ごとにスキャンしてアラートタスクを実行します', }, theme: { lingXiaGold: '凌霞金', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 7e3d81b01..fe7b4fb07 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -3155,6 +3155,8 @@ const message = { pushSuccess: '푸시 성공', syncError: '동기화 실패', success: '알림 성공', + pushing: '푸시 중...', + error: '알림 실패', cleanLog: '로그 정리', cleanAlertLogs: '알림 로그 정리', daily: '일일 알림 수: {0}', @@ -3211,6 +3213,13 @@ const message = { defaultPhone: '기본적으로 라이선스에 묶인 계정의 전화번호 사용', noticeAlert: '공지 알림', resourceAlert: '리소스 알림', + syncToNode: '자식 노드로 동기화', + syncToNodeHelper: '다른 노드로 알림 설정 동기화', + nodes: '노드', + selectNode: '노드 선택', + selectNodeError: '노드를 선택해 주세요', + syncToNodeClose: '닫으면 다른 노드로 알림 설정이 동기화되지 않습니다. 계속하시겠습니까?', + agentOfflineAlertHelper: '자식 노드 오프라인 알림은 메인 노드가 30분마다 스캔하여 실행합니다', }, theme: { lingXiaGold: '링샤 골드', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index f7425c1c0..def12065c 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -3289,6 +3289,8 @@ const message = { pushSuccess: 'Tekanan Berjaya', syncError: 'Penyelarasan Gagal', success: 'Amaran Berjaya', + pushing: 'Sedang menghantar...', + error: 'Amaran gagal', cleanLog: 'Bersihkan Log', cleanAlertLogs: 'Bersihkan Log Amaran', daily: 'Bilangan Amaran Harian: {0}', @@ -3345,6 +3347,15 @@ const message = { defaultPhone: 'Secara lalai ke nombor telefon akaun terikat lesen', noticeAlert: 'Amaran Pemberitahuan', resourceAlert: 'Amaran Sumber', + syncToNode: 'Penyegerakan ke nod anak', + syncToNodeHelper: 'Penyegerakan tetapan amaran ke nod lain', + nodes: 'Nod', + selectNode: 'Pilih nod', + selectNodeError: 'Sila pilih nod', + syncToNodeClose: + 'Menutup ini tidak akan menyegerakkan tetapan amaran ke nod lain. Adakah anda ingin meneruskan?', + agentOfflineAlertHelper: + 'Amaran luar talian nod anak akan diimbas dan dilaksanakan oleh nod utama setiap 30 minit', }, theme: { lingXiaGold: 'Ling Xia Emas', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index 7eba99593..18b45eccc 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -3290,6 +3290,8 @@ const message = { pushSuccess: 'Envio Bem-sucedido', syncError: 'Sincronização Falhou', success: 'Alerta Bem-sucedido', + pushing: 'Enviando...', + error: 'Falha no alerta', cleanLog: 'Limpar Registros', cleanAlertLogs: 'Limpar Registros de Alertas', daily: 'Contagem Diária de Alertas: {0}', @@ -3346,6 +3348,15 @@ const message = { defaultPhone: 'Número de telefone padrão vinculado à conta de licença', noticeAlert: 'Alerta de Notificação', resourceAlert: 'Alerta de Recursos', + syncToNode: 'Sincronizar para o nó filho', + syncToNodeHelper: 'Sincronizar configurações de alerta para outros nós', + nodes: 'Nós', + selectNode: 'Selecionar nó', + selectNodeError: 'Por favor, selecione um nó', + syncToNodeClose: + 'Ao fechar, as configurações de alerta não serão sincronizadas para outros nós. Deseja continuar?', + agentOfflineAlertHelper: + 'O alerta de offline do nó filho será verificado e executado pelo nó principal a cada 30 minutos', }, theme: { lingXiaGold: 'Ling Xia Gold', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 638227f9a..22f779475 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -3280,6 +3280,8 @@ const message = { pushSuccess: 'Отправка успешна', syncError: 'Ошибка синхронизации', success: 'Уведомление успешно', + pushing: 'В процессе отправки...', + error: 'Ошибка оповещения', cleanLog: 'Очистить логи', cleanAlertLogs: 'Очистить журналы уведомлений', daily: 'Ежедневное количество уведомлений: {0}', @@ -3341,6 +3343,15 @@ const message = { defaultPhone: 'По умолчанию используется номер телефона, привязанный к лицензии', noticeAlert: 'Уведомление', resourceAlert: 'Уведомление о Ресурсах', + syncToNode: 'Синхронизация с дочерним узлом', + syncToNodeHelper: 'Синхронизация настроек оповещений с другими узлами', + nodes: 'Узлы', + selectNode: 'Выберите узел', + selectNodeError: 'Пожалуйста, выберите узел', + syncToNodeClose: + 'После закрытия настройки оповещений не будут синхронизированы с другими узлами. Продолжить?', + agentOfflineAlertHelper: + 'Оповещение об отключении дочернего узла. Главный узел будет сканировать и выполнять задачу оповещения каждые 30 минут', }, theme: { lingXiaGold: 'Лин Ся Золотой', diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts index 42d382f2a..c8dcfd4b5 100644 --- a/frontend/src/lang/modules/zh-Hant.ts +++ b/frontend/src/lang/modules/zh-Hant.ts @@ -3112,6 +3112,8 @@ const message = { pushSuccess: '推送成功', syncError: '同步失敗', success: '告警成功', + pushing: '推送中...', + error: '告警失敗', cleanLog: '清空日誌', cleanAlertLogs: '清空告警日誌', daily: '當日第 {0} 次告警', @@ -3168,6 +3170,13 @@ const message = { defaultPhone: '預設使用與許可證綁定的帳戶手機號', noticeAlert: '通知告警', resourceAlert: '資源告警', + syncToNode: '同步至子節點', + syncToNodeHelper: '同步告警設置至其他節點', + nodes: '節點', + selectNode: '選擇節點', + selectNodeError: '請選擇節點', + syncToNodeClose: '關閉後將不同步告警設置到其他節點,是否繼續?', + agentOfflineAlertHelper: '子節點離線告警,將由主節點每半小時掃描執行一次告警任務', }, theme: { lingXiaGold: '凌霞金', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index e23b3e7e1..d0ed86130 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -3081,7 +3081,7 @@ const message = { allDiskTitle: '磁盘占用过高告警', timeRule: '剩余时间小于 {0} 天 (如未处理,次日会重新发送)', - panelUpdateRule: '检测到面板有新版本时发vb送一次 (如未处理,次日会重新发送)', + panelUpdateRule: '检测到面板有新版本时发送一次 (如未处理,次日会重新发送)', avgRule: '{0} 分钟内平均{1}占用超过 {2}% 触发,每天发送 {3} 次', diskRule: '挂载目录「 {0} 」的磁盘占用超过 {1}{2} 触发,每天发送 {3} 次', allDiskRule: '磁盘占用超过 {0}{1} 触发,每天发送 {2} 次', @@ -3097,6 +3097,8 @@ const message = { pushSuccess: '推送成功', syncError: '同步失败', success: '告警成功', + pushing: '推送中...', + error: '告警失败', cleanLog: '清空日志', cleanAlertLogs: '清空告警日志', daily: '当日第 {0} 次告警', @@ -3150,6 +3152,13 @@ const message = { defaultPhone: '默认使用与许可证绑定的账户手机号', noticeAlert: '通知告警', resourceAlert: '资源告警', + syncToNode: '同步至子节点', + syncToNodeHelper: '同步告警设置至其他节点', + nodes: '节点', + selectNode: '选择节点', + selectNodeError: '请选择节点', + syncToNodeClose: '关闭后将不同步告警设置到其他节点,是否继续?', + agentOfflineAlertHelper: '子节点离线告警,会通过主节点每半小时扫描执行一次告警任务', }, theme: { lingXiaGold: '凌霞金', diff --git a/frontend/src/store/interface/index.ts b/frontend/src/store/interface/index.ts index 03d508e00..0f2e5f9e0 100644 --- a/frontend/src/store/interface/index.ts +++ b/frontend/src/store/interface/index.ts @@ -41,6 +41,7 @@ export interface GlobalState { errStatus: string; currentNode: string; + isOffline: boolean; } export interface MenuState { diff --git a/frontend/src/store/modules/global.ts b/frontend/src/store/modules/global.ts index f1f2048c2..353ec7c35 100644 --- a/frontend/src/store/modules/global.ts +++ b/frontend/src/store/modules/global.ts @@ -44,6 +44,7 @@ const GlobalStore = defineStore({ errStatus: '', currentNode: 'local', + isOffline: false, }), getters: { isDarkTheme: (state) =>