Flag incidents that carry notes in the queue

A blue tag with the notebook icon and a count marks an incident with
working notes; a green one marks a note on what fixed it. Both let you
scan the queue for incidents that have more to say than their title,
without opening each one.

The incident list and detail JSON gain note_count and
resolution_note_count, counted in the same query that selects the
incident, so a list costs no extra request per row. The fields are
additive: terdut-tui and terdut-operator ignore them and need no change.

Claude-Session: https://claude.ai/code/session_016mBLURvJoMuUEr9cB2RpUN
This commit is contained in:
Niklas Ye
2026-10-10 13:29:08 +02:00
parent c67dc80a8f
commit f1754c583e
5 changed files with 29 additions and 2 deletions
+2
View File
@@ -522,6 +522,8 @@ input:focus, textarea:focus { outline: none; border-color: var(--accent); box-sh
.badge.st-unreachable, .badge.st-unpageable { background: var(--crit-soft); color: var(--crit); }
.badge.sev-critical { background: var(--crit-soft); color: var(--crit); }
.badge.sev-warning { background: var(--warn-soft); color: var(--warn); }
.badge.has-note { background: var(--info-soft); color: var(--info); }
.badge.has-fix { background: var(--ok-soft); color: var(--ok); }
.badge.sev-info { background: var(--info-soft); color: var(--info); }
/* ---------- incident detail ---------- */
+2 -1
View File
@@ -1,7 +1,7 @@
// The incident queue: filter chips and a list of incident rows.
import * as api from './api.js';
import { h, clear, icon, badge, severityBadge, originChip, emptyState, spinner, fadeOnOverflow } from './ui.js';
import { h, clear, icon, badge, noteTags, severityBadge, originChip, emptyState, spinner, fadeOnOverflow } from './ui.js';
import { ago, until, isFuture, severityClass, labelSummary, originOf, titleWithoutOrigin } from './format.js';
import { state, myID, onTeamChange } from './state.js';
import * as onboarding from './onboarding.js';
@@ -309,6 +309,7 @@ function row(inc, index) {
// The left-border colour alone doesn't say what it means; spell it out
// too, same badge the incident detail page uses for severity.
inc.severity && severityBadge(inc.severity),
...(noteTags(inc) || []),
assignee,
team,
labels && h('span', { class: 'labels', text: labels }),
+13
View File
@@ -194,6 +194,19 @@ export function badge(text, cls = '') {
return h('span', { class: `badge ${cls}`, text });
}
// A tag saying an incident has notes: blue for working notes, green for a note
// on what fixed it. Null when there are none, so it can sit in a row unguarded.
export function noteTags(inc) {
const tag = (n, cls, label) => n > 0 && h('span', {
class: `badge plain ${cls}`, title: `${n} ${label}${n === 1 ? '' : 's'}`,
}, icon('note', 'icon badge-icon'), String(n));
const tags = [
tag(inc.note_count, 'has-note', 'note'),
tag(inc.resolution_note_count, 'has-fix', 'resolution note'),
].filter(Boolean);
return tags.length ? tags : null;
}
// Where it came from (the cluster): a chip in that origin's colour, with a
// server icon so it reads as a place and not as a status.
export function originChip(value) {