From 269a63af1fcda34b0c0ff2b190c92cbd1140ebe0 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Mon, 20 Apr 2026 13:49:52 +0200 Subject: [PATCH] feat(ui/alerts): AllAlertsPage + HistoryPage AllAlertsPage: state filter chips (Open/Firing/Acked/All). HistoryPage: RESOLVED filter, respects retention window. --- ui/src/pages/Alerts/AllAlertsPage.tsx | 50 ++++++++++++++++++++++++++- ui/src/pages/Alerts/HistoryPage.tsx | 26 +++++++++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/ui/src/pages/Alerts/AllAlertsPage.tsx b/ui/src/pages/Alerts/AllAlertsPage.tsx index 22aec1f6..db462ba4 100644 --- a/ui/src/pages/Alerts/AllAlertsPage.tsx +++ b/ui/src/pages/Alerts/AllAlertsPage.tsx @@ -1,3 +1,51 @@ +import { useState } from 'react'; +import { SectionHeader, Button } from '@cameleer/design-system'; +import { PageLoader } from '../../components/PageLoader'; +import { useAlerts, type AlertDto } from '../../api/queries/alerts'; +import { AlertRow } from './AlertRow'; +import css from './alerts-page.module.css'; + +type AlertState = NonNullable; + +const STATE_FILTERS: Array<{ label: string; values: AlertState[] }> = [ + { label: 'Open', values: ['PENDING', 'FIRING', 'ACKNOWLEDGED'] }, + { label: 'Firing', values: ['FIRING'] }, + { label: 'Acked', values: ['ACKNOWLEDGED'] }, + { label: 'All', values: ['PENDING', 'FIRING', 'ACKNOWLEDGED', 'RESOLVED'] }, +]; + export default function AllAlertsPage() { - return
AllAlertsPage — coming soon
; + const [filterIdx, setFilterIdx] = useState(0); + const filter = STATE_FILTERS[filterIdx]; + const { data, isLoading, error } = useAlerts({ state: filter.values, limit: 200 }); + + if (isLoading) return ; + if (error) return
Failed to load alerts: {String(error)}
; + + const rows = data ?? []; + + return ( +
+
+ All alerts +
+ {STATE_FILTERS.map((f, i) => ( + + ))} +
+
+ {rows.length === 0 ? ( +
No alerts match this filter.
+ ) : ( + rows.map((a) => ) + )} +
+ ); } diff --git a/ui/src/pages/Alerts/HistoryPage.tsx b/ui/src/pages/Alerts/HistoryPage.tsx index 6807b6d4..27f01bb0 100644 --- a/ui/src/pages/Alerts/HistoryPage.tsx +++ b/ui/src/pages/Alerts/HistoryPage.tsx @@ -1,3 +1,27 @@ +import { SectionHeader } from '@cameleer/design-system'; +import { PageLoader } from '../../components/PageLoader'; +import { useAlerts } from '../../api/queries/alerts'; +import { AlertRow } from './AlertRow'; +import css from './alerts-page.module.css'; + export default function HistoryPage() { - return
HistoryPage — coming soon
; + const { data, isLoading, error } = useAlerts({ state: 'RESOLVED', limit: 200 }); + + if (isLoading) return ; + if (error) return
Failed to load history: {String(error)}
; + + const rows = data ?? []; + + return ( +
+
+ History +
+ {rows.length === 0 ? ( +
No resolved alerts in retention window.
+ ) : ( + rows.map((a) => ) + )} +
+ ); }