mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Type improvements (#93267)
* some type fixes + ignore graveyard folder * few more fixes * remove comment * ignore global styles * few more type fixes
This commit is contained in:
parent
3514504240
commit
161d452841
@ -44,9 +44,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/dimensions.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/processDataFrame.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -73,9 +70,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "19"]
|
||||
],
|
||||
"packages/grafana-data/src/datetime/datemath.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/datetime/durationutil.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -91,32 +86,22 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "8"]
|
||||
],
|
||||
"packages/grafana-data/src/events/EventBus.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/events/types.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.", "2"]
|
||||
],
|
||||
"packages/grafana-data/src/field/displayProcessor.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"packages/grafana-data/src/field/fieldState.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/field/overrides/processors.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.", "4"]
|
||||
],
|
||||
"packages/grafana-data/src/field/standardFieldConfigEditorRegistry.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -128,8 +113,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
||||
],
|
||||
"packages/grafana-data/src/geo/layer.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.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/panel/PanelPlugin.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -159,9 +143,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-data/src/themes/createColors.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/fieldReducer.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/matchers/valueMatchers/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -172,9 +153,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-data/src/transformations/transformDataFrame.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/transformers/joinDataFrames.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/transformers/nulls/nullInsertThreshold.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -959,48 +937,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/Graph/Graph.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/Graph/GraphContextMenu.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/Graph/utils.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/GraphNG/GraphNG.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "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, "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.", "7"],
|
||||
[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.", "10"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "11"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/GraphNG/hooks.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/GraphNG/nullInsertThreshold.ts:5381": [
|
||||
[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.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/GraphNG/nullToUndefThreshold.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, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"packages/grafana-ui/src/graveyard/TimeSeries/utils.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"]
|
||||
],
|
||||
"packages/grafana-ui/src/options/builder/hideSeries.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -1225,10 +1161,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/core/components/TagFilter/TagFilter.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"]
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"]
|
||||
],
|
||||
"public/app/core/components/TimeSeries/utils.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -2784,10 +2717,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"]
|
||||
],
|
||||
"public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.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/features/dashboard-scene/saving/SaveDashboardAsForm.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
|
||||
@ -2824,9 +2753,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard-scene/scene/DashboardControls.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard-scene/scene/NavToolbarActions.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
|
||||
@ -2863,28 +2789,10 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard-scene/serialization/buildNewDashboardSaveModel.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard-scene/serialization/transformSaveModelToScene.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"]
|
||||
],
|
||||
"public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.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"],
|
||||
[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.", "2"]
|
||||
],
|
||||
"public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -3196,16 +3104,14 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/features/dashboard/components/PanelEditor/utils.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, "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.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"public/app/features/dashboard/components/PublicDashboardNotAvailable/PublicDashboardNotAvailable.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
|
||||
@ -3244,21 +3150,17 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "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", "2"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "5"]
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "2"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/forms/SaveProvisionedDashboardForm.tsx:5381": [
|
||||
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"],
|
||||
@ -3271,9 +3173,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "7"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "8"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -3365,9 +3264,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard/containers/SoloPanelPage.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/dashgrid/SeriesVisibilityConfigFactory.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -3754,8 +3650,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "7"]
|
||||
],
|
||||
"public/app/features/dimensions/scale.ts: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.", "0"]
|
||||
],
|
||||
"public/app/features/dimensions/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -4775,10 +4670,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/panel/panellinks/link_srv.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.", "0"]
|
||||
],
|
||||
"public/app/features/playlist/PlaylistForm.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
||||
@ -4971,15 +4863,9 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "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, "Do not use any type assertions.", "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, "Do not use any type assertions.", "12"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "6"]
|
||||
],
|
||||
"public/app/features/plugins/extensions/usePluginComponents.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -7497,65 +7383,6 @@ exports[`no gf-form usage`] = {
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
|
||||
],
|
||||
"packages/grafana-ui/src/themes/GlobalStyles/forms.ts:5381": [
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
|
||||
],
|
||||
"packages/grafana-ui/src/themes/GlobalStyles/legacySelect.ts:5381": [
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
|
||||
],
|
||||
"public/app/angular/components/PageHeader/PageHeader.tsx:5381": [
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"],
|
||||
[0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"]
|
||||
|
14
.betterer.ts
14
.betterer.ts
@ -7,9 +7,10 @@ import { glob } from 'glob';
|
||||
// Why are we ignoring these?
|
||||
// They're all deprecated/being removed so doesn't make sense to fix types
|
||||
const eslintPathsToIgnore = [
|
||||
'public/app/angular', // will be removed in Grafana 11
|
||||
'public/app/plugins/panel/graph', // will be removed alongside angular
|
||||
'public/app/plugins/panel/table-old', // will be removed alongside angular
|
||||
'packages/grafana-ui/src/graveyard', // will be removed alongside angular in Grafana 12
|
||||
'public/app/angular', // will be removed in Grafana 12
|
||||
'public/app/plugins/panel/graph', // will be removed alongside angular in Grafana 12
|
||||
'public/app/plugins/panel/table-old', // will be removed alongside angular in Grafana 12
|
||||
'e2e/test-plugins',
|
||||
];
|
||||
|
||||
@ -21,10 +22,9 @@ export default {
|
||||
.exclude(new RegExp(eslintPathsToIgnore.join('|'))),
|
||||
'no undocumented stories': () => countUndocumentedStories().include('**/!(*.internal).story.tsx'),
|
||||
'no gf-form usage': () =>
|
||||
regexp(
|
||||
/gf-form/gm,
|
||||
'gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.'
|
||||
).include('**/*.{ts,tsx,html}'),
|
||||
regexp(/gf-form/gm, 'gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.')
|
||||
.include('**/*.{ts,tsx,html}')
|
||||
.exclude(new RegExp('packages/grafana-ui/src/themes/GlobalStyles')),
|
||||
};
|
||||
|
||||
function countUndocumentedStories() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { KeyValue } from '../types/data';
|
||||
import { Field } from '../types/dataFrame';
|
||||
|
||||
export interface Dimension<T = any> {
|
||||
export interface Dimension<T = unknown> {
|
||||
// Name of the dimension
|
||||
name: string;
|
||||
// Collection of fields representing dimension
|
||||
@ -12,28 +12,28 @@ export interface Dimension<T = any> {
|
||||
columns: Array<Field<T>>;
|
||||
}
|
||||
|
||||
export type Dimensions = KeyValue<Dimension>;
|
||||
export type Dimensions<T = unknown> = KeyValue<Dimension<T>>;
|
||||
|
||||
export const createDimension = (name: string, columns: Field[]): Dimension => {
|
||||
export const createDimension = <T>(name: string, columns: Array<Field<T>>): Dimension<T> => {
|
||||
return {
|
||||
name,
|
||||
columns,
|
||||
};
|
||||
};
|
||||
|
||||
export const getColumnsFromDimension = (dimension: Dimension) => {
|
||||
export const getColumnsFromDimension = <T>(dimension: Dimension<T>) => {
|
||||
return dimension.columns;
|
||||
};
|
||||
export const getColumnFromDimension = (dimension: Dimension, column: number) => {
|
||||
export const getColumnFromDimension = <T>(dimension: Dimension<T>, column: number) => {
|
||||
return dimension.columns[column];
|
||||
};
|
||||
|
||||
export const getValueFromDimension = (dimension: Dimension, column: number, row: number) => {
|
||||
export const getValueFromDimension = <T>(dimension: Dimension<T>, column: number, row: number) => {
|
||||
return dimension.columns[column].values[row];
|
||||
};
|
||||
|
||||
export const getAllValuesFromDimension = (dimension: Dimension, column: number, row: number) => {
|
||||
export const getAllValuesFromDimension = <T>(dimension: Dimension<T>, column: number, row: number) => {
|
||||
return dimension.columns.map((c) => c.values[row]);
|
||||
};
|
||||
|
||||
export const getDimensionByName = (dimensions: Dimensions, name: string) => dimensions[name];
|
||||
export const getDimensionByName = <T>(dimensions: Dimensions<T>, name: string) => dimensions[name];
|
||||
|
@ -2,7 +2,15 @@ import { includes, isDate } from 'lodash';
|
||||
|
||||
import { TimeZone } from '../types/time';
|
||||
|
||||
import { DateTime, dateTime, dateTimeForTimeZone, DurationUnit, isDateTime, ISO_8601 } from './moment_wrapper';
|
||||
import {
|
||||
DateTime,
|
||||
dateTime,
|
||||
dateTimeAsMoment,
|
||||
dateTimeForTimeZone,
|
||||
DurationUnit,
|
||||
isDateTime,
|
||||
ISO_8601,
|
||||
} from './moment_wrapper';
|
||||
|
||||
const units: DurationUnit[] = ['y', 'M', 'w', 'd', 'h', 'm', 's', 'Q'];
|
||||
|
||||
@ -51,10 +59,10 @@ export function parse(
|
||||
// We got some non string which is not a moment nor Date. TS should be able to check for that but not always.
|
||||
return undefined;
|
||||
} else {
|
||||
let time;
|
||||
let time: DateTime;
|
||||
let mathString = '';
|
||||
let index;
|
||||
let parseString;
|
||||
let index = -1;
|
||||
let parseString = '';
|
||||
|
||||
if (text.substring(0, 3) === 'now') {
|
||||
time = dateTimeForTimeZone(timezone);
|
||||
@ -104,10 +112,9 @@ export function isValid(text: string | DateTime): boolean {
|
||||
* @param time
|
||||
* @param roundUp If true it will round the time to endOf time unit, otherwise to startOf time unit.
|
||||
*/
|
||||
// TODO: Had to revert Andrejs `time: moment.Moment` to `time: any`
|
||||
export function parseDateMath(
|
||||
mathString: string,
|
||||
time: any,
|
||||
time: DateTime,
|
||||
roundUp?: boolean,
|
||||
fiscalYearStartMonth = 0
|
||||
): DateTime | undefined {
|
||||
@ -187,21 +194,21 @@ export function parseDateMath(
|
||||
return result;
|
||||
}
|
||||
|
||||
export function roundToFiscal(fyStartMonth: number, dateTime: any, unit: string, roundUp: boolean | undefined) {
|
||||
export function roundToFiscal(fyStartMonth: number, dateTime: DateTime, unit: string, roundUp: boolean | undefined) {
|
||||
switch (unit) {
|
||||
case 'y':
|
||||
if (roundUp) {
|
||||
roundToFiscal(fyStartMonth, dateTime, unit, false).add(11, 'M').endOf('M');
|
||||
roundToFiscal(fyStartMonth, dateTime, unit, false)?.add(11, 'M').endOf('M');
|
||||
} else {
|
||||
dateTime.subtract((dateTime.month() - fyStartMonth + 12) % 12, 'M').startOf('M');
|
||||
dateTime.subtract((dateTimeAsMoment(dateTime).month() - fyStartMonth + 12) % 12, 'M').startOf('M');
|
||||
}
|
||||
return dateTime;
|
||||
case 'Q':
|
||||
if (roundUp) {
|
||||
roundToFiscal(fyStartMonth, dateTime, unit, false).add(2, 'M').endOf('M');
|
||||
roundToFiscal(fyStartMonth, dateTime, unit, false)?.add(2, 'M').endOf('M');
|
||||
} else {
|
||||
// why + 12? to ensure this number is always a positive offset from fyStartMonth
|
||||
dateTime.subtract((dateTime.month() - fyStartMonth + 12) % 3, 'M').startOf('M');
|
||||
dateTime.subtract((dateTimeAsMoment(dateTime).month() - fyStartMonth + 12) % 3, 'M').startOf('M');
|
||||
}
|
||||
return dateTime;
|
||||
default:
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { IScope } from 'angular';
|
||||
import EventEmitter from 'eventemitter3';
|
||||
import { Unsubscribable, Observable, Subscriber } from 'rxjs';
|
||||
import { filter } from 'rxjs/operators';
|
||||
@ -55,7 +56,7 @@ export class EventBusSrv implements EventBus, LegacyEmitter {
|
||||
/**
|
||||
* Legacy functions
|
||||
*/
|
||||
emit<T>(event: AppEvent<T> | string, payload?: T | any): void {
|
||||
emit<T>(event: AppEvent<T> | string, payload?: T): void {
|
||||
// console.log(`Deprecated emitter function used (emit), use $emit`);
|
||||
|
||||
if (typeof event === 'string') {
|
||||
@ -65,7 +66,7 @@ export class EventBusSrv implements EventBus, LegacyEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
on<T>(event: AppEvent<T> | string, handler: LegacyEventHandler<T>, scope?: any) {
|
||||
on<T>(event: AppEvent<T> | string, handler: LegacyEventHandler<T>, scope?: IScope) {
|
||||
// console.log(`Deprecated emitter function used (on), use $on`);
|
||||
|
||||
// need this wrapper to make old events compatible with old handlers
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { IScope } from 'angular';
|
||||
import { Unsubscribable, Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
@ -128,12 +129,12 @@ export interface LegacyEmitter {
|
||||
/**
|
||||
* @deprecated use $on
|
||||
*/
|
||||
on<T>(event: AppEvent<T> | string, handler: LegacyEventHandler<T>, scope?: any): void;
|
||||
on<T>(event: AppEvent<T> | string, handler: LegacyEventHandler<T>, scope?: IScope): void;
|
||||
|
||||
/**
|
||||
* @deprecated use $on
|
||||
*/
|
||||
off<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void): void;
|
||||
off<T>(event: AppEvent<T> | string, handler: (payload?: T) => void): void;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
|
@ -64,7 +64,7 @@ export function cacheFieldDisplayNames(frames: DataFrame[]) {
|
||||
* moves each field's config.custom.hideFrom to field.state.hideFrom
|
||||
* and mutates orgiginal field.config.custom.hideFrom to one with explicit overrides only, (without the ad-hoc stateful __system override from legend toggle)
|
||||
*/
|
||||
export function decoupleHideFromState(frames: DataFrame[], fieldConfig: FieldConfigSource<any>) {
|
||||
export function decoupleHideFromState(frames: DataFrame[], fieldConfig: FieldConfigSource) {
|
||||
frames.forEach((frame) => {
|
||||
frame.fields.forEach((field) => {
|
||||
const hideFrom = {
|
||||
|
@ -19,7 +19,7 @@ export interface NumberFieldConfigSettings {
|
||||
}
|
||||
|
||||
export const numberOverrideProcessor = (
|
||||
value: any,
|
||||
value: unknown,
|
||||
context: FieldOverrideContext,
|
||||
settings?: NumberFieldConfigSettings
|
||||
) => {
|
||||
@ -27,7 +27,7 @@ export const numberOverrideProcessor = (
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return parseFloat(value);
|
||||
return parseFloat(String(value));
|
||||
};
|
||||
|
||||
export const displayNameOverrideProcessor = (
|
||||
|
@ -42,7 +42,7 @@ export interface MapLayerHandler<TConfig = any> {
|
||||
*/
|
||||
registerOptionsUI?: (
|
||||
builder: PanelOptionsEditorBuilder<MapLayerOptions<TConfig>>,
|
||||
context: StandardEditorContext<any>
|
||||
context: StandardEditorContext<MapLayerOptions<TConfig>>
|
||||
) => void;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ const buildPercentileReducers = (percentiles = [...Array.from({ length: 99 }, (_
|
||||
|
||||
percentiles.forEach((p) => {
|
||||
const percentile = p / 100;
|
||||
const id = `p${p}` as ReducerID;
|
||||
const id = `p${p}`;
|
||||
const name = `${p}${nth(p)} %`;
|
||||
const description = `${p}${nth(p)} percentile value`;
|
||||
|
||||
|
@ -546,7 +546,7 @@ export function join(tables: AlignedData[], nullModes?: number[][], mode: JoinMo
|
||||
|
||||
// Test a few samples to see if the values are ascending
|
||||
// Only exported for tests
|
||||
export function isLikelyAscendingVector(data: any[], samples = 50) {
|
||||
export function isLikelyAscendingVector(data: unknown[], samples = 50) {
|
||||
const len = data.length;
|
||||
|
||||
// empty or single value
|
||||
@ -576,7 +576,7 @@ export function isLikelyAscendingVector(data: any[], samples = 50) {
|
||||
for (let prevVal = data[firstIdx], i = firstIdx + stride; i <= lastIdx; i += stride) {
|
||||
const v = data[i];
|
||||
|
||||
if (v != null) {
|
||||
if (v != null && prevVal != null) {
|
||||
if (v <= prevVal) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { css } from '@emotion/css';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { components, MultiValueRemoveProps } from 'react-select';
|
||||
|
||||
import { escapeStringForRegex, GrafanaTheme2 } from '@grafana/data';
|
||||
import { escapeStringForRegex, GrafanaTheme2, SelectableValue } from '@grafana/data';
|
||||
import { Icon, MultiSelect, useStyles2 } from '@grafana/ui';
|
||||
import { t } from 'app/core/internationalization';
|
||||
|
||||
@ -28,9 +28,9 @@ export interface Props {
|
||||
width?: number;
|
||||
}
|
||||
|
||||
const filterOption = (option: any, searchQuery: string) => {
|
||||
const filterOption = (option: SelectableValue<string>, searchQuery: string) => {
|
||||
const regex = RegExp(escapeStringForRegex(searchQuery), 'i');
|
||||
return regex.test(option.value);
|
||||
return Boolean(option.value && regex.test(option.value));
|
||||
};
|
||||
|
||||
export const TagFilter = ({
|
||||
@ -124,8 +124,8 @@ export const TagFilter = ({
|
||||
formatCreateLabel,
|
||||
defaultOptions: true,
|
||||
filterOption,
|
||||
getOptionLabel: (i: any) => i.label,
|
||||
getOptionValue: (i: any) => i.value,
|
||||
getOptionLabel: (i: SelectableValue<string>) => i.label,
|
||||
getOptionValue: (i: SelectableValue<string>) => i.value,
|
||||
inputId,
|
||||
isMulti: true,
|
||||
onChange: onTagChange,
|
||||
|
@ -25,11 +25,11 @@ describe('DashboardSceneChangeTracker', () => {
|
||||
() =>
|
||||
({
|
||||
terminate,
|
||||
}) as any
|
||||
}) as unknown as CorsWorker
|
||||
);
|
||||
const changeTracker = new DashboardSceneChangeTracker({
|
||||
subscribeToEvent: jest.fn().mockReturnValue({ unsubscribe: jest.fn() }),
|
||||
} as any);
|
||||
} as unknown as DashboardScene);
|
||||
changeTracker.startTrackingChanges();
|
||||
|
||||
expect(changeTracker['_changesWorker']).not.toBeUndefined();
|
||||
|
@ -28,7 +28,7 @@ jest.mock('app/features/playlist/PlaylistSrv', () => ({
|
||||
}));
|
||||
|
||||
jest.mock('@grafana/runtime', () => ({
|
||||
...jest.requireActual<Record<string, any>>('@grafana/runtime'),
|
||||
...jest.requireActual('@grafana/runtime'),
|
||||
getDataSourceSrv: () => ({
|
||||
get: jest.fn(),
|
||||
getInstanceSettings: jest.fn().mockReturnValue({
|
||||
|
@ -746,7 +746,10 @@ describe('transformSaveModelToScene', () => {
|
||||
|
||||
describe('Repeating rows', () => {
|
||||
it('Should build correct scene model', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({
|
||||
dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO,
|
||||
meta: {},
|
||||
});
|
||||
const body = scene.state.body as SceneGridLayout;
|
||||
const row2 = body.state.children[1] as SceneGridRow;
|
||||
|
||||
@ -762,7 +765,7 @@ describe('transformSaveModelToScene', () => {
|
||||
|
||||
describe('Annotation queries', () => {
|
||||
it('Should build correct scene model', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} });
|
||||
|
||||
expect(scene.state.$data).toBeInstanceOf(DashboardDataLayerSet);
|
||||
expect(scene.state.controls!.state.variableControls[1]).toBeInstanceOf(SceneDataLayerControls);
|
||||
@ -790,7 +793,7 @@ describe('transformSaveModelToScene', () => {
|
||||
describe('Alerting data layer', () => {
|
||||
it('Should add alert states data layer if unified alerting enabled', () => {
|
||||
config.unifiedAlertingEnabled = true;
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} });
|
||||
|
||||
expect(scene.state.$data).toBeInstanceOf(DashboardDataLayerSet);
|
||||
expect(scene.state.controls!.state.variableControls[1]).toBeInstanceOf(SceneDataLayerControls);
|
||||
@ -803,7 +806,7 @@ describe('transformSaveModelToScene', () => {
|
||||
config.unifiedAlertingEnabled = false;
|
||||
const dashboard = { ...dashboard_to_load1 } as unknown as DashboardDataDTO;
|
||||
dashboard.panels![0].alert = {};
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} });
|
||||
|
||||
expect(scene.state.$data).toBeInstanceOf(DashboardDataLayerSet);
|
||||
expect(scene.state.controls!.state.variableControls[1]).toBeInstanceOf(SceneDataLayerControls);
|
||||
|
@ -28,6 +28,7 @@ import { PanelModel } from 'app/features/dashboard/state';
|
||||
import { getTimeRange } from 'app/features/dashboard/utils/timeRange';
|
||||
import { reduceTransformRegistryItem } from 'app/features/transformers/editors/ReduceTransformerEditor';
|
||||
import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard';
|
||||
import { DashboardDataDTO } from 'app/types';
|
||||
|
||||
import { buildPanelEditScene } from '../panel-edit/PanelEditor';
|
||||
import { DashboardDataLayerSet } from '../scene/DashboardDataLayerSet';
|
||||
@ -192,7 +193,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
},
|
||||
links: [{ ...NEW_LINK, title: 'Link 1' }],
|
||||
};
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboardWithCustomSettings as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboardWithCustomSettings as DashboardDataDTO, meta: {} });
|
||||
const saveModel = transformSceneToSaveModel(scene);
|
||||
|
||||
expect(saveModel).toMatchSnapshot();
|
||||
@ -201,7 +202,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
|
||||
describe('Given a simple scene with variables', () => {
|
||||
it('Should transform back to persisted model', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} });
|
||||
const saveModel = transformSceneToSaveModel(scene);
|
||||
|
||||
expect(saveModel).toMatchSnapshot();
|
||||
@ -210,7 +211,10 @@ describe('transformSceneToSaveModel', () => {
|
||||
|
||||
describe('Given a scene with rows', () => {
|
||||
it('Should transform back to persisted model', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({
|
||||
dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO,
|
||||
meta: {},
|
||||
});
|
||||
|
||||
const saveModel = transformSceneToSaveModel(scene);
|
||||
|
||||
@ -222,7 +226,10 @@ describe('transformSceneToSaveModel', () => {
|
||||
});
|
||||
|
||||
it('Should remove repeated rows in save model', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({
|
||||
dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO,
|
||||
meta: {},
|
||||
});
|
||||
|
||||
const variable = scene.state.$variables?.state.variables[0] as MultiValueVariable;
|
||||
variable.changeValueTo(['a', 'b', 'c']);
|
||||
@ -427,7 +434,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
|
||||
describe('Annotations', () => {
|
||||
it('should transform annotations to save model', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} });
|
||||
const saveModel = transformSceneToSaveModel(scene);
|
||||
|
||||
expect(saveModel.annotations?.list?.length).toBe(4);
|
||||
@ -435,7 +442,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
});
|
||||
|
||||
it('should transform annotations to save model after state changes', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} });
|
||||
|
||||
const layers = (scene.state.$data as DashboardDataLayerSet)?.state.annotationLayers;
|
||||
const enabledLayer = layers[1];
|
||||
@ -678,7 +685,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
});
|
||||
|
||||
it('attaches snapshot data to panels using Grafana snapshot query', async () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as DashboardDataDTO, meta: {} });
|
||||
|
||||
activateFullSceneTree(scene);
|
||||
|
||||
@ -733,7 +740,10 @@ describe('transformSceneToSaveModel', () => {
|
||||
});
|
||||
|
||||
it('handles basic rows', async () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableWithRowsDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({
|
||||
dashboard: snapshotableWithRowsDashboardJson as DashboardDataDTO,
|
||||
meta: {},
|
||||
});
|
||||
|
||||
activateFullSceneTree(scene);
|
||||
|
||||
@ -940,7 +950,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
let snapshot: Dashboard = {} as Dashboard;
|
||||
|
||||
beforeEach(() => {
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as DashboardDataDTO, meta: {} });
|
||||
activateFullSceneTree(scene);
|
||||
snapshot = transformSceneToSaveModel(scene, true);
|
||||
});
|
||||
@ -1004,7 +1014,7 @@ describe('transformSceneToSaveModel', () => {
|
||||
});
|
||||
|
||||
it('should remove links', async () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as DashboardDataDTO, meta: {} });
|
||||
activateFullSceneTree(scene);
|
||||
const snapshot = transformSceneToSaveModel(scene, true);
|
||||
expect(snapshot.links?.length).toBe(1);
|
||||
@ -1104,7 +1114,10 @@ describe('transformSceneToSaveModel', () => {
|
||||
|
||||
describe('Given a scene with repeated panels and non-repeated panels', () => {
|
||||
it('should save repeated panels itemHeight as height', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({
|
||||
dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO,
|
||||
meta: {},
|
||||
});
|
||||
const gridItem = sceneGraph.findByKey(scene, 'grid-item-2') as DashboardGridItem;
|
||||
expect(gridItem).toBeInstanceOf(DashboardGridItem);
|
||||
expect(gridItem.state.height).toBe(10);
|
||||
@ -1117,7 +1130,10 @@ describe('transformSceneToSaveModel', () => {
|
||||
});
|
||||
|
||||
it('should not save non-repeated panels itemHeight as height', () => {
|
||||
const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} });
|
||||
const scene = transformSaveModelToScene({
|
||||
dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO,
|
||||
meta: {},
|
||||
});
|
||||
const gridItem = sceneGraph.findByKey(scene, 'grid-item-15') as DashboardGridItem;
|
||||
expect(gridItem).toBeInstanceOf(DashboardGridItem);
|
||||
expect(gridItem.state.height).toBe(2);
|
||||
|
@ -135,7 +135,7 @@ export function getVisualizationOptions(props: OptionPaneRenderProps): OptionsPa
|
||||
description: fieldOption.description,
|
||||
overrides: getOptionOverrides(fieldOption, currentFieldConfig, data?.series),
|
||||
render: function renderEditor() {
|
||||
const onChange = (v: any) => {
|
||||
const onChange = (v: unknown) => {
|
||||
onFieldConfigsChange(
|
||||
updateDefaultFieldConfigValue(currentFieldConfig, fieldOption.path, v, fieldOption.isCustom)
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ export function supportsDataQuery(plugin: PanelPlugin | undefined | null): boole
|
||||
export const updateDefaultFieldConfigValue = (
|
||||
config: FieldConfigSource,
|
||||
name: string,
|
||||
value: any,
|
||||
value: unknown,
|
||||
isCustom?: boolean
|
||||
) => {
|
||||
let defaults = { ...config.defaults };
|
||||
|
@ -3,6 +3,7 @@ import userEvent from '@testing-library/user-event';
|
||||
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
import * as api from 'app/features/manage-dashboards/state/actions';
|
||||
import { SaveDashboardResponseDTO } from 'app/types';
|
||||
|
||||
import { SaveDashboardAsForm, SaveDashboardAsFormProps } from './SaveDashboardAsForm';
|
||||
|
||||
@ -16,7 +17,7 @@ jest.mock('app/features/manage-dashboards/services/ValidationSrv', () => ({
|
||||
|
||||
jest.spyOn(api, 'searchFolders').mockResolvedValue([]);
|
||||
|
||||
const prepareDashboardMock = (panel: any) => {
|
||||
const prepareDashboardMock = (panel: object) => {
|
||||
const json = {
|
||||
title: 'name',
|
||||
panels: [panel],
|
||||
@ -43,7 +44,7 @@ const renderAndSubmitForm = async (
|
||||
onSuccess={() => {}}
|
||||
onSubmit={async (jsonModel) => {
|
||||
submitSpy(jsonModel);
|
||||
return {};
|
||||
return {} as SaveDashboardResponseDTO;
|
||||
}}
|
||||
{...otherProps}
|
||||
/>
|
||||
|
@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
import { createDashboardModelFixture } from 'app/features/dashboard/state/__fixtures__/dashboardFixtures';
|
||||
import { SaveDashboardResponseDTO } from 'app/types';
|
||||
|
||||
import { SaveDashboardOptions } from '../types';
|
||||
|
||||
@ -41,7 +42,7 @@ const renderAndSubmitForm = async (dashboard: DashboardModel, submitSpy: jest.Mo
|
||||
onSuccess={() => {}}
|
||||
onSubmit={async (jsonModel) => {
|
||||
submitSpy(jsonModel);
|
||||
return { status: 'success' };
|
||||
return { status: 'success' } as SaveDashboardResponseDTO;
|
||||
}}
|
||||
saveModel={{
|
||||
clone: dashboard.getSaveModelClone(),
|
||||
@ -69,7 +70,7 @@ describe('SaveDashboardAsForm', () => {
|
||||
onCancel={() => {}}
|
||||
onSuccess={() => {}}
|
||||
onSubmit={async () => {
|
||||
return {};
|
||||
return {} as SaveDashboardResponseDTO;
|
||||
}}
|
||||
saveModel={{
|
||||
clone: { id: 1, schemaVersion: 3 },
|
||||
@ -132,7 +133,7 @@ describe('SaveDashboardAsForm', () => {
|
||||
onCancel={() => {}}
|
||||
onSuccess={() => {}}
|
||||
onSubmit={async () => {
|
||||
return {};
|
||||
return {} as SaveDashboardResponseDTO;
|
||||
}}
|
||||
saveModel={{
|
||||
clone: createDashboardModelFixture().getSaveModelClone(),
|
||||
|
@ -7,6 +7,7 @@ import { config } from '@grafana/runtime';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import { Button, Checkbox, TextArea, useStyles2, Stack } from '@grafana/ui';
|
||||
import { DashboardModel } from 'app/features/dashboard/state';
|
||||
import { SaveDashboardResponseDTO } from 'app/types';
|
||||
|
||||
import { GenAIDashboardChangesButton } from '../../GenAI/GenAIDashboardChangesButton';
|
||||
import { SaveDashboardData, SaveDashboardOptions } from '../types';
|
||||
@ -17,7 +18,11 @@ export type SaveProps = {
|
||||
saveModel: SaveDashboardData; // already cloned
|
||||
onCancel: () => void;
|
||||
onSuccess: () => void;
|
||||
onSubmit?: (saveModel: Dashboard, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise<any>;
|
||||
onSubmit?: (
|
||||
saveModel: Dashboard,
|
||||
options: SaveDashboardOptions,
|
||||
dashboard: DashboardModel
|
||||
) => Promise<SaveDashboardResponseDTO>;
|
||||
options: SaveDashboardOptions;
|
||||
onOptionsChange: (opts: SaveDashboardOptions) => void;
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ import { Dashboard } from '@grafana/schema';
|
||||
import { ObjectMeta } from 'app/features/apiserver/types';
|
||||
import { CloneOptions, DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||
import { Diffs } from 'app/features/dashboard-scene/settings/version-history/utils';
|
||||
import { SaveDashboardResponseDTO } from 'app/types';
|
||||
|
||||
export interface SaveDashboardData {
|
||||
clone: Dashboard; // cloned copy
|
||||
@ -33,7 +34,11 @@ export interface SaveDashboardFormProps {
|
||||
isLoading: boolean;
|
||||
onCancel: () => void;
|
||||
onSuccess: () => void;
|
||||
onSubmit?: (saveModel: Dashboard, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise<any>;
|
||||
onSubmit?: (
|
||||
saveModel: Dashboard,
|
||||
options: SaveDashboardOptions,
|
||||
dashboard: DashboardModel
|
||||
) => Promise<SaveDashboardResponseDTO>;
|
||||
}
|
||||
|
||||
export interface SaveDashboardModalProps {
|
||||
|
@ -379,7 +379,7 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
||||
this.setState(stateUpdate);
|
||||
};
|
||||
|
||||
onOptionsChange = (options: any) => {
|
||||
onOptionsChange = (options: object) => {
|
||||
this.props.panel.updateOptions(options);
|
||||
};
|
||||
|
||||
|
@ -94,7 +94,7 @@ export function validateScaleOptions(options?: ScaleDimensionOptions): ScaleDime
|
||||
export function validateScaleConfig(copy: ScaleDimensionConfig, options: ScaleDimensionOptions): ScaleDimensionConfig {
|
||||
let { min, max } = validateScaleOptions(options);
|
||||
if (!copy) {
|
||||
copy = {} as any;
|
||||
copy = {} as ScaleDimensionConfig;
|
||||
}
|
||||
|
||||
if (copy.max == null) {
|
||||
|
@ -719,10 +719,10 @@ function setup(
|
||||
};
|
||||
},
|
||||
getAnchorInfo(link) {
|
||||
return { ...link };
|
||||
return { ...link, href: link.url ?? '' };
|
||||
},
|
||||
getLinkUrl(link) {
|
||||
return link.url;
|
||||
return link.url ?? '';
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -242,12 +242,12 @@ export const getCalculationValueDataLinksVariableSuggestions = (dataFrames: Data
|
||||
|
||||
export interface LinkService {
|
||||
getDataLinkUIModel: <T>(link: DataLink, replaceVariables: InterpolateFunction | undefined, origin: T) => LinkModel<T>;
|
||||
getAnchorInfo: (link: any) => {
|
||||
getAnchorInfo: (link: DashboardLink) => {
|
||||
href: string;
|
||||
title: string;
|
||||
tooltip: string;
|
||||
};
|
||||
getLinkUrl: (link: any) => string;
|
||||
getLinkUrl: (link: DashboardLink) => string;
|
||||
}
|
||||
|
||||
export class LinkSrv implements LinkService {
|
||||
@ -268,7 +268,7 @@ export class LinkSrv implements LinkService {
|
||||
return getConfig().disableSanitizeHtml ? url : textUtil.sanitizeUrl(url);
|
||||
}
|
||||
|
||||
getAnchorInfo(link: any) {
|
||||
getAnchorInfo(link: DashboardLink) {
|
||||
const templateSrv = getTemplateSrv();
|
||||
return {
|
||||
href: this.getLinkUrl(link),
|
||||
|
@ -165,7 +165,7 @@ describe('linkSrv', () => {
|
||||
url: '/graph?home=$home',
|
||||
title: 'Visit home',
|
||||
tooltip: 'Visit ${home:raw}',
|
||||
});
|
||||
} as unknown as DashboardLink);
|
||||
|
||||
expect(linkSrv.getLinkUrl).toBeCalledTimes(1);
|
||||
expect(templateSrv.replace).toBeCalledTimes(3);
|
||||
|
@ -144,7 +144,7 @@ export class DatasourceSrv implements DataSourceService {
|
||||
return this.loadDatasource(nameOrUid);
|
||||
}
|
||||
|
||||
async loadDatasource(key: string): Promise<DataSourceApi<any, any>> {
|
||||
async loadDatasource(key: string): Promise<DataSourceApi> {
|
||||
if (this.datasources[key]) {
|
||||
return Promise.resolve(this.datasources[key]);
|
||||
}
|
||||
@ -164,7 +164,7 @@ export class DatasourceSrv implements DataSourceService {
|
||||
|
||||
// If there is only one constructor argument it is instanceSettings
|
||||
const useAngular = dsPlugin.DataSourceClass.length !== 1;
|
||||
let instance: DataSourceApi<any, any>;
|
||||
let instance: DataSourceApi;
|
||||
|
||||
if (useAngular) {
|
||||
instance = getLegacyAngularInjector().instantiate(dsPlugin.DataSourceClass, {
|
||||
@ -184,7 +184,7 @@ export class DatasourceSrv implements DataSourceService {
|
||||
anyInstance.type = instanceSettings.type;
|
||||
anyInstance.meta = instanceSettings.meta;
|
||||
anyInstance.uid = instanceSettings.uid;
|
||||
(instance as any).getRef = DataSourceApi.prototype.getRef;
|
||||
anyInstance.getRef = DataSourceApi.prototype.getRef;
|
||||
}
|
||||
|
||||
// store in instance cache
|
||||
|
Loading…
Reference in New Issue
Block a user