mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
36 lines
927 B
TypeScript
36 lines
927 B
TypeScript
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`
|
|
margin-bottom: 46px;
|
|
`,
|
|
});
|