diff --git a/web/ui/react-app/src/pages/alerts/CollapsibleAlertPanel.tsx b/web/ui/react-app/src/pages/alerts/CollapsibleAlertPanel.tsx index ee1f507f9..1208d5088 100644 --- a/web/ui/react-app/src/pages/alerts/CollapsibleAlertPanel.tsx +++ b/web/ui/react-app/src/pages/alerts/CollapsibleAlertPanel.tsx @@ -5,7 +5,7 @@ import { RuleStatus } from './AlertContents'; import { Rule } from '../../types/types'; import { faChevronDown, faChevronRight } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { createExpressionLink, parsePrometheusFloat } from '../../utils/index'; +import { createExpressionLink, parsePrometheusFloat, formatRange } from '../../utils/index'; interface CollapsibleAlertPanelProps { rule: Rule; @@ -36,14 +36,31 @@ const CollapsibleAlertPanel: FC = ({ rule, showAnnot
expr: {rule.query}
-
-
labels:
-
severity: {rule.labels.severity}
-
-
-
annotations:
-
summary: {rule.annotations.summary}
-
+ {rule.duration > 0 && ( +
+
for: {formatRange(rule.duration)}
+
+ )} + {rule.labels && Object.keys(rule.labels).length > 0 && ( +
+
labels:
+ {Object.entries(rule.labels).map(([key, value]) => ( +
+ {key}: {value} +
+ ))} +
+ )} + {rule.annotations && Object.keys(rule.annotations).length > 0 && ( +
+
annotations:
+ {Object.entries(rule.annotations).map(([key, value]) => ( +
+ {key}: {value} +
+ ))} +
+ )} {rule.alerts.length > 0 && (