From 893754cb0bb32dd94484e319a6cede796cce3923 Mon Sep 17 00:00:00 2001 From: ogt Date: Sat, 27 Jun 2026 19:57:39 +0800 Subject: [PATCH] fix: make service update page operator friendly --- config.py | 2 +- docs/AI_INTELLIGENCE_MODULE_SOT.md | 3 ++- templates/cicd_dashboard.html | 31 ++++++++++++++++++------------ tests/test_frontend_v2_assets.py | 9 +++++++++ 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/config.py b/config.py index 529bcbc..067f862 100644 --- a/config.py +++ b/config.py @@ -402,7 +402,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.721" +SYSTEM_VERSION = "V10.722" LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log') public_url = PUBLIC_URL # 用於模板顯示 diff --git a/docs/AI_INTELLIGENCE_MODULE_SOT.md b/docs/AI_INTELLIGENCE_MODULE_SOT.md index ffd375c..a8fcd56 100644 --- a/docs/AI_INTELLIGENCE_MODULE_SOT.md +++ b/docs/AI_INTELLIGENCE_MODULE_SOT.md @@ -2,7 +2,7 @@ > **最後更新**: 2026-06-27 (台北時間) > **狀態**: 🟢 四 AI Agent 自動化閉環已落地;LLM 路由紅線升級為 Ollama-first 三主機級聯;PChome 後台業績匯入韌性已補強;產品定位正名為「PChome 業績成長自動化作戰系統」;外部市場來源正規化層、自動同步、作戰清單與價格參考表優先讀取、CSV 備援預檢、前台操作入口、高可見頁面繁中化守門、比價/作戰 UI 工作台化、跨平台來源治理與商品身份 UI 契約已建立,GCP embedding 熔斷延後處理、110 proxy rescue 與 direct host health skip 已建立 -> **適用版本**: V10.721 +> **適用版本**: V10.722 --- @@ -806,3 +806,4 @@ POSTGRES_HOST=momo-db | 2026-06-26 | 商品來源頁不得提供 raw JSON 匯出 | V10.719 起 `/pchome_crawler` 改為「PChome 商品監控」營運清單,只提供表格與賣場清單 CSV;前台不得出現 `exportJson`、`JSON.stringify(currentProducts)`、`圖片URL`、`商品URL` 或 raw JSON 檔名。 | | 2026-06-27 | 設定頁監控來源不得直接外露 crawler 命名 | V10.720 起 `/settings` 的商品監控來源由 API 邊界轉為營運名稱與說明,前端卡片再以 `escapeHtml(monitorText(...))` 顯示;啟停與頻率更新訊息統一使用「監控來源」,不得回傳「爬蟲 XXX 已啟用」這類工程主語。 | | 2026-06-27 | 監控來源 API 不回傳前台不需要的內部設定欄位 | V10.721 起 `/api/crawlers` 的設定頁 response 會移除 `function`、`page_type`、`status`、`paused_date`,只保留前台需要的名稱、說明、啟用狀態、頻率、活動代碼與營運提示。 | +| 2026-06-27 | 服務更新監控頁不得以內部工具名當主語 | V10.722 起 `/cicd` 可見文字使用「測試站、正式站、監控圖表、自動化流程、今日更新」;前台模板不得用 `issue.error_log` 判斷顯示診斷資料,也不得顯示 `UAT 狀態`、`PROD 狀態`、`Grafana`、`n8n` 作為主按鈕文字。 | diff --git a/templates/cicd_dashboard.html b/templates/cicd_dashboard.html index 21e8b99..84dc66a 100644 --- a/templates/cicd_dashboard.html +++ b/templates/cicd_dashboard.html @@ -502,7 +502,7 @@
-
-
今日部署
+
今日更新
@@ -510,7 +510,7 @@
-
-
UAT 狀態
+
測試站狀態
@@ -518,7 +518,7 @@
-
-
PROD 狀態
+
正式站狀態
@@ -574,12 +574,12 @@
@@ -594,12 +594,12 @@
- Grafana + 監控圖表
- n8n + 自動化流程
@@ -721,7 +721,7 @@ ${issue.error ? `
已記錄診斷線索` : ''} ${issue.fix_suggestion ? `
💡 ${escapeHtml(issue.fix_suggestion)}
` : ''} - ${issue.error_log ? `
已保留診斷資料,請由維護者查看。
` : ''} + ${(issue.error || issue.fix_suggestion) ? `
已保留診斷資料,請由維護者查看。
` : ''}
${issue.auto_fixable ? ` @@ -1100,8 +1100,8 @@ // 服務修復 async function triggerFullRepair() { - const env = prompt('請輸入要修復的環境 (uat 或 prod):', 'uat'); - if (!env || !['uat', 'prod'].includes(env)) { + const env = normalizeEnvInput(prompt('請輸入要修復的環境:測試站 或 正式站', '測試站')); + if (!env) { showNotification('取消', '無效的環境'); return; } @@ -1132,8 +1132,8 @@ // 診斷 async function runDiagnosis() { - const env = prompt('請輸入要診斷的環境 (uat 或 prod):', 'uat'); - if (!env || !['uat', 'prod'].includes(env)) { + const env = normalizeEnvInput(prompt('請輸入要診斷的環境:測試站 或 正式站', '測試站')); + if (!env) { showNotification('取消', '無效的環境'); return; } @@ -1199,6 +1199,13 @@ return labels[env] || '指定環境'; } + function normalizeEnvInput(value) { + const text = String(value || '').trim().toLowerCase(); + if (['uat', 'test', '測試', '測試站'].includes(text)) return 'uat'; + if (['prod', 'production', '正式', '正式站'].includes(text)) return 'prod'; + return ''; + } + function displayRefName(ref) { const labels = { main: '正式版更新', master: '正式版更新', dev: '測試版更新', uat: '測試版更新', prod: '正式版更新' }; return labels[ref] || '服務更新'; diff --git a/tests/test_frontend_v2_assets.py b/tests/test_frontend_v2_assets.py index d1efd8b..deb9524 100644 --- a/tests/test_frontend_v2_assets.py +++ b/tests/test_frontend_v2_assets.py @@ -797,6 +797,15 @@ def test_utility_pages_keep_operator_copy_professional(): assert "情境 × 知識命中矩陣" in ai_calls assert "服務更新監控" in cicd_dashboard assert "正式服務更新與可用性監控" in cicd_dashboard + assert "測試站狀態" in cicd_dashboard + assert "正式站狀態" in cicd_dashboard + assert "監控圖表" in cicd_dashboard + assert "自動化流程" in cicd_dashboard + assert "issue.error_log" not in cicd_dashboard + assert "UAT 狀態" not in cicd_dashboard + assert "PROD 狀態" not in cicd_dashboard + assert ">Grafana<" not in cicd_dashboard + assert ">n8n<" not in cicd_dashboard assert "供貨風險" in stockout_index assert "無服務資料 / 未連線" in host_health assert "部署檢查已排入背景處理" in observability_js