From e1ead0f53769b5864a65e698dc144c8da8f13c6a Mon Sep 17 00:00:00 2001 From: Fabrizio <135109076+fabrizio-grafana@users.noreply.github.com> Date: Wed, 17 Jan 2024 12:45:17 +0100 Subject: [PATCH] Tempo: Minor refactoring (#80701) --- .betterer.results | 14 ------ .../tempo/NativeSearch/NativeSearch.tsx | 14 +++--- .../SearchTraceQLEditor/GroupByField.tsx | 6 +-- .../tempo/SearchTraceQLEditor/SearchField.tsx | 6 +-- .../components/ConfigDescriptionLink.tsx | 47 ------------------- .../components/Divider.tsx | 25 ---------- .../components/NodeGraphSettings.tsx | 4 +- .../components/TraceView/SpanBarSettings.tsx | 4 +- .../app/plugins/datasource/tempo/package.json | 9 +--- yarn.lock | 7 --- 10 files changed, 16 insertions(+), 120 deletions(-) delete mode 100644 public/app/plugins/datasource/tempo/_importedDependencies/components/ConfigDescriptionLink.tsx delete mode 100644 public/app/plugins/datasource/tempo/_importedDependencies/components/Divider.tsx diff --git a/.betterer.results b/.betterer.results index 5e71c366204..444ed4c4f6f 100644 --- a/.betterer.results +++ b/.betterer.results @@ -5730,10 +5730,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "public/app/plugins/datasource/tempo/NativeSearch/NativeSearch.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/tempo/NativeSearch/TagsField/TagsField.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"] @@ -5741,12 +5737,6 @@ exports[`better eslint`] = { "public/app/plugins/datasource/tempo/SearchTraceQLEditor/DurationInput.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] ], - "public/app/plugins/datasource/tempo/SearchTraceQLEditor/GroupByField.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"] - ], - "public/app/plugins/datasource/tempo/SearchTraceQLEditor/SearchField.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"] - ], "public/app/plugins/datasource/tempo/SearchTraceQLEditor/TagsInput.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"] @@ -5763,10 +5753,6 @@ exports[`better eslint`] = { "public/app/plugins/datasource/tempo/_importedDependencies/components/AdHocFilter/AdHocFilterRenderer.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/plugins/datasource/tempo/_importedDependencies/components/Divider.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/tempo/_importedDependencies/components/NodeGraphSettings.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], diff --git a/public/app/plugins/datasource/tempo/NativeSearch/NativeSearch.tsx b/public/app/plugins/datasource/tempo/NativeSearch/NativeSearch.tsx index 2d8d1ee4331..ae78da4318f 100644 --- a/public/app/plugins/datasource/tempo/NativeSearch/NativeSearch.tsx +++ b/public/app/plugins/datasource/tempo/NativeSearch/NativeSearch.tsx @@ -262,11 +262,11 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props export default NativeSearch; const getStyles = (theme: GrafanaTheme2) => ({ - container: css` - max-width: 500px; - `, - alert: css` - max-width: 75ch; - margin-top: ${theme.spacing(2)}; - `, + container: css({ + maxWidth: '500px', + }), + alert: css({ + maxWidth: '75ch', + marginTop: theme.spacing(2), + }), }); diff --git a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/GroupByField.tsx b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/GroupByField.tsx index 93768010da0..27b7cb86590 100644 --- a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/GroupByField.tsx +++ b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/GroupByField.tsx @@ -129,7 +129,7 @@ export const GroupByField = (props: Props) => { }; const getStyles = (theme: GrafanaTheme2) => ({ - addFilter: css` - margin-left: ${theme.spacing(2)}; - `, + addFilter: css({ + marginLeft: theme.spacing(2), + }), }); diff --git a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/SearchField.tsx b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/SearchField.tsx index 3007a78615b..c16095acf0d 100644 --- a/public/app/plugins/datasource/tempo/SearchTraceQLEditor/SearchField.tsx +++ b/public/app/plugins/datasource/tempo/SearchTraceQLEditor/SearchField.tsx @@ -18,9 +18,9 @@ import { operators as allOperators, stringOperators, numberOperators, keywordOpe import { filterScopedTag, operatorSelectableValue } from './utils'; const getStyles = () => ({ - dropdown: css` - box-shadow: none; - `, + dropdown: css({ + boxShadow: 'none', + }), }); interface Props { diff --git a/public/app/plugins/datasource/tempo/_importedDependencies/components/ConfigDescriptionLink.tsx b/public/app/plugins/datasource/tempo/_importedDependencies/components/ConfigDescriptionLink.tsx deleted file mode 100644 index c2cecc84cd9..00000000000 --- a/public/app/plugins/datasource/tempo/_importedDependencies/components/ConfigDescriptionLink.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { css } from '@emotion/css'; -import React from 'react'; - -import { GrafanaTheme2 } from '@grafana/data'; -import { useStyles2 } from '@grafana/ui'; - -type Props = { - description: string; - suffix: string; - feature: string; -}; - -export function ConfigDescriptionLink(props: Props) { - const { description, suffix, feature } = props; - const text = `Learn more about ${feature}`; - const styles = useStyles2(getStyles); - - return ( - - {description} - - {text} - - - ); -} - -const getStyles = (theme: GrafanaTheme2) => { - return { - container: css({ - color: theme.colors.text.secondary, - a: css({ - color: theme.colors.text.link, - textDecoration: 'underline', - marginLeft: '5px', - '&:hover': { - textDecoration: 'none', - }, - }), - }), - }; -}; diff --git a/public/app/plugins/datasource/tempo/_importedDependencies/components/Divider.tsx b/public/app/plugins/datasource/tempo/_importedDependencies/components/Divider.tsx deleted file mode 100644 index 7e062fd6165..00000000000 --- a/public/app/plugins/datasource/tempo/_importedDependencies/components/Divider.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { css } from '@emotion/css'; -import React from 'react'; - -import { GrafanaTheme2 } from '@grafana/data'; -import { useStyles2 } from '@grafana/ui'; - -export const Divider = ({ hideLine = false }) => { - const styles = useStyles2(getStyles); - - if (hideLine) { - return