Chore: improve typings (#87306)
* some fixes * some more fixes * some canvas fixes * use removeProperty instead * few more * fixy fix * undo changes to ticks for now
This commit is contained in:
+14
-79
@@ -696,9 +696,7 @@ exports[`better eslint`] = {
|
|||||||
[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.", "10"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
|
||||||
],
|
],
|
||||||
"packages/grafana-runtime/src/services/pluginExtensions/getPluginExtensions.ts:5381": [
|
"packages/grafana-runtime/src/services/pluginExtensions/getPluginExtensions.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
@@ -1063,12 +1061,7 @@ exports[`better eslint`] = {
|
|||||||
],
|
],
|
||||||
"public/app/core/TableModel.ts:5381": [
|
"public/app/core/TableModel.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.", "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/core/actions/index.ts:5381": [
|
"public/app/core/actions/index.ts:5381": [
|
||||||
[0, 0, 0, "Do not re-export imported variable (\`updateNavIndex\`)", "0"],
|
[0, 0, 0, "Do not re-export imported variable (\`updateNavIndex\`)", "0"],
|
||||||
@@ -1103,19 +1096,6 @@ exports[`better eslint`] = {
|
|||||||
"public/app/core/components/NestedFolderPicker/Trigger.tsx:5381": [
|
"public/app/core/components/NestedFolderPicker/Trigger.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/core/components/OptionsUI/registry.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, "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"]
|
|
||||||
],
|
|
||||||
"public/app/core/components/PageHeader/PageHeader.tsx:5381": [
|
"public/app/core/components/PageHeader/PageHeader.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||||
@@ -1157,14 +1137,12 @@ exports[`better eslint`] = {
|
|||||||
[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.", "3"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
[0, 0, 0, "Styles should be written using objects.", "4"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "5"],
|
[0, 0, 0, "Styles should be written using objects.", "5"]
|
||||||
[0, 0, 0, "Styles should be written using objects.", "6"]
|
|
||||||
],
|
],
|
||||||
"public/app/core/components/TagFilter/TagOption.tsx:5381": [
|
"public/app/core/components/TagFilter/TagOption.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/core/components/TimeSeries/utils.ts:5381": [
|
"public/app/core/components/TimeSeries/utils.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@@ -1210,23 +1188,16 @@ exports[`better eslint`] = {
|
|||||||
"public/app/core/navigation/types.ts:5381": [
|
"public/app/core/navigation/types.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/core/reducers/root.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/core/services/ResponseQueue.ts:5381": [
|
"public/app/core/services/ResponseQueue.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/core/services/backend_srv.ts:5381": [
|
"public/app/core/services/backend_srv.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "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"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
|
||||||
[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"]
|
|
||||||
],
|
],
|
||||||
"public/app/core/services/context_srv.ts:5381": [
|
"public/app/core/services/context_srv.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
@@ -1266,10 +1237,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "17"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "18"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "18"]
|
||||||
],
|
],
|
||||||
"public/app/core/utils/ConfigProvider.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
|
||||||
"public/app/core/utils/connectWithReduxStore.tsx:5381": [
|
"public/app/core/utils/connectWithReduxStore.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.", "1"],
|
||||||
@@ -1293,9 +1260,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||||
],
|
],
|
||||||
"public/app/core/utils/flatten.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/core/utils/object.ts:5381": [
|
"public/app/core/utils/object.ts:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||||
@@ -1394,8 +1358,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"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/alerting/state/reducers.ts:5381": [
|
"public/app/features/alerting/state/reducers.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@@ -2234,19 +2197,11 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "3"]
|
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "3"]
|
||||||
],
|
],
|
||||||
"public/app/features/canvas/runtime/element.tsx:5381": [
|
"public/app/features/canvas/runtime/element.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "5"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/canvas/runtime/frame.tsx:5381": [
|
"public/app/features/canvas/runtime/frame.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/canvas/runtime/root.tsx:5381": [
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/canvas/runtime/scene.tsx:5381": [
|
"public/app/features/canvas/runtime/scene.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, "Do not use any type assertions.", "1"],
|
||||||
@@ -2346,19 +2301,13 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx:5381": [
|
"public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx:5381": [
|
||||||
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
|
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard-scene/saving/DetectChangesWorker.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/getDashboardChanges.ts:5381": [
|
"public/app/features/dashboard-scene/saving/getDashboardChanges.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, "Do not use any type assertions.", "1"],
|
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx:5381": [
|
"public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
|
||||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard-scene/serialization/angularMigration.test.ts:5381": [
|
"public/app/features/dashboard-scene/serialization/angularMigration.test.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||||
@@ -2514,8 +2463,7 @@ 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"]
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/components/PanelEditor/OverrideCategoryTitle.tsx:5381": [
|
"public/app/features/dashboard/components/PanelEditor/OverrideCategoryTitle.tsx:5381": [
|
||||||
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"],
|
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx:5381": [
|
"public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx:5381": [
|
||||||
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"],
|
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"],
|
||||||
@@ -2528,9 +2476,6 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/dashboard/components/PanelEditor/VisualizationSelectPane.tsx:5381": [
|
"public/app/features/dashboard/components/PanelEditor/VisualizationSelectPane.tsx:5381": [
|
||||||
[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"]
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/components/PanelEditor/getFieldOverrideElements.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.tsx:5381": [
|
"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.", "0"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||||
@@ -3484,9 +3429,6 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/library-panels/components/LibraryPanelsSearch/LibraryPanelsSearch.tsx:5381": [
|
"public/app/features/library-panels/components/LibraryPanelsSearch/LibraryPanelsSearch.tsx:5381": [
|
||||||
[0, 0, 0, "\'VerticalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
|
[0, 0, 0, "\'VerticalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
|
||||||
],
|
],
|
||||||
"public/app/features/library-panels/components/LibraryPanelsView/actions.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/library-panels/components/OpenLibraryPanelModal/OpenLibraryPanelModal.tsx:5381": [
|
"public/app/features/library-panels/components/OpenLibraryPanelModal/OpenLibraryPanelModal.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
],
|
],
|
||||||
@@ -3502,9 +3444,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Styles should be written using objects.", "4"],
|
[0, 0, 0, "Styles should be written using objects.", "4"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "5"]
|
[0, 0, 0, "Styles should be written using objects.", "5"]
|
||||||
],
|
],
|
||||||
"public/app/features/library-panels/utils.ts:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/live/LiveConnectionWarning.tsx:5381": [
|
"public/app/features/live/LiveConnectionWarning.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||||
@@ -3655,8 +3594,7 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
[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.", "11"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
[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.", "13"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/manage-dashboards/state/reducers.ts:5381": [
|
"public/app/features/manage-dashboards/state/reducers.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
@@ -3792,9 +3730,6 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||||
[0, 0, 0, "Styles should be written using objects.", "2"]
|
[0, 0, 0, "Styles should be written using objects.", "2"]
|
||||||
],
|
],
|
||||||
"public/app/features/plugins/admin/hooks/useHistory.tsx:5381": [
|
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
|
||||||
],
|
|
||||||
"public/app/features/plugins/admin/hooks/usePluginInfo.tsx:5381": [
|
"public/app/features/plugins/admin/hooks/usePluginInfo.tsx:5381": [
|
||||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export interface BackendSrv {
|
|||||||
* wrap the Observable returned by fetch with the lastValueFrom function, or use the get|delete|post|patch|put methods.
|
* wrap the Observable returned by fetch with the lastValueFrom function, or use the get|delete|post|patch|put methods.
|
||||||
* This method is going to be private from Grafana 10.
|
* This method is going to be private from Grafana 10.
|
||||||
*/
|
*/
|
||||||
request<T = any>(options: BackendSrvRequest): Promise<T>;
|
request<T = unknown>(options: BackendSrvRequest): Promise<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special function used to communicate with datasources that will emit core
|
* Special function used to communicate with datasources that will emit core
|
||||||
@@ -167,7 +167,7 @@ export interface BackendSrv {
|
|||||||
*
|
*
|
||||||
* @deprecated Use the fetch function instead
|
* @deprecated Use the fetch function instead
|
||||||
*/
|
*/
|
||||||
datasourceRequest<T = any>(options: BackendSrvRequest): Promise<FetchResponse<T>>;
|
datasourceRequest<T = unknown>(options: BackendSrvRequest): Promise<FetchResponse<T>>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observable http request interface
|
* Observable http request interface
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default class TableModel implements TableData {
|
|||||||
columns: MutableColumn[];
|
columns: MutableColumn[];
|
||||||
rows: any[];
|
rows: any[];
|
||||||
type: string;
|
type: string;
|
||||||
columnMap: any;
|
columnMap: Record<string, Column>;
|
||||||
refId?: string;
|
refId?: string;
|
||||||
meta?: QueryResultMeta;
|
meta?: QueryResultMeta;
|
||||||
|
|
||||||
@@ -69,14 +69,14 @@ export default class TableModel implements TableData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addRow(row: any[]) {
|
addRow(row: unknown[]) {
|
||||||
this.rows.push(row);
|
this.rows.push(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if both rows have matching non-empty fields as well as matching
|
// Returns true if both rows have matching non-empty fields as well as matching
|
||||||
// indexes where one field is empty and the other is not
|
// indexes where one field is empty and the other is not
|
||||||
function areRowsMatching(columns: Column[], row: any[], otherRow: any[]) {
|
function areRowsMatching(columns: Column[], row: unknown[], otherRow: unknown[]) {
|
||||||
let foundFieldToMatch = false;
|
let foundFieldToMatch = false;
|
||||||
for (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {
|
for (let columnIndex = 0; columnIndex < columns.length; columnIndex++) {
|
||||||
if (row[columnIndex] !== undefined && otherRow[columnIndex] !== undefined) {
|
if (row[columnIndex] !== undefined && otherRow[columnIndex] !== undefined) {
|
||||||
@@ -141,7 +141,7 @@ export function mergeTablesIntoModel(dst?: TableModel, ...tables: TableModel[]):
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Merge rows that have same values for columns
|
// Merge rows that have same values for columns
|
||||||
const mergedRows: { [key: string]: any } = {};
|
const mergedRows: Record<number, MutableColumn[]> = {};
|
||||||
|
|
||||||
const compactedRows = flattenedRows.reduce<MutableColumn[][]>((acc, row, rowIndex) => {
|
const compactedRows = flattenedRows.reduce<MutableColumn[][]>((acc, row, rowIndex) => {
|
||||||
if (!mergedRows[rowIndex]) {
|
if (!mergedRows[rowIndex]) {
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export const getAllOptionEditors = () => {
|
|||||||
*/
|
*/
|
||||||
export const getAllStandardFieldConfigs = () => {
|
export const getAllStandardFieldConfigs = () => {
|
||||||
const category = ['Standard options'];
|
const category = ['Standard options'];
|
||||||
const displayName: FieldConfigPropertyItem<any, string, StringFieldConfigSettings> = {
|
const displayName: FieldConfigPropertyItem<FieldConfig, string, StringFieldConfigSettings> = {
|
||||||
id: 'displayName',
|
id: 'displayName',
|
||||||
path: 'displayName',
|
path: 'displayName',
|
||||||
name: 'Display name',
|
name: 'Display name',
|
||||||
@@ -229,7 +229,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const unit: FieldConfigPropertyItem<any, string, StringFieldConfigSettings> = {
|
const unit: FieldConfigPropertyItem<FieldConfig, string, StringFieldConfigSettings> = {
|
||||||
id: 'unit',
|
id: 'unit',
|
||||||
path: 'unit',
|
path: 'unit',
|
||||||
name: 'Unit',
|
name: 'Unit',
|
||||||
@@ -247,7 +247,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const fieldMinMax: FieldConfigPropertyItem<any, boolean, BooleanFieldSettings> = {
|
const fieldMinMax: FieldConfigPropertyItem<FieldConfig, boolean, BooleanFieldSettings> = {
|
||||||
id: 'fieldMinMax',
|
id: 'fieldMinMax',
|
||||||
path: 'fieldMinMax',
|
path: 'fieldMinMax',
|
||||||
name: 'Field min/max',
|
name: 'Field min/max',
|
||||||
@@ -258,13 +258,13 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
process: booleanOverrideProcessor,
|
process: booleanOverrideProcessor,
|
||||||
|
|
||||||
shouldApply: (field) => field.type === FieldType.number,
|
shouldApply: (field) => field.type === FieldType.number,
|
||||||
showIf: (options: FieldConfig) => {
|
showIf: (options) => {
|
||||||
return options.min === undefined || options.max === undefined;
|
return options.min === undefined || options.max === undefined;
|
||||||
},
|
},
|
||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const min: FieldConfigPropertyItem<any, number, NumberFieldConfigSettings> = {
|
const min: FieldConfigPropertyItem<FieldConfig, number, NumberFieldConfigSettings> = {
|
||||||
id: 'min',
|
id: 'min',
|
||||||
path: 'min',
|
path: 'min',
|
||||||
name: 'Min',
|
name: 'Min',
|
||||||
@@ -281,7 +281,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const max: FieldConfigPropertyItem<any, number, NumberFieldConfigSettings> = {
|
const max: FieldConfigPropertyItem<FieldConfig, number, NumberFieldConfigSettings> = {
|
||||||
id: 'max',
|
id: 'max',
|
||||||
path: 'max',
|
path: 'max',
|
||||||
name: 'Max',
|
name: 'Max',
|
||||||
@@ -299,7 +299,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const decimals: FieldConfigPropertyItem<any, number, NumberFieldConfigSettings> = {
|
const decimals: FieldConfigPropertyItem<FieldConfig, number, NumberFieldConfigSettings> = {
|
||||||
id: 'decimals',
|
id: 'decimals',
|
||||||
path: 'decimals',
|
path: 'decimals',
|
||||||
name: 'Decimals',
|
name: 'Decimals',
|
||||||
@@ -319,7 +319,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const noValue: FieldConfigPropertyItem<any, string, StringFieldConfigSettings> = {
|
const noValue: FieldConfigPropertyItem<FieldConfig, string, StringFieldConfigSettings> = {
|
||||||
id: 'noValue',
|
id: 'noValue',
|
||||||
path: 'noValue',
|
path: 'noValue',
|
||||||
name: 'No value',
|
name: 'No value',
|
||||||
@@ -332,12 +332,12 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
settings: {
|
settings: {
|
||||||
placeholder: '-',
|
placeholder: '-',
|
||||||
},
|
},
|
||||||
// ??? any optionsUi with no value
|
// ??? FieldConfig optionsUi with no value
|
||||||
shouldApply: () => true,
|
shouldApply: () => true,
|
||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const links: FieldConfigPropertyItem<any, DataLink[], StringFieldConfigSettings> = {
|
const links: FieldConfigPropertyItem<FieldConfig, DataLink[], StringFieldConfigSettings> = {
|
||||||
id: 'links',
|
id: 'links',
|
||||||
path: 'links',
|
path: 'links',
|
||||||
name: 'Data links',
|
name: 'Data links',
|
||||||
@@ -352,7 +352,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
getItemsCount: (value) => (value ? value.length : 0),
|
getItemsCount: (value) => (value ? value.length : 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
const color: FieldConfigPropertyItem<any, FieldColor | undefined, FieldColorConfigSettings> = {
|
const color: FieldConfigPropertyItem<FieldConfig, FieldColor | undefined, FieldColorConfigSettings> = {
|
||||||
id: 'color',
|
id: 'color',
|
||||||
path: 'color',
|
path: 'color',
|
||||||
name: 'Color scheme',
|
name: 'Color scheme',
|
||||||
@@ -367,7 +367,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
category,
|
category,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mappings: FieldConfigPropertyItem<any, ValueMapping[], ValueMappingFieldConfigSettings> = {
|
const mappings: FieldConfigPropertyItem<FieldConfig, ValueMapping[], ValueMappingFieldConfigSettings> = {
|
||||||
id: 'mappings',
|
id: 'mappings',
|
||||||
path: 'mappings',
|
path: 'mappings',
|
||||||
name: 'Value mappings',
|
name: 'Value mappings',
|
||||||
@@ -383,7 +383,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
getItemsCount: (value?) => (value ? value.length : 0),
|
getItemsCount: (value?) => (value ? value.length : 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
const thresholds: FieldConfigPropertyItem<any, ThresholdsConfig, ThresholdsFieldConfigSettings> = {
|
const thresholds: FieldConfigPropertyItem<FieldConfig, ThresholdsConfig, ThresholdsFieldConfigSettings> = {
|
||||||
id: 'thresholds',
|
id: 'thresholds',
|
||||||
path: 'thresholds',
|
path: 'thresholds',
|
||||||
name: 'Thresholds',
|
name: 'Thresholds',
|
||||||
@@ -403,7 +403,7 @@ export const getAllStandardFieldConfigs = () => {
|
|||||||
getItemsCount: (value) => (value ? value.steps.length : 0),
|
getItemsCount: (value) => (value ? value.steps.length : 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterable: FieldConfigPropertyItem<{}, boolean | undefined, {}> = {
|
const filterable: FieldConfigPropertyItem<FieldConfig, boolean | undefined, {}> = {
|
||||||
id: 'filterable',
|
id: 'filterable',
|
||||||
path: 'filterable',
|
path: 'filterable',
|
||||||
name: 'Ad-hoc filterable',
|
name: 'Ad-hoc filterable',
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { components } from 'react-select';
|
import { components, MultiValueRemoveProps } from 'react-select';
|
||||||
|
|
||||||
import { escapeStringForRegex, GrafanaTheme2 } from '@grafana/data';
|
import { escapeStringForRegex, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { Icon, MultiSelect, useStyles2 } from '@grafana/ui';
|
import { Icon, MultiSelect, useStyles2 } from '@grafana/ui';
|
||||||
import { t } from 'app/core/internationalization';
|
import { t } from 'app/core/internationalization';
|
||||||
|
|
||||||
import { TagBadge } from './TagBadge';
|
import { TagBadge } from './TagBadge';
|
||||||
import { TagOption } from './TagOption';
|
import { TagOption, TagSelectOption } from './TagOption';
|
||||||
|
|
||||||
export interface TermCount {
|
export interface TermCount {
|
||||||
term: string;
|
term: string;
|
||||||
count: number;
|
count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TagSelectOption {
|
|
||||||
value: string;
|
|
||||||
label: string;
|
|
||||||
count: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
allowCustomValue?: boolean;
|
allowCustomValue?: boolean;
|
||||||
formatCreateLabel?: (input: string) => string;
|
formatCreateLabel?: (input: string) => string;
|
||||||
@@ -146,7 +140,7 @@ export const TagFilter = ({
|
|||||||
MultiValueLabel: () => {
|
MultiValueLabel: () => {
|
||||||
return null; // We want the whole tag to be clickable so we use MultiValueRemove instead
|
return null; // We want the whole tag to be clickable so we use MultiValueRemove instead
|
||||||
},
|
},
|
||||||
MultiValueRemove(props: any) {
|
MultiValueRemove(props: MultiValueRemoveProps<TagSelectOption>) {
|
||||||
const { data } = props;
|
const { data } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -7,7 +7,13 @@ import { useStyles2 } from '@grafana/ui';
|
|||||||
|
|
||||||
import { TagBadge } from './TagBadge';
|
import { TagBadge } from './TagBadge';
|
||||||
|
|
||||||
export const TagOption = ({ data, className, label, isFocused, innerProps }: OptionProps<any>) => {
|
export interface TagSelectOption {
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TagOption = ({ data, className, label, isFocused, innerProps }: OptionProps<TagSelectOption>) => {
|
||||||
const styles = useStyles2(getStyles);
|
const styles = useStyles2(getStyles);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export const createRootReducer = () => {
|
|||||||
...addedReducers,
|
...addedReducers,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (state: any, action: AnyAction) => {
|
return (state: Parameters<typeof appReducer>[0], action: AnyAction) => {
|
||||||
if (action.type !== cleanUpAction.type) {
|
if (action.type !== cleanUpAction.type) {
|
||||||
return appReducer(state, action);
|
return appReducer(state, action);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export class BackendSrv implements BackendService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async request<T = any>(options: BackendSrvRequest): Promise<T> {
|
async request<T = unknown>(options: BackendSrvRequest): Promise<T> {
|
||||||
return await lastValueFrom(this.fetch<T>(options).pipe(map((response: FetchResponse<T>) => response.data)));
|
return await lastValueFrom(this.fetch<T>(options).pipe(map((response: FetchResponse<T>) => response.data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,8 +181,8 @@ export class BackendSrv implements BackendService {
|
|||||||
this.inFlightRequests.next(CANCEL_ALL_REQUESTS_REQUEST_ID);
|
this.inFlightRequests.next(CANCEL_ALL_REQUESTS_REQUEST_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
async datasourceRequest(options: BackendSrvRequest): Promise<any> {
|
async datasourceRequest<T = unknown>(options: BackendSrvRequest) {
|
||||||
return lastValueFrom(this.fetch(options));
|
return lastValueFrom(this.fetch<T>(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseRequestOptions(options: BackendSrvRequest): BackendSrvRequest {
|
private parseRequestOptions(options: BackendSrvRequest): BackendSrvRequest {
|
||||||
@@ -371,7 +371,7 @@ export class BackendSrv implements BackendService {
|
|||||||
|
|
||||||
return (inputStream) =>
|
return (inputStream) =>
|
||||||
inputStream.pipe(
|
inputStream.pipe(
|
||||||
retryWhen((attempts: Observable<any>) =>
|
retryWhen((attempts) =>
|
||||||
attempts.pipe(
|
attempts.pipe(
|
||||||
mergeMap((error, i) => {
|
mergeMap((error, i) => {
|
||||||
const firstAttempt = i === 0 && options.retry === 0;
|
const firstAttempt = i === 0 && options.retry === 0;
|
||||||
@@ -508,7 +508,7 @@ export class BackendSrv implements BackendService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
search(query: any): Promise<DashboardSearchItem[]> {
|
search(query: Parameters<typeof this.get>[1]): Promise<DashboardSearchItem[]> {
|
||||||
return this.get('/api/search', query);
|
return this.get('/api/search', query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ export const ThemeProvider = ({ children, value }: { children: React.ReactNode;
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const provideTheme = (component: React.ComponentType<any>, theme: GrafanaTheme2) => {
|
export const provideTheme = <P extends {}>(component: React.ComponentType<P>, theme: GrafanaTheme2) => {
|
||||||
return function ThemeProviderWrapper(props: any) {
|
return function ThemeProviderWrapper(props: P) {
|
||||||
return <ThemeProvider value={theme}>{React.createElement(component, { ...props })}</ThemeProvider>;
|
return <ThemeProvider value={theme}>{React.createElement(component, { ...props })}</ThemeProvider>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ export default function flatten(
|
|||||||
let currentDepth = 1;
|
let currentDepth = 1;
|
||||||
const output: Record<string, unknown> = {};
|
const output: Record<string, unknown> = {};
|
||||||
|
|
||||||
function step(object: any, prev: string | null) {
|
function step(object: object, prev: string | null) {
|
||||||
Object.keys(object).forEach((key) => {
|
Object.entries(object).forEach(([key, value]) => {
|
||||||
const value = object[key];
|
|
||||||
const isarray = opts?.safe && Array.isArray(value);
|
const isarray = opts?.safe && Array.isArray(value);
|
||||||
const type = Object.prototype.toString.call(value);
|
const type = Object.prototype.toString.call(value);
|
||||||
const isobject = type === '[object Object]';
|
const isobject = type === '[object Object]';
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class QueryPart {
|
|||||||
params: any[];
|
params: any[];
|
||||||
text: string;
|
text: string;
|
||||||
|
|
||||||
constructor(part: any, def: any) {
|
constructor(part: any, def: QueryPartDef) {
|
||||||
this.part = part;
|
this.part = part;
|
||||||
this.def = def;
|
this.def = def;
|
||||||
if (!this.def) {
|
if (!this.def) {
|
||||||
|
|||||||
@@ -191,18 +191,16 @@ export class ElementState implements LayerElement {
|
|||||||
this.sizeStyle = style;
|
this.sizeStyle = style;
|
||||||
|
|
||||||
if (this.div) {
|
if (this.div) {
|
||||||
for (const key in this.sizeStyle) {
|
for (const [key, value] of Object.entries(this.sizeStyle)) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
this.div.style.setProperty(key, value);
|
||||||
this.div.style[key as any] = (this.sizeStyle as any)[key];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is a hack, we should have a better way to handle this
|
// TODO: This is a hack, we should have a better way to handle this
|
||||||
const elementType = this.options.type;
|
const elementType = this.options.type;
|
||||||
if (!SVGElements.has(elementType)) {
|
if (!SVGElements.has(elementType)) {
|
||||||
// apply styles to div if it's not an SVG element
|
// apply styles to div if it's not an SVG element
|
||||||
for (const key in this.dataStyle) {
|
for (const [key, value] of Object.entries(this.dataStyle)) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
this.div.style.setProperty(key, value);
|
||||||
this.div.style[key as any] = (this.dataStyle as any)[key];
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ELEMENT IS SVG
|
// ELEMENT IS SVG
|
||||||
@@ -211,8 +209,7 @@ export class ElementState implements LayerElement {
|
|||||||
// wrapper div element (this.div) doesn't re-render (has static `key` property),
|
// wrapper div element (this.div) doesn't re-render (has static `key` property),
|
||||||
// so we have to clean styles manually;
|
// so we have to clean styles manually;
|
||||||
for (const key in this.dataStyle) {
|
for (const key in this.dataStyle) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
this.div.style.removeProperty(key);
|
||||||
this.div.style[key as any] = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { CanvasElementOptions, CanvasFrameOptions } from 'app/features/canvas';
|
import { CanvasFrameOptions } from 'app/features/canvas';
|
||||||
|
|
||||||
import { FrameState } from './frame';
|
import { FrameState } from './frame';
|
||||||
import { Scene } from './scene';
|
import { Scene } from './scene';
|
||||||
@@ -24,9 +24,9 @@ export class RootElement extends FrameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// root type can not change
|
// root type can not change
|
||||||
onChange(options: CanvasElementOptions) {
|
onChange(options: CanvasFrameOptions) {
|
||||||
this.revId++;
|
this.revId++;
|
||||||
this.options = { ...options } as CanvasFrameOptions;
|
this.options = { ...options };
|
||||||
this.changeCallback();
|
this.changeCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { Dashboard } from '@grafana/schema';
|
||||||
|
|
||||||
import { getDashboardChanges } from './getDashboardChanges';
|
import { getDashboardChanges } from './getDashboardChanges';
|
||||||
|
|
||||||
function _debounce<T>(f: (...args: T[]) => void, timeout: number) {
|
function _debounce<T>(f: (...args: T[]) => void, timeout: number) {
|
||||||
@@ -10,7 +12,7 @@ function _debounce<T>(f: (...args: T[]) => void, timeout: number) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
self.onmessage = _debounce((e: MessageEvent<{ initial: any; changed: any }>) => {
|
self.onmessage = _debounce((e: MessageEvent<{ initial: Dashboard; changed: Dashboard }>) => {
|
||||||
const result = getDashboardChanges(e.data.initial, e.data.changed, false, false, false);
|
const result = getDashboardChanges(e.data.initial, e.data.changed, false, false, false);
|
||||||
self.postMessage(result);
|
self.postMessage(result);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
InterpolateFunction,
|
InterpolateFunction,
|
||||||
|
LinkModel,
|
||||||
PanelMenuItem,
|
PanelMenuItem,
|
||||||
PanelPlugin,
|
PanelPlugin,
|
||||||
PluginExtensionPanelContext,
|
PluginExtensionPanelContext,
|
||||||
@@ -331,13 +332,16 @@ export function getPanelLinks(panel: VizPanel) {
|
|||||||
|
|
||||||
const panelLinks = linkSupplier.getLinks(interpolate);
|
const panelLinks = linkSupplier.getLinks(interpolate);
|
||||||
|
|
||||||
return panelLinks.map((panelLink) => ({
|
return panelLinks.map((panelLink) => {
|
||||||
...panelLink,
|
const updatedLink: LinkModel<VizPanel> = {
|
||||||
onClick: (e: any, origin: any) => {
|
...panelLink,
|
||||||
DashboardInteractions.panelLinkClicked({ has_multiple_links: panelLinks.length > 1 });
|
onClick: (e, origin) => {
|
||||||
panelLink.onClick?.(e, origin);
|
DashboardInteractions.panelLinkClicked({ has_multiple_links: panelLinks.length > 1 });
|
||||||
},
|
panelLink.onClick?.(e, origin);
|
||||||
}));
|
},
|
||||||
|
};
|
||||||
|
return updatedLink;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createExtensionContext(panel: VizPanel, dashboard: DashboardScene): PluginExtensionPanelContext {
|
function createExtensionContext(panel: VizPanel, dashboard: DashboardScene): PluginExtensionPanelContext {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { FieldMatcherUIRegistryItem } from '@grafana/ui/src/components/MatchersU
|
|||||||
interface Props {
|
interface Props {
|
||||||
isExpanded: boolean;
|
isExpanded: boolean;
|
||||||
registry: FieldConfigOptionsRegistry;
|
registry: FieldConfigOptionsRegistry;
|
||||||
matcherUi: FieldMatcherUIRegistryItem<any>;
|
matcherUi: FieldMatcherUIRegistryItem<ConfigOverrideRule>;
|
||||||
override: ConfigOverrideRule;
|
override: ConfigOverrideRule;
|
||||||
overrideName: string;
|
overrideName: string;
|
||||||
onOverrideRemove: () => void;
|
onOverrideRemove: () => void;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export function getFieldOverrideCategories(
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const onMatcherConfigChange = (options: any) => {
|
const onMatcherConfigChange = (options: unknown) => {
|
||||||
override.matcher.options = options;
|
override.matcher.options = options;
|
||||||
onOverrideChange(idx, override);
|
onOverrideChange(idx, override);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export function deleteLibraryPanel(uid: string, args: SearchArgs): DispatchResul
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function asyncDispatcher(dispatch: Dispatch<AnyAction>) {
|
export function asyncDispatcher(dispatch: Dispatch<AnyAction>) {
|
||||||
return function (action: any) {
|
return function (action: AnyAction | DispatchResult) {
|
||||||
if (action instanceof Function) {
|
if (action instanceof Function) {
|
||||||
return action(dispatch);
|
return action(dispatch);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { PanelModel } from '../dashboard/state';
|
import { PanelModel } from '../dashboard/state';
|
||||||
|
|
||||||
import { addLibraryPanel, updateLibraryPanel } from './state/api';
|
import { addLibraryPanel, updateLibraryPanel } from './state/api';
|
||||||
import { LibraryElementDTO } from './types';
|
import { LibraryElementDTO, PanelModelWithLibraryPanel } from './types';
|
||||||
|
|
||||||
export async function saveAndRefreshLibraryPanel(panel: PanelModel, folderUid: string): Promise<LibraryElementDTO> {
|
export async function saveAndRefreshLibraryPanel(panel: PanelModel, folderUid: string): Promise<LibraryElementDTO> {
|
||||||
const panelSaveModel = toPanelSaveModel(panel);
|
const panelSaveModel = toPanelSaveModel(panel);
|
||||||
@@ -34,7 +34,7 @@ function updatePanelModelWithUpdate(panel: PanelModel, updated: LibraryElementDT
|
|||||||
panel.refresh();
|
panel.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveOrUpdateLibraryPanel(panel: any, folderUid: string): Promise<LibraryElementDTO> {
|
function saveOrUpdateLibraryPanel(panel: PanelModelWithLibraryPanel, folderUid: string): Promise<LibraryElementDTO> {
|
||||||
if (!panel.libraryPanel) {
|
if (!panel.libraryPanel) {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ export function importDashboard(importDashboardForm: ImportDashboardDTO): ThunkR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
importDashboardForm.constants?.forEach((constant: any, index: number) => {
|
importDashboardForm.constants?.forEach((constant, index) => {
|
||||||
const input = inputs.constants[index];
|
const input = inputs.constants[index];
|
||||||
|
|
||||||
inputsToPersist.push({
|
inputsToPersist.push({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { locationService } from '@grafana/runtime';
|
|||||||
|
|
||||||
export const useHistory = () => {
|
export const useHistory = () => {
|
||||||
return {
|
return {
|
||||||
push: ({ query }: any) => {
|
push: ({ query }: { query: Parameters<typeof locationService.partial>[0] }) => {
|
||||||
locationService.partial(query);
|
locationService.partial(query);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user