From 20a83ba14f6136bbb53d1cae2480eb95a1670022 Mon Sep 17 00:00:00 2001 From: Konrad Lalik Date: Thu, 26 May 2022 11:46:54 +0200 Subject: [PATCH] Narrow the alert condition picker (#49570) --- .../components/rule-editor/ConditionField.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx b/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx index a3eb1411c58..5ec13955b0e 100644 --- a/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx @@ -1,9 +1,10 @@ +import { css } from '@emotion/css'; import { last } from 'lodash'; import React, { FC, useEffect, useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; -import { SelectableValue } from '@grafana/data'; -import { Alert, Card, Field, InputControl, RadioButtonList } from '@grafana/ui'; +import { GrafanaTheme2, SelectableValue } from '@grafana/data'; +import { Alert, Card, Field, InputControl, RadioButtonList, useStyles2 } from '@grafana/ui'; import { ExpressionDatasourceUID } from 'app/features/expressions/ExpressionDatasource'; import { RuleFormValues } from '../../types/rule-form'; @@ -53,8 +54,10 @@ export const ConditionField: FC = () => { } }, [condition, expressions, options, setValue]); + const styles = useStyles2(getStyles); + return options.length ? ( - + Set alert condition Select one of your queries or expressions set above that contains your alert condition. @@ -75,8 +78,14 @@ export const ConditionField: FC = () => { ) : ( - + Create at least one query or expression to be alerted on ); }; + +const getStyles = (theme: GrafanaTheme2) => ({ + container: css` + max-width: ${theme.breakpoints.values.sm}px; + `, +});