MDK Logo

Alerts

Historical alerts log and related views for past incident data

Views for inspecting past alerts and incident history. Pair this page with the dashboard for live context.

Prerequisites

HistoricalAlerts

Renders the historical alerts log as a sortable data table, with a date-range picker in the title row for adjusting the query window. Shares filter state with the current alerts view.

Import

import { HistoricalAlerts } from '@mdk/foundation'
import type { HistoricalAlertsProps, HistoricalAlertsRange } from '@mdk/foundation'

Props

PropTypeDefaultDescription
alertsAlert[][]Pre-fetched historical alert entries
isLoadingbooleanfalseShow table loading state
localFiltersAlertLocalFiltersrequiredFilters and search state shared with CurrentAlerts
filterTagsstring[]requiredActive filter tags
dateRangeHistoricalAlertsRangerequiredControlled start/end timestamps (ms)
onDateRangeChange(range: HistoricalAlertsRange) => voidrequiredFires when the user picks a new range
onAlertClick(id?: string, uuid?: string) => voidnoneRow click handler
classNamestringnoneAdditional CSS class

HistoricalAlertsRange type

type HistoricalAlertsRange = {
  start: number
  end: number
}

Basic usage

<HistoricalAlerts
  alerts={historicalAlerts}
  localFilters={localFilters}
  filterTags={filterTags}
  dateRange={{ start: rangeStart, end: rangeEnd }}
  onDateRangeChange={({ start, end }) => setRange({ start, end })}
  onAlertClick={(id, uuid) => console.log('Alert clicked', id, uuid)}
/>

Loading state

<HistoricalAlerts
  alerts={[]}
  isLoading
  localFilters={localFilters}
  filterTags={filterTags}
  dateRange={dateRange}
  onDateRangeChange={onDateRangeChange}
/>

Behaviour notes

  • The component wires a DateRangePicker into the table title via AlertsTableTitle, so date range changes come back through onDateRangeChange.
  • Rows are sorted by severity (descending) then creation date (descending) by default.
  • Timestamps are formatted through the useTimezone() hook's getFormattedDate.

Next steps

On this page