diff --git a/web/ui/react-app/src/pages/rules/RulesContent.tsx b/web/ui/react-app/src/pages/rules/RulesContent.tsx index 1144e43517..d3a13ff13e 100644 --- a/web/ui/react-app/src/pages/rules/RulesContent.tsx +++ b/web/ui/react-app/src/pages/rules/RulesContent.tsx @@ -3,7 +3,7 @@ import { RouteComponentProps } from '@reach/router'; import { APIResponse } from '../../hooks/useFetch'; import { Alert, Table, Badge } from 'reactstrap'; import { Link } from '@reach/router'; -import { formatRelative, createExpressionLink, humanizeDuration } from '../../utils'; +import { formatRelative, createExpressionLink, humanizeDuration, formatRange } from '../../utils'; import { Rule } from '../../types/types'; import { now } from 'moment'; @@ -23,12 +23,12 @@ export interface RulesMap { groups: RuleGroup[]; } -const GraphExpressionLink: FC<{ expr: string; title: string }> = props => { +const GraphExpressionLink: FC<{ expr: string; text: string; title: string }> = props => { return ( <> {props.title}: - {props.expr} + {props.text}
@@ -83,10 +83,19 @@ export const RulesContent: FC = ({ resp {g.rules.map((r, i) => { return ( - {r.alerts ? ( - - - + + {r.alerts ? ( + + ) : ( + + )} + + {r.duration > 0 && ( +
+ for: {formatRange(r.duration)} +
+ )} + {r.labels && Object.keys(r.labels).length > 0 && (
labels: {Object.entries(r.labels).map(([key, value]) => ( @@ -95,6 +104,8 @@ export const RulesContent: FC = ({ resp
))} + )} + {r.alerts && r.annotations && Object.keys(r.annotations).length > 0 && (
annotations: {Object.entries(r.annotations).map(([key, value]) => ( @@ -103,13 +114,8 @@ export const RulesContent: FC = ({ resp
))} - - ) : ( - - - - - )} + )} + {r.health.toUpperCase()}