feat: finalize no-iframe portal shell route-view migration

This commit is contained in:
egg
2026-02-11 17:07:50 +08:00
parent ccab10bee8
commit 1e7f8f4498
100 changed files with 8794 additions and 642 deletions

View File

@@ -4,6 +4,7 @@
> 專案主執行根目錄:`DashBoard_vite/`
> 目前已移除舊版 `DashBoard/` 代碼,僅保留新架構。
> 2026-02-11`portal-shell-route-view-integration` 已完成並封存Portal Shell 全面採用 no-iframe 的 SPA route-view 架構。
---
@@ -39,6 +40,9 @@
| 前端核心模組測試Node test | ✅ 已完成 |
| 部署自動化 | ✅ 已完成 |
| Portal 動態抽屜導覽管理 | ✅ 已完成 |
| Portal Shell no-iframe 路由整合(含 fallback/guard | ✅ 已完成 |
| Wave B 查詢頁job/excel/query-tool/tmtt-defect原生化 | ✅ 已完成 |
| Shell 健康檢查 summary/detail 契約(`/health/frontend-shell` | ✅ 已完成 |
| QC-GATE 即時狀態報表Vue 3 + Vite | ✅ 已完成 |
| 數據表查詢頁面 Vue 3 遷移 | ✅ 已完成 |
| WIP 三頁 Vue 3 遷移Overview/Detail/Hold Detail | ✅ 已完成 |
@@ -51,6 +55,7 @@
## 開發歷史Vite 重構後)
- 2026-02-11完成 Portal Shell route-view 全遷移(`portal-shell-route-view-integration`)— 全站移除 iframe 內容嵌入、導入 Vue Router 動態註冊與 fallback guard、補齊 Wave A/Wave B page parity 測試、健康檢查 summary/detail UX 與 `/health/frontend-shell` 契約,並完成 pre/post parity 與 smoke 證據彙整。
- 2026-02-11完成 table query API `table_name` 白名單驗證(`/api/query_table``/api/get_table_columns`)— 拒絕未註冊資料表,補上整合測試,避免 SQL injection 入口。
- 2026-02-11完成設備雙頁級聯篩選`/resource``/resource-history`)— 新增 Group/Family/Machine 多層篩選聯動,前後端支援 `resource_ids` 條件,矩陣與明細篩選一致。
- 2026-02-11完成 Hold Dashboard/Portal 修補 — realtime equipment cache dedup、Portal iframe 載入修正、Hold Overview/Hold History 明細與樣式優化。
@@ -110,6 +115,7 @@
- Root cutover 盤點:`docs/root_cutover_inventory.md`
- 頁面架構與抽屜分類:`docs/page_architecture_map.md`
- 前端計算前移與 parity 規則:`docs/frontend_compute_shift_plan.md`
- Portal Shell route-view 遷移基線與驗收:`docs/migration/portal-shell-route-view-integration/`
- Hold 歷史頁資料口徑說明:`docs/hold_history.md`
- Cutover gates / rollout / rollback`docs/migration_gates_and_runbook.md`
- 環境依賴缺口與對策:`docs/environment_gaps_and_mitigation.md`
@@ -118,10 +124,15 @@
## 最新架構重點
1. 單一 port 契約維持不變
1. Portal Shell 已完成 no-iframe route-view 遷移
- Shell 內容切換全面使用 Vue Router + native route-view不再使用 iframe。
- 動態抽屜導覽、fallback routing、admin 可見性規則由 `/api/portal/navigation` + route contract 驅動。
- shell 健康狀態採 summary-first詳細資訊由互動展開`/health/frontend-shell`)。
2. 單一 port 契約維持不變
- Flask + Gunicorn + Vite dist 由同一服務提供(`GUNICORN_BIND`),前後端同源。
2. Runtime 韌性採「降級 + 可操作建議 + policy state」
3. Runtime 韌性採「降級 + 可操作建議 + policy state」
- `/health``/health/deep``/admin/api/system-status``/admin/api/worker/status` 皆提供:
- 門檻thresholds
- policy state`allowed` / `cooldown` / `blocked`
@@ -129,22 +140,22 @@
- alertspool/circuit/churn
- recovery recommendation值班建議動作
3. Watchdog 自癒策略具界限保護
4. Watchdog 自癒策略具界限保護
- restart 流程納入 cooldown + retry budget + churn window。
- churn 超標時進入 guarded mode需 admin manual override 才可繼續重啟。
- state 檔保留 bounded restart history供 policy 與稽核使用。
4. 前端治理WIP compute 共用化
5. 前端治理WIP compute 共用化
- `frontend/src/core/autocomplete.js` 作為 WIP overview/detail 共用邏輯來源。
- `frontend/src/core/wip-derive.js` 共用 KPI/filter/chart/table 導出運算。
- 維持既有頁面流程與 drill-down 語意,不變更操作習慣。
5. P1 快取效率治理
6. P1 快取效率治理
- 保留 `resource``wip` 全表快取策略(業務約束不變)。
- 查詢改走索引選擇,並提供 memory amplification / index efficiency telemetry。
- 以 benchmark gate 驗證 P95 延遲與記憶體放大不超過門檻。
6. P0 Runtime Hardening安全 + 穩定)
7. P0 Runtime Hardening安全 + 穩定)
- Production 必須提供 `SECRET_KEY`;未設定時服務拒絕啟動。
- `/admin/login``/admin/api/*` 變更請求必須攜帶 CSRF token。
- `/health` 資料庫連通探針使用獨立 health pool降低 pool 飽和時誤判。
@@ -417,7 +428,7 @@ sudo systemctl start mes-dashboard mes-dashboard-watchdog
### 存取系統
1. 開啟瀏覽器,輸入系統網址(預設為 `http://localhost:8080`
2. 進入 Portal 首頁,可透過上方 Tab 切換各功能模組
2. 進入 Portal Shell 首頁(`/portal-shell`),透過左側抽屜切換各功能模組
### 基本操作
@@ -483,10 +494,10 @@ A: 請確認瀏覽器允許下載檔案,並檢查查詢結果是否有資料
### Portal 入口頁面
透過側邊欄抽屜分組導覽切換各功能模組:
- **即時報表**WIP 即時概況、Hold 即時概況dev設備即時況、QC-GATE 即時狀態
- **歷史報表**Hold 歷史績效dev、設備歷史績效
- **查詢工具**:設備維修查詢
- **開發工具**admin only數據表查詢、Excel 批次查詢、批次追蹤工具、TMTT 不良分析、中段製程不良追溯、頁面管理、效能監控
- **即時報表**WIP 即時概況、設備即時況、QC-GATE 狀態
- **歷史報表**設備歷史績效、Hold 歷史績效
- **查詢工具**:設備維修查詢、Excel 查詢工具、Query Tool
- **開發工具**admin onlyTMTT 不良分析、數據表查詢、頁面管理、效能監控
- 抽屜/頁面配置可由管理員動態管理(新增、重排、刪除)
### WIP 即時概況
@@ -805,6 +816,11 @@ conda run -n mes-dashboard python scripts/run_cache_benchmarks.py --enforce
### 2026-02-11
- Portal Shell route-view 全遷移封存(`portal-shell-route-view-integration`
- Shell 導覽切換全面改為 no-iframeVue Router dynamic route host
- Wave B 頁面(`/job-query`、`/excel-query`、`/query-tool`、`/tmtt-defect`)完成 native route-view rewrite
- health widget 改為 summary-first詳細診斷由互動展開後端提供 `/health/frontend-shell`
- 完成 route/query parity、cutover gate、visual regression、E2E/stress 驗證
- 安全修補:`/api/query_table`、`/api/get_table_columns` 新增 `table_name` 白名單驗證
- 僅允許 `TABLES_CONFIG` 註冊表格,未授權名稱直接回傳 400
- 補上整合測試(拒絕惡意 table_name
@@ -813,7 +829,7 @@ conda run -n mes-dashboard python scripts/run_cache_benchmarks.py --enforce
- status/summary/matrix、history summary/detail/export 全線支援 `resource_ids`
- Hold 與 Portal 修補:
- realtime equipment cache dedup降低重複合併與資料抖動
- 修正 Portal iframe 載入與 Hold Dashboard 視覺/明細互動細節
- 修正 Hold Dashboard 視覺/明細互動細節
- WIP 體驗與穩定性:
- Overview → Detail → Overview 往返保留篩選條件URL params
- auto refresh 加入 jitter±15%)避免多頁同步 thundering-herd