diff --git a/dashboard-frontend/src/pages/Notifications.tsx b/dashboard-frontend/src/pages/Notifications.tsx index 0c3b462..b20bcbd 100644 --- a/dashboard-frontend/src/pages/Notifications.tsx +++ b/dashboard-frontend/src/pages/Notifications.tsx @@ -41,20 +41,38 @@ interface NotificationRuleConfig { interface NotificationToggle { name: string enabled: boolean - min_severity: string regions: string[] severity_channels: Record - broadcast_channel: number | null - node_ids: string[] - smtp_host: string - smtp_port: number - smtp_user: string - smtp_password: string - smtp_tls: boolean - from_address: string - recipients: string[] - webhook_url: string - webhook_headers: Record + freshness_seconds?: number + cooldown_seconds?: number + // Legacy fields (deprecated, use sinks instead) + min_severity?: string + broadcast_channel?: number | null + node_ids?: string[] + smtp_host?: string + smtp_port?: number + smtp_user?: string + smtp_password?: string + smtp_tls?: boolean + from_address?: string + recipients?: string[] + webhook_url?: string + webhook_headers?: Record +} + +interface SinkConfig { + type: 'mesh_broadcast' | 'mesh_dm' | 'email' | 'webhook' + channel?: number + node_ids?: string[] + smtp_host?: string + smtp_port?: number + smtp_user?: string + smtp_password?: string + smtp_tls?: boolean + from_address?: string + recipients?: string[] + webhook_url?: string + webhook_headers?: Record } interface NotificationsConfig { @@ -64,6 +82,8 @@ interface NotificationsConfig { band_conditions_schedule?: string[] rules: NotificationRuleConfig[] toggles?: Record + sinks?: Record + digest?: { include?: string[] } } interface AlertCategory { @@ -341,7 +361,7 @@ function InfoButton({ info }: { info: string }) { )} - {helper &&

{helper}

} + {helper &&

{helper}

} ) } @@ -412,7 +432,7 @@ function NumberInput({ label, value, onChange, min, max, step = 1, helper = '', }) { return (
-
) } @@ -440,11 +460,11 @@ function Toggle({ label, checked, onChange, helper = '', info = '' }: { return (
- + {label} {info && } - {helper &&

{helper}

} + {helper &&

{helper}

}
) } @@ -510,7 +530,7 @@ function ListInput({ label, value, onChange, placeholder = 'Add item...', helper return (
-
)} - {helper &&

{helper}

} + {helper &&

{helper}

} ) } @@ -565,7 +585,7 @@ function SeveritySelector({ value, onChange }: { return (
-
)} -

Lower = more notifications. "Warning" recommended for most rules.

+

Lower = more notifications. "Priority" recommended for most rules.

) } @@ -679,7 +699,7 @@ function ChannelTestButton({ rule }: { type="button" onClick={handleTest} disabled={testing} - className="flex items-center gap-2 px-3 py-1.5 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50" + className="flex items-center gap-2 px-3 py-1.5 bg-gray-700 hover:bg-gray-600 rounded text-sm disabled:opacity-50" > {testing ? ( <> @@ -915,17 +935,17 @@ function NotificationRuleCard({ } return ( -
+
{/* Header */}
setExpanded(!expanded)} >
- {expanded ? : } + {expanded ? : }
-

+

{rule.trigger_type === 'schedule' ? 'Send reports on a schedule (daily briefings, weekly digests)' : 'React to alert conditions (fires, outages, weather warnings)'} @@ -1066,7 +1086,7 @@ function NotificationRuleCard({ {/* WHEN section - Condition trigger */} {rule.trigger_type !== 'schedule' && (

-
+
WHEN (Condition)
@@ -1077,11 +1097,11 @@ function NotificationRuleCard({ />
-