mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Avoid Grafana core imports for the test data source (#71956)
This commit is contained in:
parent
2c82a6b6c4
commit
47f1c5d084
33
.eslintrc
33
.eslintrc
@ -88,6 +88,39 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"public/app/plugins/datasource/testdata/*.{ts,tsx}",
|
||||||
|
"public/app/plugins/datasource/testdata/**/*.{ts,tsx}"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-restricted-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"paths": [
|
||||||
|
// generic rules
|
||||||
|
{
|
||||||
|
"name": "react-redux",
|
||||||
|
"importNames": ["useDispatch", "useSelector"],
|
||||||
|
"message": "Please import from app/types instead."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "react-i18next",
|
||||||
|
"importNames": ["Trans", "t"],
|
||||||
|
"message": "Please import from app/core/internationalization instead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// new rules
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"group": ["**/app/*"],
|
||||||
|
"message": "Core plugins are not allowed to depend on Grafana core packages"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import { useAsync } from 'react-use';
|
|||||||
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
import { QueryEditorProps, SelectableValue } from '@grafana/data';
|
||||||
import { selectors as editorSelectors } from '@grafana/e2e-selectors';
|
import { selectors as editorSelectors } from '@grafana/e2e-selectors';
|
||||||
import { InlineField, InlineFieldRow, InlineSwitch, Input, Select, Icon, TextArea } from '@grafana/ui';
|
import { InlineField, InlineFieldRow, InlineSwitch, Input, Select, Icon, TextArea } from '@grafana/ui';
|
||||||
import { NumberInput } from 'app/core/components/OptionsUI/NumberInput';
|
|
||||||
|
|
||||||
import { RandomWalkEditor, StreamingClientEditor } from './components';
|
import { RandomWalkEditor, StreamingClientEditor } from './components';
|
||||||
import { CSVContentEditor } from './components/CSVContentEditor';
|
import { CSVContentEditor } from './components/CSVContentEditor';
|
||||||
@ -166,13 +165,6 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
onUpdate({ ...query, csvWave });
|
onUpdate({ ...query, csvWave });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDropPercentChanged = (dropPercent: number | undefined) => {
|
|
||||||
if (!dropPercent) {
|
|
||||||
dropPercent = undefined;
|
|
||||||
}
|
|
||||||
onChange({ ...query, dropPercent });
|
|
||||||
};
|
|
||||||
|
|
||||||
const options = useMemo(
|
const options = useMemo(
|
||||||
() =>
|
() =>
|
||||||
(scenarioList || [])
|
(scenarioList || [])
|
||||||
@ -234,12 +226,14 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
)}
|
)}
|
||||||
{show.dropPercent && (
|
{show.dropPercent && (
|
||||||
<InlineField label="Drop" tooltip={'Drop a random set of points'}>
|
<InlineField label="Drop" tooltip={'Drop a random set of points'}>
|
||||||
<NumberInput
|
<Input
|
||||||
|
type="number"
|
||||||
min={0}
|
min={0}
|
||||||
max={100}
|
max={100}
|
||||||
step={5}
|
step={5}
|
||||||
width={8}
|
width={8}
|
||||||
onChange={onDropPercentChanged}
|
onChange={onInputChange}
|
||||||
|
name="dropPercent"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
value={query.dropPercent}
|
value={query.dropPercent}
|
||||||
suffix={<Icon name="percentage" />}
|
suffix={<Icon name="percentage" />}
|
||||||
|
@ -12,7 +12,9 @@ import {
|
|||||||
DataFrameSchema,
|
DataFrameSchema,
|
||||||
DataFrameData,
|
DataFrameData,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
|
// eslint-disable-next-line no-restricted-imports -- In the process from being removed
|
||||||
import { liveTimer } from 'app/features/dashboard/dashgrid/liveTimer';
|
import { liveTimer } from 'app/features/dashboard/dashgrid/liveTimer';
|
||||||
|
// eslint-disable-next-line no-restricted-imports -- In the process from being removed
|
||||||
import { StreamingDataFrame } from 'app/features/live/data/StreamingDataFrame';
|
import { StreamingDataFrame } from 'app/features/live/data/StreamingDataFrame';
|
||||||
|
|
||||||
import { getRandomLine } from './LogIpsum';
|
import { getRandomLine } from './LogIpsum';
|
||||||
|
Loading…
Reference in New Issue
Block a user