diff --git a/ui/src/pages/Alerts/HistoryPage.tsx b/ui/src/pages/Alerts/HistoryPage.tsx index 59bda291..a7e22922 100644 --- a/ui/src/pages/Alerts/HistoryPage.tsx +++ b/ui/src/pages/Alerts/HistoryPage.tsx @@ -1,8 +1,7 @@ -import { useState } from 'react'; import { Link } from 'react-router'; import { History } from 'lucide-react'; import { - DataTable, EmptyState, DateRangePicker, + DataTable, EmptyState, useGlobalFilters, } from '@cameleer/design-system'; import type { Column } from '@cameleer/design-system'; import { PageLoader } from '../../components/PageLoader'; @@ -29,18 +28,16 @@ function formatDuration(from?: string | null, to?: string | null): string { } export default function HistoryPage() { - const [dateRange, setDateRange] = useState({ - start: new Date(Date.now() - 7 * 24 * 3600_000), - end: new Date(), - }); + const { timeRange } = useGlobalFilters(); - // useAlerts doesn't accept a time range today; filter client-side. + // useAlerts doesn't accept a time range today; filter client-side + // against the global TimeRangeDropdown in the top bar. const { data, isLoading, error } = useAlerts({ state: 'RESOLVED', limit: 200 }); const filtered = (data ?? []).filter((a) => { if (!a.firedAt) return false; const t = new Date(a.firedAt).getTime(); - return t >= dateRange.start.getTime() && t <= dateRange.end.getTime(); + return t >= timeRange.start.getTime() && t <= timeRange.end.getTime(); }); const columns: Column[] = [ @@ -95,9 +92,6 @@ export default function HistoryPage() { : `${filtered.length} resolved alert${filtered.length === 1 ? '' : 's'} in range`} -
- -
{filtered.length === 0 ? ( diff --git a/ui/src/pages/Alerts/InboxPage.tsx b/ui/src/pages/Alerts/InboxPage.tsx index 0ac3a1ff..b7760bdf 100644 --- a/ui/src/pages/Alerts/InboxPage.tsx +++ b/ui/src/pages/Alerts/InboxPage.tsx @@ -200,38 +200,47 @@ export default function InboxPage() { {allSelected ? 'Deselect all' : `Select all${rows.length ? ` (${rows.length})` : ''}`} - - - - + {selectedIds.length > 0 ? ( + <> + + + + ) : ( + <> + + + + )} {rows.length === 0 ? (