From 8464fba0956a7e2e9f3fe3770ec5e8ec0cd4be6f Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 9 Oct 2025 23:20:25 +0000 Subject: [PATCH] feat: improve alert delay UI with collapsible row and better UX - Add collapsible toggle for alert delay settings row to reduce visual clutter - Match delay input styling to global threshold inputs (w-16, text-sm) - Auto-clear delay override when value matches default to avoid confusion - Remove unnecessary clear button - users can clear by emptying the field - Simplify placeholder from "5s" to "5" for clarity --- .../src/components/Alerts/ResourceTable.tsx | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/frontend-modern/src/components/Alerts/ResourceTable.tsx b/frontend-modern/src/components/Alerts/ResourceTable.tsx index 42ab2667c..2b96419f0 100644 --- a/frontend-modern/src/components/Alerts/ResourceTable.tsx +++ b/frontend-modern/src/components/Alerts/ResourceTable.tsx @@ -117,6 +117,7 @@ export function ResourceTable(props: ResourceTableProps) { const hasRows = () => flattenResources().length > 0; const [activeMetricInput, setActiveMetricInput] = createSignal<{ resourceId: string; metric: string } | null>(null); + const [showDelayRow, setShowDelayRow] = createSignal(false); const normalizeMetricKey = (column: string): string => { const key = column.trim().toLowerCase(); @@ -536,11 +537,35 @@ export function ResourceTable(props: ResourceTableProps) { - - + + + + + - + - + - @@ -558,15 +583,15 @@ export function ResourceTable(props: ResourceTableProps) { return ( -
+
{ return overrideDelay !== undefined ? overrideDelay : ''; })()} - placeholder={formatDelayLabel(typeDefaultDelay)} - class="w-20 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-2 py-0.5 text-xs text-gray-700 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500" + placeholder={String(typeDefaultDelay)} + class="w-16 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 px-2 py-0.5 text-sm text-center text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:ring-1 focus:ring-blue-500" onInput={(e) => { const raw = e.currentTarget.value; if (raw === '') { @@ -577,36 +602,17 @@ export function ResourceTable(props: ResourceTableProps) { if (Number.isNaN(parsed)) { return; } - props.onMetricDelayChange?.(metric, Math.max(0, parsed)); + const sanitized = Math.max(0, parsed); + // If the value matches the default, clear the override + if (sanitized === typeDefaultDelay) { + props.onMetricDelayChange?.(metric, null); + } else { + props.onMetricDelayChange?.(metric, sanitized); + } props.setHasUnsavedChanges?.(true); } }} /> - - -
);