本卡屬 FR-166(母卡 CM-3109 延伸),依賴同母卡 Agent 卡(HTML 預覽回應帶 sandbox)。Repo:compliance-manager-fe(console/)。首腦第 6 棒直接實作。
白話
Agent 端可以安全回 HTML 預覽之後,主控台的預覽對話框要能顯示它;執行紀錄的 HTML 報告選單從「下載」改回「預覽」。
問題在哪
- console/reportPreview.js previewViewOf:text/html 一律 unsupported。console/components/ReportPreviewDialog.vue load:PDF 先 fetch 成 blob 再進 iframe。console/runs.js downloadOnly:html 直接走下載(前一個 commit 683c25c3 為了避開「預覽後才說不支援」加的)。
怎麼做
- 【extend reportPreview】previewViewOf 認得 text/html → 'html';previewKindOf 對 .html/.htm 回 'frame'。
- 【extend ReportPreviewDialog】view === 'html':不讀內容、不建 blob,iframe src 直接設成該報告的預覽網址(同來源,session cookie 會帶上)。報告項目要多給一個 previewUrl(Runs.vue reportItem 組)。照主系統 FilePreviewDialog 的註解:HTML 必須走原網址,blob 會繼承本站來源、丟掉 sandbox。
- 【回退】runs.downloadOnly 拿掉 html/htm(只留 svg/xhtml)。
改哪些檔
- console/reportPreview.js、console/components/ReportPreviewDialog.vue、console/views/Runs.vue、console/runs.js、src/tests 對應測試
驗證
- 單元:previewViewOf('text/html; charset=utf-8', 'inline') === 'html';attachment 仍 unsupported。headless:主控台執行紀錄點 CINC 報告預覽,iframe 顯示報告。
紀律
- HTML 預覽不得 fetch 成 blob 或用 srcdoc;顯式 git add;不切 branch。
首腦第 6 棒實作回寫(2026-10-28)
commit:compliance-manager-fe 9c0d778b,已 push;123 主控台已換上。
做了什麼(白話):主控台的預覽視窗能顯示 HTML 報告;執行紀錄的 HTML 報告選單改回「預覽」。
reuse/extend/new
- extend:
reportPreview.previewViewOf 認得 inline 的 text/html → 'html'(附件形式的 HTML 仍不支援)