From 3487e89492aeee6ddafe5580bf68049732042034 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Mon, 11 Sep 2023 14:45:46 +0200 Subject: [PATCH] Alerting: Update query options layout (#74660) --- .../components/rule-editor/QueryOptions.tsx | 51 +++++------------- .../components/rule-editor/QueryWrapper.tsx | 52 +++++++------------ 2 files changed, 34 insertions(+), 69 deletions(-) diff --git a/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx b/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx index 655f3fc4e93..87e6443b765 100644 --- a/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import { dateTime, getDefaultRelativeTimeRange, GrafanaTheme2, RelativeTimeRange } from '@grafana/data'; import { relativeToTimeRange } from '@grafana/data/src/datetime/rangeutil'; -import { clearButtonStyles, Icon, RelativeTimeRangePicker, Toggletip, useStyles2 } from '@grafana/ui'; +import { clearButtonStyles, Icon, InlineField, RelativeTimeRangePicker, Toggletip, useStyles2 } from '@grafana/ui'; import { AlertQuery } from 'app/types/unified-alerting-dto'; import { AlertQueryOptions, MaxDataPointsOption, MinIntervalOption } from './QueryWrapper'; @@ -33,25 +33,17 @@ export const QueryOptions = ({ <> -
- {onChangeTimeRange && ( -
- Time Range - onChangeTimeRange(range, index)} - /> -
- )} -
-
- onChangeQueryOptions(options, index)} - /> - onChangeQueryOptions(options, index)} /> -
+
+ {onChangeTimeRange && ( + + onChangeTimeRange(range, index)} + /> + + )} + onChangeQueryOptions(options, index)} /> + onChangeQueryOptions(options, index)} />
} closeButton={true} @@ -79,24 +71,9 @@ const getStyles = (theme: GrafanaTheme2) => { const clearButton = clearButtonStyles(theme); return { - container: css` - display: flex; - flex-direction: column; - gap: 10px; - `, - timeRangeContainer: css` - display: flex; - `, - - timeRangeLabel: css` - width: 20%; - `, queryOptions: css` - margin-bottom: -${theme.spacing(2)}; - - label { - line-height: 12px; - padding: 0px; + > div { + justify-content: space-between; } `, diff --git a/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx b/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx index a12ccb246a2..e5e24829dcf 100644 --- a/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx @@ -14,7 +14,7 @@ import { } from '@grafana/data'; import { Stack } from '@grafana/experimental'; import { DataQuery } from '@grafana/schema'; -import { GraphTresholdsStyleMode, Icon, InlineFormLabel, Input, Tooltip, useStyles2 } from '@grafana/ui'; +import { GraphTresholdsStyleMode, Icon, InlineField, Input, Tooltip, useStyles2 } from '@grafana/ui'; import { QueryEditorRow } from 'app/features/query/components/QueryEditorRow'; import { AlertQuery } from 'app/types/unified-alerting-dto'; @@ -205,27 +205,20 @@ export function MaxDataPointsOption({ }; return ( - - - The maximum data points per series. Used directly by some data sources and used in calculation of auto - interval. With streaming data this value is used for the rolling buffer. - - } - > - Max data points - + - + ); } @@ -249,27 +242,25 @@ export function MinIntervalOption({ }; return ( - - - A lower limit for the interval. Recommended to be set to write frequency, for example 1m if - your data is written every minute. - - } - > - Min interval - + + A lower limit for the interval. Recommended to be set to write frequency, for example 1m if your + data is written every minute. + + } + > - + ); } @@ -284,9 +275,6 @@ const getStyles = (theme: GrafanaTheme2) => ({ overflow: visible; } `, - queryOptions: css` - margin-bottom: -${theme.spacing(2)}; - `, dsTooltip: css` display: flex; align-items: center;