feat(viewer): add severity filtering for event logs
This commit is contained in:
@@ -326,6 +326,45 @@ body {
|
||||
border-bottom: 1px solid var(--border-lite);
|
||||
}
|
||||
|
||||
.table-block {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.table-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.table-toolbar-label {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.table-severity-filter {
|
||||
min-width: 180px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 4px;
|
||||
padding: 7px 10px;
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.table-severity-filter:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.table-filter-empty {
|
||||
margin: 10px 0 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* ── Status ──────────────────────────────────────── */
|
||||
|
||||
.status-badge {
|
||||
@@ -370,4 +409,14 @@ body {
|
||||
.section-card-full {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.table-toolbar {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-severity-filter {
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
31
web/static/view.js
Normal file
31
web/static/view.js
Normal file
@@ -0,0 +1,31 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelectorAll(".table-filterable").forEach((container) => {
|
||||
const select = container.querySelector(".table-severity-filter");
|
||||
if (!select) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rows = Array.from(container.querySelectorAll("tbody tr[data-severity-row='true']"));
|
||||
const emptyNotice = container.querySelector(".table-filter-empty");
|
||||
|
||||
const applyFilter = () => {
|
||||
const selected = select.value;
|
||||
let visibleCount = 0;
|
||||
|
||||
rows.forEach((row) => {
|
||||
const matches = selected === "" || row.dataset.severity === selected;
|
||||
row.hidden = !matches;
|
||||
if (matches) {
|
||||
visibleCount += 1;
|
||||
}
|
||||
});
|
||||
|
||||
if (emptyNotice) {
|
||||
emptyNotice.hidden = visibleCount !== 0;
|
||||
}
|
||||
};
|
||||
|
||||
select.addEventListener("change", applyFilter);
|
||||
applyFilter();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user