The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/alerting/unified/components/rules/RuleDetailsExpression.tsx

35 lines
930 B

import { css, cx } from '@emotion/css';
import React from 'react';
import { CombinedRule, RulesSource } from 'app/types/unified-alerting';
import { isCloudRulesSource } from '../../utils/datasource';
import { DetailsField } from '../DetailsField';
import { Expression } from '../Expression';
type Props = {
rule: CombinedRule;
rulesSource: RulesSource;
annotations: Array<[string, string]>;
};
export function RuleDetailsExpression(props: Props): JSX.Element | null {
const { annotations, rulesSource, rule } = props;
const styles = getStyles();
if (!isCloudRulesSource(rulesSource)) {
return null;
}
return (
<DetailsField label="Expression" horizontal={true} className={cx({ [styles.exprRow]: !!annotations.length })}>
<Expression expression={rule.query} rulesSource={rulesSource} />
</DetailsField>
);
}
const getStyles = () => ({
exprRow: css({
marginBottom: '46px',
}),
});