web: wrap run titles and give applied filters a separate row
This commit is contained in:
+24
-9
@@ -36,6 +36,8 @@ export function createRunsView(rt) {
|
||||
function renderRunList(now = Date.now()) {
|
||||
const pane = h("div", { class: "list runs" });
|
||||
pane.append(renderRunToolbar());
|
||||
const applied = renderAppliedRunFilters();
|
||||
if (applied) pane.append(applied);
|
||||
|
||||
const scroll = h("div", { class: "run-scroll list-scroll" });
|
||||
if (state.loading && !state.runs.length) {
|
||||
@@ -200,20 +202,33 @@ function renderRunToolbar() {
|
||||
h("span", { class: "spacer" }),
|
||||
renderAttentionBell(),
|
||||
);
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
function renderAppliedRunFilters() {
|
||||
if (runFiltersActiveCount(state.runFilters) === 0) return null;
|
||||
const applied = h("div", { class: "run-applied-filters", "aria-label": "Applied run filters" });
|
||||
const chip = (label, clear, className = "") => h("button", {
|
||||
class: `run-filter-chip ${className}`,
|
||||
type: "button",
|
||||
"aria-label": `Clear filter: ${label}`,
|
||||
title: `Clear filter: ${label}`,
|
||||
onclick: clear,
|
||||
}, h("span", { text: label }), h("span", { "aria-hidden": "true", text: "×" }));
|
||||
const pipelineId = state.runFilters.pipelineId;
|
||||
if (pipelineId != null) {
|
||||
const name = state.pipelines.find((pipeline) => pipeline.id === pipelineId)?.name ??
|
||||
state.runs.find((run) => run.pipeline_id === pipelineId)?.name ?? `Pipeline ${pipelineId}`;
|
||||
const chip = h("button", {
|
||||
class: "pipeline-filter-chip",
|
||||
type: "button",
|
||||
"aria-label": `Clear pipeline filter: ${name}`,
|
||||
title: `Showing only ${name}`,
|
||||
onclick: () => setPipelineFilter(null),
|
||||
}, h("span", { text: name }), h("span", { "aria-hidden": "true", text: "×" }));
|
||||
toolbar.insertBefore(chip, toolbar.querySelector(".spacer"));
|
||||
applied.append(chip(name, () => setPipelineFilter(null), "pipeline-filter-chip"));
|
||||
}
|
||||
return toolbar;
|
||||
for (const status of state.runFilters.statuses) {
|
||||
applied.append(chip(status, () => toggleStatusFilter(status)));
|
||||
}
|
||||
const range = RUN_TIME_RANGES.find((entry) => entry.value === state.runFilters.timeRange);
|
||||
if (range && state.runFilters.timeRange !== defaultRunFilters().timeRange) {
|
||||
applied.append(chip(range.label, () => setTimeRangeFilter(defaultRunFilters().timeRange)));
|
||||
}
|
||||
return applied;
|
||||
}
|
||||
|
||||
/** One small live-stream badge (LiveBadge.kt): a dot plus the honest word. */
|
||||
|
||||
Reference in New Issue
Block a user