diff --git a/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx b/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx index 72894d2b5fe..0409ef4d326 100644 --- a/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx +++ b/packages/grafana-ui/src/components/Forms/InlineFieldRow.tsx @@ -24,6 +24,7 @@ const getStyles = (theme: GrafanaTheme) => { flex-direction: row; flex-wrap: wrap; align-content: flex-start; + row-gap: ${theme.spacing.xs}; `, }; }; diff --git a/packages/grafana-ui/src/components/Segment/SegmentSection.tsx b/packages/grafana-ui/src/components/Segment/SegmentSection.tsx index 7d420738187..8cc5b7f751d 100644 --- a/packages/grafana-ui/src/components/Segment/SegmentSection.tsx +++ b/packages/grafana-ui/src/components/Segment/SegmentSection.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; -import { SegmentSectionFill } from './SegmentSectionFill'; -import { SegmentSectionLabel } from './SegmentSectionLabel'; import { useStyles2 } from '../../themes'; +import { InlineLabel } from '../Forms/InlineLabel'; +import { InlineFieldRow } from '../Forms/InlineFieldRow'; /** * Horizontal section for editor components. @@ -25,20 +25,27 @@ export const SegmentSection = ({ const styles = useStyles2(getStyles); return ( <> -
- + + + {label} + {children} - {fill && } -
+ {fill && ( +
+ {''} +
+ )} + ); }; const getStyles = (theme: GrafanaTheme2) => ({ - container: css` - display: flex; - flex-wrap: wrap; - row-gap: ${theme.spacing(0.5)}; - align-content: flex-start; + label: css` + color: ${theme.colors.primary.text}; + `, + fill: css` + flex-grow: 1; + margin-bottom: ${theme.spacing(0.5)}; `, }); diff --git a/packages/grafana-ui/src/components/Segment/SegmentSectionFill.tsx b/packages/grafana-ui/src/components/Segment/SegmentSectionFill.tsx deleted file mode 100644 index 63f945b2dd2..00000000000 --- a/packages/grafana-ui/src/components/Segment/SegmentSectionFill.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; - -/** - * @alpha - */ -export const SegmentSectionFill = () => ( -
-
-); diff --git a/packages/grafana-ui/src/components/Segment/SegmentSectionLabel.tsx b/packages/grafana-ui/src/components/Segment/SegmentSectionLabel.tsx deleted file mode 100644 index 2606e85429b..00000000000 --- a/packages/grafana-ui/src/components/Segment/SegmentSectionLabel.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import { cx } from '@emotion/css'; - -/** - * @alpha - */ -export const SegmentSectionLabel = ({ name, className }: { name: string; className?: string }) => ( - -); diff --git a/packages/grafana-ui/src/components/Segment/index.ts b/packages/grafana-ui/src/components/Segment/index.ts index 6c0f404075c..95c32736f69 100644 --- a/packages/grafana-ui/src/components/Segment/index.ts +++ b/packages/grafana-ui/src/components/Segment/index.ts @@ -3,6 +3,5 @@ export { SegmentAsync } from './SegmentAsync'; export { SegmentSelect } from './SegmentSelect'; export { SegmentInput } from './SegmentInput'; export { SegmentSection } from './SegmentSection'; -export { SegmentSectionLabel } from './SegmentSectionLabel'; export { SegmentProps } from './types'; export { useExpandableLabel } from './useExpandableLabel'; diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index b5b17c35e1e..3c7458379a0 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -152,7 +152,7 @@ export { CertificationKey } from './DataSourceSettings/CertificationKey'; export { Spinner } from './Spinner/Spinner'; export { FadeTransition } from './transitions/FadeTransition'; export { SlideOutTransition } from './transitions/SlideOutTransition'; -export { Segment, SegmentAsync, SegmentInput, SegmentSelect, SegmentSection, SegmentSectionLabel } from './Segment/'; +export { Segment, SegmentAsync, SegmentInput, SegmentSelect, SegmentSection } from './Segment/'; export { Drawer } from './Drawer/Drawer'; export { Slider } from './Slider/Slider'; export { RangeSlider } from './Slider/RangeSlider'; diff --git a/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx b/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx index ac8173b5462..5c87bcc5a5b 100644 --- a/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx +++ b/public/app/plugins/datasource/influxdb/components/VisualInfluxQLEditor/Editor.tsx @@ -26,7 +26,9 @@ import { import { FormatAsSection } from './FormatAsSection'; import { DEFAULT_RESULT_FORMAT } from '../constants'; import { getNewSelectPartOptions, getNewGroupByPartOptions, makePartList } from './partListUtils'; -import { SegmentSection, SegmentSectionLabel } from '@grafana/ui'; +import { InlineLabel, SegmentSection, useStyles2 } from '@grafana/ui'; +import { GrafanaTheme2 } from '@grafana/data'; +import { css } from '@emotion/css'; type Props = { query: InfluxQuery; @@ -51,6 +53,7 @@ function withTemplateVariableOptions(optionsPromise: Promise): Promise } export const Editor = (props: Props): JSX.Element => { + const styles = useStyles2(getStyles); const query = normalizeQuery(props.query); const { datasource } = props; const { measurement, policy } = query; @@ -115,7 +118,9 @@ export const Editor = (props: Props): JSX.Element => { } onChange={handleFromSectionChange} /> - + + WHERE + { onAppliedChange({ ...query, tz }); }} /> - + + ORDER BY TIME + { @@ -188,7 +195,9 @@ export const Editor = (props: Props): JSX.Element => { onAppliedChange({ ...query, limit }); }} /> - + + SLIMIT + { /> {query.resultFormat !== 'table' && ( <> - + + ALIAS + { ); }; + +function getStyles(theme: GrafanaTheme2) { + return { + inlineLabel: css` + color: ${theme.colors.primary.text}; + `, + }; +}