mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Improve typings (#93180)
* fix some any's/type assertions * fix some more any/type assertions
This commit is contained in:
parent
25ebb5b76f
commit
79a86b9e6a
@ -6259,8 +6259,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationSchemaForm.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||
],
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/index.ts:5381": [
|
||||
[0, 0, 0, "Do not re-export imported variable (\`./StreamingClientEditor\`)", "0"],
|
||||
@ -6270,9 +6269,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/webpack.config.ts:5381": [
|
||||
[0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"]
|
||||
],
|
||||
@ -6321,7 +6317,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
||||
],
|
||||
"public/app/plugins/datasource/graphite/components/MetricTankMetaInspector.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "2"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "3"],
|
||||
@ -6330,8 +6326,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Styles should be written using objects.", "6"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "7"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "8"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "9"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "10"]
|
||||
[0, 0, 0, "Styles should be written using objects.", "9"]
|
||||
],
|
||||
"public/app/plugins/datasource/graphite/components/TagsSection.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
@ -6374,8 +6369,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "26"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "27"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "28"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "29"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "30"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "29"]
|
||||
],
|
||||
"public/app/plugins/datasource/graphite/gfunc.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -6398,14 +6392,11 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "15"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "18"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "19"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"]
|
||||
],
|
||||
"public/app/plugins/datasource/graphite/lexer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -6474,10 +6465,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/plugins/datasource/influxdb/influx_query_model.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/plugins/datasource/influxdb/influx_series.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -6491,17 +6479,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "18"]
|
||||
],
|
||||
"public/app/plugins/datasource/influxdb/migrations.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"]
|
||||
],
|
||||
"public/app/plugins/datasource/influxdb/query_part.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -6517,8 +6495,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"]
|
||||
],
|
||||
"public/app/plugins/datasource/influxdb/response_parser.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -6631,9 +6608,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
||||
],
|
||||
"public/app/plugins/datasource/loki/streaming.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/datasource/loki/types.ts:5381": [
|
||||
[0, 0, 0, "Do not re-export imported variable (\`LokiQueryDirection\`)", "0"],
|
||||
[0, 0, 0, "Do not re-export imported variable (\`LokiQueryType\`)", "1"],
|
||||
@ -6670,9 +6644,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"]
|
||||
],
|
||||
"public/app/plugins/datasource/opentsdb/migrations.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/datasource/parca/QueryEditor/LabelsEditor.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||
@ -6744,12 +6715,8 @@ exports[`better eslint`] = {
|
||||
"public/app/plugins/datasource/tempo/resultTransformer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/plugins/datasource/tempo/webpack.config.ts:5381": [
|
||||
[0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"]
|
||||
@ -6813,9 +6780,6 @@ exports[`better eslint`] = {
|
||||
"public/app/plugins/panel/barchart/quadtree.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/barchart/utils.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/candlestick/CandlestickPanel.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -6953,12 +6917,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "15"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "16"]
|
||||
],
|
||||
"public/app/plugins/panel/histogram/migrations.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/live/LiveChannelEditor.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/live/LivePanel.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -7072,17 +7032,14 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/plugins/panel/text/TextPanel.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/panel/text/TextPanelEditor.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/text/textPanelMigrationHandler.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -7146,9 +7103,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Styles should be written using objects.", "5"]
|
||||
],
|
||||
"public/app/plugins/panel/xychart/AutoEditor.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/xychart/ManualEditor.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -7173,12 +7129,10 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
],
|
||||
"public/app/plugins/panel/xychart/v2/migrations.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/xychart/v2/scatter.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -7200,9 +7154,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "16"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "17"]
|
||||
],
|
||||
"public/app/plugins/panel/xychart/v2/utils.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/sdk.ts:5381": [
|
||||
[0, 0, 0, "Do not re-export imported variable (\`loadPluginCss\`)", "0"]
|
||||
],
|
||||
@ -7228,9 +7179,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"public/app/types/dashboard.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -7244,11 +7193,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
],
|
||||
"public/app/types/index.ts:5381": [
|
||||
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "0"],
|
||||
@ -7292,18 +7237,13 @@ exports[`better eslint`] = {
|
||||
"public/app/types/unified-alerting-dto.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/swagger/K8sNameLookup.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/swagger/SwaggerPage.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"]
|
||||
],
|
||||
"public/swagger/index.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/swagger/plugins.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -7313,8 +7253,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/test/core/thunk/thunkTester.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -7322,9 +7261,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
],
|
||||
"public/test/global-jquery-shim.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -7338,21 +7275,12 @@ exports[`better eslint`] = {
|
||||
"public/test/jest-setup.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/test/lib/common.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/test/specs/helpers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
]
|
||||
}`
|
||||
};
|
||||
|
@ -4,10 +4,12 @@ import { FormEvent, useState, ChangeEvent } from 'react';
|
||||
import { DataFrameSchema, FieldSchema, GrafanaTheme2 } from '@grafana/data';
|
||||
import { useStyles2, TextArea, InlineField, Input, FieldSet, InlineSwitch } from '@grafana/ui';
|
||||
|
||||
type Config = Record<string, any>;
|
||||
|
||||
interface SchemaFormProps {
|
||||
config: Record<string, any>;
|
||||
config: Config;
|
||||
schema: DataFrameSchema;
|
||||
onChange: (config: Record<string, any>) => void;
|
||||
onChange: (config: Config) => void;
|
||||
}
|
||||
|
||||
const renderInput = (field: FieldSchema, onChange: SchemaFormProps['onChange'], config: SchemaFormProps['config']) => {
|
||||
|
@ -215,7 +215,9 @@ export function runFetchStream(
|
||||
},
|
||||
});
|
||||
|
||||
const processChunk = (value: ReadableStreamReadResult<Uint8Array>): any => {
|
||||
const processChunk = async (
|
||||
value: ReadableStreamReadResult<Uint8Array>
|
||||
): Promise<ReadableStreamReadResult<Uint8Array> | undefined> => {
|
||||
if (value.value) {
|
||||
const text = new TextDecoder().decode(value.value);
|
||||
csv.readCSV(text);
|
||||
|
@ -96,8 +96,9 @@ export class MetricTankMetaInspector extends PureComponent<Props, State> {
|
||||
const seriesMetas: Record<string, MetricTankSeriesMeta> = {};
|
||||
|
||||
for (const series of data) {
|
||||
if (series?.meta?.custom?.seriesMetaList) {
|
||||
for (const metaItem of series.meta.custom.seriesMetaList as MetricTankSeriesMeta[]) {
|
||||
const seriesMetaList: MetricTankSeriesMeta[] | undefined = series?.meta?.custom?.seriesMetaList;
|
||||
if (seriesMetaList) {
|
||||
for (const metaItem of seriesMetaList) {
|
||||
// key is to dedupe as many series will have identitical meta
|
||||
const key = `${JSON.stringify(metaItem)}`;
|
||||
|
||||
|
@ -494,7 +494,7 @@ export class GraphiteDatasource
|
||||
}
|
||||
|
||||
metricFindQuery(findQuery: string | GraphiteQuery, optionalOptions?: any): Promise<MetricFindValue[]> {
|
||||
const options: any = optionalOptions || {};
|
||||
const options = optionalOptions || {};
|
||||
|
||||
const queryObject = convertToGraphiteQueryObject(findQuery);
|
||||
if (queryObject.queryType === GraphiteQueryType.Value || queryObject.queryType === GraphiteQueryType.MetricName) {
|
||||
|
@ -39,9 +39,9 @@ export default class GraphiteQuery {
|
||||
checkOtherSegmentsIndex = 0;
|
||||
removeTagValue: string;
|
||||
templateSrv: any;
|
||||
scopedVars: any;
|
||||
scopedVars?: ScopedVars;
|
||||
|
||||
constructor(datasource: any, target: any, templateSrv?: TemplateSrv, scopedVars?: ScopedVars) {
|
||||
constructor(datasource: GraphiteDatasource, target: any, templateSrv?: TemplateSrv, scopedVars?: ScopedVars) {
|
||||
this.datasource = datasource;
|
||||
this.target = target;
|
||||
this.templateSrv = templateSrv;
|
||||
@ -153,7 +153,7 @@ export default class GraphiteQuery {
|
||||
}
|
||||
}
|
||||
|
||||
updateSegmentValue(segment: any, index: number) {
|
||||
updateSegmentValue(segment: GraphiteSegment, index: number) {
|
||||
this.segments[index].value = segment.value;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ export default class InfluxQueryModel {
|
||||
this.updateProjection();
|
||||
}
|
||||
|
||||
removeSelectPart(selectParts: any[], part: any) {
|
||||
removeSelectPart(selectParts: QueryPart[], part: QueryPart) {
|
||||
// if we remove the field remove the whole statement
|
||||
if (part.def.type === 'field') {
|
||||
if (this.selectModels.length > 1) {
|
||||
@ -137,7 +137,7 @@ export default class InfluxQueryModel {
|
||||
this.updatePersistedParts();
|
||||
}
|
||||
|
||||
addSelectPart(selectParts: any[], type: string) {
|
||||
addSelectPart(selectParts: QueryPart[], type: string) {
|
||||
const partModel = queryPart.create({ type: type });
|
||||
partModel.def.addStrategy(selectParts, partModel, this);
|
||||
this.updatePersistedParts();
|
||||
|
@ -266,7 +266,9 @@ describe('when generating timeseries from influxdb response', () => {
|
||||
describe('with empty tagsColumn', () => {
|
||||
const options = {
|
||||
alias: '',
|
||||
annotation: {},
|
||||
annotation: {
|
||||
refId: '',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'logins.count',
|
||||
@ -290,6 +292,7 @@ describe('when generating timeseries from influxdb response', () => {
|
||||
alias: '',
|
||||
annotation: {
|
||||
tagsColumn: 'datacenter, source',
|
||||
refId: '',
|
||||
},
|
||||
series: [
|
||||
{
|
||||
|
@ -3,14 +3,22 @@ import { each, map, includes, flatten, keys } from 'lodash';
|
||||
import { FieldType, QueryResultMeta, TimeSeries, TableData } from '@grafana/data';
|
||||
import TableModel from 'app/core/TableModel';
|
||||
|
||||
import { InfluxQuery } from './types';
|
||||
|
||||
export default class InfluxSeries {
|
||||
refId?: string;
|
||||
series: any;
|
||||
alias: any;
|
||||
annotation: any;
|
||||
alias?: string;
|
||||
annotation?: InfluxQuery;
|
||||
meta?: QueryResultMeta;
|
||||
|
||||
constructor(options: { series: any; alias?: any; annotation?: any; meta?: QueryResultMeta; refId?: string }) {
|
||||
constructor(options: {
|
||||
series: any;
|
||||
alias?: string;
|
||||
annotation?: InfluxQuery;
|
||||
meta?: QueryResultMeta;
|
||||
refId?: string;
|
||||
}) {
|
||||
this.series = options.series;
|
||||
this.alias = options.alias;
|
||||
this.annotation = options.annotation;
|
||||
@ -70,7 +78,7 @@ export default class InfluxSeries {
|
||||
const regex = /\$(\w+)|\[\[([\s\S]+?)\]\]/g;
|
||||
const segments = series.name.split('.');
|
||||
|
||||
return this.alias.replace(regex, (match: any, g1: any, g2: any) => {
|
||||
return this.alias?.replace(regex, (match, g1, g2) => {
|
||||
const group = g1 || g2;
|
||||
const segIndex = parseInt(group, 10);
|
||||
|
||||
@ -113,19 +121,19 @@ export default class InfluxSeries {
|
||||
if (column === 'sequence_number') {
|
||||
return;
|
||||
}
|
||||
if (column === this.annotation.titleColumn) {
|
||||
if (column === this.annotation?.titleColumn) {
|
||||
titleCol = index;
|
||||
return;
|
||||
}
|
||||
if (includes((this.annotation.tagsColumn || '').replace(' ', '').split(','), column)) {
|
||||
if (includes((this.annotation?.tagsColumn || '').replace(' ', '').split(','), column)) {
|
||||
tagsCol.push(index);
|
||||
return;
|
||||
}
|
||||
if (column === this.annotation.textColumn) {
|
||||
if (column === this.annotation?.textColumn) {
|
||||
textCol = index;
|
||||
return;
|
||||
}
|
||||
if (column === this.annotation.timeEndColumn) {
|
||||
if (column === this.annotation?.timeEndColumn) {
|
||||
timeEndCol = index;
|
||||
return;
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { AnnotationQuery, AnnotationSupport } from '@grafana/data';
|
||||
|
||||
import { InfluxQuery, InfluxQueryTag } from './types';
|
||||
|
||||
type LegacyAnnotation = {
|
||||
@ -52,8 +54,9 @@ const migrateLegacyAnnotation = (json: LegacyAnnotation) => {
|
||||
return target;
|
||||
};
|
||||
|
||||
// eslint-ignore-next-line
|
||||
export const prepareAnnotation = (json: any) => {
|
||||
export const prepareAnnotation: AnnotationSupport<InfluxQuery, AnnotationQuery<InfluxQuery>>['prepareAnnotation'] = (
|
||||
json
|
||||
) => {
|
||||
// make sure that any additional target fields are migrated
|
||||
json.target = json.target && !json.target?.query ? migrateLegacyAnnotation(json) : json.target;
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { clone, map } from 'lodash';
|
||||
import { functionRenderer, QueryPart, QueryPartDef, suffixRenderer } from 'app/features/alerting/state/query_part';
|
||||
|
||||
const index: any[] = [];
|
||||
const categories: any = {
|
||||
const categories = {
|
||||
Aggregations: [],
|
||||
Selectors: [],
|
||||
Transformations: [],
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
DataFrameJSON,
|
||||
DataQueryRequest,
|
||||
DataQueryResponse,
|
||||
LiveChannelEvent,
|
||||
LiveChannelScope,
|
||||
LoadingState,
|
||||
StreamingDataFrame,
|
||||
@ -43,8 +44,8 @@ export function doLokiChannelStream(
|
||||
}
|
||||
|
||||
let frame: StreamingDataFrame | undefined = undefined;
|
||||
const updateFrame = (msg: any) => {
|
||||
if (msg?.message) {
|
||||
const updateFrame = (msg: LiveChannelEvent<unknown>) => {
|
||||
if ('message' in msg && msg.message) {
|
||||
const p: DataFrameJSON = msg.message;
|
||||
if (!frame) {
|
||||
frame = StreamingDataFrame.fromDataFrameJSON(p, {
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { LegacyAnnotation } from './types';
|
||||
import { AnnotationQuery, AnnotationSupport } from '@grafana/data';
|
||||
|
||||
import { LegacyAnnotation, OpenTsdbQuery } from './types';
|
||||
|
||||
// this becomes the target in the migrated annotations
|
||||
const migrateLegacyAnnotation = (json: LegacyAnnotation) => {
|
||||
@ -13,8 +15,10 @@ const migrateLegacyAnnotation = (json: LegacyAnnotation) => {
|
||||
return annotation;
|
||||
};
|
||||
|
||||
// eslint-ignore-next-line
|
||||
export const prepareAnnotation = (json: any) => {
|
||||
export const prepareAnnotation: AnnotationSupport<
|
||||
OpenTsdbQuery,
|
||||
AnnotationQuery<OpenTsdbQuery>
|
||||
>['prepareAnnotation'] = (json) => {
|
||||
const resultingTarget = json.target && typeof json.target !== 'string' ? json.target : migrateLegacyAnnotation(json);
|
||||
|
||||
json.target = resultingTarget;
|
||||
|
@ -48,11 +48,11 @@ function getAttributeValue(value: collectorTypes.opentelemetryProto.common.v1.An
|
||||
}
|
||||
|
||||
if (value.intValue !== undefined) {
|
||||
return Number.parseInt(value.intValue as any, 10);
|
||||
return Number.parseInt(String(value.intValue), 10);
|
||||
}
|
||||
|
||||
if (value.doubleValue) {
|
||||
return Number.parseFloat(value.doubleValue as any);
|
||||
return Number.parseFloat(String(value.doubleValue));
|
||||
}
|
||||
|
||||
if (value.arrayValue) {
|
||||
|
@ -52,7 +52,7 @@ interface BarSeries {
|
||||
|
||||
export function prepSeries(
|
||||
frames: DataFrame[],
|
||||
fieldConfig: FieldConfigSource<any>,
|
||||
fieldConfig: FieldConfigSource,
|
||||
stacking: StackingMode,
|
||||
theme: GrafanaTheme2,
|
||||
xFieldName?: string,
|
||||
|
@ -38,11 +38,10 @@ export const changeToHistogramPanelMigrationHandler: PanelTypeChangedHandler = (
|
||||
return {};
|
||||
};
|
||||
|
||||
function graphToHistogramOptions(angular: any): {
|
||||
function graphToHistogramOptions(graphOptions: GraphOptions): {
|
||||
fieldConfig: FieldConfigSource;
|
||||
options: Options;
|
||||
} {
|
||||
const graphOptions: GraphOptions = angular;
|
||||
let histogramFieldConfig: HistogramFieldConfig = {};
|
||||
const options: Options = {
|
||||
legend: {
|
||||
|
@ -15,7 +15,7 @@ import { getManagedChannelInfo } from 'app/features/live/info';
|
||||
|
||||
import { LivePanelOptions } from './types';
|
||||
|
||||
type Props = StandardEditorProps<Partial<LiveChannelAddress>, any, LivePanelOptions>;
|
||||
type Props = StandardEditorProps<Partial<LiveChannelAddress>, {}, LivePanelOptions>;
|
||||
|
||||
const scopes: Array<SelectableValue<LiveChannelScope>> = [
|
||||
{ label: 'Grafana', value: LiveChannelScope.Grafana, description: 'Core grafana live features' },
|
||||
|
@ -75,7 +75,7 @@ const generateThresholds = (thresholds: string[], colors: string[]) => {
|
||||
};
|
||||
|
||||
const migrateTransformations = (
|
||||
panel: PanelModel<Partial<Options>> | any,
|
||||
panel: PanelModel<Partial<Options>>,
|
||||
oldOpts: { columns: any; transform: Transformations }
|
||||
) => {
|
||||
const transformations: Transformation[] = panel.transformations ?? [];
|
||||
@ -237,7 +237,7 @@ const migrateDefaults = (prevDefaults: Style) => {
|
||||
* This is called when the panel changes from another panel
|
||||
*/
|
||||
export const tablePanelChangedHandler = (
|
||||
panel: PanelModel<Partial<Options>> | any,
|
||||
panel: PanelModel<Partial<Options>>,
|
||||
prevPluginId: string,
|
||||
prevOptions: any
|
||||
) => {
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
|
||||
import { Options, TextMode } from './panelcfg.gen';
|
||||
|
||||
export const TextPanelEditor = ({ value, onChange, context }: StandardEditorProps<string, any, Options>) => {
|
||||
export const TextPanelEditor = ({ value, onChange, context }: StandardEditorProps<string, {}, Options>) => {
|
||||
const language = useMemo(() => context.options?.mode ?? TextMode.Markdown, [context]);
|
||||
const styles = useStyles2(getStyles);
|
||||
|
||||
|
@ -19,7 +19,7 @@ interface XYInfo {
|
||||
yFields: Array<SelectableValue<boolean>>;
|
||||
}
|
||||
|
||||
export const AutoEditor = ({ value, onChange, context }: StandardEditorProps<XYDimensionConfig, any, Options>) => {
|
||||
export const AutoEditor = ({ value, onChange, context }: StandardEditorProps<XYDimensionConfig, {}, Options>) => {
|
||||
const frameNames = useMemo(() => {
|
||||
if (context?.data?.length) {
|
||||
return context.data.map((f, idx) => ({
|
||||
|
@ -26,7 +26,7 @@ export const SeriesEditor = ({
|
||||
const style = useStyles2(getStyles);
|
||||
|
||||
// reset opts when mapping changes (no way to do this in panel opts builder?)
|
||||
const mapping = context.options?.mapping as SeriesMapping;
|
||||
const mapping = context.options?.mapping;
|
||||
const prevMapping = usePrevious(mapping);
|
||||
const mappingChanged = prevMapping != null && mapping !== prevMapping;
|
||||
|
||||
|
@ -11,7 +11,7 @@ export const xyChartMigrationHandler = (panel: PanelModel): Options => {
|
||||
return migrateOptions(panel);
|
||||
}
|
||||
|
||||
return panel.options as Options;
|
||||
return panel.options;
|
||||
};
|
||||
|
||||
function migrateOptions(panel: PanelModel): Options {
|
||||
|
@ -40,7 +40,7 @@ export function prepSeries(
|
||||
mapping: SeriesMapping,
|
||||
mappedSeries: XYSeriesConfig[],
|
||||
frames: DataFrame[],
|
||||
fieldConfig: FieldConfigSource<any>
|
||||
fieldConfig: FieldConfigSource
|
||||
) {
|
||||
cacheFieldDisplayNames(frames);
|
||||
decoupleHideFromState(frames, fieldConfig);
|
||||
|
@ -17,6 +17,10 @@ export interface AppEventEmitter {
|
||||
}
|
||||
|
||||
export interface AppEventConsumer {
|
||||
onAppEvent(name: string, callback: (event: IAngularEvent, ...args: any[]) => void, localScope?: any): void;
|
||||
onAppEvent<T>(event: AppEvent<T>, callback: (event: IAngularEvent, ...args: any[]) => void, localScope?: any): void;
|
||||
onAppEvent(name: string, callback: (event: IAngularEvent, ...args: unknown[]) => void, localScope?: any): void;
|
||||
onAppEvent<T>(
|
||||
event: AppEvent<T>,
|
||||
callback: (event: IAngularEvent, ...args: unknown[]) => void,
|
||||
localScope?: any
|
||||
): void;
|
||||
}
|
||||
|
@ -44,20 +44,6 @@ export interface ShowConfirmModalPayload {
|
||||
onAltAction?: () => void;
|
||||
}
|
||||
|
||||
export interface DataSourceResponse<T> {
|
||||
data: T;
|
||||
readonly status: number;
|
||||
readonly statusText: string;
|
||||
readonly ok: boolean;
|
||||
readonly headers: Headers;
|
||||
readonly redirected: boolean;
|
||||
readonly type: ResponseType;
|
||||
readonly url: string;
|
||||
readonly config: any;
|
||||
}
|
||||
|
||||
type DataSourceResponsePayload = DataSourceResponse<any>;
|
||||
|
||||
export interface ToggleKioskModePayload {
|
||||
exit?: boolean;
|
||||
}
|
||||
@ -70,7 +56,7 @@ export interface GraphClickedPayload {
|
||||
|
||||
export interface ThresholdChangedPayload {
|
||||
threshold: any;
|
||||
handleIndex: any;
|
||||
handleIndex: number;
|
||||
}
|
||||
|
||||
export interface DashScrollPayload {
|
||||
@ -85,8 +71,6 @@ export interface PanelChangeViewPayload {}
|
||||
* Events
|
||||
*/
|
||||
|
||||
export const dsRequestResponse = eventFactory<DataSourceResponsePayload>('ds-request-response');
|
||||
export const dsRequestError = eventFactory<any>('ds-request-error');
|
||||
export const templateVariableValueUpdated = eventFactory('template-variable-value-updated');
|
||||
export const graphClicked = eventFactory<GraphClickedPayload>('graph-click');
|
||||
|
||||
|
@ -49,12 +49,12 @@ export function K8sNameLookup(props: Props) {
|
||||
console.log('LIST', url, table);
|
||||
const options: Array<SelectableValue<string>> = [];
|
||||
if (table.rows?.length) {
|
||||
table.rows.forEach((row: any) => {
|
||||
for (const row of table.rows) {
|
||||
const n = row.object?.metadata?.name;
|
||||
if (n) {
|
||||
options.push({ label: n, value: n });
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setPlaceholder('No items found');
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ const tt = window.trustedTypes;
|
||||
if (tt?.createPolicy) {
|
||||
tt.createPolicy('default', {
|
||||
createHTML: (string, sink) => DOMPurify.sanitize(string, { RETURN_TRUSTED_TYPE: true }) as unknown as string,
|
||||
createScriptURL: (url, sink) => textUtil.sanitizeUrl(url) as unknown as string,
|
||||
createScriptURL: (url, sink) => textUtil.sanitizeUrl(url),
|
||||
createScript: (script, sink) => script,
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { AnyAction, configureStore, EnhancedStore, Reducer, Tuple } from '@reduxjs/toolkit';
|
||||
import { Middleware, StoreEnhancer, UnknownAction } from 'redux';
|
||||
import { Middleware, Store, StoreEnhancer, UnknownAction } from 'redux';
|
||||
import { thunk, ThunkDispatch, ThunkMiddleware } from 'redux-thunk';
|
||||
|
||||
import { setStore } from '../../../app/store/store';
|
||||
@ -79,7 +79,7 @@ export const reduxTester = <State>(args?: ReduxTesterArguments<State>): ReduxTes
|
||||
preloadedState,
|
||||
});
|
||||
|
||||
setStore(store as any);
|
||||
setStore(store as Store<StoreState>);
|
||||
|
||||
return instance;
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ export interface ThunkGiven {
|
||||
}
|
||||
|
||||
export interface ThunkWhen {
|
||||
whenThunkIsDispatched: (...args: any) => Promise<Array<PayloadAction<any>>>;
|
||||
whenThunkIsDispatched: (...args: unknown[]) => Promise<Array<PayloadAction<any>>>;
|
||||
}
|
||||
|
||||
export const thunkTester = (initialState: unknown, debug?: boolean): ThunkGiven => {
|
||||
@ -23,7 +23,7 @@ export const thunkTester = (initialState: unknown, debug?: boolean): ThunkGiven
|
||||
return instance;
|
||||
};
|
||||
|
||||
const whenThunkIsDispatched = async (...args: any): Promise<Array<PayloadAction<any>>> => {
|
||||
const whenThunkIsDispatched = async (...args: unknown[]): Promise<Array<PayloadAction<any>>> => {
|
||||
await store.dispatch(thunkUnderTest(...args));
|
||||
|
||||
dispatchedActions = store.getActions();
|
||||
|
@ -1,7 +0,0 @@
|
||||
const _global = window as any;
|
||||
const angularMocks = {
|
||||
module: _global.module,
|
||||
inject: _global.inject,
|
||||
};
|
||||
|
||||
export { angularMocks };
|
@ -1,13 +1,10 @@
|
||||
import { each, template } from 'lodash';
|
||||
import { template } from 'lodash';
|
||||
|
||||
import { RawTimeRange, PanelPluginMeta, dateMath } from '@grafana/data';
|
||||
import { GrafanaRootScope } from 'app/angular/GrafanaCtrl';
|
||||
import config from 'app/core/config';
|
||||
import { ContextSrv } from 'app/core/services/context_srv';
|
||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||
|
||||
import { angularMocks } from '../lib/common';
|
||||
|
||||
export function ControllerTestContext(this: any) {
|
||||
const self = this;
|
||||
|
||||
@ -30,75 +27,16 @@ export function ControllerTestContext(this: any) {
|
||||
};
|
||||
this.isUtc = false;
|
||||
|
||||
this.providePhase = (mocks: any) => {
|
||||
return angularMocks.module(($provide: any) => {
|
||||
$provide.value('contextSrv', self.contextSrv);
|
||||
$provide.value('datasourceSrv', self.datasourceSrv);
|
||||
$provide.value('annotationsSrv', self.annotationsSrv);
|
||||
$provide.value('timeSrv', self.timeSrv);
|
||||
$provide.value('templateSrv', self.templateSrv);
|
||||
$provide.value('$element', self.$element);
|
||||
$provide.value('$sanitize', self.$sanitize);
|
||||
each(mocks, (value, key) => {
|
||||
$provide.value(key, value);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.createPanelController = (Ctrl: any) => {
|
||||
return angularMocks.inject(($controller: any, $rootScope: GrafanaRootScope, $browser: any) => {
|
||||
self.scope = $rootScope.$new();
|
||||
self.$browser = $browser;
|
||||
return () => {
|
||||
self.panel = new PanelModel({ type: 'test' });
|
||||
self.dashboard = { meta: {} };
|
||||
self.isUtc = false;
|
||||
self.dashboard.getTimezone = () => {
|
||||
return self.isUtc ? 'utc' : 'browser';
|
||||
};
|
||||
|
||||
$rootScope.appEvent = jest.fn();
|
||||
$rootScope.onAppEvent = jest.fn();
|
||||
$rootScope.colors = [];
|
||||
|
||||
for (let i = 0; i < 50; i++) {
|
||||
$rootScope.colors.push('#' + i);
|
||||
}
|
||||
|
||||
config.panels['test'] = { info: {} } as PanelPluginMeta;
|
||||
self.ctrl = $controller(
|
||||
Ctrl,
|
||||
{ $scope: self.scope },
|
||||
{
|
||||
panel: self.panel,
|
||||
dashboard: self.dashboard,
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
this.createControllerPhase = (controllerName: string) => {
|
||||
return angularMocks.inject(($controller: any, $rootScope: GrafanaRootScope, $browser: any) => {
|
||||
self.scope = $rootScope.$new();
|
||||
self.$browser = $browser;
|
||||
self.scope.contextSrv = {};
|
||||
self.scope.panel = {};
|
||||
self.scope.dashboard = { meta: {} };
|
||||
self.scope.dashboardMeta = {};
|
||||
self.scope.dashboardViewState = DashboardViewStateStub();
|
||||
self.scope.appEvent = jest.fn();
|
||||
self.scope.onAppEvent = jest.fn();
|
||||
|
||||
$rootScope.colors = [];
|
||||
for (let i = 0; i < 50; i++) {
|
||||
$rootScope.colors.push('#' + i);
|
||||
}
|
||||
|
||||
self.scope.skipDataOnInit = true;
|
||||
self.scope.skipAutoInit = true;
|
||||
self.controller = $controller(controllerName, {
|
||||
$scope: self.scope,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
this.setIsUtc = (isUtc = false) => {
|
||||
|
Loading…
Reference in New Issue
Block a user