import TimeSince from 'sentry/components/timeSince'; import {t, tct} from 'sentry/locale'; import getDuration from 'sentry/utils/duration/getDuration'; import {hasActiveIncident} from 'sentry/views/alerts/list/rules/utils'; import { type CombinedAlerts, CombinedAlertType, type CronRule, type IssueAlert, type MetricAlert, type UptimeAlert, } from 'sentry/views/alerts/types'; import {scheduleAsText} from 'sentry/views/monitors/utils/scheduleAsText'; interface Props { rule: CombinedAlerts; } /** * Displays the time since the last uptime incident given an uptime alert rule */ function LastUptimeIncident({rule}: {rule: UptimeAlert}) { // TODO(davidenwang): Once we have a lastTriggered field returned from // backend, display that info here return tct('Actively monitoring every [interval]', { interval: getDuration(rule.intervalSeconds), }); } function LastCronMonitorIncident({rule}: {rule: CronRule}) { // TODO(evanpurkhiser): Would probably be better if we had a way to get the // most recent incident. return tct('Expected [interval]', { interval: scheduleAsText(rule.config), }); } /** * Displays the last time an issue alert was triggered */ function LastIssueTrigger({rule}: {rule: IssueAlert}) { if (!rule.lastTriggered) { return t('Alert not triggered yet'); } return (