From 780b5e69935859c3f99b941ad07cca9632342ea3 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 28 Jun 2026 11:19:45 +0000 Subject: [PATCH] fix: align sentinel run row tags with check counts --- .../monitor-web.js | 12 +++++++----- scripts/src/hwlab-node-web-sentinel-cicd.ts | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/scripts/assets/web-probe-sentinel-monitor-web/monitor-web.js b/scripts/assets/web-probe-sentinel-monitor-web/monitor-web.js index de62c44d..cc7c340e 100644 --- a/scripts/assets/web-probe-sentinel-monitor-web/monitor-web.js +++ b/scripts/assets/web-probe-sentinel-monitor-web/monitor-web.js @@ -672,16 +672,18 @@ createApp({ :key="run.id" class="run-row" :class="[severityClass(run), { selected: run.id === selectedRunId }]" + :data-run-id="run.id" + :data-run-error-count="runCheckErrorCount(run)" + :data-run-warning-count="runCheckWarningCount(run)" + :data-run-alert-count="runCheckAlertCount(run)" type="button" @click="selectRun(run)" > {{ run.scenarioId || shortId(run.id) }} - - 错误 {{ runCheckErrorCount(run) }} - 告警 {{ runCheckWarningCount(run) }} - 正常 - + 错误 {{ runCheckErrorCount(run) }} + 告警 {{ runCheckWarningCount(run) }} + 正常 {{ run.status || "-" }} diff --git a/scripts/src/hwlab-node-web-sentinel-cicd.ts b/scripts/src/hwlab-node-web-sentinel-cicd.ts index f3e9ce97..591ece55 100644 --- a/scripts/src/hwlab-node-web-sentinel-cicd.ts +++ b/scripts/src/hwlab-node-web-sentinel-cicd.ts @@ -2393,18 +2393,22 @@ const dom = await page.evaluate(async ({ expectedRoutePrefix, expectedSentinelId belowWorkspace: Boolean(workspaceRect && checksRect && checksRect.top >= workspaceRect.bottom - 2), fullWidth: Boolean(workspaceRect && checksRect && checksRect.width >= workspaceRect.width - 2), }; - const selectedRunRow = document.querySelector(".run-list .run-row.selected"); + const runListRowFor = (runId) => Array.from(document.querySelectorAll(".run-list .run-row")) + .find((row) => row.getAttribute("data-run-id") === runId) || null; + const selectedRunRow = runListRowFor(latestRunCounts.runId) || document.querySelector(".run-list .run-row.selected"); const selectedRunTags = { error: numberValue(String(selectedRunRow?.querySelector("[data-run-error-tag='true']")?.textContent || "").match(/(\\d+)/u)?.[1]), warning: numberValue(String(selectedRunRow?.querySelector("[data-run-warning-tag='true']")?.textContent || "").match(/(\\d+)/u)?.[1]), errorVisible: Boolean(selectedRunRow?.querySelector("[data-run-error-tag='true']")), warningVisible: Boolean(selectedRunRow?.querySelector("[data-run-warning-tag='true']")), + rowSelected: Boolean(selectedRunRow?.classList.contains("selected")), matchesRunDetail: false, }; selectedRunTags.matchesRunDetail = selectedRunTags.error === latestDetailSummary.errorTypeCount && selectedRunTags.warning === latestDetailSummary.warningTypeCount && selectedRunTags.errorVisible === (latestDetailSummary.errorTypeCount > 0) - && selectedRunTags.warningVisible === (latestDetailSummary.warningTypeCount > 0); + && selectedRunTags.warningVisible === (latestDetailSummary.warningTypeCount > 0) + && selectedRunTags.rowSelected === true; checkScope.matchesLatestRun = checkScope.present === true && checkScope.scope === "run" && checkScope.runId === latestRunCounts.runId @@ -2638,12 +2642,15 @@ const runFilterProbe = await page.evaluate(async ({ expectedRoutePrefix }) => { alertSamples: sum(errorRows) + sum(warningRows), }; }; + const runListRowFor = (runId) => Array.from(document.querySelectorAll(".run-list .run-row")) + .find((row) => row.getAttribute("data-run-id") === runId) || null; const panelCounts = () => { const panel = document.querySelector("[data-monitor-checks='true']"); - const selectedRunRow = document.querySelector(".run-list .run-row.selected"); + const panelRunId = panel?.getAttribute("data-check-run-id") || null; + const selectedRunRow = runListRowFor(panelRunId) || document.querySelector(".run-list .run-row.selected"); return { present: Boolean(panel), - runId: panel?.getAttribute("data-check-run-id") || null, + runId: panelRunId, typeCount: numberValue(panel?.getAttribute("data-check-type-count")), errorTypeCount: numberValue(panel?.getAttribute("data-check-error-type-count")), warningTypeCount: numberValue(panel?.getAttribute("data-check-warning-type-count")), @@ -2655,6 +2662,7 @@ const runFilterProbe = await page.evaluate(async ({ expectedRoutePrefix }) => { visibleAlertSamples: numberValue(panel?.getAttribute("data-visible-check-alert-samples")), selectedRunErrorTag: numberValue(String(selectedRunRow?.querySelector("[data-run-error-tag='true']")?.textContent || "").match(/(\\d+)/u)?.[1]), selectedRunWarningTag: numberValue(String(selectedRunRow?.querySelector("[data-run-warning-tag='true']")?.textContent || "").match(/(\\d+)/u)?.[1]), + selectedRunRowSelected: Boolean(selectedRunRow?.classList.contains("selected")), }; }; const waitForRun = async (runId) => { @@ -2693,7 +2701,8 @@ const runFilterProbe = await page.evaluate(async ({ expectedRoutePrefix }) => { && observed.visibleRowCount === expected.alertTypeCount && observed.visibleAlertSamples === expected.alertSamples && observed.selectedRunErrorTag === expected.errorTypeCount - && observed.selectedRunWarningTag === expected.warningTypeCount; + && observed.selectedRunWarningTag === expected.warningTypeCount + && observed.selectedRunRowSelected === true; return { ok: panelReady === true && matchesRunDetail === true, requestedRunId,