fix(ui/alerts): InboxPage polish — status colors, selected-scrub on delete, drop stale comment

- STATE_ITEMS gains color dots (text-muted/error/success) to match SEVERITY_ITEMS
- onDeleteOne removes the deleted id from the selection Set so a follow-up bulk
  action doesn't try to re-delete a tombstoned row
- drop stale comment block that described an alternative SilenceRulesForSelection
  implementation not matching the shipped code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-21 19:14:55 +02:00
parent 2bc214e324
commit 35fea645b6

View File

@@ -34,9 +34,9 @@ const SEVERITY_ITEMS: ButtonGroupItem[] = [
];
const STATE_ITEMS: ButtonGroupItem[] = [
{ value: 'PENDING', label: 'Pending' },
{ value: 'FIRING', label: 'Firing' },
{ value: 'RESOLVED', label: 'Resolved' },
{ value: 'PENDING', label: 'Pending', color: 'var(--text-muted)' },
{ value: 'FIRING', label: 'Firing', color: 'var(--error)' },
{ value: 'RESOLVED', label: 'Resolved', color: 'var(--success)' },
];
// ── Bulk silence helper ─────────────────────────────────────────────────────
@@ -90,12 +90,6 @@ function SilenceRulesForSelection({ selected, rows }: SilenceRulesForSelectionPr
const handleCustom = () => navigate('/alerts/silences');
// Render ONE SilenceRuleMenu that uses the first ruleId as its anchor but
// overrides the click handlers to fire against all selected rule IDs.
// We use a Dropdown-equivalent by wiring SilenceRuleMenu with the first
// ruleId; for bulk we drive our own mutation loop above.
// Since SilenceRuleMenu is self-contained, we render a parallel Button set
// for the bulk path to keep it clean.
return (
<div style={{ display: 'flex', gap: 'var(--space-xs)' }}>
{SILENCE_PRESETS.map(({ label, hours }) => (
@@ -200,6 +194,12 @@ export default function InboxPage() {
const onDeleteOne = async (id: string) => {
try {
await del.mutateAsync(id);
setSelected((prev) => {
if (!prev.has(id)) return prev;
const next = new Set(prev);
next.delete(id);
return next;
});
// No built-in action slot in DS toast — render Undo as a Button node
const undoNode = (
<Button