diff --git a/.betterer.results b/.betterer.results index 87b8a31de53..e14d97f73cc 100644 --- a/.betterer.results +++ b/.betterer.results @@ -6134,10 +6134,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not re-export imported variable (\`./thirdArgAfterSearchQuery\`)", "4"], [0, 0, 0, "Do not re-export imported variable (\`./withinStringQuery\`)", "5"] ], - "public/app/plugins/datasource/cloudwatch/components/CheatSheet/LogsCheatSheet.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"], - [0, 0, 0, "Styles should be written using objects.", "1"] - ], "public/app/plugins/datasource/cloudwatch/components/ConfigEditor/XrayLinkConfig.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] ], diff --git a/packages/grafana-prometheus/src/components/PromCheatSheet.tsx b/packages/grafana-prometheus/src/components/PromCheatSheet.tsx index 7eaee0b0782..4e452244cce 100644 --- a/packages/grafana-prometheus/src/components/PromCheatSheet.tsx +++ b/packages/grafana-prometheus/src/components/PromCheatSheet.tsx @@ -1,7 +1,9 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromCheatSheet.tsx +import { css } from '@emotion/css'; import React from 'react'; -import { QueryEditorHelpProps } from '@grafana/data'; +import { GrafanaTheme2, QueryEditorHelpProps } from '@grafana/data'; +import { useStyles2 } from '@grafana/ui'; import { PromQuery } from '../types'; @@ -29,23 +31,44 @@ const CHEAT_SHEET_ITEMS = [ }, ]; -export const PromCheatSheet = (props: QueryEditorHelpProps) => ( -
-

PromQL Cheat Sheet

- {CHEAT_SHEET_ITEMS.map((item, index) => ( -
-
{item.title}
- {item.expression ? ( - - ) : null} -
{item.label}
-
- ))} -
-); +export const PromCheatSheet = (props: QueryEditorHelpProps) => { + const styles = useStyles2(getStyles); + + return ( +
+

PromQL Cheat Sheet

+ {CHEAT_SHEET_ITEMS.map((item, index) => ( +
+
{item.title}
+ {item.expression ? ( + + ) : null} + {item.label} +
+ ))} +
+ ); +}; + +const getStyles = (theme: GrafanaTheme2) => ({ + cheatSheetItem: css({ + margin: theme.spacing(3, 0), + }), + cheatSheetItemTitle: css({ + fontSize: theme.typography.h3.fontSize, + }), + cheatSheetExample: css({ + margin: theme.spacing(0.5, 0), + // element is interactive, clear button styles + textAlign: 'left', + border: 'none', + background: 'transparent', + display: 'block', + }), +}); diff --git a/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx b/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx index a202786e14a..bbff06629c5 100644 --- a/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx +++ b/packages/grafana-prometheus/src/components/PromExploreExtraField.tsx @@ -4,7 +4,8 @@ import { isEqual } from 'lodash'; import React, { memo, useCallback } from 'react'; import { usePrevious } from 'react-use'; -import { InlineFormLabel, RadioButtonGroup } from '@grafana/ui'; +import { GrafanaTheme2 } from '@grafana/data'; +import { InlineFormLabel, RadioButtonGroup, useStyles2 } from '@grafana/ui'; import { PrometheusDatasource } from '../datasource'; import { PromQuery } from '../types'; @@ -21,6 +22,7 @@ export interface PromExploreExtraFieldProps { export const PromExploreExtraField = memo(({ query, datasource, onChange, onRunQuery }: PromExploreExtraFieldProps) => { const rangeOptions = getQueryTypeOptions(true); const prevQuery = usePrevious(query); + const styles = useStyles2(getStyles); const onExemplarChange = useCallback( (exemplar: boolean) => { @@ -59,7 +61,8 @@ export const PromExploreExtraField = memo(({ query, datasource, onChange, onRunQ
({ + queryTypeField: css({ + marginRight: theme.spacing(0.5), + }), +}); diff --git a/packages/grafana-prometheus/src/components/PromQueryField.tsx b/packages/grafana-prometheus/src/components/PromQueryField.tsx index ac648271d44..e4a83498aad 100644 --- a/packages/grafana-prometheus/src/components/PromQueryField.tsx +++ b/packages/grafana-prometheus/src/components/PromQueryField.tsx @@ -1,5 +1,5 @@ // Core Grafana history https://github.com/grafana/grafana/blob/v11.0.0-preview/public/app/plugins/datasource/prometheus/components/PromQueryField.tsx -import { cx } from '@emotion/css'; +import { css, cx } from '@emotion/css'; import React, { ReactNode } from 'react'; import { isDataFrame, QueryEditorProps, QueryHint, TimeRange, toLegacyResponseData } from '@grafana/data'; @@ -265,8 +265,12 @@ class PromQueryFieldClass extends React.PureComponent -
+
+
{hint.label}{' '} {hint.fix ? (