mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: friday typings 5 (#73844)
* fix some event.target as stuff * segment async story * segmentinput story * SegmentSelect * fixing some tests * more test fixes * undo change to SilencesFilter
This commit is contained in:
parent
eea4adea29
commit
0853819ff7
@ -1038,29 +1038,10 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"]
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"]
|
||||||
],
|
],
|
||||||
"packages/grafana-ui/src/components/Segment/SegmentAsync.story.tsx:5381": [
|
"packages/grafana-ui/src/components/Segment/SegmentAsync.story.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, "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"]
|
|
||||||
],
|
|
||||||
"packages/grafana-ui/src/components/Segment/SegmentInput.story.tsx:5381": [
|
|
||||||
[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.", "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, "Unexpected any. Specify a different type.", "6"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
|
||||||
],
|
],
|
||||||
"packages/grafana-ui/src/components/Segment/SegmentSelect.tsx:5381": [
|
"packages/grafana-ui/src/components/Segment/SegmentSelect.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.", "2"]
|
|
||||||
],
|
],
|
||||||
"packages/grafana-ui/src/components/Select/SelectBase.tsx:5381": [
|
"packages/grafana-ui/src/components/Select/SelectBase.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@ -1099,17 +1080,6 @@ 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"]
|
||||||
],
|
],
|
||||||
"packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.test.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"]
|
|
||||||
],
|
|
||||||
"packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts:5381": [
|
"packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.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"],
|
||||||
@ -1683,9 +1653,6 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/alerting/components/OptionElement.tsx:5381": [
|
"public/app/features/alerting/components/OptionElement.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/alerting/getAlertingValidationMessage.test.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/alerting/getAlertingValidationMessage.ts:5381": [
|
"public/app/features/alerting/getAlertingValidationMessage.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"],
|
||||||
@ -1765,9 +1732,6 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx:5381": [
|
"public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/alerting/unified/components/alert-groups/MatcherFilter.tsx:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/alerting/unified/components/contact-points/ContactPoints.v2.tsx:5381": [
|
"public/app/features/alerting/unified/components/contact-points/ContactPoints.v2.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
@ -2332,8 +2296,7 @@ exports[`better eslint`] = {
|
|||||||
],
|
],
|
||||||
"public/app/features/dashboard/utils/getPanelMenu.ts:5381": [
|
"public/app/features/dashboard/utils/getPanelMenu.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, "Do not use any type assertions.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/utils/panelMerge.ts:5381": [
|
"public/app/features/dashboard/utils/panelMerge.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -2543,10 +2506,7 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/live/centrifuge/LiveDataStream.test.ts:5381": [
|
"public/app/features/live/centrifuge/LiveDataStream.test.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, "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"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/live/centrifuge/LiveDataStream.ts:5381": [
|
"public/app/features/live/centrifuge/LiveDataStream.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -2651,13 +2611,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
||||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"]
|
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"]
|
||||||
],
|
],
|
||||||
"public/app/features/playlist/PlaylistSrv.test.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"]
|
|
||||||
],
|
|
||||||
"public/app/features/plugins/admin/components/GetStartedWithPlugin/GetStartedWithDataSource.tsx:5381": [
|
"public/app/features/plugins/admin/components/GetStartedWithPlugin/GetStartedWithDataSource.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
],
|
],
|
||||||
@ -3615,9 +3568,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use any type assertions.", "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, "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.", "8"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/grafana/components/SearchEditor.tsx:5381": [
|
"public/app/plugins/datasource/grafana/components/SearchEditor.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -3658,35 +3609,7 @@ 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, "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.", "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"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "19"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "20"],
|
|
||||||
[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.", "23"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "24"],
|
|
||||||
[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.", "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.", "31"],
|
|
||||||
[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.", "34"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/graphite/datasource.ts:5381": [
|
"public/app/plugins/datasource/graphite/datasource.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@ -3944,14 +3867,7 @@ exports[`better eslint`] = {
|
|||||||
[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, "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, "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"]
|
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/influxdb/specs/mocks.ts:5381": [
|
"public/app/plugins/datasource/influxdb/specs/mocks.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@ -4002,10 +3918,6 @@ 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, "Unexpected any. Specify a different type.", "1"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/datasource/loki/datasource.test.ts: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/loki/datasource.ts:5381": [
|
"public/app/plugins/datasource/loki/datasource.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"],
|
||||||
@ -4608,8 +4520,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/flamegraph/components/FlameGraph/dataTransform.test.ts:5381": [
|
"public/app/plugins/panel/flamegraph/components/FlameGraph/dataTransform.test.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/panel/gauge/GaugeMigrations.ts:5381": [
|
"public/app/plugins/panel/gauge/GaugeMigrations.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
@ -4673,9 +4584,6 @@ exports[`better eslint`] = {
|
|||||||
[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"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/geomap/migrations.test.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/panel/geomap/migrations.ts:5381": [
|
"public/app/plugins/panel/geomap/migrations.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"]
|
||||||
@ -4694,10 +4602,6 @@ exports[`better eslint`] = {
|
|||||||
[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"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/graph/GraphMigrations.test.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/panel/graph/GraphMigrations.ts:5381": [
|
"public/app/plugins/panel/graph/GraphMigrations.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"],
|
||||||
@ -4957,8 +4861,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/graph/specs/histogram.test.ts:5381": [
|
"public/app/plugins/panel/graph/specs/histogram.test.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/panel/graph/specs/series_override_ctrl.test.ts:5381": [
|
"public/app/plugins/panel/graph/specs/series_override_ctrl.test.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
@ -5242,19 +5145,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
|
[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.", "16"]
|
||||||
],
|
],
|
||||||
"public/app/plugins/panel/table-old/specs/renderer.test.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/panel/table-old/specs/transformers.test.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"]
|
|
||||||
],
|
|
||||||
"public/app/plugins/panel/table-old/transformers.ts:5381": [
|
"public/app/plugins/panel/table-old/transformers.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"],
|
||||||
|
@ -14,11 +14,10 @@ const AddButton = (
|
|||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
||||||
const toOption = (value: any) => ({ label: value, value: value });
|
const toOption = <T,>(value: T): SelectableValue<T> => ({ label: String(value), value: value });
|
||||||
const options = ['Option1', 'Option2', 'OptionWithLooongLabel', 'Option4'].map(toOption);
|
const options = ['Option1', 'Option2', 'OptionWithLooongLabel', 'Option4'].map(toOption);
|
||||||
|
|
||||||
const loadOptions = (options: any): Promise<Array<SelectableValue<string>>> =>
|
const loadOptions = <T,>(options: T): Promise<T> => new Promise((res) => setTimeout(() => res(options), 2000));
|
||||||
new Promise((res) => setTimeout(() => res(options), 2000));
|
|
||||||
|
|
||||||
const loadOptionsErr = (): Promise<Array<SelectableValue<string>>> =>
|
const loadOptionsErr = (): Promise<Array<SelectableValue<string>>> =>
|
||||||
new Promise((_, rej) => setTimeout(() => rej(Error('Could not find data')), 2000));
|
new Promise((_, rej) => setTimeout(() => rej(Error('Could not find data')), 2000));
|
||||||
@ -37,7 +36,7 @@ const SegmentFrame = ({ loadOptions, children }: any) => (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const ArrayOptions = () => {
|
export const ArrayOptions = () => {
|
||||||
const [value, setValue] = useState<any>(options[0]);
|
const [value, setValue] = useState(options[0]);
|
||||||
return (
|
return (
|
||||||
<SegmentFrame loadOptions={() => loadOptions(options)}>
|
<SegmentFrame loadOptions={() => loadOptions(options)}>
|
||||||
<SegmentAsync
|
<SegmentAsync
|
||||||
@ -73,7 +72,10 @@ export const ArrayOptionsWithPrimitiveValue = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const groupedOptions: any = [
|
const groupedOptions: Array<{
|
||||||
|
label: string;
|
||||||
|
options: Array<SelectableValue<string | number>>;
|
||||||
|
}> = [
|
||||||
{ label: 'Names', options: ['Jane', 'Tom', 'Lisa'].map(toOption) },
|
{ label: 'Names', options: ['Jane', 'Tom', 'Lisa'].map(toOption) },
|
||||||
{ label: 'Prime', options: [2, 3, 5, 7, 11, 13].map(toOption) },
|
{ label: 'Prime', options: [2, 3, 5, 7, 11, 13].map(toOption) },
|
||||||
];
|
];
|
||||||
@ -82,7 +84,7 @@ export const GroupedArrayOptions = () => {
|
|||||||
const [value, setValue] = useState(groupedOptions[0].options[0]);
|
const [value, setValue] = useState(groupedOptions[0].options[0]);
|
||||||
return (
|
return (
|
||||||
<SegmentFrame loadOptions={() => loadOptions(groupedOptions)}>
|
<SegmentFrame loadOptions={() => loadOptions(groupedOptions)}>
|
||||||
<SegmentAsync
|
<SegmentAsync<string | number>
|
||||||
value={value}
|
value={value}
|
||||||
loadOptions={() => loadOptions(groupedOptions)}
|
loadOptions={() => loadOptions(groupedOptions)}
|
||||||
onChange={(item) => {
|
onChange={(item) => {
|
||||||
@ -111,13 +113,15 @@ export const CustomOptionsAllowed = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CustomLabelComponent = ({ value }: any) => <div className="gf-form-label">custom({value})</div>;
|
const CustomLabelComponent = ({ value }: { value: unknown }) => (
|
||||||
|
<div className="gf-form-label">custom({String(value)})</div>
|
||||||
|
);
|
||||||
|
|
||||||
export const CustomLabel = () => {
|
export const CustomLabel = () => {
|
||||||
const [value, setValue] = useState(groupedOptions[0].options[0].value);
|
const [value, setValue] = useState(groupedOptions[0].options[0].value);
|
||||||
return (
|
return (
|
||||||
<SegmentFrame loadOptions={() => loadOptions(groupedOptions)}>
|
<SegmentFrame loadOptions={() => loadOptions(groupedOptions)}>
|
||||||
<SegmentAsync
|
<SegmentAsync<string | number>
|
||||||
Component={<CustomLabelComponent value={value} />}
|
Component={<CustomLabelComponent value={value} />}
|
||||||
loadOptions={() => loadOptions(groupedOptions)}
|
loadOptions={() => loadOptions(groupedOptions)}
|
||||||
onChange={({ value }) => {
|
onChange={({ value }) => {
|
||||||
@ -146,7 +150,7 @@ export const CustomStateMessageHandler = () => {
|
|||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const [value, setValue] = useState<any>(options[0]);
|
const [value, setValue] = useState(options[0].value);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SegmentFrame loadOptions={() => loadOptions(groupedOptions)}>
|
<SegmentFrame loadOptions={() => loadOptions(groupedOptions)}>
|
||||||
@ -187,7 +191,7 @@ export const CustomStateMessageHandler = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const HtmlAttributes = () => {
|
export const HtmlAttributes = () => {
|
||||||
const [value, setValue] = useState<any>(options[0]);
|
const [value, setValue] = useState(options[0]);
|
||||||
return (
|
return (
|
||||||
<SegmentFrame loadOptions={() => loadOptions(options)}>
|
<SegmentFrame loadOptions={() => loadOptions(options)}>
|
||||||
<SegmentAsync
|
<SegmentAsync
|
||||||
|
@ -6,20 +6,20 @@ import { SegmentInput, Icon, SegmentSection } from '@grafana/ui';
|
|||||||
|
|
||||||
import { SegmentInputProps } from './SegmentInput';
|
import { SegmentInputProps } from './SegmentInput';
|
||||||
|
|
||||||
const SegmentFrame = ({ children }: any) => (
|
const SegmentFrame = ({ children }: React.PropsWithChildren) => (
|
||||||
<>
|
<>
|
||||||
<SegmentSection label="Segment Name">{children}</SegmentSection>
|
<SegmentSection label="Segment Name">{children}</SegmentSection>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const BasicInput = () => {
|
export const BasicInput = () => {
|
||||||
const [value, setValue] = useState('some text');
|
const [value, setValue] = useState<string | number>('some text');
|
||||||
return (
|
return (
|
||||||
<SegmentFrame>
|
<SegmentFrame>
|
||||||
<SegmentInput
|
<SegmentInput
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(text) => {
|
onChange={(text) => {
|
||||||
setValue(text as string);
|
setValue(text);
|
||||||
action('Segment value changed')(text);
|
action('Segment value changed')(text);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -33,14 +33,14 @@ const meta: Meta<typeof SegmentInput> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const BasicInputWithPlaceholder = () => {
|
export const BasicInputWithPlaceholder = () => {
|
||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState<string | number>('');
|
||||||
return (
|
return (
|
||||||
<SegmentFrame>
|
<SegmentFrame>
|
||||||
<SegmentInput
|
<SegmentInput
|
||||||
placeholder="add text"
|
placeholder="add text"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(text) => {
|
onChange={(text) => {
|
||||||
setValue(text as string);
|
setValue(text);
|
||||||
action('Segment value changed')(text);
|
action('Segment value changed')(text);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -49,7 +49,7 @@ export const BasicInputWithPlaceholder = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const BasicInputWithHtmlAttributes = () => {
|
export const BasicInputWithHtmlAttributes = () => {
|
||||||
const [value, setValue] = useState('some text');
|
const [value, setValue] = useState<string | number>('some text');
|
||||||
return (
|
return (
|
||||||
<SegmentFrame>
|
<SegmentFrame>
|
||||||
<SegmentInput
|
<SegmentInput
|
||||||
@ -57,7 +57,7 @@ export const BasicInputWithHtmlAttributes = () => {
|
|||||||
id="segment-input"
|
id="segment-input"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(text) => {
|
onChange={(text) => {
|
||||||
setValue(text as string);
|
setValue(text);
|
||||||
action('Segment value changed')(text);
|
action('Segment value changed')(text);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -65,7 +65,11 @@ export const BasicInputWithHtmlAttributes = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const InputComponent = ({ initialValue }: any) => {
|
interface InputComponentProps {
|
||||||
|
initialValue: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const InputComponent = ({ initialValue }: InputComponentProps) => {
|
||||||
const [value, setValue] = useState(initialValue);
|
const [value, setValue] = useState(initialValue);
|
||||||
return (
|
return (
|
||||||
<SegmentInput
|
<SegmentInput
|
||||||
@ -73,7 +77,7 @@ const InputComponent = ({ initialValue }: any) => {
|
|||||||
autofocus
|
autofocus
|
||||||
value={value}
|
value={value}
|
||||||
onChange={(text) => {
|
onChange={(text) => {
|
||||||
setValue(text as string);
|
setValue(text);
|
||||||
action('Segment value changed')(text);
|
action('Segment value changed')(text);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -81,10 +85,10 @@ const InputComponent = ({ initialValue }: any) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const InputWithAutoFocus = () => {
|
export const InputWithAutoFocus = () => {
|
||||||
const [inputComponents, setInputComponents] = useState<any>([]);
|
const [inputComponents, setInputComponents] = useState<Array<(props: InputComponentProps) => JSX.Element>>([]);
|
||||||
return (
|
return (
|
||||||
<SegmentFrame>
|
<SegmentFrame>
|
||||||
{inputComponents.map((InputComponent: any, i: number) => (
|
{inputComponents.map((InputComponent, i) => (
|
||||||
<InputComponent initialValue="test" key={i} />
|
<InputComponent initialValue="test" key={i} />
|
||||||
))}
|
))}
|
||||||
<button
|
<button
|
||||||
|
@ -76,9 +76,9 @@ export function SegmentSelect<T>({
|
|||||||
if (ref && ref.current) {
|
if (ref && ref.current) {
|
||||||
// https://github.com/JedWatson/react-select/issues/188#issuecomment-279240292
|
// https://github.com/JedWatson/react-select/issues/188#issuecomment-279240292
|
||||||
// Unfortunately there's no other way of retrieving the value (not yet) created new option
|
// Unfortunately there's no other way of retrieving the value (not yet) created new option
|
||||||
const input = ref.current.querySelector('input[id^="react-select-"]') as HTMLInputElement;
|
const input = ref.current.querySelector<HTMLInputElement>('input[id^="react-select-"]');
|
||||||
if (input && (input.value || allowEmptyValue)) {
|
if (input && (input.value || allowEmptyValue)) {
|
||||||
onChange({ value: input.value as any, label: input.value });
|
onChange({ value: input.value as T, label: input.value });
|
||||||
} else {
|
} else {
|
||||||
onClickOutside();
|
onClickOutside();
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,10 @@ describe('sharedSingleStatMigrationHandler', () => {
|
|||||||
},
|
},
|
||||||
title: 'Usage',
|
title: 'Usage',
|
||||||
type: 'bargauge',
|
type: 'bargauge',
|
||||||
};
|
} as PanelModel;
|
||||||
|
|
||||||
sharedSingleStatMigrationHandler(panel as any);
|
sharedSingleStatMigrationHandler(panel);
|
||||||
expect((panel as any).fieldConfig).toMatchInlineSnapshot(`
|
expect(panel.fieldConfig).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"color": {
|
"color": {
|
||||||
@ -105,11 +105,11 @@ describe('sharedSingleStatMigrationHandler', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
} as PanelModel;
|
||||||
|
|
||||||
sharedSingleStatMigrationHandler(panel as any);
|
sharedSingleStatMigrationHandler(panel);
|
||||||
|
|
||||||
expect((panel as any).fieldConfig).toMatchInlineSnapshot(`
|
expect(panel.fieldConfig).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"mappings": undefined,
|
"mappings": undefined,
|
||||||
@ -141,10 +141,10 @@ describe('sharedSingleStatMigrationHandler', () => {
|
|||||||
},
|
},
|
||||||
title: 'Usage',
|
title: 'Usage',
|
||||||
type: 'bargauge',
|
type: 'bargauge',
|
||||||
};
|
} as PanelModel;
|
||||||
|
|
||||||
sharedSingleStatMigrationHandler(panel as any);
|
sharedSingleStatMigrationHandler(panel);
|
||||||
expect((panel as any).fieldConfig).toMatchInlineSnapshot(`
|
expect(panel.fieldConfig).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"defaults": {
|
"defaults": {
|
||||||
"mappings": undefined,
|
"mappings": undefined,
|
||||||
@ -174,10 +174,10 @@ describe('sharedSingleStatMigrationHandler', () => {
|
|||||||
},
|
},
|
||||||
title: 'Usage',
|
title: 'Usage',
|
||||||
type: 'bargauge',
|
type: 'bargauge',
|
||||||
};
|
} as PanelModel;
|
||||||
|
|
||||||
sharedSingleStatMigrationHandler(panel as any);
|
sharedSingleStatMigrationHandler(panel);
|
||||||
expect((panel as any).fieldConfig.defaults.displayName).toBe('newTitle');
|
expect(panel.fieldConfig.defaults.displayName).toBe('newTitle');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change from angular singlestat with no enabled gauge', () => {
|
it('change from angular singlestat with no enabled gauge', () => {
|
||||||
@ -242,8 +242,8 @@ describe('sharedSingleStatMigrationHandler', () => {
|
|||||||
},
|
},
|
||||||
title: 'Usage',
|
title: 'Usage',
|
||||||
type: 'bargauge',
|
type: 'bargauge',
|
||||||
} as unknown as PanelModel;
|
} as PanelModel;
|
||||||
sharedSingleStatMigrationHandler(panel as any);
|
sharedSingleStatMigrationHandler(panel);
|
||||||
expect(panel.fieldConfig.defaults.unit).toBe('percentunit');
|
expect(panel.fieldConfig.defaults.unit).toBe('percentunit');
|
||||||
expect(panel.fieldConfig.defaults.min).toBe(0);
|
expect(panel.fieldConfig.defaults.min).toBe(0);
|
||||||
expect(panel.fieldConfig.defaults.max).toBe(1);
|
expect(panel.fieldConfig.defaults.max).toBe(1);
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
DataTransformerConfig,
|
DataTransformerConfig,
|
||||||
DataSourceInstanceSettings,
|
DataSourceInstanceSettings,
|
||||||
DataSourceRef,
|
DataSourceRef,
|
||||||
|
DataQuery,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { DataSourceSrv } from '@grafana/runtime';
|
import { DataSourceSrv } from '@grafana/runtime';
|
||||||
|
|
||||||
@ -81,9 +82,9 @@ describe('getAlertingValidationMessage', () => {
|
|||||||
},
|
},
|
||||||
reload: jest.fn(),
|
reload: jest.fn(),
|
||||||
};
|
};
|
||||||
const targets: any[] = [
|
const targets: DataQuery[] = [
|
||||||
{ refId: 'A', query: 'some query', datasource: 'alertingDatasource' },
|
{ refId: 'A', datasource: { type: 'alertingDatasource' } },
|
||||||
{ refId: 'B', query: 'some query', datasource: 'datasource' },
|
{ refId: 'B', datasource: { type: 'datasource' } },
|
||||||
];
|
];
|
||||||
const transformations: DataTransformerConfig[] = [];
|
const transformations: DataTransformerConfig[] = [];
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export const MatcherFilter = ({ className, onFilterChange, defaultQueryString }:
|
|||||||
debounce((e: FormEvent<HTMLInputElement>) => {
|
debounce((e: FormEvent<HTMLInputElement>) => {
|
||||||
logInfo(LogMessages.filterByLabel);
|
logInfo(LogMessages.filterByLabel);
|
||||||
|
|
||||||
const target = e.target as HTMLInputElement;
|
const target = e.currentTarget;
|
||||||
onFilterChange(target.value);
|
onFilterChange(target.value);
|
||||||
}, 600),
|
}, 600),
|
||||||
[onFilterChange]
|
[onFilterChange]
|
||||||
|
@ -188,10 +188,12 @@ export function getPanelMenu(
|
|||||||
iconClassName: 'info-circle',
|
iconClassName: 'info-circle',
|
||||||
onClick: (e: React.MouseEvent<HTMLElement>) => {
|
onClick: (e: React.MouseEvent<HTMLElement>) => {
|
||||||
const currentTarget = e.currentTarget;
|
const currentTarget = e.currentTarget;
|
||||||
const target = e.target as HTMLElement;
|
const target = e.target;
|
||||||
const closestMenuItem = target.closest('[role="menuitem"]');
|
|
||||||
|
|
||||||
if (target === currentTarget || closestMenuItem === currentTarget) {
|
if (
|
||||||
|
target === currentTarget ||
|
||||||
|
(target instanceof HTMLElement && target.closest('[role="menuitem"]') === currentTarget)
|
||||||
|
) {
|
||||||
onInspectPanel();
|
onInspectPanel();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -253,7 +253,7 @@ describe('LiveDataStream', () => {
|
|||||||
|
|
||||||
describe('happy path with a single subscriber in `append` mode', () => {
|
describe('happy path with a single subscriber in `append` mode', () => {
|
||||||
let deps: ReturnType<typeof createDeps>;
|
let deps: ReturnType<typeof createDeps>;
|
||||||
let liveDataStream: LiveDataStream<any>;
|
let liveDataStream: LiveDataStream;
|
||||||
const valuesCollection = new ValuesCollection<DataQueryResponse>();
|
const valuesCollection = new ValuesCollection<DataQueryResponse>();
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
@ -494,7 +494,7 @@ describe('LiveDataStream', () => {
|
|||||||
|
|
||||||
describe('happy path with a single subscriber in `replace` mode', () => {
|
describe('happy path with a single subscriber in `replace` mode', () => {
|
||||||
let deps: ReturnType<typeof createDeps>;
|
let deps: ReturnType<typeof createDeps>;
|
||||||
let liveDataStream: LiveDataStream<any>;
|
let liveDataStream: LiveDataStream;
|
||||||
const valuesCollection = new ValuesCollection<DataQueryResponse>();
|
const valuesCollection = new ValuesCollection<DataQueryResponse>();
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
@ -850,7 +850,7 @@ describe('LiveDataStream', () => {
|
|||||||
|
|
||||||
describe('happy path with multiple subscribers', () => {
|
describe('happy path with multiple subscribers', () => {
|
||||||
let deps: ReturnType<typeof createDeps>;
|
let deps: ReturnType<typeof createDeps>;
|
||||||
let liveDataStream: LiveDataStream<any>;
|
let liveDataStream: LiveDataStream;
|
||||||
const valuesCollections = {
|
const valuesCollections = {
|
||||||
withTimeBFilter: new ValuesCollection<DataQueryResponse>(),
|
withTimeBFilter: new ValuesCollection<DataQueryResponse>(),
|
||||||
withTimeAFilter: new ValuesCollection<DataQueryResponse>(),
|
withTimeAFilter: new ValuesCollection<DataQueryResponse>(),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { Store } from 'redux';
|
||||||
import configureMockStore from 'redux-mock-store';
|
import configureMockStore from 'redux-mock-store';
|
||||||
|
|
||||||
import { locationService } from '@grafana/runtime';
|
import { locationService } from '@grafana/runtime';
|
||||||
@ -31,10 +32,9 @@ jest.mock('./api', () => ({
|
|||||||
const mockStore = configureMockStore();
|
const mockStore = configureMockStore();
|
||||||
|
|
||||||
setStore(
|
setStore(
|
||||||
// eslint-disable-next-line
|
|
||||||
mockStore({
|
mockStore({
|
||||||
location: {},
|
location: {},
|
||||||
}) as any
|
}) as Store
|
||||||
);
|
);
|
||||||
|
|
||||||
function createPlaylistSrv(): PlaylistSrv {
|
function createPlaylistSrv(): PlaylistSrv {
|
||||||
@ -42,7 +42,7 @@ function createPlaylistSrv(): PlaylistSrv {
|
|||||||
return new PlaylistSrv();
|
return new PlaylistSrv();
|
||||||
}
|
}
|
||||||
|
|
||||||
const mockWindowLocation = (): [jest.MockInstance<any, any>, () => void] => {
|
const mockWindowLocation = (): [jest.Mock, () => void] => {
|
||||||
const oldLocation = window.location;
|
const oldLocation = window.location;
|
||||||
const hrefMock = jest.fn();
|
const hrefMock = jest.fn();
|
||||||
|
|
||||||
@ -51,8 +51,7 @@ const mockWindowLocation = (): [jest.MockInstance<any, any>, () => void] => {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
delete window.location;
|
delete window.location;
|
||||||
|
|
||||||
// eslint-disable-next-line
|
window.location = {} as Location;
|
||||||
window.location = {} as any;
|
|
||||||
|
|
||||||
// Only mocking href as that is all this test needs, but otherwise there is lots of things missing, so keep that
|
// Only mocking href as that is all this test needs, but otherwise there is lots of things missing, so keep that
|
||||||
// in mind if this is reused.
|
// in mind if this is reused.
|
||||||
@ -68,7 +67,7 @@ const mockWindowLocation = (): [jest.MockInstance<any, any>, () => void] => {
|
|||||||
|
|
||||||
describe('PlaylistSrv', () => {
|
describe('PlaylistSrv', () => {
|
||||||
let srv: PlaylistSrv;
|
let srv: PlaylistSrv;
|
||||||
let hrefMock: jest.MockInstance<any, any>;
|
let hrefMock: jest.Mock;
|
||||||
let unmockLocation: () => void;
|
let unmockLocation: () => void;
|
||||||
const initialUrl = 'http://localhost/playlist';
|
const initialUrl = 'http://localhost/playlist';
|
||||||
|
|
||||||
|
@ -220,11 +220,11 @@ export class UnthemedQueryEditor extends PureComponent<Props, State> {
|
|||||||
if (e.key !== 'Enter') {
|
if (e.key !== 'Enter') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.checkAndUpdateValue('buffer', (e.target as any).value);
|
this.checkAndUpdateValue('buffer', e.currentTarget.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
|
||||||
this.checkAndUpdateValue('buffer', e.target.value);
|
this.checkAndUpdateValue('buffer', e.currentTarget.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderMeasurementsQuery() {
|
renderMeasurementsQuery() {
|
||||||
|
@ -3,6 +3,7 @@ import { of } from 'rxjs';
|
|||||||
import { createFetchResponse } from 'test/helpers/createFetchResponse';
|
import { createFetchResponse } from 'test/helpers/createFetchResponse';
|
||||||
|
|
||||||
import { AbstractLabelMatcher, AbstractLabelOperator, getFrameDisplayName, dateTime } from '@grafana/data';
|
import { AbstractLabelMatcher, AbstractLabelOperator, getFrameDisplayName, dateTime } from '@grafana/data';
|
||||||
|
import { BackendSrvRequest } from '@grafana/runtime';
|
||||||
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
|
import { backendSrv } from 'app/core/services/backend_srv'; // will use the version in __mocks__
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
|
|
||||||
@ -120,10 +121,10 @@ describe('graphiteDatasource', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let response: any;
|
let response: any;
|
||||||
let requestOptions: any;
|
let requestOptions: BackendSrvRequest;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
requestOptions = options;
|
requestOptions = options;
|
||||||
return of(
|
return of(
|
||||||
createFetchResponse([
|
createFetchResponse([
|
||||||
@ -142,8 +143,8 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('X-Dashboard and X-Panel headers to be set!', () => {
|
it('X-Dashboard and X-Panel headers to be set!', () => {
|
||||||
expect(requestOptions.headers['X-Dashboard-Id']).toBe(5);
|
expect(requestOptions.headers?.['X-Dashboard-Id']).toBe(5);
|
||||||
expect(requestOptions.headers['X-Panel-Id']).toBe(3);
|
expect(requestOptions.headers?.['X-Panel-Id']).toBe(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate the correct query', () => {
|
it('should generate the correct query', () => {
|
||||||
@ -226,10 +227,10 @@ describe('graphiteDatasource', () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
return of(createFetchResponse(response));
|
return of(createFetchResponse(response));
|
||||||
});
|
});
|
||||||
await ctx.ds.annotationEvents(options.range, options.targets[0]).then((data: any) => {
|
await ctx.ds.annotationEvents(options.range, options.targets[0]).then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -254,11 +255,11 @@ describe('graphiteDatasource', () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
return of(createFetchResponse(response));
|
return of(createFetchResponse(response));
|
||||||
});
|
});
|
||||||
|
|
||||||
await ctx.ds.annotationEvents(options.range, options.targets[0]).then((data: any) => {
|
await ctx.ds.annotationEvents(options.range, options.targets[0]).then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -272,10 +273,10 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('and tags response is invalid', async () => {
|
it('and tags response is invalid', async () => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
return of(createFetchResponse('zzzzzzz'));
|
return of(createFetchResponse('zzzzzzz'));
|
||||||
});
|
});
|
||||||
await ctx.ds.annotationEvents(options.range, options.targets[0]).then((data: any) => {
|
await ctx.ds.annotationEvents(options.range, options.targets[0]).then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
expect(results).toEqual([]);
|
expect(results).toEqual([]);
|
||||||
@ -411,86 +412,86 @@ describe('graphiteDatasource', () => {
|
|||||||
|
|
||||||
describe('querying for template variables', () => {
|
describe('querying for template variables', () => {
|
||||||
let results: any;
|
let results: any;
|
||||||
let requestOptions: any;
|
let requestOptions: BackendSrvRequest;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
requestOptions = options;
|
requestOptions = options;
|
||||||
return of(createFetchResponse(['backend_01', 'backend_02']));
|
return of(createFetchResponse(['backend_01', 'backend_02']));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tags query', () => {
|
it('should generate tags query', () => {
|
||||||
ctx.ds.metricFindQuery('tags()').then((data: any) => {
|
ctx.ds.metricFindQuery('tags()').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/tags');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/tags');
|
||||||
expect(requestOptions.params.expr).toEqual([]);
|
expect(requestOptions.params?.expr).toEqual([]);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tags query with a filter expression', () => {
|
it('should generate tags query with a filter expression', () => {
|
||||||
ctx.ds.metricFindQuery('tags(server=backend_01)').then((data: any) => {
|
ctx.ds.metricFindQuery('tags(server=backend_01)').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/tags');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/tags');
|
||||||
expect(requestOptions.params.expr).toEqual(['server=backend_01']);
|
expect(requestOptions.params?.expr).toEqual(['server=backend_01']);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tags query for an expression with whitespace after', () => {
|
it('should generate tags query for an expression with whitespace after', () => {
|
||||||
ctx.ds.metricFindQuery('tags(server=backend_01 )').then((data: any) => {
|
ctx.ds.metricFindQuery('tags(server=backend_01 )').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/tags');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/tags');
|
||||||
expect(requestOptions.params.expr).toEqual(['server=backend_01']);
|
expect(requestOptions.params?.expr).toEqual(['server=backend_01']);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tag values query for one tag', () => {
|
it('should generate tag values query for one tag', () => {
|
||||||
ctx.ds.metricFindQuery('tag_values(server)').then((data: any) => {
|
ctx.ds.metricFindQuery('tag_values(server)').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
||||||
expect(requestOptions.params.tag).toBe('server');
|
expect(requestOptions.params?.tag).toBe('server');
|
||||||
expect(requestOptions.params.expr).toEqual([]);
|
expect(requestOptions.params?.expr).toEqual([]);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tag values query for a tag and expression', () => {
|
it('should generate tag values query for a tag and expression', () => {
|
||||||
ctx.ds.metricFindQuery('tag_values(server,server=~backend*)').then((data: any) => {
|
ctx.ds.metricFindQuery('tag_values(server,server=~backend*)').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
||||||
expect(requestOptions.params.tag).toBe('server');
|
expect(requestOptions.params?.tag).toBe('server');
|
||||||
expect(requestOptions.params.expr).toEqual(['server=~backend*']);
|
expect(requestOptions.params?.expr).toEqual(['server=~backend*']);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tag values query for a tag with whitespace after', () => {
|
it('should generate tag values query for a tag with whitespace after', () => {
|
||||||
ctx.ds.metricFindQuery('tag_values(server )').then((data: any) => {
|
ctx.ds.metricFindQuery('tag_values(server )').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
||||||
expect(requestOptions.params.tag).toBe('server');
|
expect(requestOptions.params?.tag).toBe('server');
|
||||||
expect(requestOptions.params.expr).toEqual([]);
|
expect(requestOptions.params?.expr).toEqual([]);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate tag values query for a tag and expression with whitespace after', () => {
|
it('should generate tag values query for a tag and expression with whitespace after', () => {
|
||||||
ctx.ds.metricFindQuery('tag_values(server , server=~backend* )').then((data: any) => {
|
ctx.ds.metricFindQuery('tag_values(server , server=~backend* )').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/tags/autoComplete/values');
|
||||||
expect(requestOptions.params.tag).toBe('server');
|
expect(requestOptions.params?.tag).toBe('server');
|
||||||
expect(requestOptions.params.expr).toEqual(['server=~backend*']);
|
expect(requestOptions.params?.expr).toEqual(['server=~backend*']);
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -513,7 +514,7 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should interpolate $__searchFilter with searchFilter', () => {
|
it('should interpolate $__searchFilter with searchFilter', () => {
|
||||||
ctx.ds.metricFindQuery('app.$__searchFilter', { searchFilter: 'backend' }).then((data: any) => {
|
ctx.ds.metricFindQuery('app.$__searchFilter', { searchFilter: 'backend' }).then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -524,7 +525,7 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should interpolate $__searchFilter with default when searchFilter is missing', () => {
|
it('should interpolate $__searchFilter with default when searchFilter is missing', () => {
|
||||||
ctx.ds.metricFindQuery('app.$__searchFilter', {}).then((data: any) => {
|
ctx.ds.metricFindQuery('app.$__searchFilter', {}).then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -535,18 +536,18 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should request expanded metrics', () => {
|
it('should request expanded metrics', () => {
|
||||||
ctx.ds.metricFindQuery('expand(*.servers.*)').then((data: any) => {
|
ctx.ds.metricFindQuery('expand(*.servers.*)').then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/metrics/expand');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/metrics/expand');
|
||||||
expect(requestOptions.params.query).toBe('*.servers.*');
|
expect(requestOptions.params?.query).toBe('*.servers.*');
|
||||||
expect(results).not.toBe(null);
|
expect(results).not.toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch from /metrics/find endpoint when queryType is default or query is string', async () => {
|
it('should fetch from /metrics/find endpoint when queryType is default or query is string', async () => {
|
||||||
const stringQuery = 'query';
|
const stringQuery = 'query';
|
||||||
ctx.ds.metricFindQuery(stringQuery).then((data: any) => {
|
ctx.ds.metricFindQuery(stringQuery).then((data) => {
|
||||||
results = data;
|
results = data;
|
||||||
});
|
});
|
||||||
expect(requestOptions.url).toBe('/api/datasources/proxy/1/metrics/find');
|
expect(requestOptions.url).toBe('/api/datasources/proxy/1/metrics/find');
|
||||||
@ -564,7 +565,7 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch from /render endpoint when queryType is value', async () => {
|
it('should fetch from /render endpoint when queryType is value', async () => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
requestOptions = options;
|
requestOptions = options;
|
||||||
return of(
|
return of(
|
||||||
createFetchResponse([
|
createFetchResponse([
|
||||||
@ -591,7 +592,7 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return values of a query when queryType is GraphiteQueryType.Value', async () => {
|
it('should return values of a query when queryType is GraphiteQueryType.Value', async () => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
requestOptions = options;
|
requestOptions = options;
|
||||||
return of(
|
return of(
|
||||||
createFetchResponse([
|
createFetchResponse([
|
||||||
@ -621,7 +622,7 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return metric names when queryType is GraphiteQueryType.MetricName', async () => {
|
it('should return metric names when queryType is GraphiteQueryType.MetricName', async () => {
|
||||||
fetchMock.mockImplementation((options: any) => {
|
fetchMock.mockImplementation((options) => {
|
||||||
requestOptions = options;
|
requestOptions = options;
|
||||||
return of(
|
return of(
|
||||||
createFetchResponse([
|
createFetchResponse([
|
||||||
@ -731,10 +732,9 @@ describe('graphiteDatasource', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function accessScenario(name: string, url: string, fn: any) {
|
function accessScenario(name: string, url: string, fn: ({ headers }: { headers: Record<string, unknown> }) => void) {
|
||||||
describe('access scenario ' + name, () => {
|
describe('access scenario ' + name, () => {
|
||||||
const ctx: any = {
|
const ctx = {
|
||||||
// @ts-ignore
|
|
||||||
templateSrv: new TemplateSrv(),
|
templateSrv: new TemplateSrv(),
|
||||||
instanceSettings: { url: 'url', name: 'graphiteProd', jsonData: {} },
|
instanceSettings: { url: 'url', name: 'graphiteProd', jsonData: {} },
|
||||||
};
|
};
|
||||||
@ -756,12 +756,12 @@ function accessScenario(name: string, url: string, fn: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
accessScenario('with proxy access', '/api/datasources/proxy/1', (httpOptions: any) => {
|
accessScenario('with proxy access', '/api/datasources/proxy/1', (httpOptions) => {
|
||||||
expect(httpOptions.headers['X-Dashboard-Id']).toBe(1);
|
expect(httpOptions.headers['X-Dashboard-Id']).toBe(1);
|
||||||
expect(httpOptions.headers['X-Panel-Id']).toBe(2);
|
expect(httpOptions.headers['X-Panel-Id']).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
accessScenario('with direct access', 'http://localhost:8080', (httpOptions: any) => {
|
accessScenario('with direct access', 'http://localhost:8080', (httpOptions) => {
|
||||||
expect(httpOptions.headers['X-Dashboard-Id']).toBe(undefined);
|
expect(httpOptions.headers['X-Dashboard-Id']).toBe(undefined);
|
||||||
expect(httpOptions.headers['X-Panel-Id']).toBe(undefined);
|
expect(httpOptions.headers['X-Panel-Id']).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ import { backendSrv } from 'app/core/services/backend_srv'; // will use the vers
|
|||||||
|
|
||||||
import { BROWSER_MODE_DISABLED_MESSAGE } from '../constants';
|
import { BROWSER_MODE_DISABLED_MESSAGE } from '../constants';
|
||||||
import InfluxDatasource from '../datasource';
|
import InfluxDatasource from '../datasource';
|
||||||
import { InfluxVersion } from '../types';
|
import { InfluxQuery, InfluxVersion } from '../types';
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const templateSrv = new TemplateSrvStub();
|
const templateSrv = new TemplateSrvStub();
|
||||||
@ -34,18 +34,21 @@ describe('InfluxDataSource', () => {
|
|||||||
|
|
||||||
describe('When issuing metricFindQuery', () => {
|
describe('When issuing metricFindQuery', () => {
|
||||||
const query = 'SELECT max(value) FROM measurement WHERE $timeFilter';
|
const query = 'SELECT max(value) FROM measurement WHERE $timeFilter';
|
||||||
const queryOptions: any = {
|
const queryOptions = {
|
||||||
range: {
|
range: {
|
||||||
from: '2018-01-01T00:00:00Z',
|
from: '2018-01-01T00:00:00Z',
|
||||||
to: '2018-01-02T00:00:00Z',
|
to: '2018-01-02T00:00:00Z',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let requestQuery: any, requestMethod: any, requestData: any, response: any;
|
let requestQuery: any;
|
||||||
|
let requestMethod: string | undefined;
|
||||||
|
let requestData: any;
|
||||||
|
let response: any;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
fetchMock.mockImplementation((req: any) => {
|
fetchMock.mockImplementation((req) => {
|
||||||
requestMethod = req.method;
|
requestMethod = req.method;
|
||||||
requestQuery = req.params.q;
|
requestQuery = req.params?.q;
|
||||||
requestData = req.data;
|
requestData = req.data;
|
||||||
return of({
|
return of({
|
||||||
data: {
|
data: {
|
||||||
@ -160,11 +163,14 @@ describe('InfluxDataSource', () => {
|
|||||||
|
|
||||||
describe('When issuing metricFindQuery', () => {
|
describe('When issuing metricFindQuery', () => {
|
||||||
const query = 'SELECT max(value) FROM measurement';
|
const query = 'SELECT max(value) FROM measurement';
|
||||||
const queryOptions: any = {};
|
const queryOptions = {};
|
||||||
let requestMethod: any, requestQueryParameter: any, queryEncoded: any, requestQuery: any;
|
let requestMethod: string | undefined;
|
||||||
|
let requestQueryParameter: Record<string, any> | undefined;
|
||||||
|
let queryEncoded: any;
|
||||||
|
let requestQuery: any;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
fetchMock.mockImplementation((req: any) => {
|
fetchMock.mockImplementation((req) => {
|
||||||
requestMethod = req.method;
|
requestMethod = req.method;
|
||||||
requestQueryParameter = req.params;
|
requestQueryParameter = req.params;
|
||||||
requestQuery = req.data;
|
requestQuery = req.data;
|
||||||
@ -280,7 +286,7 @@ describe('InfluxDataSource', () => {
|
|||||||
adhocFilters,
|
adhocFilters,
|
||||||
};
|
};
|
||||||
|
|
||||||
function influxChecks(query: any) {
|
function influxChecks(query: InfluxQuery) {
|
||||||
expect(templateSrv.replace).toBeCalledTimes(10);
|
expect(templateSrv.replace).toBeCalledTimes(10);
|
||||||
expect(query.alias).toBe(text);
|
expect(query.alias).toBe(text);
|
||||||
expect(query.measurement).toBe(textWithFormatRegex);
|
expect(query.measurement).toBe(textWithFormatRegex);
|
||||||
@ -291,7 +297,7 @@ describe('InfluxDataSource', () => {
|
|||||||
expect(query.tags![0].value).toBe(textWithFormatRegex);
|
expect(query.tags![0].value).toBe(textWithFormatRegex);
|
||||||
expect(query.groupBy![0].params![0]).toBe(textWithFormatRegex);
|
expect(query.groupBy![0].params![0]).toBe(textWithFormatRegex);
|
||||||
expect(query.select![0][0].params![0]).toBe(textWithFormatRegex);
|
expect(query.select![0][0].params![0]).toBe(textWithFormatRegex);
|
||||||
expect(query.adhocFilters[0].key).toBe(adhocFilters[0].key);
|
expect(query.adhocFilters?.[0].key).toBe(adhocFilters[0].key);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('when interpolating query variables for dashboard->explore', () => {
|
describe('when interpolating query variables for dashboard->explore', () => {
|
||||||
|
@ -1233,7 +1233,7 @@ describe('LokiDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('keeps all labels when no labels are loaded', async () => {
|
it('keeps all labels when no labels are loaded', async () => {
|
||||||
ds.getResource = () => Promise.resolve({ data: [] } as any);
|
ds.getResource = <T>() => Promise.resolve({ data: [] } as T);
|
||||||
const queries = await ds.importFromAbstractQueries([
|
const queries = await ds.importFromAbstractQueries([
|
||||||
{
|
{
|
||||||
refId: 'A',
|
refId: 'A',
|
||||||
@ -1247,7 +1247,7 @@ describe('LokiDatasource', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('filters out non existing labels', async () => {
|
it('filters out non existing labels', async () => {
|
||||||
ds.getResource = () => Promise.resolve({ data: ['foo'] } as any);
|
ds.getResource = <T>() => Promise.resolve({ data: ['foo'] } as T);
|
||||||
const queries = await ds.importFromAbstractQueries([
|
const queries = await ds.importFromAbstractQueries([
|
||||||
{
|
{
|
||||||
refId: 'A',
|
refId: 'A',
|
||||||
|
@ -168,8 +168,10 @@ const FlameGraph = ({
|
|||||||
// hide context menu if outside the flame graph canvas is clicked
|
// hide context menu if outside the flame graph canvas is clicked
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleOnClick = (e: MouseEvent) => {
|
const handleOnClick = (e: MouseEvent) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
if (
|
||||||
if ((e.target as HTMLElement).parentElement?.id !== 'flameGraphCanvasContainer_clickOutsideCheck') {
|
e.target instanceof HTMLElement &&
|
||||||
|
e.target.parentElement?.id !== 'flameGraphCanvasContainer_clickOutsideCheck'
|
||||||
|
) {
|
||||||
setClickedItemData(undefined);
|
setClickedItemData(undefined);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -148,7 +148,7 @@ function diffFlamebearerToDataFrameDTO(levels: number[][], names: string[]) {
|
|||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
const prevNodesInLevel = nodeLevels[i].slice(0, -1);
|
const prevNodesInLevel = nodeLevels[i].slice(0, -1);
|
||||||
const currentNodeStart =
|
const currentNodeStart =
|
||||||
prevNodesInLevel.reduce((acc: number, n: any) => n.offsetTotal + n.valTotal + acc, 0) + node.offsetTotal;
|
prevNodesInLevel.reduce((acc, n) => n.offsetTotal + n.valTotal + acc, 0) + node.offsetTotal;
|
||||||
|
|
||||||
const prevLevel = nodeLevels[i - 1];
|
const prevLevel = nodeLevels[i - 1];
|
||||||
let prevLevelOffset = 0;
|
let prevLevelOffset = 0;
|
||||||
|
@ -12,7 +12,7 @@ describe('Worldmap Migrations', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('simple worldmap', () => {
|
it('simple worldmap', () => {
|
||||||
const old: any = {
|
const old = {
|
||||||
angular: simpleWorldmapConfig,
|
angular: simpleWorldmapConfig,
|
||||||
};
|
};
|
||||||
const panel = {} as PanelModel;
|
const panel = {} as PanelModel;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { PanelModel, FieldConfigSource, DataQuery } from '@grafana/data';
|
import { PanelModel, DataQuery } from '@grafana/data';
|
||||||
|
|
||||||
import { graphPanelMigrationHandler } from './GraphMigrations';
|
import { graphPanelMigrationHandler } from './GraphMigrations';
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ describe('Graph Panel Migrations', () => {
|
|||||||
} as Omit<PanelModel, 'fieldConfig'>;
|
} as Omit<PanelModel, 'fieldConfig'>;
|
||||||
|
|
||||||
const result = graphPanelMigrationHandler(panel as PanelModel);
|
const result = graphPanelMigrationHandler(panel as PanelModel);
|
||||||
const fieldSource = (panel as any).fieldConfig as FieldConfigSource;
|
const fieldSource = (panel as PanelModel).fieldConfig;
|
||||||
|
|
||||||
expect(result.dataLinks).toBeUndefined();
|
expect(result.dataLinks).toBeUndefined();
|
||||||
expect(fieldSource.defaults.links).toHaveLength(1);
|
expect(fieldSource.defaults.links).toHaveLength(1);
|
||||||
@ -145,7 +145,7 @@ describe('Graph Panel Migrations', () => {
|
|||||||
} as unknown as PanelModel;
|
} as unknown as PanelModel;
|
||||||
|
|
||||||
graphPanelMigrationHandler(panel as PanelModel);
|
graphPanelMigrationHandler(panel as PanelModel);
|
||||||
const fieldConfig = (panel as any).fieldConfig as FieldConfigSource;
|
const fieldConfig = (panel as PanelModel).fieldConfig;
|
||||||
expect(fieldConfig.defaults.links).toHaveLength(1);
|
expect(fieldConfig.defaults.links).toHaveLength(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,7 @@ import { convertValuesToHistogram, getSeriesValues } from '../histogram';
|
|||||||
|
|
||||||
describe('Graph Histogam Converter', () => {
|
describe('Graph Histogam Converter', () => {
|
||||||
describe('Values to histogram converter', () => {
|
describe('Values to histogram converter', () => {
|
||||||
let values: any;
|
let values: number[];
|
||||||
let bucketSize = 10;
|
let bucketSize = 10;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -9,12 +9,12 @@ import { ColumnRender } from '../types';
|
|||||||
|
|
||||||
const utc: TimeZone = 'utc';
|
const utc: TimeZone = 'utc';
|
||||||
|
|
||||||
const sanitize = (value: any): string => {
|
const sanitize = (): string => {
|
||||||
return 'sanitized';
|
return 'sanitized';
|
||||||
};
|
};
|
||||||
|
|
||||||
const templateSrv = {
|
const templateSrv = {
|
||||||
replace: (value: any, scopedVars: ScopedVars) => {
|
replace: (value: string, scopedVars: ScopedVars) => {
|
||||||
if (scopedVars) {
|
if (scopedVars) {
|
||||||
// For testing variables replacement in link
|
// For testing variables replacement in link
|
||||||
each(scopedVars, (val, key) => {
|
each(scopedVars, (val, key) => {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
import TableModel from 'app/core/TableModel';
|
||||||
|
|
||||||
import { tableDataFormatFilterer, timeSeriesFormatFilterer, transformDataToTable, transformers } from '../transformers';
|
import { tableDataFormatFilterer, timeSeriesFormatFilterer, transformDataToTable, transformers } from '../transformers';
|
||||||
|
|
||||||
describe('when transforming time series table', () => {
|
describe('when transforming time series table', () => {
|
||||||
let table: any;
|
let table: TableModel;
|
||||||
|
|
||||||
describe('given 2 time series', () => {
|
describe('given 2 time series', () => {
|
||||||
const time = new Date().getTime();
|
const time = new Date().getTime();
|
||||||
@ -419,7 +421,7 @@ describe('when transforming time series table', () => {
|
|||||||
describe('timeSeriesFormatFilterer', () => {
|
describe('timeSeriesFormatFilterer', () => {
|
||||||
describe('when called with an object that contains datapoints property', () => {
|
describe('when called with an object that contains datapoints property', () => {
|
||||||
it('then it should return same object in array', () => {
|
it('then it should return same object in array', () => {
|
||||||
const data: any = { datapoints: [] };
|
const data = { datapoints: [] };
|
||||||
|
|
||||||
const result = timeSeriesFormatFilterer(data);
|
const result = timeSeriesFormatFilterer(data);
|
||||||
|
|
||||||
@ -429,7 +431,7 @@ describe('timeSeriesFormatFilterer', () => {
|
|||||||
|
|
||||||
describe('when called with an object that does not contain datapoints property', () => {
|
describe('when called with an object that does not contain datapoints property', () => {
|
||||||
it('then it should return empty array', () => {
|
it('then it should return empty array', () => {
|
||||||
const data: any = { prop: [] };
|
const data = { prop: [] };
|
||||||
|
|
||||||
const result = timeSeriesFormatFilterer(data);
|
const result = timeSeriesFormatFilterer(data);
|
||||||
|
|
||||||
@ -440,7 +442,7 @@ describe('timeSeriesFormatFilterer', () => {
|
|||||||
describe('when called with an array of series with both timeseries and table data', () => {
|
describe('when called with an array of series with both timeseries and table data', () => {
|
||||||
it('then it should return an array with timeseries', () => {
|
it('then it should return an array with timeseries', () => {
|
||||||
const time = new Date().getTime();
|
const time = new Date().getTime();
|
||||||
const data: any[] = [
|
const data = [
|
||||||
{
|
{
|
||||||
target: 'series1',
|
target: 'series1',
|
||||||
datapoints: [
|
datapoints: [
|
||||||
@ -484,7 +486,7 @@ describe('timeSeriesFormatFilterer', () => {
|
|||||||
describe('tableDataFormatFilterer', () => {
|
describe('tableDataFormatFilterer', () => {
|
||||||
describe('when called with an object that contains columns property', () => {
|
describe('when called with an object that contains columns property', () => {
|
||||||
it('then it should return same object in array', () => {
|
it('then it should return same object in array', () => {
|
||||||
const data: any = { columns: [] };
|
const data = { columns: [] };
|
||||||
|
|
||||||
const result = tableDataFormatFilterer(data);
|
const result = tableDataFormatFilterer(data);
|
||||||
|
|
||||||
@ -494,7 +496,7 @@ describe('tableDataFormatFilterer', () => {
|
|||||||
|
|
||||||
describe('when called with an object that does not contain columns property', () => {
|
describe('when called with an object that does not contain columns property', () => {
|
||||||
it('then it should return empty array', () => {
|
it('then it should return empty array', () => {
|
||||||
const data: any = { prop: [] };
|
const data = { prop: [] };
|
||||||
|
|
||||||
const result = tableDataFormatFilterer(data);
|
const result = tableDataFormatFilterer(data);
|
||||||
|
|
||||||
@ -505,7 +507,7 @@ describe('tableDataFormatFilterer', () => {
|
|||||||
describe('when called with an array of series with both timeseries and table data', () => {
|
describe('when called with an array of series with both timeseries and table data', () => {
|
||||||
it('then it should return an array with table data', () => {
|
it('then it should return an array with table data', () => {
|
||||||
const time = new Date().getTime();
|
const time = new Date().getTime();
|
||||||
const data: any[] = [
|
const data = [
|
||||||
{
|
{
|
||||||
target: 'series1',
|
target: 'series1',
|
||||||
datapoints: [
|
datapoints: [
|
||||||
|
Loading…
Reference in New Issue
Block a user