mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Various type improvements (#77877)
* more datasource type fixes * more type updates
This commit is contained in:
parent
323ee7c38c
commit
40fd80c46f
@ -5387,13 +5387,9 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[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.", "1"]
|
||||||
],
|
],
|
||||||
"public/app/features/variables/shared/testing/datasourceVariableBuilder.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/variables/shared/testing/optionsVariableBuilder.ts:5381": [
|
"public/app/features/variables/shared/testing/optionsVariableBuilder.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[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.", "1"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/variables/shared/testing/variableBuilder.ts:5381": [
|
"public/app/features/variables/shared/testing/variableBuilder.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
@ -5404,15 +5400,9 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
[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.", "3"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "6"],
|
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "8"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "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"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/variables/state/keyedVariablesReducer.ts:5381": [
|
"public/app/features/variables/state/keyedVariablesReducer.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@ -5443,13 +5433,12 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/variables/system/adapter.ts:5381": [
|
"public/app/features/variables/system/adapter.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[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.", "1"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
[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.", "3"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "6"],
|
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/variables/types.ts:5381": [
|
"public/app/features/variables/types.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@ -5466,9 +5455,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
[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.", "5"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
[0, 0, 0, "Do not use any type assertions.", "7"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "9"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/visualization/data-hover/DataHoverRows.tsx:5381": [
|
"public/app/features/visualization/data-hover/DataHoverRows.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
@ -5504,8 +5491,7 @@ exports[`better eslint`] = {
|
|||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloud-monitoring/annotationSupport.ts:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/annotationSupport.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -5514,41 +5500,24 @@ exports[`better eslint`] = {
|
|||||||
"public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/cloud-monitoring/components/CloudMonitoringCheatSheet.tsx:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/components/CloudMonitoringCheatSheet.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx:5381": [
|
||||||
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
|
],
|
||||||
|
"public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx:5381": [
|
||||||
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
|
],
|
||||||
|
"public/app/plugins/datasource/cloud-monitoring/datasource.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
[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.", "2"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
[0, 0, 0, "Do not use any type assertions.", "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"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/cloud-monitoring/datasource.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, "Unexpected any. Specify a different type.", "3"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "5"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloud-monitoring/functions.ts:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/functions.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[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.", "1"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloud-monitoring/types/types.ts:5381": [
|
"public/app/plugins/datasource/cloud-monitoring/types/types.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
@ -5604,12 +5573,10 @@ exports[`better eslint`] = {
|
|||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloudwatch/utils/datalinks.ts:5381": [
|
"public/app/plugins/datasource/cloudwatch/utils/datalinks.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[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.", "1"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts:5381": [
|
"public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/dashboard/DashboardQueryEditor.tsx:5381": [
|
"public/app/plugins/datasource/dashboard/DashboardQueryEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
@ -5639,12 +5606,12 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"],
|
[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.", "18"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "19"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "19"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "20"],
|
[0, 0, 0, "Do not use any type assertions.", "20"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "21"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "21"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "22"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "22"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "23"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "23"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "24"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "24"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "25"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "25"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "26"],
|
[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.", "27"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "28"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "28"],
|
||||||
@ -5654,17 +5621,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "32"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "32"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "33"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "33"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "34"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "34"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "35"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "35"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "36"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "37"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "38"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "39"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "40"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "41"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "42"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "43"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "44"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "45"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/LanguageProvider.ts:5381": [
|
"public/app/plugins/datasource/elasticsearch/LanguageProvider.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@ -5688,17 +5645,12 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
[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.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
[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.", "8"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "10"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/MetricPicker.tsx:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/MetricPicker.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
@ -5715,21 +5667,14 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
[0, 0, 0, "Styles should be written using objects.", "2"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/aggregations.ts:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/aggregations.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/reducer.ts:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/reducer.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/MetricEditor.tsx:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/MetricEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
@ -5749,11 +5694,6 @@ exports[`better eslint`] = {
|
|||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/aggregations.ts:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/aggregations.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/actions.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"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/reducer.ts:5381": [
|
"public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/reducer.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
@ -5797,8 +5737,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
[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.", "3"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
[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.", "5"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/elasticsearch/hooks/useStatelessReducer.ts:5381": [
|
"public/app/plugins/datasource/elasticsearch/hooks/useStatelessReducer.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
@ -5810,26 +5749,17 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Styles should be written using objects.", "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.", "1"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/ConfigEditor.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx:5381": [
|
"public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
[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.", "2"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "5"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx:5381": [
|
"public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/RawFrameEditor.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationQueryEditor.tsx:5381": [
|
"public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationQueryEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -5847,9 +5777,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.ts:5381": [
|
"public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[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"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts:5381": [
|
"public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
@ -5867,11 +5795,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use any type assertions.", "6"],
|
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "7"]
|
[0, 0, 0, "Styles should be written using objects.", "7"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana/components/SearchEditor.tsx:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/datasource/grafana/components/TimePickerInput.tsx:5381": [
|
"public/app/plugins/datasource/grafana/components/TimePickerInput.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "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.", "1"],
|
||||||
@ -5890,22 +5813,18 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
[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.", "2"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
[0, 0, 0, "Do not use any type assertions.", "7"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "8"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "9"],
|
[0, 0, 0, "Do not use any type assertions.", "9"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "12"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/graphite/components/AddGraphiteFunction.tsx:5381": [
|
"public/app/plugins/datasource/graphite/components/AddGraphiteFunction.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/graphite/components/FunctionEditor.tsx:5381": [
|
"public/app/plugins/datasource/graphite/components/FunctionEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/graphite/components/FunctionParamEditor.tsx:5381": [
|
"public/app/plugins/datasource/graphite/components/FunctionParamEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
|
@ -29,7 +29,12 @@ function getTestContext({ sources = [], query, regex }: Args = {}) {
|
|||||||
const getListMock = jest.fn().mockReturnValue(sources);
|
const getListMock = jest.fn().mockReturnValue(sources);
|
||||||
const getDatasourceSrvMock = jest.fn().mockReturnValue({ getList: getListMock });
|
const getDatasourceSrvMock = jest.fn().mockReturnValue({ getList: getListMock });
|
||||||
const dependencies: DataSourceVariableActionDependencies = { getDatasourceSrv: getDatasourceSrvMock };
|
const dependencies: DataSourceVariableActionDependencies = { getDatasourceSrv: getDatasourceSrvMock };
|
||||||
const datasource = datasourceBuilder().withId('0').withRootStateKey('key').withQuery(query).withRegEx(regex).build();
|
const datasource = datasourceBuilder()
|
||||||
|
.withId('0')
|
||||||
|
.withRootStateKey('key')
|
||||||
|
.withQuery(query!)
|
||||||
|
.withRegEx(regex!)
|
||||||
|
.build();
|
||||||
|
|
||||||
return { getListMock, getDatasourceSrvMock, dependencies, datasource };
|
return { getListMock, getDatasourceSrvMock, dependencies, datasource };
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ export class DatasourceVariableBuilder<
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
withRegEx(regex: any) {
|
withRegEx(regex: string) {
|
||||||
this.variable.regex = regex;
|
this.variable.regex = regex;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ export class OptionsVariableBuilder<T extends VariableWithOptions> extends Varia
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
withQuery(query: any) {
|
withQuery(query: string) {
|
||||||
this.variable.query = query;
|
this.variable.query = query;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ export const variableUpdated = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const node = g.getNode(variableInState.name);
|
const node = g.getNode(variableInState.name);
|
||||||
let promises: Array<Promise<any>> = [];
|
let promises: Array<Promise<void>> = [];
|
||||||
if (node) {
|
if (node) {
|
||||||
promises = node.getOptimizedInputEdges().map((e) => {
|
promises = node.getOptimizedInputEdges().map((e) => {
|
||||||
const variable = variables.find((v) => v.name === e.inputNode?.name);
|
const variable = variables.find((v) => v.name === e.inputNode?.name);
|
||||||
@ -758,8 +758,8 @@ const getVariablesThatNeedRefreshOld = (key: string, state: StoreState): Variabl
|
|||||||
const allVariables = getVariablesByKey(key, state);
|
const allVariables = getVariablesByKey(key, state);
|
||||||
|
|
||||||
const variablesThatNeedRefresh = allVariables.filter((variable) => {
|
const variablesThatNeedRefresh = allVariables.filter((variable) => {
|
||||||
if (variable.hasOwnProperty('refresh') && variable.hasOwnProperty('options')) {
|
if ('refresh' in variable && 'options' in variable) {
|
||||||
const variableWithRefresh = variable as unknown as QueryVariableModel;
|
const variableWithRefresh = variable;
|
||||||
return variableWithRefresh.refresh === VariableRefresh.onTimeRangeChanged;
|
return variableWithRefresh.refresh === VariableRefresh.onTimeRangeChanged;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -828,7 +828,7 @@ export const timeRangeUpdated =
|
|||||||
export const templateVarsChangedInUrl =
|
export const templateVarsChangedInUrl =
|
||||||
(key: string, vars: ExtendedUrlQueryMap, events: typeof appEvents = appEvents): ThunkResult<void> =>
|
(key: string, vars: ExtendedUrlQueryMap, events: typeof appEvents = appEvents): ThunkResult<void> =>
|
||||||
async (dispatch, getState) => {
|
async (dispatch, getState) => {
|
||||||
const update: Array<Promise<any>> = [];
|
const update: Array<Promise<void>> = [];
|
||||||
const dashboard = getState().dashboard.getModel();
|
const dashboard = getState().dashboard.getModel();
|
||||||
const variables = getVariablesByKey(key, getState());
|
const variables = getVariablesByKey(key, getState());
|
||||||
|
|
||||||
@ -888,7 +888,7 @@ export const templateVarsChangedInUrl =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export function isVariableUrlValueDifferentFromCurrent(variable: TypedVariableModel, urlValue: any): boolean {
|
export function isVariableUrlValueDifferentFromCurrent(variable: TypedVariableModel, urlValue: unknown): boolean {
|
||||||
const variableValue = variableAdapters.get(variable.type).getValueForUrl(variable);
|
const variableValue = variableAdapters.get(variable.type).getValueForUrl(variable);
|
||||||
let stringUrlValue = ensureStringValues(urlValue);
|
let stringUrlValue = ensureStringValues(urlValue);
|
||||||
if (Array.isArray(variableValue) && !Array.isArray(stringUrlValue)) {
|
if (Array.isArray(variableValue) && !Array.isArray(stringUrlValue)) {
|
||||||
@ -1032,12 +1032,12 @@ export const updateOptions =
|
|||||||
|
|
||||||
export const createVariableErrorNotification = (
|
export const createVariableErrorNotification = (
|
||||||
message: string,
|
message: string,
|
||||||
error: any,
|
error: unknown,
|
||||||
identifier?: KeyedVariableIdentifier
|
identifier?: KeyedVariableIdentifier
|
||||||
): AppNotification =>
|
): AppNotification =>
|
||||||
createErrorNotification(
|
createErrorNotification(
|
||||||
`${identifier ? `Templating [${identifier.id}]` : 'Templating'}`,
|
`${identifier ? `Templating [${identifier.id}]` : 'Templating'}`,
|
||||||
`${message} ${error.message}`
|
error instanceof Error ? `${message} ${error.message}` : `${message}`
|
||||||
);
|
);
|
||||||
|
|
||||||
export const completeVariableLoading =
|
export const completeVariableLoading =
|
||||||
|
@ -20,7 +20,7 @@ export const createSystemVariableAdapter = (): VariableAdapter<SystemVariable<an
|
|||||||
current: { value: { toString: () => '' } },
|
current: { value: { toString: () => '' } },
|
||||||
state: LoadingState.Done,
|
state: LoadingState.Done,
|
||||||
},
|
},
|
||||||
reducer: (state: any, action: any) => state,
|
reducer: (state: any) => state,
|
||||||
picker: null as unknown as ComponentType<VariablePickerProps<SystemVariable<any>>>,
|
picker: null as unknown as ComponentType<VariablePickerProps<SystemVariable<any>>>,
|
||||||
editor: null as unknown as ComponentType<VariableEditorProps<SystemVariable<any>>>,
|
editor: null as unknown as ComponentType<VariableEditorProps<SystemVariable<any>>>,
|
||||||
dependsOn: () => {
|
dependsOn: () => {
|
||||||
|
@ -184,7 +184,7 @@ export function getVariableTypes(): Array<{ label: string; value: VariableType }
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUrlValueForComparison(value: any): any {
|
function getUrlValueForComparison(value: unknown) {
|
||||||
if (isArray(value)) {
|
if (isArray(value)) {
|
||||||
if (value.length === 0) {
|
if (value.length === 0) {
|
||||||
value = undefined;
|
value = undefined;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import { isString } from 'lodash';
|
import { isString } from 'lodash';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
|
||||||
|
|
||||||
import { ALIGNMENT_PERIODS, SELECTORS } from './constants';
|
import { ALIGNMENT_PERIODS, SELECTORS } from './constants';
|
||||||
import CloudMonitoringDatasource from './datasource';
|
import CloudMonitoringDatasource from './datasource';
|
||||||
import {
|
import {
|
||||||
@ -59,7 +57,7 @@ export default class CloudMonitoringMetricFindQuery {
|
|||||||
|
|
||||||
async handleProjectsQuery() {
|
async handleProjectsQuery() {
|
||||||
const projects = await this.datasource.getProjects();
|
const projects = await this.datasource.getProjects();
|
||||||
return (projects as SelectableValue<string>).map((s: { label: string; value: string }) => ({
|
return projects.map((s) => ({
|
||||||
text: s.label,
|
text: s.label,
|
||||||
value: s.value,
|
value: s.value,
|
||||||
expandable: true,
|
expandable: true,
|
||||||
|
@ -6,7 +6,7 @@ import { Input } from '@grafana/ui';
|
|||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
refId: string;
|
refId: string;
|
||||||
onChange: (alias: any) => void;
|
onChange: (alias: string) => void;
|
||||||
value?: string;
|
value?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,14 +15,14 @@ export const AliasBy = ({ refId, value = '', onChange }: Props) => {
|
|||||||
|
|
||||||
const propagateOnChange = debounce(onChange, 1000);
|
const propagateOnChange = debounce(onChange, 1000);
|
||||||
|
|
||||||
onChange = (e: any) => {
|
const onInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setAlias(e.target.value);
|
setAlias(e.currentTarget.value);
|
||||||
propagateOnChange(e.target.value);
|
propagateOnChange(e.currentTarget.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EditorField label="Alias by">
|
<EditorField label="Alias by">
|
||||||
<Input id={`${refId}-alias-by`} value={alias} onChange={onChange} />
|
<Input id={`${refId}-alias-by`} value={alias} onChange={onInputChange} />
|
||||||
</EditorField>
|
</EditorField>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@ export interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function MQLQueryEditor({ query, onChange, onRunQuery }: React.PropsWithChildren<Props>) {
|
export function MQLQueryEditor({ query, onChange, onRunQuery }: React.PropsWithChildren<Props>) {
|
||||||
const onKeyDown = (event: any) => {
|
const onKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||||
if (event.key === 'Enter' && (event.shiftKey || event.ctrlKey)) {
|
if (event.key === 'Enter' && (event.shiftKey || event.ctrlKey)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onRunQuery();
|
onRunQuery();
|
||||||
|
@ -66,7 +66,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
|
|||||||
const metricDescriptors = await this.props.datasource.getMetricTypes(
|
const metricDescriptors = await this.props.datasource.getMetricTypes(
|
||||||
this.props.query.projectName || this.props.datasource.getDefaultProject()
|
this.props.query.projectName || this.props.datasource.getDefaultProject()
|
||||||
);
|
);
|
||||||
const services = extractServicesFromMetricDescriptors(metricDescriptors).map((m: any) => ({
|
const services = extractServicesFromMetricDescriptors(metricDescriptors).map((m) => ({
|
||||||
value: m.service,
|
value: m.service,
|
||||||
label: m.serviceShortName,
|
label: m.serviceShortName,
|
||||||
}));
|
}));
|
||||||
@ -87,7 +87,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
|
|||||||
|
|
||||||
const sloServices = await this.props.datasource.getSLOServices(projectName);
|
const sloServices = await this.props.datasource.getSLOServices(projectName);
|
||||||
|
|
||||||
const state: any = {
|
const state = {
|
||||||
services,
|
services,
|
||||||
selectedService,
|
selectedService,
|
||||||
metricTypes,
|
metricTypes,
|
||||||
@ -108,7 +108,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
|
|||||||
};
|
};
|
||||||
|
|
||||||
async onQueryTypeChange(queryType: string) {
|
async onQueryTypeChange(queryType: string) {
|
||||||
const state: any = {
|
const state = {
|
||||||
selectedQueryType: queryType,
|
selectedQueryType: queryType,
|
||||||
...(await this.getLabels(this.state.selectedMetricType, this.state.projectName, queryType)),
|
...(await this.getLabels(this.state.selectedMetricType, this.state.projectName, queryType)),
|
||||||
};
|
};
|
||||||
@ -148,7 +148,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
|
|||||||
getTemplateSrv().replace(this.state.selectedMetricType),
|
getTemplateSrv().replace(this.state.selectedMetricType),
|
||||||
getTemplateSrv().replace(service)
|
getTemplateSrv().replace(service)
|
||||||
);
|
);
|
||||||
const state: any = {
|
const state = {
|
||||||
selectedService: service,
|
selectedService: service,
|
||||||
metricTypes,
|
metricTypes,
|
||||||
selectedMetricType,
|
selectedMetricType,
|
||||||
@ -158,7 +158,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onMetricTypeChange(metricType: string) {
|
async onMetricTypeChange(metricType: string) {
|
||||||
const state: any = {
|
const state = {
|
||||||
selectedMetricType: metricType,
|
selectedMetricType: metricType,
|
||||||
...(await this.getLabels(metricType, this.state.projectName)),
|
...(await this.getLabels(metricType, this.state.projectName)),
|
||||||
};
|
};
|
||||||
@ -195,7 +195,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent<Props, Var
|
|||||||
expanded: false,
|
expanded: false,
|
||||||
options: getTemplateSrv()
|
options: getTemplateSrv()
|
||||||
.getVariables()
|
.getVariables()
|
||||||
.map((v: any) => ({
|
.map((v) => ({
|
||||||
value: `$${v.name}`,
|
value: `$${v.name}`,
|
||||||
label: `$${v.name}`,
|
label: `$${v.name}`,
|
||||||
})),
|
})),
|
||||||
|
@ -42,7 +42,7 @@ export function Editor({
|
|||||||
aliasBy,
|
aliasBy,
|
||||||
onChangeAliasBy,
|
onChangeAliasBy,
|
||||||
}: React.PropsWithChildren<Props>) {
|
}: React.PropsWithChildren<Props>) {
|
||||||
const [labels, setLabels] = useState<{ [k: string]: any }>({});
|
const [labels, setLabels] = useState<{ [k: string]: string[] }>({});
|
||||||
const [metricDescriptors, setMetricDescriptors] = useState<MetricDescriptor[]>([]);
|
const [metricDescriptors, setMetricDescriptors] = useState<MetricDescriptor[]>([]);
|
||||||
const [metricDescriptor, setMetricDescriptor] = useState<MetricDescriptor>();
|
const [metricDescriptor, setMetricDescriptor] = useState<MetricDescriptor>();
|
||||||
const [metrics, setMetrics] = useState<Array<SelectableValue<string>>>([]);
|
const [metrics, setMetrics] = useState<Array<SelectableValue<string>>>([]);
|
||||||
|
@ -54,7 +54,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
|
|||||||
return super.query(request);
|
return super.query(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyTemplateVariables(target: CloudMonitoringQuery, scopedVars: ScopedVars): Record<string, any> {
|
applyTemplateVariables(target: CloudMonitoringQuery, scopedVars: ScopedVars) {
|
||||||
const { timeSeriesList, timeSeriesQuery, sloQuery, promQLQuery } = target;
|
const { timeSeriesList, timeSeriesQuery, sloQuery, promQLQuery } = target;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -335,9 +335,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
|
|||||||
}
|
}
|
||||||
|
|
||||||
interpolateVariablesInQueries(queries: CloudMonitoringQuery[], scopedVars: ScopedVars): CloudMonitoringQuery[] {
|
interpolateVariablesInQueries(queries: CloudMonitoringQuery[], scopedVars: ScopedVars): CloudMonitoringQuery[] {
|
||||||
return queries.map(
|
return queries.map((query) => this.applyTemplateVariables(this.migrateQuery(query), scopedVars));
|
||||||
(query) => this.applyTemplateVariables(this.migrateQuery(query), scopedVars) as CloudMonitoringQuery
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interpolateFilters(filters: string[], scopedVars: ScopedVars) {
|
interpolateFilters(filters: string[], scopedVars: ScopedVars) {
|
||||||
|
@ -90,7 +90,15 @@ export const getAlignmentPickerData = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const labelsToGroupedOptions = (groupBys: string[]) => {
|
export const labelsToGroupedOptions = (groupBys: string[]) => {
|
||||||
const groups = groupBys.reduce((acc: any, curr: string) => {
|
const groups = groupBys.reduce<
|
||||||
|
Record<
|
||||||
|
string,
|
||||||
|
Array<{
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
}>
|
||||||
|
>
|
||||||
|
>((acc, curr) => {
|
||||||
const arr = curr.split('.').map(startCase);
|
const arr = curr.split('.').map(startCase);
|
||||||
const group = (arr.length === 2 ? arr : initial(arr)).join(' ');
|
const group = (arr.length === 2 ? arr : initial(arr)).join(' ');
|
||||||
const option = {
|
const option = {
|
||||||
|
@ -43,7 +43,7 @@ export async function addDataLinksToLogsResponse(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createInternalXrayLink(datasourceUid: string, region: string) {
|
async function createInternalXrayLink(datasourceUid: string, region: string): Promise<DataLink | undefined> {
|
||||||
let ds;
|
let ds;
|
||||||
try {
|
try {
|
||||||
ds = await getDataSourceSrv().get(datasourceUid);
|
ds = await getDataSourceSrv().get(datasourceUid);
|
||||||
@ -60,7 +60,7 @@ async function createInternalXrayLink(datasourceUid: string, region: string) {
|
|||||||
datasourceUid: datasourceUid,
|
datasourceUid: datasourceUid,
|
||||||
datasourceName: ds.name,
|
datasourceName: ds.name,
|
||||||
},
|
},
|
||||||
} as DataLink;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAwsConsoleLink(
|
function createAwsConsoleLink(
|
||||||
|
@ -27,7 +27,7 @@ export function runWithRetry(
|
|||||||
): Observable<{ frames: DataFrame[]; error?: DataQueryError }> {
|
): Observable<{ frames: DataFrame[]; error?: DataQueryError }> {
|
||||||
const startTime = new Date();
|
const startTime = new Date();
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
let timerID: any;
|
let timerID: ReturnType<typeof setTimeout>;
|
||||||
let subscription: Subscription;
|
let subscription: Subscription;
|
||||||
let collected = {};
|
let collected = {};
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ export class ElasticResponse {
|
|||||||
if (target.alias) {
|
if (target.alias) {
|
||||||
const regex = /\{\{([\s\S]+?)\}\}/g;
|
const regex = /\{\{([\s\S]+?)\}\}/g;
|
||||||
|
|
||||||
return target.alias.replace(regex, (match: any, g1: any, g2: any) => {
|
return target.alias.replace(regex, (match, g1, g2) => {
|
||||||
const group = g1 || g2;
|
const group = g1 || g2;
|
||||||
|
|
||||||
if (group.indexOf('term ') === 0) {
|
if (group.indexOf('term ') === 0) {
|
||||||
@ -367,7 +367,7 @@ export class ElasticResponse {
|
|||||||
metricName = getScriptValue(agg);
|
metricName = getScriptValue(agg);
|
||||||
|
|
||||||
for (const pv of agg.pipelineVariables) {
|
for (const pv of agg.pipelineVariables) {
|
||||||
const appliedAgg: any = find(target.metrics, { id: pv.pipelineAgg });
|
const appliedAgg = find(target.metrics, { id: pv.pipelineAgg });
|
||||||
if (appliedAgg) {
|
if (appliedAgg) {
|
||||||
metricName = metricName.replace('params.' + pv.name, describeMetric(appliedAgg));
|
metricName = metricName.replace('params.' + pv.name, describeMetric(appliedAgg));
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ export class ElasticResponse {
|
|||||||
metricName = 'Unset';
|
metricName = 'Unset';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const appliedAgg: any = find(target.metrics, { id: series.field });
|
const appliedAgg = find(target.metrics, { id: series.field });
|
||||||
if (appliedAgg) {
|
if (appliedAgg) {
|
||||||
metricName += ' ' + describeMetric(appliedAgg);
|
metricName += ' ' + describeMetric(appliedAgg);
|
||||||
} else {
|
} else {
|
||||||
@ -734,7 +734,7 @@ const createEmptyDataFrame = (
|
|||||||
name: logMessageField,
|
name: logMessageField,
|
||||||
type: FieldType.string,
|
type: FieldType.string,
|
||||||
});
|
});
|
||||||
series.setParser(f, (v: any) => {
|
series.setParser(f, (v) => {
|
||||||
return v || '';
|
return v || '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -744,7 +744,7 @@ const createEmptyDataFrame = (
|
|||||||
name: 'level',
|
name: 'level',
|
||||||
type: FieldType.string,
|
type: FieldType.string,
|
||||||
});
|
});
|
||||||
series.setParser(f, (v: any) => {
|
series.setParser(f, (v) => {
|
||||||
return v || '';
|
return v || '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -768,7 +768,7 @@ const createEmptyDataFrame = (
|
|||||||
name,
|
name,
|
||||||
type,
|
type,
|
||||||
});
|
});
|
||||||
series.setParser(f, (v: any) => {
|
series.setParser(f, (v) => {
|
||||||
return v || '';
|
return v || '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -776,7 +776,7 @@ const createEmptyDataFrame = (
|
|||||||
return series;
|
return series;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addPreferredVisualisationType = (series: any, type: PreferredVisualisationType) => {
|
const addPreferredVisualisationType = (series: DataFrame, type: PreferredVisualisationType) => {
|
||||||
let s = series;
|
let s = series;
|
||||||
s.meta
|
s.meta
|
||||||
? (s.meta.preferredVisualisationType = type)
|
? (s.meta.preferredVisualisationType = type)
|
||||||
@ -786,7 +786,7 @@ const addPreferredVisualisationType = (series: any, type: PreferredVisualisation
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toNameTypePair =
|
const toNameTypePair =
|
||||||
(docs: Array<Record<string, any>>) =>
|
(docs: Array<Record<string, unknown>>) =>
|
||||||
(propName: string): [string, FieldType] => [
|
(propName: string): [string, FieldType] => [
|
||||||
propName,
|
propName,
|
||||||
guessType(docs.find((doc) => doc[propName] !== undefined)?.[propName]),
|
guessType(docs.find((doc) => doc[propName] !== undefined)?.[propName]),
|
||||||
|
@ -37,17 +37,18 @@ export class ElasticQueryBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRangeFilter() {
|
getRangeFilter() {
|
||||||
const filter: any = {};
|
const filter = {
|
||||||
filter[this.timeField] = {
|
[this.timeField]: {
|
||||||
gte: '$timeFrom',
|
gte: '$timeFrom',
|
||||||
lte: '$timeTo',
|
lte: '$timeTo',
|
||||||
format: 'epoch_millis',
|
format: 'epoch_millis',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTermsAgg(aggDef: Terms, queryNode: { terms?: any; aggs?: any }, target: ElasticsearchQuery) {
|
buildTermsAgg(aggDef: Terms, queryNode: { terms?: any; aggs?: Record<string, unknown> }, target: ElasticsearchQuery) {
|
||||||
queryNode.terms = { field: aggDef.field };
|
queryNode.terms = { field: aggDef.field };
|
||||||
|
|
||||||
if (!aggDef.settings) {
|
if (!aggDef.settings) {
|
||||||
@ -101,7 +102,7 @@ export class ElasticQueryBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDateHistogramAgg(aggDef: DateHistogram) {
|
getDateHistogramAgg(aggDef: DateHistogram) {
|
||||||
const esAgg: any = {};
|
const esAgg: Record<string, unknown> = {};
|
||||||
const settings = aggDef.settings || {};
|
const settings = aggDef.settings || {};
|
||||||
|
|
||||||
esAgg.field = aggDef.field || this.timeField;
|
esAgg.field = aggDef.field || this.timeField;
|
||||||
@ -128,11 +129,11 @@ export class ElasticQueryBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getHistogramAgg(aggDef: Histogram) {
|
getHistogramAgg(aggDef: Histogram) {
|
||||||
const esAgg: any = {};
|
const esAgg = {
|
||||||
const settings = aggDef.settings || {};
|
interval: aggDef.settings?.interval,
|
||||||
esAgg.interval = settings.interval;
|
field: aggDef.field,
|
||||||
esAgg.field = aggDef.field;
|
min_doc_count: aggDef.settings?.min_doc_count || 0,
|
||||||
esAgg.min_doc_count = settings.min_doc_count || 0;
|
};
|
||||||
|
|
||||||
return esAgg;
|
return esAgg;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { Button } from '@grafana/ui';
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
index: number;
|
index: number;
|
||||||
elements: any[];
|
elements: unknown[];
|
||||||
onAdd: () => void;
|
onAdd: () => void;
|
||||||
onRemove: () => void;
|
onRemove: () => void;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ function createOrderByOptionsForExtendedStats(metric: ExtendedStats): Selectable
|
|||||||
return metaKeys
|
return metaKeys
|
||||||
.filter((key) => metric.meta?.[key])
|
.filter((key) => metric.meta?.[key])
|
||||||
.map((key) => {
|
.map((key) => {
|
||||||
let method = key as string;
|
let method: string = key;
|
||||||
// The bucket path for std_deviation_bounds.lower and std_deviation_bounds.upper
|
// The bucket path for std_deviation_bounds.lower and std_deviation_bounds.upper
|
||||||
// is accessed via std_lower and std_upper, respectively.
|
// is accessed via std_lower and std_upper, respectively.
|
||||||
if (key === 'std_deviation_bounds_lower') {
|
if (key === 'std_deviation_bounds_lower') {
|
||||||
|
@ -15,5 +15,5 @@ export const changeBucketAggregationField = createAction<{
|
|||||||
export const changeBucketAggregationSetting = createAction<{
|
export const changeBucketAggregationSetting = createAction<{
|
||||||
bucketAgg: BucketAggregation;
|
bucketAgg: BucketAggregation;
|
||||||
settingName: string;
|
settingName: string;
|
||||||
newValue: any;
|
newValue: unknown;
|
||||||
}>('@bucketAggs/change_setting');
|
}>('@bucketAggs/change_setting');
|
||||||
|
@ -91,7 +91,7 @@ const getHook: GetHook = (c) => () => {
|
|||||||
throw new Error('use ElasticsearchProvider first.');
|
throw new Error('use ElasticsearchProvider first.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return contextValue as NonNullable<typeof contextValue>;
|
return contextValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useQuery = getHook(QueryContext);
|
export const useQuery = getHook(QueryContext);
|
||||||
|
@ -9,16 +9,16 @@ export const changeMetricField = createAction<{ id: MetricAggregation['id']; fie
|
|||||||
export const changeMetricType = createAction<{ id: MetricAggregation['id']; type: MetricAggregation['type'] }>(
|
export const changeMetricType = createAction<{ id: MetricAggregation['id']; type: MetricAggregation['type'] }>(
|
||||||
'@metrics/change_type'
|
'@metrics/change_type'
|
||||||
);
|
);
|
||||||
export const changeMetricAttribute = createAction<{ metric: MetricAggregation; attribute: string; newValue: any }>(
|
export const changeMetricAttribute = createAction<{ metric: MetricAggregation; attribute: string; newValue: unknown }>(
|
||||||
'@metrics/change_attr'
|
'@metrics/change_attr'
|
||||||
);
|
);
|
||||||
export const changeMetricSetting = createAction<{
|
export const changeMetricSetting = createAction<{
|
||||||
metric: MetricAggregationWithSettings;
|
metric: MetricAggregationWithSettings;
|
||||||
settingName: string;
|
settingName: string;
|
||||||
newValue: any;
|
newValue: unknown;
|
||||||
}>('@metrics/change_setting');
|
}>('@metrics/change_setting');
|
||||||
export const changeMetricMeta = createAction<{
|
export const changeMetricMeta = createAction<{
|
||||||
metric: MetricAggregationWithMeta;
|
metric: MetricAggregationWithMeta;
|
||||||
meta: string;
|
meta: string;
|
||||||
newValue: any;
|
newValue: unknown;
|
||||||
}>('@metrics/change_meta');
|
}>('@metrics/change_meta');
|
||||||
|
@ -191,7 +191,7 @@ export class ElasticDatasource
|
|||||||
* @param url the url to query the index on, for example `/_mapping`.
|
* @param url the url to query the index on, for example `/_mapping`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private requestAllIndices(url: string, range = getDefaultTimeRange()): Observable<any> {
|
private requestAllIndices(url: string, range = getDefaultTimeRange()) {
|
||||||
let indexList = this.indexPattern.getIndexList(range.from, range.to);
|
let indexList = this.indexPattern.getIndexList(range.from, range.to);
|
||||||
if (!Array.isArray(indexList)) {
|
if (!Array.isArray(indexList)) {
|
||||||
indexList = [this.indexPattern.getIndexForToday()];
|
indexList = [this.indexPattern.getIndexForToday()];
|
||||||
|
@ -3,7 +3,7 @@ import React, { PureComponent } from 'react';
|
|||||||
|
|
||||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
|
|
||||||
type Props = DataSourcePluginOptionsEditorProps<any>;
|
type Props = DataSourcePluginOptionsEditorProps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty Config Editor -- settings to save
|
* Empty Config Editor -- settings to save
|
||||||
|
@ -127,7 +127,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
|
|
||||||
const onInputChange = (e: FormEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
const onInputChange = (e: FormEvent<HTMLInputElement | HTMLTextAreaElement>) => {
|
||||||
const { name, value, type } = e.currentTarget;
|
const { name, value, type } = e.currentTarget;
|
||||||
let newValue: any = value;
|
let newValue: string | number | boolean = value;
|
||||||
|
|
||||||
if (type === 'number') {
|
if (type === 'number') {
|
||||||
newValue = Number(value);
|
newValue = Number(value);
|
||||||
@ -142,7 +142,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props)
|
|||||||
|
|
||||||
const onFieldChange = (field: string) => (e: { target: { name: string; value: string; type: string } }) => {
|
const onFieldChange = (field: string) => (e: { target: { name: string; value: string; type: string } }) => {
|
||||||
const { name, value, type } = e.target;
|
const { name, value, type } = e.target;
|
||||||
let newValue: any = value;
|
let newValue: string | number = value;
|
||||||
|
|
||||||
if (type === 'number') {
|
if (type === 'number') {
|
||||||
newValue = Number(value);
|
newValue = Number(value);
|
||||||
|
@ -6,7 +6,15 @@ import { InlineField, InlineFieldRow, Input } from '@grafana/ui';
|
|||||||
import { EditorProps } from '../QueryEditor';
|
import { EditorProps } from '../QueryEditor';
|
||||||
import { TestData } from '../dataquery.gen';
|
import { TestData } from '../dataquery.gen';
|
||||||
|
|
||||||
const randomWalkFields = [
|
const randomWalkFields: Array<{
|
||||||
|
label: string;
|
||||||
|
id: Selector;
|
||||||
|
placeholder: string;
|
||||||
|
min?: number;
|
||||||
|
step?: number;
|
||||||
|
max?: number;
|
||||||
|
tooltip?: string;
|
||||||
|
}> = [
|
||||||
{ label: 'Series count', id: 'seriesCount', placeholder: '1', min: 1, step: 1 },
|
{ label: 'Series count', id: 'seriesCount', placeholder: '1', min: 1, step: 1 },
|
||||||
{ label: 'Start value', id: 'startValue', placeholder: 'auto', step: 1 },
|
{ label: 'Start value', id: 'startValue', placeholder: 'auto', step: 1 },
|
||||||
{ label: 'Min', id: 'min', placeholder: 'none', step: 0.1 },
|
{ label: 'Min', id: 'min', placeholder: 'none', step: 0.1 },
|
||||||
@ -31,7 +39,7 @@ export const RandomWalkEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
return (
|
return (
|
||||||
<InlineFieldRow>
|
<InlineFieldRow>
|
||||||
{randomWalkFields.map(({ label, id, min, step, placeholder, tooltip }) => {
|
{randomWalkFields.map(({ label, id, min, step, placeholder, tooltip }) => {
|
||||||
const selector = testSelectors?.[id as Selector];
|
const selector = testSelectors[id];
|
||||||
return (
|
return (
|
||||||
<InlineField label={label} labelWidth={14} key={id} aria-label={selector} tooltip={tooltip}>
|
<InlineField label={label} labelWidth={14} key={id} aria-label={selector} tooltip={tooltip}>
|
||||||
<Input
|
<Input
|
||||||
|
@ -25,7 +25,7 @@ export const RawFrameEditor = ({ onChange, query }: EditorProps) => {
|
|||||||
|
|
||||||
// Copy paste from panel json
|
// Copy paste from panel json
|
||||||
if (isArray(json.series) && json.state) {
|
if (isArray(json.series) && json.state) {
|
||||||
data = json.series.map((v: any) => toDataFrameDTO(toDataFrame(v)));
|
data = json.series.map((v: unknown) => toDataFrameDTO(toDataFrame(v)));
|
||||||
} else {
|
} else {
|
||||||
// Chek if it is a copy of the raw resuls
|
// Chek if it is a copy of the raw resuls
|
||||||
const v = toDataQueryResponse({ data: json });
|
const v = toDataQueryResponse({ data: json });
|
||||||
|
@ -11,6 +11,7 @@ import { nodes, edges } from './testData/serviceMapResponse';
|
|||||||
|
|
||||||
export function generateRandomNodes(count = 10) {
|
export function generateRandomNodes(count = 10) {
|
||||||
const nodes = [];
|
const nodes = [];
|
||||||
|
const edges: string[] = [];
|
||||||
|
|
||||||
const root = {
|
const root = {
|
||||||
id: 'root',
|
id: 'root',
|
||||||
@ -20,7 +21,7 @@ export function generateRandomNodes(count = 10) {
|
|||||||
error: 0,
|
error: 0,
|
||||||
stat1: Math.random(),
|
stat1: Math.random(),
|
||||||
stat2: Math.random(),
|
stat2: Math.random(),
|
||||||
edges: [] as any[],
|
edges,
|
||||||
};
|
};
|
||||||
nodes.push(root);
|
nodes.push(root);
|
||||||
const nodesWithoutMaxEdges = [root];
|
const nodesWithoutMaxEdges = [root];
|
||||||
|
@ -29,7 +29,7 @@ export default function SearchEditor({ value, onChange }: Props) {
|
|||||||
setJSON(JSON.stringify({ ...emptySearchQuery, ...value }, null, 2));
|
setJSON(JSON.stringify({ ...emptySearchQuery, ...value }, null, 2));
|
||||||
}, [value]);
|
}, [value]);
|
||||||
|
|
||||||
const handleSearchBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
const handleSearchBlur = () => {
|
||||||
if (query !== value.query) {
|
if (query !== value.query) {
|
||||||
onChange({ ...value, query });
|
onChange({ ...value, query });
|
||||||
}
|
}
|
||||||
@ -39,12 +39,12 @@ export default function SearchEditor({ value, onChange }: Props) {
|
|||||||
if (e.key !== 'Enter') {
|
if (e.key !== 'Enter') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handleSearchBlur(e as any);
|
handleSearchBlur();
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSaveSearchJSON = (rawSearchJSON: string) => {
|
const onSaveSearchJSON = (rawSearchJSON: string) => {
|
||||||
try {
|
try {
|
||||||
const searchQuery = JSON.parse(rawSearchJSON) as SearchQuery;
|
const searchQuery: SearchQuery = JSON.parse(rawSearchJSON);
|
||||||
onChange(searchQuery);
|
onChange(searchQuery);
|
||||||
setQuery(searchQuery.query ?? '');
|
setQuery(searchQuery.query ?? '');
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -60,7 +60,7 @@ export class GrafanaDatasource extends DataSourceWithBackend<GrafanaQuery> {
|
|||||||
datasource = ref;
|
datasource = ref;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
datasource = anno.datasource as DataSourceRef;
|
datasource = anno.datasource;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter from streaming query conflicts with filter from annotations
|
// Filter from streaming query conflicts with filter from annotations
|
||||||
@ -188,7 +188,7 @@ export class GrafanaDatasource extends DataSourceWithBackend<GrafanaQuery> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
metricFindQuery(options: any) {
|
metricFindQuery() {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ export class GrafanaDatasource extends DataSourceWithBackend<GrafanaQuery> {
|
|||||||
const delimiter = '__delimiter__';
|
const delimiter = '__delimiter__';
|
||||||
const tags = [];
|
const tags = [];
|
||||||
for (const t of params.tags) {
|
for (const t of params.tags) {
|
||||||
const renderedValues = templateSrv.replace(t, {}, (value: any) => {
|
const renderedValues = templateSrv.replace(t, {}, (value: string | string[]) => {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Icon, Tooltip, useStyles2 } from '@grafana/ui';
|
import { Icon, Tooltip, useStyles2, type PopoverContent } from '@grafana/ui';
|
||||||
|
|
||||||
import { FuncInstance } from '../gfunc';
|
import { FuncInstance } from '../gfunc';
|
||||||
|
|
||||||
@ -29,17 +29,17 @@ const getStyles = (theme: GrafanaTheme2) => {
|
|||||||
const FunctionEditor = ({ onMoveLeft, onMoveRight, func, ...props }: FunctionEditorProps) => {
|
const FunctionEditor = ({ onMoveLeft, onMoveRight, func, ...props }: FunctionEditorProps) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
const renderContent = ({ updatePopperPosition }: any) => (
|
const renderContent: PopoverContent = ({ updatePopperPosition }) => (
|
||||||
<FunctionEditorControls
|
<FunctionEditorControls
|
||||||
{...props}
|
{...props}
|
||||||
func={func}
|
func={func}
|
||||||
onMoveLeft={() => {
|
onMoveLeft={() => {
|
||||||
onMoveLeft(func);
|
onMoveLeft(func);
|
||||||
updatePopperPosition();
|
updatePopperPosition?.();
|
||||||
}}
|
}}
|
||||||
onMoveRight={() => {
|
onMoveRight={() => {
|
||||||
onMoveRight(func);
|
onMoveRight(func);
|
||||||
updatePopperPosition();
|
updatePopperPosition?.();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user