AllAlertsPage: state filter chips (Open/Firing/Acked/All). HistoryPage: RESOLVED filter, respects retention window.
28 lines
900 B
TypeScript
28 lines
900 B
TypeScript
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() {
|
|
const { data, isLoading, error } = useAlerts({ state: 'RESOLVED', limit: 200 });
|
|
|
|
if (isLoading) return <PageLoader />;
|
|
if (error) return <div className={css.page}>Failed to load history: {String(error)}</div>;
|
|
|
|
const rows = data ?? [];
|
|
|
|
return (
|
|
<div className={css.page}>
|
|
<div className={css.toolbar}>
|
|
<SectionHeader>History</SectionHeader>
|
|
</div>
|
|
{rows.length === 0 ? (
|
|
<div className={css.empty}>No resolved alerts in retention window.</div>
|
|
) : (
|
|
rows.map((a) => <AlertRow key={a.id} alert={a} unread={false} />)
|
|
)}
|
|
</div>
|
|
);
|
|
}
|