diff --git a/dashboard-frontend/src/pages/Notifications.tsx b/dashboard-frontend/src/pages/Notifications.tsx index 34d85dc..6edf862 100644 --- a/dashboard-frontend/src/pages/Notifications.tsx +++ b/dashboard-frontend/src/pages/Notifications.tsx @@ -36,6 +36,7 @@ interface NotificationRuleConfig { webhook_headers: Record cooldown_minutes: number override_quiet: boolean + region_scope: string[] } interface NotificationToggle { @@ -73,6 +74,12 @@ interface AlertCategory { description: string default_severity: string example_message: string + toggle?: string +} + +interface RegionInfo { + name: string + local_name?: string } interface RuleStats { @@ -719,6 +726,7 @@ function NotificationRuleCard({ rule, ruleIndex, categories, + regions, quietHoursEnabled, onChange, onDelete, @@ -728,6 +736,7 @@ function NotificationRuleCard({ rule: NotificationRuleConfig ruleIndex: number categories: AlertCategory[] + regions: RegionInfo[] quietHoursEnabled: boolean onChange: (r: NotificationRuleConfig) => void onDelete: () => void @@ -793,6 +802,26 @@ function NotificationRuleCard({ } } + const selectManyCategories = (catIds: string[], action: 'add' | 'remove') => { + const current = rule.categories || [] + if (action === 'add') { + const merged = Array.from(new Set([...current, ...catIds])) + onChange({ ...rule, categories: merged }) + } else { + const drop = new Set(catIds) + onChange({ ...rule, categories: current.filter(c => !drop.has(c)) }) + } + } + + const toggleRegion = (regionName: string) => { + const current = rule.region_scope || [] + if (current.includes(regionName)) { + onChange({ ...rule, region_scope: current.filter(r => r !== regionName) }) + } else { + onChange({ ...rule, region_scope: [...current, regionName] }) + } + } + const toggleDay = (day: string) => { const current = rule.schedule_days || [] if (current.includes(day)) { @@ -914,7 +943,7 @@ function NotificationRuleCard({ ) : ( )} - {rule.name || 'New Rule'} + {rule.name || 'New Rule'} {!expanded && (