Skip to content

Commit 8f61a5a

Browse files
committed
Separate reset and clear report functions
1 parent 0029340 commit 8f61a5a

2 files changed

Lines changed: 24 additions & 9 deletions

File tree

‎app.js‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -485,22 +485,33 @@ async function startScan() {
485485
}
486486

487487
function resetUi() {
488-
setStatus("Idle");
489-
safeText($("runId"), "—");
490-
safeText($("authBranch"), "—");
491-
$("runLink").textContent = "—";
492-
$("artifactsLink").textContent = "—";
493-
$("log").textContent = "Waiting…";
494-
495-
// Clear input fields
488+
// Clear input fields only
496489
const tokenField = $("token");
497490
if (tokenField) tokenField.value = "";
498491
const targetUrlField = $("targetUrl");
499492
if (targetUrlField) targetUrlField.value = "";
500493
const authFileField = $("authFile");
501494
if (authFileField) authFileField.value = "";
495+
496+
// Reset mode and profile to defaults
497+
const modeField = $("mode");
498+
if (modeField) modeField.value = "posture";
499+
const profileField = $("profile");
500+
if (profileField) profileField.value = "standard";
501+
502+
logLine("Input fields cleared.");
503+
}
502504

503-
// Summary reset
505+
function clearReport() {
506+
// Clear scan status and run info
507+
setStatus("Idle");
508+
safeText($("runId"), "—");
509+
safeText($("authBranch"), "—");
510+
$("runLink").textContent = "—";
511+
$("artifactsLink").textContent = "—";
512+
$("log").textContent = "Waiting…";
513+
514+
// Clear report summary
504515
safeText($("sumGrade"), "—");
505516
safeText($("sumMode"), "—");
506517
safeText($("sumFindings"), "—");
@@ -513,6 +524,8 @@ function resetUi() {
513524

514525
const tbody = $("findingsTbody");
515526
if (tbody) tbody.innerHTML = `<tr><td colspan="5" class="muted">No data loaded yet.</td></tr>`;
527+
528+
logLine("Report summary cleared.");
516529
}
517530

518531
async function refreshReport() {
@@ -567,6 +580,7 @@ function wireEvents() {
567580
$("startBtn")?.addEventListener("click", startScan);
568581
$("resetBtn")?.addEventListener("click", resetUi);
569582
$("refreshBtn")?.addEventListener("click", refreshReport);
583+
$("clearReportBtn")?.addEventListener("click", clearReport);
570584

571585
// Load whatever latest report exists at page open (with minimal retries)
572586
loadLatestReport(0, 2, 1000).catch(() => {

‎index.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ <h1>Report Summary</h1>
132132
</div>
133133

134134
<div class="download-row">
135+
<button id="clearReportBtn" class="btn" style="background: var(--btn); border-color: var(--btn-border);">Clear Report</button>
135136
<a class="btn primary" id="downloadMd" href="latest/report.md" download>Download report.md</a>
136137
<a class="btn" id="downloadJson" href="latest/report.json" download>Download report.json</a>
137138
</div>

0 commit comments

Comments
 (0)