feat: notification center toast coordination (PR-4)

- EventToastBridge checks notification_toast_level and notification_mute_categories
- toast-rules.ts: event-to-category/severity mapping functions
- Settings page: notification preferences section (toast level dropdown, mute checkboxes)
- Settings API types extended with notification preference fields
- 17 frontend tests (toast-rules + bridge)
- Preference hierarchy: mute categories → toast level → show/hide

Quality gates: vitest 17 passed, tsc clean, eslint clean
This commit is contained in:
2026-05-29 13:45:17 +02:00
parent ceaed9af66
commit 19242b4152
8 changed files with 808 additions and 281 deletions
+26
View File
@@ -19,6 +19,32 @@ function shouldShowToast(instanceId: string, eventType: string): boolean {
return true;
}
export function mapEventToCategory(event: InstanceEventPayload): string {
if (event.event.startsWith("instance.")) return "instance";
if (event.event.startsWith("health.")) return "health";
return "system";
}
export function mapEventToSeverity(
event: InstanceEventPayload,
): "info" | "warning" | "error" | "success" {
switch (event.event) {
case "instance.error":
case "health.error":
return "error";
case "instance.health_changed":
return event.status === "unhealthy" ? "warning" : "success";
case "instance.created":
case "instance.started":
case "instance.stopped":
case "instance.restarted":
case "instance.deleted":
return "info";
default:
return "info";
}
}
export function handleEventToast(event: InstanceEventPayload): void {
const { event: eventType, instance_id, status, message, metadata } = event;