(reportId, silent = false)
| 3005 | } |
| 3006 | |
| 3007 | async function loadReportContent(reportId, silent = false) { |
| 3008 | if (!reportId) return; |
| 3009 | const data = await api(`/api/reports/content?report_id=${encodeURIComponent(reportId)}`); |
| 3010 | const report = data.report; |
| 3011 | if (!report) { |
| 3012 | if (!silent) throw new Error(ui().reports.missing); |
| 3013 | return; |
| 3014 | } |
| 3015 | state.currentReport = report; |
| 3016 | renderReportList(state.reports, report.report_id); |
| 3017 | $("reportViewerTitle").textContent = report.title || ui().reports.defaultTitle; |
| 3018 | $("reportViewerMeta").textContent = [report.user_id, report.saved_at, report.report_path].filter(Boolean).join(" · "); |
| 3019 | $("reportViewerBody").className = "markdown-body"; |
| 3020 | const annotatedHtml = loadReportAnnotation(report.report_id); |
| 3021 | $("reportViewerBody").innerHTML = annotatedHtml || renderMarkdown(report.markdown || ""); |
| 3022 | $("clearReportAnnotationsBtn").disabled = !annotatedHtml; |
| 3023 | hideReportAnnotationToolbar(); |
| 3024 | setReportLinks(report); |
| 3025 | } |
| 3026 | |
| 3027 | async function directRead(kind) { |
| 3028 | const isPdf = kind === "pdf"; |
no test coverage detected