Tempo: Minor refactoring (#80701)

This commit is contained in:
Fabrizio
2024-01-17 12:45:17 +01:00
committed by GitHub
parent 472f450333
commit e1ead0f537
10 changed files with 16 additions and 120 deletions
-14
View File
@@ -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"],
@@ -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),
}),
});
@@ -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),
}),
});
@@ -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 {
@@ -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 (
<span className={styles.container}>
{description}
<a
aria-label={text}
href={`https://grafana.com/docs/grafana/next/datasources/${suffix}`}
rel="noreferrer"
target="_blank"
>
{text}
</a>
</span>
);
}
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',
},
}),
}),
};
};
@@ -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 <hr className={styles.dividerHideLine} />;
}
return <hr className={styles.divider} />;
};
const getStyles = (theme: GrafanaTheme2) => ({
divider: css`
margin: ${theme.spacing(4, 0)};
`,
dividerHideLine: css`
border: none;
margin: ${theme.spacing(3, 0)};
`,
});
@@ -7,11 +7,9 @@ import {
GrafanaTheme2,
updateDatasourcePluginJsonDataOption,
} from '@grafana/data';
import { ConfigSubSection } from '@grafana/experimental';
import { ConfigSubSection, ConfigDescriptionLink } from '@grafana/experimental';
import { InlineField, InlineFieldRow, InlineSwitch, useStyles2 } from '@grafana/ui';
import { ConfigDescriptionLink } from './ConfigDescriptionLink';
export interface NodeGraphOptions {
enabled?: boolean;
}
@@ -8,11 +8,9 @@ import {
toOption,
updateDatasourcePluginJsonDataOption,
} from '@grafana/data';
import { ConfigSubSection } from '@grafana/experimental';
import { ConfigSubSection, ConfigDescriptionLink } from '@grafana/experimental';
import { InlineField, InlineFieldRow, Input, Select, useStyles2 } from '@grafana/ui';
import { ConfigDescriptionLink } from '../ConfigDescriptionLink';
export interface SpanBarOptions {
type?: string;
tag?: string;
@@ -40,10 +40,7 @@
"uuid": "9.0.0"
},
"devDependencies": {
"@babel/core": "7.23.7",
"@grafana/plugin-configs": "10.4.0-pre",
"@grafana/tsconfig": "^1.3.0-rc1",
"@swc/core": "1.3.38",
"@testing-library/jest-dom": "6.1.4",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.5.2",
@@ -55,14 +52,10 @@
"@types/react-dom": "18.2.7",
"@types/semver": "7.5.6",
"@types/uuid": "9.0.2",
"copy-webpack-plugin": "11.0.0",
"eslint-webpack-plugin": "4.0.1",
"glob": "10.3.10",
"react-select-event": "5.5.1",
"replace-in-file-webpack-plugin": "1.0.6",
"ts-node": "10.9.1",
"typescript": "5.2.2",
"webpack": "5.89.0"
"typescript": "5.2.2"
},
"peerDependencies": {
"@grafana/runtime": "*"
-7
View File
@@ -3053,7 +3053,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@grafana-plugins/tempo@workspace:public/app/plugins/datasource/tempo"
dependencies:
"@babel/core": "npm:7.23.7"
"@emotion/css": "npm:11.11.2"
"@grafana/data": "workspace:*"
"@grafana/e2e-selectors": "workspace:*"
@@ -3064,7 +3063,6 @@ __metadata:
"@grafana/plugin-configs": "npm:10.4.0-pre"
"@grafana/runtime": "workspace:*"
"@grafana/schema": "workspace:*"
"@grafana/tsconfig": "npm:^1.3.0-rc1"
"@grafana/ui": "workspace:*"
"@lezer/common": "npm:1.2.1"
"@lezer/lr": "npm:1.3.3"
@@ -3072,7 +3070,6 @@ __metadata:
"@opentelemetry/exporter-collector": "npm:0.25.0"
"@opentelemetry/semantic-conventions": "npm:1.17.1"
"@reduxjs/toolkit": "npm:1.9.5"
"@swc/core": "npm:1.3.38"
"@testing-library/jest-dom": "npm:6.1.4"
"@testing-library/react": "npm:14.0.0"
"@testing-library/user-event": "npm:14.5.2"
@@ -3085,8 +3082,6 @@ __metadata:
"@types/semver": "npm:7.5.6"
"@types/uuid": "npm:9.0.2"
buffer: "npm:6.0.3"
copy-webpack-plugin: "npm:11.0.0"
eslint-webpack-plugin: "npm:4.0.1"
events: "npm:3.3.0"
glob: "npm:10.3.10"
i18next: "npm:^22.0.0"
@@ -3100,7 +3095,6 @@ __metadata:
react-select-event: "npm:5.5.1"
react-use: "npm:17.4.3"
redux: "npm:4.2.1"
replace-in-file-webpack-plugin: "npm:1.0.6"
rxjs: "npm:7.8.1"
semver: "npm:7.5.4"
stream-browserify: "npm:3.0.0"
@@ -3109,7 +3103,6 @@ __metadata:
tslib: "npm:2.6.0"
typescript: "npm:5.2.2"
uuid: "npm:9.0.0"
webpack: "npm:5.89.0"
peerDependencies:
"@grafana/runtime": "*"
languageName: unknown