mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Improve typings 🧹 (#74599)
* various type fixes * candlestick panel type fixes * few more fixes * some fixes * more :) * moar! * undo change to SilencesFilter * undo change to configureStore
This commit is contained in:
parent
5753024ad5
commit
0c44a6f9bb
@ -188,17 +188,12 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "8"]
|
||||
],
|
||||
"packages/grafana-data/src/datetime/rangeutil.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, "Unexpected any. Specify a different type.", "2"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/datetime/timezones.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/events/EventBus.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"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"],
|
||||
@ -224,10 +219,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"packages/grafana-data/src/field/fieldOverrides.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"]
|
||||
],
|
||||
"packages/grafana-data/src/field/overrides/processors.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -256,8 +248,7 @@ exports[`better eslint`] = {
|
||||
[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.", "6"]
|
||||
],
|
||||
"packages/grafana-data/src/geo/layer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -277,15 +268,7 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-data/src/panel/getPanelOptionsWithDefaults.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, "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.", "2"]
|
||||
],
|
||||
"packages/grafana-data/src/panel/registryFactories.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -307,16 +290,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-data/src/transformations/fieldReducer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/matchers/predicates.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"]
|
||||
],
|
||||
"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"]
|
||||
@ -334,9 +307,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/transformers/ensureColumns.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/transformers/groupBy.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -346,9 +316,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"packages/grafana-data/src/transformations/transformers/histogram.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"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/transformations/transformers/joinDataFrames.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -691,12 +659,7 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-data/src/utils/location.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-data/src/utils/testdata/testTheme.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, "Unexpected any. Specify a different type.", "2"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/url.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -715,13 +678,10 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "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.", "7"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/AppendedVectors.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -733,23 +693,15 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/AsNumberVector.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/BinaryOperationVector.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/CircularVector.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/vector/ConstantVector.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.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/FormattedVector.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.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/FunctionalVector.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -764,9 +716,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/IndexVector.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/vector/SortedVector.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -814,12 +763,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
||||
],
|
||||
"packages/grafana-runtime/src/services/live.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -1422,9 +1366,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"public/app/core/components/TagFilter/TagOption.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -1456,15 +1398,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"]
|
||||
],
|
||||
"public/app/core/services/context_srv.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -1484,9 +1418,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/core/specs/time_series.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.", "0"]
|
||||
],
|
||||
"public/app/core/time_series2.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -1557,9 +1489,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"public/app/core/utils/query.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/core/utils/richHistory.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -1679,12 +1608,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/alerting/unified/AlertsFolderView.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/alerting/unified/PanelAlertTabContent.test.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"]
|
||||
],
|
||||
"public/app/features/alerting/unified/PanelAlertTabContent.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
],
|
||||
@ -1708,10 +1631,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/Expression.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/alert-groups/AlertGroupFilter.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -1725,10 +1644,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/alerting/unified/components/contact-points/ContactPoints.v2.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/receivers/TemplateForm.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/receivers/form/ChannelOptions.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
@ -1740,10 +1655,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/receivers/form/TestContactPointModal.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/receivers/form/fields/OptionField.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -1762,9 +1673,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -1780,9 +1688,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndExpressionsStep.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/alerting/unified/components/silences/SilencesEditor.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -1795,15 +1700,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/alerting/unified/hooks/useControlledFieldArray.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/alerting/unified/hooks/useFilteredRules.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/hooks/useGroupedAlerts.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"]
|
||||
],
|
||||
"public/app/features/alerting/unified/mocks.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
@ -1825,10 +1721,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/utils/amroutes.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/alerting/unified/utils/misc.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -1838,9 +1730,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/features/alerting/unified/utils/redux.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -1861,8 +1751,7 @@ exports[`better eslint`] = {
|
||||
[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"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
],
|
||||
"public/app/features/annotations/events_processing.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -1882,19 +1771,16 @@ exports[`better eslint`] = {
|
||||
"public/app/features/canvas/runtime/element.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "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.", "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.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
],
|
||||
"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.", "1"]
|
||||
[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"]
|
||||
@ -1920,9 +1806,7 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard-scene/utils/test-utils.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"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -2078,9 +1962,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/dashboard/components/VersionHistory/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, "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.", "1"]
|
||||
],
|
||||
"public/app/features/dashboard/containers/DashboardPage.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -2291,10 +2173,9 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/dashboard/utils/panelMerge.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
[0, 0, 0, "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"]
|
||||
],
|
||||
"public/app/features/datasources/components/BasicSettings.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
@ -2728,9 +2609,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/query/state/DashboardQueryRunner/PublicAnnotationsDataSource.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/query/state/DashboardQueryRunner/SnapshotWorker.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/query/state/DashboardQueryRunner/testHelpers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -3076,18 +2954,13 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[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, "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, "Do not use any type assertions.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "13"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "14"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "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, "Unexpected any. Specify a different type.", "9"]
|
||||
],
|
||||
"public/app/features/variables/interval/reducer.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -3109,8 +2982,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
||||
],
|
||||
"public/app/features/variables/pickers/shared/VariableInput.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -3144,8 +3016,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "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.", "4"]
|
||||
],
|
||||
"public/app/features/variables/query/operators.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -3217,9 +3088,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"]
|
||||
],
|
||||
"public/app/features/variables/state/keyedVariablesReducer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -3996,9 +3866,7 @@ exports[`better eslint`] = {
|
||||
"public/app/plugins/datasource/prometheus/components/PromQueryField.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, "Do not use any type assertions.", "4"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -4129,8 +3997,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
],
|
||||
"public/app/plugins/datasource/prometheus/querybuilder/binaryScalarOperations.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.", "0"]
|
||||
],
|
||||
"public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilterItem.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
||||
@ -4306,16 +4173,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"]
|
||||
],
|
||||
"public/app/plugins/datasource/tempo/testResponse.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.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/plugins/datasource/tempo/traceql/TraceQLEditor.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/plugins/datasource/tempo/traceql/autocomplete.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -4351,9 +4208,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/plugins/datasource/testdata/components/StreamingClientEditor.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/plugins/datasource/testdata/datasource.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -4366,10 +4220,6 @@ exports[`better eslint`] = {
|
||||
"public/app/plugins/datasource/testdata/runStreams.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/datasource/testdata/testData/serviceMapResponse.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/plugins/datasource/zipkin/QueryField.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
@ -4433,29 +4283,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/plugins/panel/candlestick/CandlestickPanel.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/plugins/panel/candlestick/module.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
],
|
||||
"public/app/plugins/panel/candlestick/utils.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"],
|
||||
[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"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "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"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/canvas/editor/connectionEditor.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -5026,24 +4854,13 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/piechart/suggestions.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/stat/StatMigrations.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.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/state-timeline/migrations.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, "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"],
|
||||
[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.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/table-old/column_options.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -5165,24 +4982,15 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||
],
|
||||
"public/app/plugins/panel/table/module.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/plugins/panel/text/TextPanelEditor.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/text/textPanelMigrationHandler.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/timeseries/migrations.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.", "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"],
|
||||
@ -5190,17 +4998,13 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "8"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "13"],
|
||||
[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, "Unexpected any. Specify a different type.", "13"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "15"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "17"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "18"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "19"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"]
|
||||
],
|
||||
"public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
@ -5208,12 +5012,6 @@ exports[`better eslint`] = {
|
||||
"public/app/plugins/panel/timeseries/plugins/annotations/AnnotationEditor.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/timeseries/suggestions.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/trend/suggestions.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/xychart/AutoEditor.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
|
@ -328,7 +328,7 @@ export function describeInterval(str: string) {
|
||||
);
|
||||
}
|
||||
return {
|
||||
sec: (intervals_in_seconds as any)[matches[2]] as number,
|
||||
sec: intervals_in_seconds[matches[2] as keyof typeof intervals_in_seconds],
|
||||
type: matches[2],
|
||||
count: parseInt(matches[1], 10),
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ describe('EventBus', () => {
|
||||
it('can add sources to the source path', () => {
|
||||
const bus = new EventBusSrv();
|
||||
const busWithSource = bus.newScopedBus('foo');
|
||||
expect((busWithSource as any).path).toEqual(['foo']);
|
||||
expect(busWithSource.path).toEqual(['foo']);
|
||||
});
|
||||
|
||||
it('adds the source to the event payload', () => {
|
||||
|
@ -48,7 +48,7 @@ export class EventBusSrv implements EventBus, LegacyEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
newScopedBus(key: string, filter?: EventFilterOptions): EventBus {
|
||||
newScopedBus(key: string, filter?: EventFilterOptions): ScopedEventBus {
|
||||
return new ScopedEventBus([key], this, filter);
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ function cachingDisplayProcessor(disp: DisplayProcessor, maxCacheSize = 2500): D
|
||||
caches.set(i, new Map());
|
||||
}
|
||||
|
||||
return (value: any, decimals?: DecimalCount) => {
|
||||
return (value: unknown, decimals?: DecimalCount) => {
|
||||
let cache = caches.get(decimals ?? -1)!;
|
||||
|
||||
let v = cache.get(value);
|
||||
@ -342,8 +342,8 @@ export function setFieldConfigDefaults(config: FieldConfig, defaults: FieldConfi
|
||||
}
|
||||
|
||||
function processFieldConfigValue(
|
||||
destination: Record<string, any>, // it's mutable
|
||||
source: Record<string, any>,
|
||||
destination: Record<string, unknown>, // it's mutable
|
||||
source: Record<string, unknown>,
|
||||
fieldConfigProperty: FieldConfigPropertyItem,
|
||||
context: FieldOverrideEnv
|
||||
) {
|
||||
|
@ -29,4 +29,4 @@ export interface StandardEditorsRegistryItem<TValue = any, TSettings = any> exte
|
||||
}
|
||||
export const standardFieldConfigEditorRegistry = new FieldConfigOptionsRegistry();
|
||||
|
||||
export const standardEditorsRegistry = new Registry<StandardEditorsRegistryItem<any>>();
|
||||
export const standardEditorsRegistry = new Registry<StandardEditorsRegistryItem>();
|
||||
|
@ -37,16 +37,12 @@ export function getPanelOptionsWithDefaults({
|
||||
currentFieldConfig,
|
||||
isAfterPluginChange,
|
||||
}: Props): OptionDefaults {
|
||||
const optionsWithDefaults = mergeWith(
|
||||
{},
|
||||
plugin.defaults,
|
||||
currentOptions || {},
|
||||
(objValue: any, srcValue: any): any => {
|
||||
if (isArray(srcValue)) {
|
||||
return srcValue;
|
||||
}
|
||||
const optionsWithDefaults = mergeWith({}, plugin.defaults, currentOptions || {}, (objValue, srcValue) => {
|
||||
if (isArray(srcValue)) {
|
||||
return srcValue;
|
||||
}
|
||||
);
|
||||
return;
|
||||
});
|
||||
|
||||
const fieldConfigWithDefaults = applyFieldConfigDefaults(currentFieldConfig, plugin);
|
||||
const fieldConfigWithOptimalColorMode = adaptFieldColorMode(plugin, fieldConfigWithDefaults, isAfterPluginChange);
|
||||
@ -62,10 +58,11 @@ function applyFieldConfigDefaults(existingFieldConfig: FieldConfigSource, plugin
|
||||
{},
|
||||
pluginDefaults.defaults,
|
||||
existingFieldConfig ? existingFieldConfig.defaults : {},
|
||||
(objValue: any, srcValue: any): any => {
|
||||
(objValue, srcValue) => {
|
||||
if (isArray(srcValue)) {
|
||||
return srcValue;
|
||||
}
|
||||
return;
|
||||
}
|
||||
),
|
||||
overrides: existingFieldConfig?.overrides ?? [],
|
||||
@ -86,7 +83,7 @@ function applyFieldConfigDefaults(existingFieldConfig: FieldConfigSource, plugin
|
||||
for (const override of result.overrides) {
|
||||
for (const property of override.properties) {
|
||||
if (property.id === 'thresholds') {
|
||||
fixThresholds(property.value as ThresholdsConfig);
|
||||
fixThresholds(property.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,7 +154,7 @@ function adaptFieldColorMode(
|
||||
const color = plugin.fieldConfigRegistry.getIfExists(FieldConfigProperty.Color);
|
||||
|
||||
if (color && color.settings) {
|
||||
const colorSettings = color.settings as FieldColorConfigSettings;
|
||||
const colorSettings: FieldColorConfigSettings = color.settings;
|
||||
const mode = fieldColorModeRegistry.getIfExists(fieldConfig.defaults.color?.mode);
|
||||
|
||||
// When no support fo value colors, use classic palette
|
||||
|
@ -205,11 +205,11 @@ const alwaysFieldMatcherInfo: FieldMatcherInfo = {
|
||||
name: 'All Fields',
|
||||
description: 'Always Match',
|
||||
|
||||
get: (option: any) => {
|
||||
get: (_option) => {
|
||||
return alwaysFieldMatcher;
|
||||
},
|
||||
|
||||
getOptionsDisplayText: (options: any) => {
|
||||
getOptionsDisplayText: (_options) => {
|
||||
return 'Always';
|
||||
},
|
||||
};
|
||||
@ -219,11 +219,11 @@ const alwaysFrameMatcherInfo: FrameMatcherInfo = {
|
||||
name: 'All Frames',
|
||||
description: 'Always Match',
|
||||
|
||||
get: (option: any) => {
|
||||
get: (_option) => {
|
||||
return alwaysFrameMatcher;
|
||||
},
|
||||
|
||||
getOptionsDisplayText: (options: any) => {
|
||||
getOptionsDisplayText: (_options) => {
|
||||
return 'Always';
|
||||
},
|
||||
};
|
||||
@ -234,11 +234,11 @@ const neverFieldMatcherInfo: FieldMatcherInfo = {
|
||||
description: 'Never Match',
|
||||
excludeFromPicker: true,
|
||||
|
||||
get: (option: any) => {
|
||||
get: (_option) => {
|
||||
return neverFieldMatcher;
|
||||
},
|
||||
|
||||
getOptionsDisplayText: (options: any) => {
|
||||
getOptionsDisplayText: (_options) => {
|
||||
return 'Never';
|
||||
},
|
||||
};
|
||||
@ -248,11 +248,11 @@ const neverFrameMatcherInfo: FrameMatcherInfo = {
|
||||
name: 'No Frames',
|
||||
description: 'Never Match',
|
||||
|
||||
get: (option: any) => {
|
||||
get: (_option) => {
|
||||
return neverFrameMatcher;
|
||||
},
|
||||
|
||||
getOptionsDisplayText: (options: any) => {
|
||||
getOptionsDisplayText: (_options) => {
|
||||
return 'Never';
|
||||
},
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ export const ensureColumnsTransformer: SynchronousDataTransformerInfo = {
|
||||
operator: (options, ctx) => (source) =>
|
||||
source.pipe(map((data) => ensureColumnsTransformer.transformer(options, ctx)(data))),
|
||||
|
||||
transformer: (_options: any, ctx) => (frames: DataFrame[]) => {
|
||||
transformer: (_options, ctx) => (frames: DataFrame[]) => {
|
||||
// Assume timeseries should first be joined by time
|
||||
const timeFieldName = findConsistentTimeFieldName(frames);
|
||||
|
||||
|
@ -361,7 +361,7 @@ function histogram(
|
||||
vals: number[],
|
||||
getBucket: (v: number) => number,
|
||||
filterOut?: any[] | null,
|
||||
sort?: ((a: any, b: any) => number) | null
|
||||
sort?: ((a: number, b: number) => number) | null
|
||||
) {
|
||||
let hist = new Map();
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { GrafanaConfig, RawTimeRange, ScopedVars } from '../types';
|
||||
|
||||
import { UrlQueryMap, urlUtil } from './url';
|
||||
|
||||
let grafanaConfig: GrafanaConfig = { appSubUrl: '' } as any;
|
||||
let grafanaConfig = { appSubUrl: '' } as GrafanaConfig;
|
||||
let getTimeRangeUrlParams: () => RawTimeRange;
|
||||
let getVariablesUrlParams: (scopedVars?: ScopedVars) => UrlQueryMap;
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
import { GrafanaTheme, GrafanaThemeType } from '../../types/theme';
|
||||
|
||||
export function getTestTheme(type: GrafanaThemeType = GrafanaThemeType.Dark): GrafanaTheme {
|
||||
return {
|
||||
type,
|
||||
isDark: type === GrafanaThemeType.Dark,
|
||||
isLight: type === GrafanaThemeType.Light,
|
||||
colors: {
|
||||
panelBg: 'white',
|
||||
},
|
||||
} as unknown as GrafanaTheme;
|
||||
}
|
@ -76,13 +76,13 @@ export function getValueMappingResult(valueMappings: ValueMapping[], value: any)
|
||||
break;
|
||||
}
|
||||
case SpecialValueMatch.NaN: {
|
||||
if (isNaN(value as any)) {
|
||||
if (isNaN(value as number)) {
|
||||
return vm.options.result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SpecialValueMatch.NullAndNaN: {
|
||||
if (isNaN(value as any) || value == null) {
|
||||
if (isNaN(value as number) || value == null) {
|
||||
return vm.options.result;
|
||||
}
|
||||
break;
|
||||
@ -113,7 +113,7 @@ export function getValueMappingResult(valueMappings: ValueMapping[], value: any)
|
||||
}
|
||||
|
||||
// Ref https://stackoverflow.com/a/58550111
|
||||
export function isNumeric(num: any) {
|
||||
export function isNumeric(num: unknown) {
|
||||
return (typeof num === 'number' || (typeof num === 'string' && num.trim() !== '')) && !isNaN(num as number);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,6 @@ import { Vector } from '../types';
|
||||
export class AsNumberVector extends Array<number> {
|
||||
constructor(field: Vector) {
|
||||
super();
|
||||
return field.map((v) => +v) as AsNumberVector;
|
||||
return field.map((v) => +v);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ export class BinaryOperationVector extends Array<number> {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
arr[i] = operation(left[i], right[i]);
|
||||
}
|
||||
return arr as BinaryOperationVector;
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,6 @@
|
||||
export class ConstantVector<T = any> extends Array<T> {
|
||||
constructor(value: T, len: number) {
|
||||
super();
|
||||
return new Array<T>(len).fill(value) as ConstantVector<T>;
|
||||
return new Array<T>(len).fill(value);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ import { formattedValueToString } from '../valueFormats';
|
||||
export class FormattedVector<T = any> extends Array<string> {
|
||||
constructor(source: Vector<T>, formatter: DisplayProcessor) {
|
||||
super();
|
||||
return source.map((v) => formattedValueToString(formatter(v))) as FormattedVector<T>;
|
||||
return source.map((v) => formattedValueToString(formatter(v)));
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ export class IndexVector extends Array<number> {
|
||||
for (let i = 0; i < len; i++) {
|
||||
arr[i] = i;
|
||||
}
|
||||
return arr as IndexVector;
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,10 +147,10 @@ export function isFetchError(e: unknown): e is FetchError {
|
||||
*/
|
||||
export interface BackendSrv {
|
||||
get<T = any>(url: string, params?: any, requestId?: string, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
delete<T = any>(url: string, data?: any, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
post<T = any>(url: string, data?: any, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
patch<T = any>(url: string, data?: any, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
put<T = any>(url: string, data?: any, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
delete<T = unknown>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
post<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
patch<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
put<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>): Promise<T>;
|
||||
|
||||
/**
|
||||
* @deprecated Use the `.fetch()` function instead. If you prefer to work with a promise
|
||||
|
@ -143,7 +143,7 @@ export const TagFilter = ({
|
||||
width,
|
||||
components: {
|
||||
Option: TagOption,
|
||||
MultiValueLabel: (): any => {
|
||||
MultiValueLabel: () => {
|
||||
return null; // We want the whole tag to be clickable so we use MultiValueRemove instead
|
||||
},
|
||||
MultiValueRemove(props: any) {
|
||||
@ -155,7 +155,7 @@ export const TagFilter = ({
|
||||
</components.MultiValueRemove>
|
||||
);
|
||||
},
|
||||
MultiValueContainer: hideValues ? (): any => null : components.MultiValueContainer,
|
||||
MultiValueContainer: hideValues ? () => null : components.MultiValueContainer,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -416,7 +416,7 @@ export class BackendSrv implements BackendService {
|
||||
);
|
||||
}
|
||||
|
||||
private handleStreamCancellation(options: BackendSrvRequest): MonoTypeOperatorFunction<FetchResponse<any>> {
|
||||
private handleStreamCancellation(options: BackendSrvRequest): MonoTypeOperatorFunction<FetchResponse> {
|
||||
return (inputStream) =>
|
||||
inputStream.pipe(
|
||||
takeUntil(
|
||||
@ -452,7 +452,7 @@ export class BackendSrv implements BackendService {
|
||||
);
|
||||
}
|
||||
|
||||
getInspectorStream(): Observable<FetchResponse<any> | FetchError> {
|
||||
getInspectorStream(): Observable<FetchResponse | FetchError> {
|
||||
return this.inspectorStream;
|
||||
}
|
||||
|
||||
@ -465,23 +465,23 @@ export class BackendSrv implements BackendService {
|
||||
return this.request<T>({ ...options, method: 'GET', url, params, requestId });
|
||||
}
|
||||
|
||||
async delete<T = any>(url: string, data?: any, options?: Partial<BackendSrvRequest>) {
|
||||
async delete<T = unknown>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>) {
|
||||
return this.request<T>({ ...options, method: 'DELETE', url, data });
|
||||
}
|
||||
|
||||
async post<T = any>(url: string, data?: any, options?: Partial<BackendSrvRequest>) {
|
||||
async post<T = any>(url: string, data?: unknown, options?: Partial<BackendSrvRequest>) {
|
||||
return this.request<T>({ ...options, method: 'POST', url, data });
|
||||
}
|
||||
|
||||
async patch<T = any>(url: string, data: any, options?: Partial<BackendSrvRequest>) {
|
||||
async patch<T = any>(url: string, data: unknown, options?: Partial<BackendSrvRequest>) {
|
||||
return this.request<T>({ ...options, method: 'PATCH', url, data });
|
||||
}
|
||||
|
||||
async put<T = any>(url: string, data: any, options?: Partial<BackendSrvRequest>): Promise<T> {
|
||||
async put<T = any>(url: string, data: unknown, options?: Partial<BackendSrvRequest>): Promise<T> {
|
||||
return this.request<T>({ ...options, method: 'PUT', url, data });
|
||||
}
|
||||
|
||||
withNoBackendCache(callback: any) {
|
||||
withNoBackendCache(callback: () => Promise<void>) {
|
||||
this.noBackendCache = true;
|
||||
return callback().finally(() => {
|
||||
this.noBackendCache = false;
|
||||
|
@ -1,9 +1,9 @@
|
||||
import TimeSeries, { updateLegendValues } from 'app/core/time_series2';
|
||||
|
||||
describe('TimeSeries', () => {
|
||||
let points: any[][];
|
||||
let points: ReturnType<TimeSeries['getFlotPairs']>;
|
||||
let series: TimeSeries;
|
||||
let testData: { alias?: string; datapoints: any };
|
||||
let testData: { alias?: string; datapoints: Array<[number | null, number | null]> };
|
||||
|
||||
beforeEach(() => {
|
||||
testData = {
|
||||
|
@ -27,15 +27,17 @@ export function queryIsEmpty(query: DataQuery): boolean {
|
||||
}
|
||||
|
||||
export function addQuery(queries: DataQuery[], query?: Partial<DataQuery>, datasource?: DataSourceRef): DataQuery[] {
|
||||
const q = query || {};
|
||||
q.refId = getNextRefIdChar(queries);
|
||||
q.hide = false;
|
||||
const q: DataQuery = {
|
||||
...query,
|
||||
refId: getNextRefIdChar(queries),
|
||||
hide: false,
|
||||
};
|
||||
|
||||
if (!q.datasource && datasource) {
|
||||
q.datasource = datasource;
|
||||
}
|
||||
|
||||
return [...queries, q as DataQuery];
|
||||
return [...queries, q];
|
||||
}
|
||||
|
||||
export function isDataQuery(url: string): boolean {
|
||||
|
@ -184,11 +184,8 @@ describe('PanelAlertTabContent', () => {
|
||||
const dsService = new MockDataSourceSrv(dataSources);
|
||||
dsService.datasources[dataSources.prometheus.uid] = new PrometheusDatasource(
|
||||
dataSources.prometheus
|
||||
) as DataSourceApi<any, any>;
|
||||
dsService.datasources[dataSources.default.uid] = new PrometheusDatasource(dataSources.default) as DataSourceApi<
|
||||
any,
|
||||
any
|
||||
>;
|
||||
) as DataSourceApi;
|
||||
dsService.datasources[dataSources.default.uid] = new PrometheusDatasource(dataSources.default) as DataSourceApi;
|
||||
setDataSourceSrv(dsService);
|
||||
disableRBAC();
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { css, cx } from '@emotion/css';
|
||||
import { LanguageMap, languages as prismLanguages } from 'prismjs';
|
||||
import { languages as prismLanguages } from 'prismjs';
|
||||
import React, { FC, useMemo } from 'react';
|
||||
import { Editor } from 'slate-react';
|
||||
|
||||
@ -23,10 +23,10 @@ export const HighlightedQuery: FC<{ language: 'promql' | 'logql'; expr: string }
|
||||
() => [
|
||||
SlatePrism(
|
||||
{
|
||||
onlyIn: (node: any) => node.type === 'code_block',
|
||||
onlyIn: (node) => 'type' in node && node.type === 'code_block',
|
||||
getSyntax: () => language,
|
||||
},
|
||||
{ ...(prismLanguages as LanguageMap), [language]: language === 'logql' ? LogqlSyntax : PromqlSyntax }
|
||||
{ ...prismLanguages, [language]: language === 'logql' ? LogqlSyntax : PromqlSyntax }
|
||||
),
|
||||
],
|
||||
[language]
|
||||
|
@ -8,6 +8,7 @@ import AutoSizer from 'react-virtualized-auto-sizer';
|
||||
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { Stack } from '@grafana/experimental';
|
||||
import { isFetchError } from '@grafana/runtime';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
@ -159,7 +160,7 @@ export const TemplateForm = ({ existing, alertManagerSourceName, config, provena
|
||||
<h4>{existing && !isduplicating ? 'Edit notification template' : 'Create notification template'}</h4>
|
||||
{error && (
|
||||
<Alert severity="error" title="Error saving template">
|
||||
{error.message || (error as any)?.data?.message || String(error)}
|
||||
{error.message || (isFetchError(error) && error.data?.message) || String(error)}
|
||||
</Alert>
|
||||
)}
|
||||
{provenance && <ProvisioningAlert resource={ProvisionedResource.Template} />}
|
||||
|
@ -49,14 +49,14 @@ export const TestContactPointModal = ({ isOpen, onDismiss, onTest }: Props) => {
|
||||
const alert = {
|
||||
annotations: data.annotations
|
||||
.filter(({ key, value }) => !!key && !!value)
|
||||
.reduce((acc, { key, value }) => {
|
||||
.reduce<Annotations>((acc, { key, value }) => {
|
||||
return { ...acc, [key]: value };
|
||||
}, {} as Annotations),
|
||||
}, {}),
|
||||
labels: data.labels
|
||||
.filter(({ key, value }) => !!key && !!value)
|
||||
.reduce((acc, { key, value }) => {
|
||||
.reduce<Labels>((acc, { key, value }) => {
|
||||
return { ...acc, [key]: value };
|
||||
}, {} as Labels),
|
||||
}, {}),
|
||||
};
|
||||
onTest(alert);
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ export const AlertRuleForm = ({ existing, prefill }: Props) => {
|
||||
const ruleType = translateRouteParamToRuleType(routeParams.type);
|
||||
const uidFromParams = routeParams.id;
|
||||
|
||||
const returnTo: string = (queryParams['returnTo'] as string | undefined) ?? '/alerting/list';
|
||||
const returnTo = String(queryParams['returnTo']) ?? '/alerting/list';
|
||||
const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);
|
||||
|
||||
const defaultValues: RuleFormValues = useMemo(() => {
|
||||
|
@ -27,19 +27,16 @@ export function RuleDetailsDataSources(props: Props): JSX.Element | null {
|
||||
|
||||
if (isGrafanaRulerRule(rule.rulerRule)) {
|
||||
const { data } = rule.rulerRule.grafana_alert;
|
||||
const unique = data.reduce(
|
||||
(dataSources, query) => {
|
||||
const ds = getDataSourceSrv().getInstanceSettings(query.datasourceUid);
|
||||
const unique = data.reduce<Record<string, { name: string; icon?: string }>>((dataSources, query) => {
|
||||
const ds = getDataSourceSrv().getInstanceSettings(query.datasourceUid);
|
||||
|
||||
if (!ds || ds.uid === ExpressionDatasourceUID) {
|
||||
return dataSources;
|
||||
}
|
||||
|
||||
dataSources[ds.name] = { name: ds.name, icon: ds.meta.info.logos.small };
|
||||
if (!ds || ds.uid === ExpressionDatasourceUID) {
|
||||
return dataSources;
|
||||
},
|
||||
{} as Record<string, { name: string; icon?: string }>
|
||||
);
|
||||
}
|
||||
|
||||
dataSources[ds.name] = { name: ds.name, icon: ds.meta.info.logos.small };
|
||||
return dataSources;
|
||||
}, {});
|
||||
|
||||
return Object.values(unique);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ export const filterRules = (
|
||||
}
|
||||
|
||||
// If a namespace and group have rules that match the rules filters then keep them.
|
||||
return filteredNamespaces.reduce(reduceNamespaces(filterState), [] as CombinedRuleNamespace[]);
|
||||
return filteredNamespaces.reduce<CombinedRuleNamespace[]>(reduceNamespaces(filterState), []);
|
||||
};
|
||||
|
||||
const reduceNamespaces = (filterState: RulesFilter) => {
|
||||
@ -154,7 +154,7 @@ const reduceNamespaces = (filterState: RulesFilter) => {
|
||||
}
|
||||
}
|
||||
|
||||
filteredGroups = filteredGroups.reduce(reduceGroups(filterState), [] as CombinedRuleGroup[]);
|
||||
filteredGroups = filteredGroups.reduce<CombinedRuleGroup[]>(reduceGroups(filterState), []);
|
||||
|
||||
if (filteredGroups.length) {
|
||||
namespaceAcc.push({
|
||||
|
@ -10,7 +10,7 @@ export const useGroupedAlerts = (groups: AlertmanagerGroup[], groupBy: string[])
|
||||
const emptyGroupings = groups.filter((group) => Object.keys(group.labels).length === 0);
|
||||
if (emptyGroupings.length > 1) {
|
||||
// Merges multiple ungrouped grouping
|
||||
return groups.reduce((combinedGroups, group) => {
|
||||
return groups.reduce<AlertmanagerGroup[]>((combinedGroups, group) => {
|
||||
if (Object.keys(group.labels).length === 0) {
|
||||
const noGroupingGroup = combinedGroups.find(({ labels }) => Object.keys(labels));
|
||||
if (!noGroupingGroup) {
|
||||
@ -22,13 +22,13 @@ export const useGroupedAlerts = (groups: AlertmanagerGroup[], groupBy: string[])
|
||||
combinedGroups.push(group);
|
||||
}
|
||||
return combinedGroups;
|
||||
}, [] as AlertmanagerGroup[]);
|
||||
}, []);
|
||||
} else {
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
const alerts = groups.flatMap(({ alerts }) => alerts);
|
||||
return alerts.reduce((groupings, alert) => {
|
||||
return alerts.reduce<AlertmanagerGroup[]>((groupings, alert) => {
|
||||
const alertContainsGroupings = groupBy.every((groupByLabel) => Object.keys(alert.labels).includes(groupByLabel));
|
||||
|
||||
if (alertContainsGroupings) {
|
||||
@ -38,10 +38,10 @@ export const useGroupedAlerts = (groups: AlertmanagerGroup[], groupBy: string[])
|
||||
});
|
||||
});
|
||||
if (!existingGrouping) {
|
||||
const labels = groupBy.reduce((acc, key) => {
|
||||
const labels = groupBy.reduce<Labels>((acc, key) => {
|
||||
acc = { ...acc, [key]: alert.labels[key] };
|
||||
return acc;
|
||||
}, {} as Labels);
|
||||
}, {});
|
||||
groupings.push({
|
||||
alerts: [alert],
|
||||
labels,
|
||||
@ -62,6 +62,6 @@ export const useGroupedAlerts = (groups: AlertmanagerGroup[], groupBy: string[])
|
||||
}
|
||||
|
||||
return groupings;
|
||||
}, [] as AlertmanagerGroup[]);
|
||||
}, []);
|
||||
}, [groups, groupBy]);
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ const matchersToArrayFieldMatchers = (
|
||||
operator: isRegex ? MatcherOperator.regex : MatcherOperator.equal,
|
||||
},
|
||||
],
|
||||
[] as MatcherFieldValue[]
|
||||
[]
|
||||
);
|
||||
|
||||
const selectableValueToString = (selectableValue: SelectableValue<string>): string => selectableValue.value!;
|
||||
@ -149,9 +149,9 @@ export const formAmRouteToAmRoute = (
|
||||
|
||||
const overrideRepeatInterval = overrideTimings && repeatIntervalValue;
|
||||
const repeat_interval = overrideRepeatInterval ? repeatIntervalValue : INHERIT_FROM_PARENT;
|
||||
const object_matchers = formAmRoute.object_matchers
|
||||
const object_matchers: ObjectMatcher[] | undefined = formAmRoute.object_matchers
|
||||
?.filter((route) => route.name && route.value && route.operator)
|
||||
.map(({ name, operator, value }) => [name, operator, value] as ObjectMatcher);
|
||||
.map(({ name, operator, value }) => [name, operator, value]);
|
||||
|
||||
const routes = formAmRoute.routes?.map((subRoute) =>
|
||||
formAmRouteToAmRoute(alertManagerSourceName, subRoute, routeTree)
|
||||
|
@ -54,7 +54,7 @@ export function cloudReceiverToFormValues(
|
||||
// map property names to cloud notifier types by removing the `_config` suffix
|
||||
.map(([type, configs]): [CloudNotifierType, CloudChannelConfig[]] => [
|
||||
type.replace('_configs', '') as CloudNotifierType,
|
||||
configs as CloudChannelConfig[],
|
||||
configs,
|
||||
])
|
||||
// convert channel configs to form values
|
||||
.map(([type, configs]) =>
|
||||
@ -115,7 +115,7 @@ export function formValuesToCloudReceiver(
|
||||
if (!(`${type}_configs` in recv)) {
|
||||
recv[`${type}_configs`] = [channel];
|
||||
} else {
|
||||
(recv[`${type}_configs`] as unknown[]).push(channel);
|
||||
recv[`${type}_configs`]?.push(channel);
|
||||
}
|
||||
});
|
||||
return recv;
|
||||
|
@ -169,20 +169,17 @@ export function getFirstActiveAt(promRule?: AlertingRule) {
|
||||
if (!promRule?.alerts) {
|
||||
return null;
|
||||
}
|
||||
return promRule.alerts.reduce(
|
||||
(prev, alert) => {
|
||||
const isNotNormal =
|
||||
mapStateWithReasonToBaseState(alert.state as GrafanaAlertStateWithReason) !== GrafanaAlertState.Normal;
|
||||
if (alert.activeAt && isNotNormal) {
|
||||
const activeAt = new Date(alert.activeAt);
|
||||
if (prev === null || prev.getTime() > activeAt.getTime()) {
|
||||
return activeAt;
|
||||
}
|
||||
return promRule.alerts.reduce<Date | null>((prev, alert) => {
|
||||
const isNotNormal =
|
||||
mapStateWithReasonToBaseState(alert.state as GrafanaAlertStateWithReason) !== GrafanaAlertState.Normal;
|
||||
if (alert.activeAt && isNotNormal) {
|
||||
const activeAt = new Date(alert.activeAt);
|
||||
if (prev === null || prev.getTime() > activeAt.getTime()) {
|
||||
return activeAt;
|
||||
}
|
||||
return prev;
|
||||
},
|
||||
null as Date | null
|
||||
);
|
||||
}
|
||||
return prev;
|
||||
}, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ export class ElementState implements LayerElement {
|
||||
|
||||
const { constraint } = this.options;
|
||||
const { vertical, horizontal } = constraint ?? {};
|
||||
const placement = this.options.placement ?? ({} as Placement);
|
||||
const placement: Placement = this.options.placement ?? {};
|
||||
|
||||
const editingEnabled = this.getScene()?.isEditingEnabled;
|
||||
|
||||
@ -229,7 +229,7 @@ export class ElementState implements LayerElement {
|
||||
? Math.round(parentContainer.right - parentBorderWidth - elementContainer.right)
|
||||
: 0;
|
||||
|
||||
const placement = {} as Placement;
|
||||
const placement: Placement = {};
|
||||
|
||||
const width = elementContainer?.width ?? 100;
|
||||
const height = elementContainer?.height ?? 100;
|
||||
|
@ -134,7 +134,7 @@ export class FrameState extends ElementState {
|
||||
if (shiftItemsOnDuplicate) {
|
||||
const { constraint, placement: oldPlacement } = element.options;
|
||||
const { vertical, horizontal } = constraint ?? {};
|
||||
const placement = { ...oldPlacement } ?? ({} as Placement);
|
||||
const placement: Placement = { ...oldPlacement } ?? {};
|
||||
|
||||
switch (vertical) {
|
||||
case VerticalConstraint.Top:
|
||||
|
@ -11,7 +11,7 @@ export function setupLoadDashboardMock(rsp: DeepPartial<DashboardDTO>) {
|
||||
}
|
||||
|
||||
export function mockResizeObserver() {
|
||||
(window as any).ResizeObserver = class ResizeObserver {
|
||||
window.ResizeObserver = class ResizeObserver {
|
||||
constructor(callback: ResizeObserverCallback) {
|
||||
setTimeout(() => {
|
||||
callback(
|
||||
|
@ -5,8 +5,8 @@ import { flow, get, isArray, isEmpty, last, sortBy, tail, toNumber, isNaN } from
|
||||
|
||||
export type Diff = {
|
||||
op: 'add' | 'replace' | 'remove' | 'copy' | 'test' | '_get' | 'move';
|
||||
value: any;
|
||||
originalValue: any;
|
||||
value: unknown;
|
||||
originalValue: unknown;
|
||||
path: string[];
|
||||
startLineNumber: number;
|
||||
};
|
||||
|
@ -43,7 +43,7 @@ export function mergePanels(current: PanelModel[], data: IPanelModel[]): PanelMe
|
||||
}
|
||||
|
||||
for (const panel of current) {
|
||||
const target = inputPanels.get(panel.id) as PanelModel;
|
||||
const target = inputPanels.get(panel.id);
|
||||
if (!target) {
|
||||
info.changed = true;
|
||||
info.actions.remove.push(panel.id);
|
||||
|
@ -24,9 +24,9 @@ export class SnapshotWorker implements DashboardQueryRunnerWorker {
|
||||
private getAnnotationsFromSnapshot(dashboard: DashboardModel): AnnotationEvent[] {
|
||||
const dashAnnotations = dashboard?.annotations?.list?.filter((a) => a.enable);
|
||||
const snapshots = dashAnnotations.filter((a) => Boolean(a.snapshotData));
|
||||
const annotations = snapshots.reduce(
|
||||
const annotations = snapshots.reduce<AnnotationEvent[]>(
|
||||
(acc, curr) => acc.concat(translateQueryResult(curr, curr.snapshotData)),
|
||||
[] as AnnotationEvent[]
|
||||
[]
|
||||
);
|
||||
|
||||
return annotations;
|
||||
|
@ -118,58 +118,52 @@ const validVariableNames: Record<string, RegExp[]> = {
|
||||
};
|
||||
|
||||
export const getPropsWithVariable = (variableId: string, parent: { key: string; value: any }, result: any) => {
|
||||
const stringValues = Object.keys(parent.value).reduce(
|
||||
(all, key) => {
|
||||
const value = parent.value[key];
|
||||
if (!value || typeof value !== 'string') {
|
||||
return all;
|
||||
const stringValues = Object.keys(parent.value).reduce<Record<string, any>>((all, key) => {
|
||||
const value = parent.value[key];
|
||||
if (!value || typeof value !== 'string') {
|
||||
return all;
|
||||
}
|
||||
|
||||
const isValidName = validVariableNames[key]
|
||||
? validVariableNames[key].find((regex: RegExp) => regex.test(variableId))
|
||||
: undefined;
|
||||
|
||||
let hasVariable = containsVariable(value, variableId);
|
||||
if (key === 'repeat' && value === variableId) {
|
||||
// repeat stores value without variable format
|
||||
hasVariable = true;
|
||||
}
|
||||
|
||||
if (!isValidName && hasVariable) {
|
||||
all = {
|
||||
...all,
|
||||
[key]: value,
|
||||
};
|
||||
}
|
||||
|
||||
return all;
|
||||
}, {});
|
||||
|
||||
const objectValues = Object.keys(parent.value).reduce<Record<string, any>>((all, key) => {
|
||||
const value = parent.value[key];
|
||||
if (value && typeof value === 'object' && Object.keys(value).length) {
|
||||
let id = value.title || value.name || value.id || key;
|
||||
if (Array.isArray(parent.value) && parent.key === 'panels') {
|
||||
id = `${id}[${value.id}]`;
|
||||
}
|
||||
|
||||
const isValidName = validVariableNames[key]
|
||||
? validVariableNames[key].find((regex: RegExp) => regex.test(variableId))
|
||||
: undefined;
|
||||
const newResult = getPropsWithVariable(variableId, { key, value }, {});
|
||||
|
||||
let hasVariable = containsVariable(value, variableId);
|
||||
if (key === 'repeat' && value === variableId) {
|
||||
// repeat stores value without variable format
|
||||
hasVariable = true;
|
||||
}
|
||||
|
||||
if (!isValidName && hasVariable) {
|
||||
if (Object.keys(newResult).length) {
|
||||
all = {
|
||||
...all,
|
||||
[key]: value,
|
||||
[id]: newResult,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return all;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
);
|
||||
|
||||
const objectValues = Object.keys(parent.value).reduce(
|
||||
(all, key) => {
|
||||
const value = parent.value[key];
|
||||
if (value && typeof value === 'object' && Object.keys(value).length) {
|
||||
let id = value.title || value.name || value.id || key;
|
||||
if (Array.isArray(parent.value) && parent.key === 'panels') {
|
||||
id = `${id}[${value.id}]`;
|
||||
}
|
||||
|
||||
const newResult = getPropsWithVariable(variableId, { key, value }, {});
|
||||
|
||||
if (Object.keys(newResult).length) {
|
||||
all = {
|
||||
...all,
|
||||
[id]: newResult,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return all;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
);
|
||||
return all;
|
||||
}, {});
|
||||
|
||||
if (Object.keys(stringValues).length || Object.keys(objectValues).length) {
|
||||
result = {
|
||||
@ -341,7 +335,7 @@ export const transformUsagesToNetwork = (usages: VariableUsageTree[]): UsagesToN
|
||||
return results;
|
||||
};
|
||||
|
||||
const countLeaves = (object: any): number => {
|
||||
const countLeaves = (object: object): number => {
|
||||
const total = Object.values(object).reduce((count: number, value: any) => {
|
||||
if (typeof value === 'object') {
|
||||
return count + countLeaves(value);
|
||||
@ -350,7 +344,7 @@ const countLeaves = (object: any): number => {
|
||||
return count + 1;
|
||||
}, 0);
|
||||
|
||||
return total as unknown as number;
|
||||
return total;
|
||||
};
|
||||
|
||||
export const getVariableUsages = (variableId: string, usages: VariableUsageTree[]): number => {
|
||||
|
@ -65,7 +65,7 @@ describe('optionsPickerReducer', () => {
|
||||
clearOthers: args.clearOthers,
|
||||
option: { text: args.option, value: args.option, selected: true },
|
||||
};
|
||||
const expectedAsRecord: any = args.expectSelected.reduce((all: any, current: any) => {
|
||||
const expectedAsRecord = args.expectSelected.reduce((all: any, current: any) => {
|
||||
all[current] = current;
|
||||
return all;
|
||||
}, {});
|
||||
|
@ -184,25 +184,22 @@ export function flattenQuery(query: any): any {
|
||||
}
|
||||
|
||||
const keys = Object.keys(query);
|
||||
const flattened = keys.reduce(
|
||||
(all, key) => {
|
||||
const value = query[key];
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
all[key] = value;
|
||||
return all;
|
||||
}
|
||||
|
||||
const result = flattenQuery(value);
|
||||
for (let childProp in result) {
|
||||
if (result.hasOwnProperty(childProp)) {
|
||||
all[`${key}_${childProp}`] = result[childProp];
|
||||
}
|
||||
}
|
||||
|
||||
const flattened = keys.reduce<Record<string, any>>((all, key) => {
|
||||
const value = query[key];
|
||||
if (typeof value !== 'object' || value === null) {
|
||||
all[key] = value;
|
||||
return all;
|
||||
},
|
||||
{} as Record<string, any>
|
||||
);
|
||||
}
|
||||
|
||||
const result = flattenQuery(value);
|
||||
for (let childProp in result) {
|
||||
if (result.hasOwnProperty(childProp)) {
|
||||
all[`${key}_${childProp}`] = result[childProp];
|
||||
}
|
||||
}
|
||||
|
||||
return all;
|
||||
}, {});
|
||||
|
||||
return flattened;
|
||||
}
|
||||
|
@ -877,10 +877,10 @@ const getQueryWithVariables = (key: string, getState: () => StoreState): UrlQuer
|
||||
|
||||
const queryParamsNew = Object.keys(queryParams)
|
||||
.filter((key) => key.indexOf(VARIABLE_PREFIX) === -1)
|
||||
.reduce((obj, key) => {
|
||||
.reduce<UrlQueryMap>((obj, key) => {
|
||||
obj[key] = queryParams[key];
|
||||
return obj;
|
||||
}, {} as UrlQueryMap);
|
||||
}, {});
|
||||
|
||||
for (const variable of getVariablesByKey(key, getState())) {
|
||||
if (variable.skipUrlSync) {
|
||||
|
@ -100,8 +100,8 @@ class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryF
|
||||
BracesPlugin(),
|
||||
SlatePrism(
|
||||
{
|
||||
onlyIn: (node: any) => node.type === 'code_block',
|
||||
getSyntax: (node: any) => 'promql',
|
||||
onlyIn: (node) => 'type' in node && node.type === 'code_block',
|
||||
getSyntax: (node) => 'promql',
|
||||
},
|
||||
{ ...(prismLanguages as LanguageMap), promql: this.props.datasource.languageProvider.syntax }
|
||||
),
|
||||
|
@ -71,16 +71,15 @@ export const binaryScalarDefs = [
|
||||
},
|
||||
];
|
||||
|
||||
export const binaryScalarOperatorToOperatorName = binaryScalarDefs.reduce(
|
||||
(acc, def) => {
|
||||
acc[def.sign] = {
|
||||
id: def.id,
|
||||
comparison: def.comparison,
|
||||
};
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, { id: string; comparison?: boolean }>
|
||||
);
|
||||
export const binaryScalarOperatorToOperatorName = binaryScalarDefs.reduce<
|
||||
Record<string, { id: string; comparison?: boolean }>
|
||||
>((acc, def) => {
|
||||
acc[def.sign] = {
|
||||
id: def.id,
|
||||
comparison: def.comparison,
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// Not sure about this one. It could also be a more generic 'Simple math operation' where user specifies
|
||||
// both the operator and the operand in a single input
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { MutableDataFrame } from '@grafana/data';
|
||||
import { FieldType, MutableDataFrame } from '@grafana/data';
|
||||
|
||||
export const bigResponse = new MutableDataFrame({
|
||||
fields: [
|
||||
@ -1807,73 +1807,73 @@ export const otlpDataFrameFromResponse = new MutableDataFrame({
|
||||
fields: [
|
||||
{
|
||||
name: 'traceID',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['60ba2abb44f13eae'],
|
||||
},
|
||||
{
|
||||
name: 'spanID',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['726b5e30102fc0d0'],
|
||||
},
|
||||
{
|
||||
name: 'parentSpanID',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['398f0f21a3db99ae'],
|
||||
},
|
||||
{
|
||||
name: 'operationName',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['HTTP GET - root'],
|
||||
},
|
||||
{
|
||||
name: 'serviceName',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['db'],
|
||||
},
|
||||
{
|
||||
name: 'kind',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['client'],
|
||||
},
|
||||
{
|
||||
name: 'statusCode',
|
||||
type: 'number',
|
||||
type: FieldType.number,
|
||||
config: {},
|
||||
values: [2],
|
||||
},
|
||||
{
|
||||
name: 'statusMessage',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['message'],
|
||||
},
|
||||
{
|
||||
name: 'instrumentationLibraryName',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['libraryName'],
|
||||
},
|
||||
{
|
||||
name: 'instrumentationLibraryVersion',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['libraryVersion'],
|
||||
},
|
||||
{
|
||||
name: 'traceState',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['traceState'],
|
||||
},
|
||||
{
|
||||
name: 'serviceTags',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [
|
||||
[
|
||||
@ -1906,25 +1906,25 @@ export const otlpDataFrameFromResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'startTime',
|
||||
type: 'number',
|
||||
type: FieldType.number,
|
||||
config: {},
|
||||
values: [1627471657255.809],
|
||||
},
|
||||
{
|
||||
name: 'duration',
|
||||
type: 'number',
|
||||
type: FieldType.number,
|
||||
config: {},
|
||||
values: [0.459008],
|
||||
},
|
||||
{
|
||||
name: 'logs',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [[]],
|
||||
},
|
||||
{
|
||||
name: 'references',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [
|
||||
[
|
||||
@ -1946,7 +1946,7 @@ export const otlpDataFrameFromResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [
|
||||
[
|
||||
@ -1971,7 +1971,7 @@ export const otlpDataFrameFromResponse = new MutableDataFrame({
|
||||
},
|
||||
],
|
||||
length: 1,
|
||||
} as any);
|
||||
});
|
||||
|
||||
export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
meta: {
|
||||
@ -1983,7 +1983,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
fields: [
|
||||
{
|
||||
name: 'traceID',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['60ba2abb44f13eae'],
|
||||
state: {
|
||||
@ -1992,7 +1992,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'spanID',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['726b5e30102fc0d0'],
|
||||
state: {
|
||||
@ -2001,7 +2001,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'parentSpanID',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['398f0f21a3db99ae'],
|
||||
state: {
|
||||
@ -2010,7 +2010,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'operationName',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['HTTP GET - root'],
|
||||
state: {
|
||||
@ -2019,7 +2019,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'serviceName',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['db'],
|
||||
state: {
|
||||
@ -2028,7 +2028,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'kind',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['client'],
|
||||
state: {
|
||||
@ -2037,7 +2037,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'statusCode',
|
||||
type: 'number',
|
||||
type: FieldType.number,
|
||||
config: {},
|
||||
values: [2],
|
||||
state: {
|
||||
@ -2046,7 +2046,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'statusMessage',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['message'],
|
||||
state: {
|
||||
@ -2055,7 +2055,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'instrumentationLibraryName',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['libraryName'],
|
||||
state: {
|
||||
@ -2064,7 +2064,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'instrumentationLibraryVersion',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['libraryVersion'],
|
||||
state: {
|
||||
@ -2073,7 +2073,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'traceState',
|
||||
type: 'string',
|
||||
type: FieldType.string,
|
||||
config: {},
|
||||
values: ['traceState'],
|
||||
state: {
|
||||
@ -2082,7 +2082,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'serviceTags',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [
|
||||
[
|
||||
@ -2118,7 +2118,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'startTime',
|
||||
type: 'number',
|
||||
type: FieldType.number,
|
||||
config: {},
|
||||
values: [1627471657255.809],
|
||||
state: {
|
||||
@ -2127,7 +2127,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'duration',
|
||||
type: 'number',
|
||||
type: FieldType.number,
|
||||
config: {},
|
||||
values: [0.459008],
|
||||
state: {
|
||||
@ -2136,7 +2136,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'logs',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [[]],
|
||||
state: {
|
||||
@ -2145,7 +2145,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
values: [
|
||||
[
|
||||
@ -2173,7 +2173,7 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
{
|
||||
name: 'references',
|
||||
type: 'other',
|
||||
type: FieldType.other,
|
||||
config: {},
|
||||
labels: undefined,
|
||||
values: [
|
||||
@ -2198,9 +2198,8 @@ export const otlpDataFrameToResponse = new MutableDataFrame({
|
||||
},
|
||||
},
|
||||
],
|
||||
first: ['60ba2abb44f13eae'],
|
||||
length: 1,
|
||||
} as any);
|
||||
});
|
||||
|
||||
export const otlpResponse = {
|
||||
batches: [
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { css } from '@emotion/css';
|
||||
import type { languages } from 'monaco-editor';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
@ -194,8 +193,8 @@ function ensureTraceQL(monaco: Monaco) {
|
||||
traceqlSetupDone = true;
|
||||
const { aliases, extensions, mimetypes, def } = languageDefinition;
|
||||
monaco.languages.register({ id: langId, aliases, extensions, mimetypes });
|
||||
monaco.languages.setMonarchTokensProvider(langId, def.language as languages.IMonarchLanguage);
|
||||
monaco.languages.setLanguageConfiguration(langId, def.languageConfiguration as languages.LanguageConfiguration);
|
||||
monaco.languages.setMonarchTokensProvider(langId, def.language);
|
||||
monaco.languages.setLanguageConfiguration(langId, def.languageConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { languages } from 'monaco-editor';
|
||||
import { Grammar } from 'prismjs';
|
||||
|
||||
export const languageConfiguration = {
|
||||
export const languageConfiguration: languages.LanguageConfiguration = {
|
||||
// the default separators except `@$`
|
||||
wordPattern: /(-?\d*\.\d\w*)|([^`~!#%^&*()\-=+\[{\]}\\|;:'",.<>\/?\s]+)/g,
|
||||
brackets: [
|
||||
@ -35,7 +36,7 @@ const keywords = intrinsics.concat(scopes);
|
||||
|
||||
const statusValues = ['ok', 'unset', 'error', 'false', 'true'];
|
||||
|
||||
export const language = {
|
||||
export const language: languages.IMonarchLanguage = {
|
||||
ignoreCase: false,
|
||||
defaultToken: '',
|
||||
tokenPostfix: '.traceql',
|
||||
|
@ -4,14 +4,13 @@ import { SelectableValue } from '@grafana/data';
|
||||
import { InlineField, InlineFieldRow, Input, Select } from '@grafana/ui';
|
||||
|
||||
import { EditorProps } from '../QueryEditor';
|
||||
import { StreamingQuery } from '../dataquery.gen';
|
||||
|
||||
const streamingClientFields = [
|
||||
{ label: 'Speed (ms)', id: 'speed', placeholder: 'value', min: 10, step: 10 },
|
||||
{ label: 'Spread', id: 'spread', placeholder: 'value', min: 0.5, step: 0.1 },
|
||||
{ label: 'Noise', id: 'noise', placeholder: 'value', min: 0, step: 0.1 },
|
||||
{ label: 'Bands', id: 'bands', placeholder: 'bands', min: 0, step: 1 },
|
||||
];
|
||||
] as const;
|
||||
|
||||
const types = [
|
||||
{ value: 'signal', label: 'Signal' },
|
||||
@ -46,7 +45,7 @@ export const StreamingClientEditor = ({ onChange, query }: EditorProps) => {
|
||||
name={id}
|
||||
min={min}
|
||||
step={step}
|
||||
value={query.stream?.[id as keyof StreamingQuery]}
|
||||
value={query.stream?.[id]}
|
||||
placeholder={placeholder}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { FieldColorModeId, FieldType, PreferredVisualisationType, NodeGraphDataFrameFieldNames } from '@grafana/data';
|
||||
import { FieldColorModeId, FieldType, NodeGraphDataFrameFieldNames } from '@grafana/data';
|
||||
|
||||
export const nodes = {
|
||||
fields: [
|
||||
@ -157,7 +157,7 @@ export const nodes = {
|
||||
values: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
},
|
||||
],
|
||||
meta: { preferredVisualisationType: 'nodeGraph' as PreferredVisualisationType },
|
||||
meta: { preferredVisualisationType: 'nodeGraph' as const },
|
||||
name: 'nodes',
|
||||
};
|
||||
|
||||
@ -333,6 +333,6 @@ export const edges = {
|
||||
],
|
||||
},
|
||||
],
|
||||
meta: { preferredVisualisationType: 'nodeGraph' as PreferredVisualisationType },
|
||||
meta: { preferredVisualisationType: 'nodeGraph' as const },
|
||||
name: 'edges',
|
||||
};
|
||||
|
@ -110,12 +110,12 @@ export const CandlestickPanel = ({
|
||||
if (forField.name === info.volume?.name) {
|
||||
let filter = (u: uPlot, splits: number[]) => {
|
||||
let _splits = [];
|
||||
let max = u.series[volumeIdx].max as number;
|
||||
let max = u.series[volumeIdx].max;
|
||||
|
||||
for (let i = 0; i < splits.length; i++) {
|
||||
_splits.push(splits[i]);
|
||||
|
||||
if (splits[i] > max) {
|
||||
if (max && splits[i] > max) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ export const CandlestickPanel = ({
|
||||
if (shouldRenderPrice) {
|
||||
// hide series from legend that are rendered as composite markers
|
||||
for (let key in renderers[0].fieldMap) {
|
||||
let field = (info as any)[key] as Field;
|
||||
let field: Field = (info as any)[key];
|
||||
field.config = {
|
||||
...field.config,
|
||||
custom: {
|
||||
|
@ -17,21 +17,21 @@ import { CandlestickData, candlestickFieldsInfo, FieldPickerInfo, prepareCandles
|
||||
import { CandlestickSuggestionsSupplier } from './suggestions';
|
||||
import { defaultCandlestickColors, defaultOptions, Options, VizDisplayMode, ColorStrategy, CandleStyle } from './types';
|
||||
|
||||
const modeOptions = [
|
||||
const modeOptions: Array<SelectableValue<VizDisplayMode>> = [
|
||||
{ label: 'Candles', value: VizDisplayMode.Candles },
|
||||
{ label: 'Volume', value: VizDisplayMode.Volume },
|
||||
{ label: 'Both', value: VizDisplayMode.CandlesVolume },
|
||||
] as Array<SelectableValue<VizDisplayMode>>;
|
||||
];
|
||||
|
||||
const candleStyles = [
|
||||
const candleStyles: Array<SelectableValue<CandleStyle>> = [
|
||||
{ label: 'Candles', value: CandleStyle.Candles },
|
||||
{ label: 'OHLC Bars', value: CandleStyle.OHLCBars },
|
||||
] as Array<SelectableValue<CandleStyle>>;
|
||||
];
|
||||
|
||||
const colorStrategies = [
|
||||
const colorStrategies: Array<SelectableValue<ColorStrategy>> = [
|
||||
{ label: 'Since Open', value: ColorStrategy.OpenClose },
|
||||
{ label: 'Since Prior Close', value: ColorStrategy.CloseClose },
|
||||
] as Array<SelectableValue<ColorStrategy>>;
|
||||
];
|
||||
|
||||
const numericFieldFilter = (f: Field) => f.type === FieldType.number;
|
||||
|
||||
@ -43,7 +43,7 @@ function addFieldPicker(
|
||||
let placeholderText = 'Auto ';
|
||||
|
||||
if (data) {
|
||||
const current = data[info.key] as Field;
|
||||
const current = data[info.key];
|
||||
|
||||
if (current?.config) {
|
||||
placeholderText += '= ' + getFieldDisplayName(current);
|
||||
|
@ -120,12 +120,12 @@ export function drawMarkers(opts: RendererOpts) {
|
||||
let intraDir = Math.sign(cData[i]! - oData[i]!);
|
||||
|
||||
// volume
|
||||
if (drawVolume) {
|
||||
if (drawVolume && flatPathVol && upPathVol && downPathVol) {
|
||||
let outerPath = selectPath(
|
||||
colorStrategy === ColorStrategy.CloseClose ? interDir : intraDir,
|
||||
flatPathVol as Path2D,
|
||||
upPathVol as Path2D,
|
||||
downPathVol as Path2D,
|
||||
flatPathVol,
|
||||
upPathVol,
|
||||
downPathVol,
|
||||
i === idx0 && ColorStrategy.CloseClose ? false : flatAsUp
|
||||
);
|
||||
|
||||
@ -133,12 +133,12 @@ export function drawMarkers(opts: RendererOpts) {
|
||||
outerPath.rect(tPx - halfWidth, vPx, barWidth, zeroPx! - vPx);
|
||||
}
|
||||
|
||||
if (drawPrice) {
|
||||
if (drawPrice && flatPath && upPath && downPath) {
|
||||
let outerPath = selectPath(
|
||||
colorStrategy === ColorStrategy.CloseClose ? interDir : intraDir,
|
||||
flatPath as Path2D,
|
||||
upPath as Path2D,
|
||||
downPath as Path2D,
|
||||
flatPath,
|
||||
upPath,
|
||||
downPath,
|
||||
i === idx0 && ColorStrategy.CloseClose ? false : flatAsUp
|
||||
);
|
||||
|
||||
@ -179,26 +179,26 @@ export function drawMarkers(opts: RendererOpts) {
|
||||
ctx.rect(u.bbox.left, u.bbox.top, u.bbox.width, u.bbox.height);
|
||||
ctx.clip();
|
||||
|
||||
if (drawVolume) {
|
||||
if (drawVolume && flatPathVol && upPathVol && downPathVol) {
|
||||
ctx.fillStyle = alpha(upColor, volumeAlpha);
|
||||
ctx.fill(upPathVol as Path2D);
|
||||
ctx.fill(upPathVol);
|
||||
|
||||
ctx.fillStyle = alpha(downColor, volumeAlpha);
|
||||
ctx.fill(downPathVol as Path2D);
|
||||
ctx.fill(downPathVol);
|
||||
|
||||
ctx.fillStyle = alpha(flatColor, volumeAlpha);
|
||||
ctx.fill(flatPathVol as Path2D);
|
||||
ctx.fill(flatPathVol);
|
||||
}
|
||||
|
||||
if (drawPrice) {
|
||||
if (drawPrice && flatPath && upPath && downPath) {
|
||||
ctx.fillStyle = upColor;
|
||||
ctx.fill(upPath as Path2D);
|
||||
ctx.fill(upPath);
|
||||
|
||||
ctx.fillStyle = downColor;
|
||||
ctx.fill(downPath as Path2D);
|
||||
ctx.fill(downPath);
|
||||
|
||||
ctx.fillStyle = flatColor;
|
||||
ctx.fill(flatPath as Path2D);
|
||||
ctx.fill(flatPath);
|
||||
|
||||
ctx.globalCompositeOperation = 'destination-out';
|
||||
ctx.fill(hollowPath);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { VisualizationSuggestionsBuilder } from '@grafana/data';
|
||||
import { LegendDisplayMode } from '@grafana/schema';
|
||||
import { SuggestionName } from 'app/types/suggestions';
|
||||
|
||||
import { PieChartLabels, Options, PieChartType } from './panelcfg.gen';
|
||||
@ -15,14 +16,11 @@ export class PieChartSuggestionsSupplier {
|
||||
},
|
||||
displayLabels: [PieChartLabels.Percent],
|
||||
legend: {
|
||||
calcs: [],
|
||||
displayMode: LegendDisplayMode.Hidden,
|
||||
placement: 'right',
|
||||
values: [],
|
||||
} as any,
|
||||
},
|
||||
cardOptions: {
|
||||
previewModifier: (s) => {
|
||||
// Hide labels in preview
|
||||
s.options!.legend.showLegend = false;
|
||||
showLegend: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ export const statPanelChangedHandler = (
|
||||
prevOptions: any
|
||||
) => {
|
||||
// This handles most config changes
|
||||
const options = sharedSingleStatPanelChangedHandler(panel, prevPluginId, prevOptions) as Options;
|
||||
const options: Options = sharedSingleStatPanelChangedHandler(panel, prevPluginId, prevOptions);
|
||||
|
||||
// Changing from angular singlestat
|
||||
if (prevOptions.angular && (prevPluginId === 'singlestat' || prevPluginId === 'grafana-singlestat-panel')) {
|
||||
|
@ -10,7 +10,7 @@ export const timelinePanelChangedHandler = (
|
||||
prevPluginId: string,
|
||||
prevOptions: any
|
||||
) => {
|
||||
let options = (panel.options ?? {}) as Options;
|
||||
let options: Options = panel.options ?? {};
|
||||
|
||||
// Changing from angular singlestat
|
||||
if (prevPluginId === 'natel-discrete-panel' && prevOptions.angular) {
|
||||
@ -34,17 +34,17 @@ export const timelinePanelChangedHandler = (
|
||||
|
||||
if (isArray(oldOptions.colorMaps)) {
|
||||
for (const p of oldOptions.colorMaps) {
|
||||
const color = p.color as string;
|
||||
const color: string = p.color;
|
||||
if (color) {
|
||||
valuemap.options[p.text as string] = { color };
|
||||
valuemap.options[p.text] = { color };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isArray(oldOptions.valueMaps)) {
|
||||
for (const p of oldOptions.valueMaps) {
|
||||
const text = p.text as string;
|
||||
const value = p.value as string;
|
||||
const text: string = p.text;
|
||||
const value: string = p.value;
|
||||
if (text && value) {
|
||||
let old = valuemap.options[value];
|
||||
if (old) {
|
||||
@ -60,7 +60,7 @@ export const timelinePanelChangedHandler = (
|
||||
for (const p of oldOptions.rangeMaps) {
|
||||
let from = +p.from;
|
||||
let to = +p.to;
|
||||
const text = p.text as string;
|
||||
const text: string = p.text;
|
||||
if (text) {
|
||||
fieldConfig.defaults.mappings.push({
|
||||
type: MappingType.RangeToText,
|
||||
|
@ -138,7 +138,7 @@ export const plugin = new PanelPlugin<Options, TableFieldOptions>(TablePanel)
|
||||
path: 'footer.reducer',
|
||||
name: 'Calculation',
|
||||
description: 'Choose a reducer function / calculation',
|
||||
editor: standardEditorsRegistry.get('stats-picker').editor as any,
|
||||
editor: standardEditorsRegistry.get('stats-picker').editor,
|
||||
defaultValue: [ReducerID.sum],
|
||||
showIf: (cfg) => cfg.footer?.show,
|
||||
})
|
||||
@ -167,7 +167,7 @@ export const plugin = new PanelPlugin<Options, TableFieldOptions>(TablePanel)
|
||||
if (field.type === FieldType.number) {
|
||||
const name = getFieldDisplayName(field, frame, context.data);
|
||||
const value = field.name;
|
||||
options.push({ value, label: name } as any);
|
||||
options.push({ value, label: name });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ export const textPanelMigrationHandler = (panel: PanelModel<Options>): Partial<O
|
||||
|
||||
// Migrates old Angular based text panel props to new props
|
||||
if (panel.hasOwnProperty('content') && panel.hasOwnProperty('mode')) {
|
||||
const oldTextPanel: any = panel as any;
|
||||
const oldTextPanel: any = panel;
|
||||
const content = oldTextPanel.content;
|
||||
const mode = oldTextPanel.mode as TextMode;
|
||||
const mode: TextMode = oldTextPanel.mode;
|
||||
|
||||
delete oldTextPanel.content;
|
||||
delete oldTextPanel.mode;
|
||||
|
@ -297,7 +297,7 @@ export function graphToTimeseriesOptions(angular: any): {
|
||||
}
|
||||
}
|
||||
|
||||
const graph = y1.custom ?? ({} as GraphFieldConfig);
|
||||
const graph: GraphFieldConfig = y1.custom ?? {};
|
||||
graph.drawStyle = angular.bars ? GraphDrawStyle.Bars : angular.lines ? GraphDrawStyle.Line : GraphDrawStyle.Points;
|
||||
|
||||
if (angular.points) {
|
||||
@ -344,7 +344,7 @@ export function graphToTimeseriesOptions(angular: any): {
|
||||
}
|
||||
|
||||
y1.custom = omitBy(graph, isNil);
|
||||
y1.nullValueMode = angular.nullPointMode as NullValueMode;
|
||||
y1.nullValueMode = angular.nullPointMode;
|
||||
|
||||
const options: Options = {
|
||||
legend: {
|
||||
@ -616,7 +616,7 @@ function getFieldConfigFromOldAxis(obj: any): FieldConfig<GraphFieldConfig> {
|
||||
graph.axisLabel = obj.label;
|
||||
}
|
||||
if (obj.logBase) {
|
||||
const log = obj.logBase as number;
|
||||
const log: number = obj.logBase;
|
||||
if (log === 2 || log === 10) {
|
||||
graph.scaleDistribution = {
|
||||
type: ScaleDistribution.Log,
|
||||
@ -666,7 +666,7 @@ function fillY2DynamicValues(
|
||||
}
|
||||
}
|
||||
|
||||
function validNumber(val: any): number | undefined {
|
||||
function validNumber(val: unknown): number | undefined {
|
||||
if (isNumber(val)) {
|
||||
return val;
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ import {
|
||||
GraphDrawStyle,
|
||||
GraphFieldConfig,
|
||||
GraphGradientMode,
|
||||
LegendDisplayMode,
|
||||
LineInterpolation,
|
||||
StackingMode,
|
||||
VizLegendOptions,
|
||||
} from '@grafana/schema';
|
||||
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
||||
import { SuggestionName } from 'app/types/suggestions';
|
||||
@ -29,7 +29,12 @@ export class TimeSeriesSuggestionsSupplier {
|
||||
name: SuggestionName.LineChart,
|
||||
pluginId: 'timeseries',
|
||||
options: {
|
||||
legend: {} as VizLegendOptions,
|
||||
legend: {
|
||||
calcs: [],
|
||||
displayMode: LegendDisplayMode.Hidden,
|
||||
placement: 'right',
|
||||
showLegend: false,
|
||||
},
|
||||
},
|
||||
fieldConfig: {
|
||||
defaults: {
|
||||
@ -39,8 +44,6 @@ export class TimeSeriesSuggestionsSupplier {
|
||||
},
|
||||
cardOptions: {
|
||||
previewModifier: (s) => {
|
||||
s.options!.legend.showLegend = false;
|
||||
|
||||
if (s.fieldConfig?.defaults.custom?.drawStyle !== GraphDrawStyle.Bars) {
|
||||
s.fieldConfig!.defaults.custom!.lineWidth = Math.max(s.fieldConfig!.defaults.custom!.lineWidth ?? 1, 2);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { VisualizationSuggestionsBuilder } from '@grafana/data';
|
||||
import { GraphDrawStyle, GraphFieldConfig, VizLegendOptions } from '@grafana/schema';
|
||||
import { GraphDrawStyle, GraphFieldConfig, LegendDisplayMode } from '@grafana/schema';
|
||||
import { SuggestionName } from 'app/types/suggestions';
|
||||
|
||||
import { Options } from './panelcfg.gen';
|
||||
@ -17,7 +17,12 @@ export class TrendSuggestionsSupplier {
|
||||
name: SuggestionName.LineChart,
|
||||
pluginId: 'trend',
|
||||
options: {
|
||||
legend: {} as VizLegendOptions,
|
||||
legend: {
|
||||
calcs: [],
|
||||
displayMode: LegendDisplayMode.Hidden,
|
||||
placement: 'right',
|
||||
showLegend: false,
|
||||
},
|
||||
},
|
||||
fieldConfig: {
|
||||
defaults: {
|
||||
@ -27,8 +32,6 @@ export class TrendSuggestionsSupplier {
|
||||
},
|
||||
cardOptions: {
|
||||
previewModifier: (s) => {
|
||||
s.options!.legend.showLegend = false;
|
||||
|
||||
if (s.fieldConfig?.defaults.custom?.drawStyle !== GraphDrawStyle.Bars) {
|
||||
s.fieldConfig!.defaults.custom!.lineWidth = Math.max(s.fieldConfig!.defaults.custom!.lineWidth ?? 1, 2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user