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:
@@ -34,9 +34,9 @@ const SEVERITY_ITEMS: ButtonGroupItem[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const STATE_ITEMS: ButtonGroupItem[] = [
|
const STATE_ITEMS: ButtonGroupItem[] = [
|
||||||
{ value: 'PENDING', label: 'Pending' },
|
{ value: 'PENDING', label: 'Pending', color: 'var(--text-muted)' },
|
||||||
{ value: 'FIRING', label: 'Firing' },
|
{ value: 'FIRING', label: 'Firing', color: 'var(--error)' },
|
||||||
{ value: 'RESOLVED', label: 'Resolved' },
|
{ value: 'RESOLVED', label: 'Resolved', color: 'var(--success)' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// ── Bulk silence helper ─────────────────────────────────────────────────────
|
// ── Bulk silence helper ─────────────────────────────────────────────────────
|
||||||
@@ -90,12 +90,6 @@ function SilenceRulesForSelection({ selected, rows }: SilenceRulesForSelectionPr
|
|||||||
|
|
||||||
const handleCustom = () => navigate('/alerts/silences');
|
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 (
|
return (
|
||||||
<div style={{ display: 'flex', gap: 'var(--space-xs)' }}>
|
<div style={{ display: 'flex', gap: 'var(--space-xs)' }}>
|
||||||
{SILENCE_PRESETS.map(({ label, hours }) => (
|
{SILENCE_PRESETS.map(({ label, hours }) => (
|
||||||
@@ -200,6 +194,12 @@ export default function InboxPage() {
|
|||||||
const onDeleteOne = async (id: string) => {
|
const onDeleteOne = async (id: string) => {
|
||||||
try {
|
try {
|
||||||
await del.mutateAsync(id);
|
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
|
// No built-in action slot in DS toast — render Undo as a Button node
|
||||||
const undoNode = (
|
const undoNode = (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user