From cadc551a3c7d2757f1b37aa23935439b44b582e4 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Fri, 10 May 2024 12:00:41 +0100 Subject: [PATCH] Chore: Remove deprecated re-exported template variable types (#87459) Chore: Remove deprecated re-exported template varible types --- .betterer.results | 5 +- .../DashExportModal/DashboardExporter.ts | 3 +- .../components/ShareModal/ShareSnapshot.tsx | 3 +- .../dashboard/state/DashboardMigrator.test.ts | 3 +- .../dashboard/state/DashboardMigrator.ts | 4 +- .../variables/adhoc/AdHocVariableEditor.tsx | 3 +- .../app/features/variables/adhoc/actions.ts | 3 +- .../app/features/variables/adhoc/adapter.ts | 3 +- .../adhoc/picker/AdHocFilter.test.tsx | 3 +- .../variables/adhoc/picker/AdHocFilter.tsx | 3 +- .../adhoc/picker/AdHocFilterBuilder.tsx | 3 +- .../adhoc/picker/AdHocFilterRenderer.tsx | 3 +- .../variables/adhoc/picker/AdHocPicker.tsx | 2 +- .../features/variables/adhoc/reducer.test.ts | 3 +- .../app/features/variables/adhoc/reducer.ts | 3 +- .../variables/adhoc/urlParser.test.ts | 3 +- .../app/features/variables/adhoc/urlParser.ts | 3 +- .../constant/ConstantVariableEditor.tsx | 2 +- .../variables/constant/actions.test.ts | 4 +- .../features/variables/constant/adapter.ts | 3 +- .../variables/constant/reducer.test.ts | 3 +- .../features/variables/constant/reducer.ts | 4 +- .../variables/custom/CustomVariableEditor.tsx | 2 +- .../features/variables/custom/actions.test.ts | 4 +- .../app/features/variables/custom/adapter.ts | 3 +- .../features/variables/custom/reducer.test.ts | 3 +- .../app/features/variables/custom/reducer.ts | 4 +- .../datasource/DataSourceVariableEditor.tsx | 3 +- .../features/variables/datasource/adapter.ts | 3 +- .../variables/datasource/reducer.test.ts | 3 +- .../features/variables/datasource/reducer.ts | 10 +++- .../editor/SelectionOptionsEditor.tsx | 2 +- .../variables/editor/VariableEditorEditor.tsx | 3 +- public/app/features/variables/guard.ts | 15 +++--- .../features/variables/interval/adapter.ts | 3 +- .../variables/interval/reducer.test.ts | 3 +- .../features/variables/interval/reducer.ts | 4 +- .../OptionsPicker/OptionPicker.test.tsx | 3 +- .../pickers/OptionsPicker/OptionsPicker.tsx | 3 +- .../pickers/OptionsPicker/actions.test.ts | 3 +- .../pickers/OptionsPicker/actions.ts | 3 +- .../pickers/OptionsPicker/reducer.test.ts | 3 +- .../pickers/OptionsPicker/reducer.ts | 3 +- .../pickers/shared/VariableOptions.tsx | 3 +- .../query/QueryVariableEditor.test.tsx | 3 +- .../variables/query/QueryVariableEditor.tsx | 10 +++- .../query/QueryVariableSortSelect.tsx | 3 +- .../query/VariableQueryRunner.test.ts | 9 +++- .../variables/query/VariableQueryRunner.ts | 2 +- .../features/variables/query/actions.test.tsx | 13 ++++- .../app/features/variables/query/adapter.ts | 3 +- .../app/features/variables/query/operators.ts | 2 +- .../variables/query/queryRunners.test.ts | 3 +- .../features/variables/query/queryRunners.ts | 2 +- .../features/variables/query/reducer.test.ts | 3 +- .../app/features/variables/query/reducer.ts | 11 ++++- .../variables/shared/multiOptions.test.ts | 2 +- .../features/variables/shared/multiOptions.ts | 2 +- .../shared/testing/adHocVariableBuilder.ts | 3 +- .../testing/datasourceVariableBuilder.ts | 2 +- .../shared/testing/intervalVariableBuilder.ts | 2 +- .../shared/testing/multiVariableBuilder.ts | 2 +- .../shared/testing/optionsVariableBuilder.ts | 2 +- .../shared/testing/queryVariableBuilder.ts | 3 +- .../shared/testing/textboxVariableBuilder.ts | 2 +- .../features/variables/state/actions.test.ts | 3 +- .../state/onTimeRangeUpdated.test.ts | 3 +- .../variables/state/processVariable.test.ts | 3 +- .../features/variables/state/reducers.test.ts | 3 +- .../variables/state/sharedReducer.test.ts | 10 +++- .../app/features/variables/system/adapter.ts | 4 +- .../textbox/TextBoxVariableEditor.tsx | 2 +- .../textbox/TextBoxVariablePicker.tsx | 3 +- .../variables/textbox/actions.test.ts | 2 +- .../variables/textbox/adapter.test.ts | 3 +- .../app/features/variables/textbox/adapter.ts | 3 +- .../variables/textbox/reducer.test.ts | 3 +- .../app/features/variables/textbox/reducer.ts | 4 +- public/app/features/variables/types.ts | 47 +------------------ public/app/features/variables/utils.test.ts | 3 +- 80 files changed, 162 insertions(+), 173 deletions(-) diff --git a/.betterer.results b/.betterer.results index 55c8535ea9f..3eb8c158d17 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3524,12 +3524,11 @@ exports[`better eslint`] = { ], "public/app/features/variables/types.ts:5381": [ [0, 0, 0, "Do not re-export imported variable (\`@grafana/data\`)", "0"], - [0, 0, 0, "Do not re-export imported variable (\`VariableHide\`)", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"] + [0, 0, 0, "Unexpected any. Specify a different type.", "5"] ], "public/app/features/variables/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts index 8548434f913..6ae2611f63c 100644 --- a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts +++ b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts @@ -1,6 +1,6 @@ import { defaults, each, sortBy } from 'lodash'; -import { DataSourceRef, PanelPluginMeta } from '@grafana/data'; +import { DataSourceRef, PanelPluginMeta, VariableOption, VariableRefresh } from '@grafana/data'; import { getDataSourceSrv } from '@grafana/runtime'; import config from 'app/core/config'; import { PanelModel } from 'app/features/dashboard/state'; @@ -10,7 +10,6 @@ import { variableRegex } from 'app/features/variables/utils'; import { isPanelModelLibraryPanel } from '../../../library-panels/guard'; import { LibraryElementKind } from '../../../library-panels/types'; import { isConstant, isQuery } from '../../../variables/guard'; -import { VariableOption, VariableRefresh } from '../../../variables/types'; import { DashboardModel } from '../../state/DashboardModel'; import { GridPos } from '../../state/PanelModel'; diff --git a/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx b/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx index 300cdbc29bf..e3309e2547e 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareSnapshot.tsx @@ -1,6 +1,6 @@ import React, { PureComponent } from 'react'; -import { isEmptyObject, SelectableValue } from '@grafana/data'; +import { isEmptyObject, SelectableValue, VariableRefresh } from '@grafana/data'; import { getBackendSrv } from '@grafana/runtime'; import { Button, ClipboardButton, Field, Input, LinkButton, Modal, Select, Spinner } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; @@ -8,7 +8,6 @@ import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; import { DashboardInteractions } from 'app/features/dashboard-scene/utils/interactions'; -import { VariableRefresh } from '../../../variables/types'; import { getDashboardSnapshotSrv } from '../../services/SnapshotSrv'; import { ShareModalTabProps } from './types'; diff --git a/public/app/features/dashboard/state/DashboardMigrator.test.ts b/public/app/features/dashboard/state/DashboardMigrator.test.ts index 9c5c6d5dfd8..b3aef514daf 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.test.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.test.ts @@ -1,6 +1,6 @@ import { each, map } from 'lodash'; -import { DataLinkBuiltInVars, MappingType } from '@grafana/data'; +import { DataLinkBuiltInVars, MappingType, VariableHide } from '@grafana/data'; import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks'; import { setDataSourceSrv } from '@grafana/runtime'; import { FieldConfigSource } from '@grafana/schema'; @@ -9,7 +9,6 @@ import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN } from 'app/core/constants'; import { mockDataSource, MockDataSourceSrv } from 'app/features/alerting/unified/mocks'; import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource'; -import { VariableHide } from '../../variables/types'; import { DashboardModel } from '../state/DashboardModel'; import { PanelModel } from '../state/PanelModel'; diff --git a/public/app/features/dashboard/state/DashboardMigrator.ts b/public/app/features/dashboard/state/DashboardMigrator.ts index 8f88281836f..4220f9d945e 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.ts @@ -2,6 +2,7 @@ import { each, find, findIndex, flattenDeep, isArray, isBoolean, isNumber, isStr import { AnnotationQuery, + ConstantVariableModel, DataLink, DataLinkBuiltInVars, DataQuery, @@ -19,10 +20,12 @@ import { SpecialValueMatch, standardEditorsRegistry, standardFieldConfigEditorRegistry, + TextBoxVariableModel, ThresholdsConfig, urlUtil, ValueMap, ValueMapping, + VariableHide, } from '@grafana/data'; import { labelsToFieldsTransformer } from '@grafana/data/src/transformations/transformers/labelsToFields'; import { mergeTransformer } from '@grafana/data/src/transformations/transformers/merge'; @@ -59,7 +62,6 @@ import { migrateMultipleStatsAnnotationQuery, migrateMultipleStatsMetricsQuery, } from '../../../plugins/datasource/cloudwatch/migrations/dashboardMigrations'; -import { ConstantVariableModel, TextBoxVariableModel, VariableHide } from '../../variables/types'; import { DashboardModel } from './DashboardModel'; import { PanelModel } from './PanelModel'; diff --git a/public/app/features/variables/adhoc/AdHocVariableEditor.tsx b/public/app/features/variables/adhoc/AdHocVariableEditor.tsx index 8bd63d44309..b99328b3f9f 100644 --- a/public/app/features/variables/adhoc/AdHocVariableEditor.tsx +++ b/public/app/features/variables/adhoc/AdHocVariableEditor.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import { DataSourceInstanceSettings, getDataSourceRef } from '@grafana/data'; +import { AdHocVariableModel, DataSourceInstanceSettings, getDataSourceRef } from '@grafana/data'; import { AdHocVariableForm } from 'app/features/dashboard-scene/settings/variables/components/AdHocVariableForm'; import { StoreState } from 'app/types'; @@ -9,7 +9,6 @@ import { initialVariableEditorState } from '../editor/reducer'; import { getAdhocVariableEditorState } from '../editor/selectors'; import { VariableEditorProps } from '../editor/types'; import { getVariablesState } from '../state/selectors'; -import { AdHocVariableModel } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { changeVariableDatasource } from './actions'; diff --git a/public/app/features/variables/adhoc/actions.ts b/public/app/features/variables/adhoc/actions.ts index 91d1ed8ef9c..4263bd09d3f 100644 --- a/public/app/features/variables/adhoc/actions.ts +++ b/public/app/features/variables/adhoc/actions.ts @@ -1,8 +1,7 @@ import { cloneDeep } from 'lodash'; -import { DataSourceRef } from '@grafana/data'; +import { AdHocVariableFilter, AdHocVariableModel, DataSourceRef } from '@grafana/data'; import { getDatasourceSrv } from 'app/features/plugins/datasource_srv'; -import { AdHocVariableFilter, AdHocVariableModel } from 'app/features/variables/types'; import { StoreState, ThunkResult } from 'app/types'; import { changeVariableEditorExtended } from '../editor/reducer'; diff --git a/public/app/features/variables/adhoc/adapter.ts b/public/app/features/variables/adhoc/adapter.ts index f5e9587de50..280a16eb723 100644 --- a/public/app/features/variables/adhoc/adapter.ts +++ b/public/app/features/variables/adhoc/adapter.ts @@ -1,8 +1,9 @@ import { cloneDeep } from 'lodash'; +import { AdHocVariableModel } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; -import { AdHocVariableModel } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { AdHocVariableEditor } from './AdHocVariableEditor'; diff --git a/public/app/features/variables/adhoc/picker/AdHocFilter.test.tsx b/public/app/features/variables/adhoc/picker/AdHocFilter.test.tsx index 1ef1b0b81f4..0e73c602ef4 100644 --- a/public/app/features/variables/adhoc/picker/AdHocFilter.test.tsx +++ b/public/app/features/variables/adhoc/picker/AdHocFilter.test.tsx @@ -3,10 +3,9 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import selectEvent from 'react-select-event'; +import { AdHocVariableFilter } from '@grafana/data'; import { DataSourceSrv, setDataSourceSrv } from '@grafana/runtime'; -import { AdHocVariableFilter } from '../../types'; - import { AdHocFilter } from './AdHocFilter'; describe('AdHocFilter', () => { diff --git a/public/app/features/variables/adhoc/picker/AdHocFilter.tsx b/public/app/features/variables/adhoc/picker/AdHocFilter.tsx index 80d8797b74e..8e3a34183cc 100644 --- a/public/app/features/variables/adhoc/picker/AdHocFilter.tsx +++ b/public/app/features/variables/adhoc/picker/AdHocFilter.tsx @@ -1,8 +1,7 @@ import React, { PureComponent, ReactNode } from 'react'; -import { DataSourceRef, SelectableValue } from '@grafana/data'; +import { AdHocVariableFilter, DataSourceRef, SelectableValue } from '@grafana/data'; import { Segment } from '@grafana/ui'; -import { AdHocVariableFilter } from 'app/features/variables/types'; import { AdHocFilterBuilder } from './AdHocFilterBuilder'; import { REMOVE_FILTER_KEY } from './AdHocFilterKey'; diff --git a/public/app/features/variables/adhoc/picker/AdHocFilterBuilder.tsx b/public/app/features/variables/adhoc/picker/AdHocFilterBuilder.tsx index 1f8e8ee5a57..10511671b89 100644 --- a/public/app/features/variables/adhoc/picker/AdHocFilterBuilder.tsx +++ b/public/app/features/variables/adhoc/picker/AdHocFilterBuilder.tsx @@ -1,8 +1,7 @@ import React, { useCallback, useState } from 'react'; -import { DataSourceRef, SelectableValue } from '@grafana/data'; +import { AdHocVariableFilter, DataSourceRef, SelectableValue } from '@grafana/data'; import { t } from 'app/core/internationalization'; -import { AdHocVariableFilter } from 'app/features/variables/types'; import { AdHocFilterKey, REMOVE_FILTER_KEY } from './AdHocFilterKey'; import { AdHocFilterRenderer } from './AdHocFilterRenderer'; diff --git a/public/app/features/variables/adhoc/picker/AdHocFilterRenderer.tsx b/public/app/features/variables/adhoc/picker/AdHocFilterRenderer.tsx index 12886ce6530..1a5c8fd0054 100644 --- a/public/app/features/variables/adhoc/picker/AdHocFilterRenderer.tsx +++ b/public/app/features/variables/adhoc/picker/AdHocFilterRenderer.tsx @@ -1,7 +1,6 @@ import React from 'react'; -import { DataSourceRef, SelectableValue } from '@grafana/data'; -import { AdHocVariableFilter } from 'app/features/variables/types'; +import { AdHocVariableFilter, DataSourceRef, SelectableValue } from '@grafana/data'; import { AdHocFilterKey } from './AdHocFilterKey'; import { AdHocFilterValue } from './AdHocFilterValue'; diff --git a/public/app/features/variables/adhoc/picker/AdHocPicker.tsx b/public/app/features/variables/adhoc/picker/AdHocPicker.tsx index 9c70288c839..2a1b79ad7e0 100644 --- a/public/app/features/variables/adhoc/picker/AdHocPicker.tsx +++ b/public/app/features/variables/adhoc/picker/AdHocPicker.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import { AdHocVariableFilter, AdHocVariableModel } from 'app/features/variables/types'; +import { AdHocVariableFilter, AdHocVariableModel } from '@grafana/data'; import { VariablePickerProps } from '../../pickers/types'; import { toKeyedVariableIdentifier } from '../../utils'; diff --git a/public/app/features/variables/adhoc/reducer.test.ts b/public/app/features/variables/adhoc/reducer.test.ts index b34a2d592aa..235d6d9376a 100644 --- a/public/app/features/variables/adhoc/reducer.test.ts +++ b/public/app/features/variables/adhoc/reducer.test.ts @@ -1,9 +1,10 @@ import { cloneDeep } from 'lodash'; +import { AdHocVariableFilter, AdHocVariableModel } from '@grafana/data'; + import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { AdHocVariableFilter, AdHocVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createAdHocVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/adhoc/reducer.ts b/public/app/features/variables/adhoc/reducer.ts index cb6af23d137..7d56f529092 100644 --- a/public/app/features/variables/adhoc/reducer.ts +++ b/public/app/features/variables/adhoc/reducer.ts @@ -1,6 +1,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { AdHocVariableFilter, AdHocVariableModel, initialVariableModelState } from 'app/features/variables/types'; +import { AdHocVariableFilter, AdHocVariableModel } from '@grafana/data'; +import { initialVariableModelState } from 'app/features/variables/types'; import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; diff --git a/public/app/features/variables/adhoc/urlParser.test.ts b/public/app/features/variables/adhoc/urlParser.test.ts index 8211f87ee3b..1c3179e906a 100644 --- a/public/app/features/variables/adhoc/urlParser.test.ts +++ b/public/app/features/variables/adhoc/urlParser.test.ts @@ -1,5 +1,4 @@ -import { UrlQueryValue } from '@grafana/data'; -import { AdHocVariableFilter } from 'app/features/variables/types'; +import { AdHocVariableFilter, UrlQueryValue } from '@grafana/data'; import { toFilters, toUrl } from './urlParser'; diff --git a/public/app/features/variables/adhoc/urlParser.ts b/public/app/features/variables/adhoc/urlParser.ts index bd8118954ff..4e3ad5c392e 100644 --- a/public/app/features/variables/adhoc/urlParser.ts +++ b/public/app/features/variables/adhoc/urlParser.ts @@ -1,7 +1,6 @@ import { isArray, isString } from 'lodash'; -import { UrlQueryValue } from '@grafana/data'; -import { AdHocVariableFilter } from 'app/features/variables/types'; +import { AdHocVariableFilter, UrlQueryValue } from '@grafana/data'; export const toUrl = (filters: AdHocVariableFilter[]): string[] => { return filters.map((filter) => toArray(filter).map(escapeDelimiter).join('|')); diff --git a/public/app/features/variables/constant/ConstantVariableEditor.tsx b/public/app/features/variables/constant/ConstantVariableEditor.tsx index bcabde359ad..2f26c9ed80c 100644 --- a/public/app/features/variables/constant/ConstantVariableEditor.tsx +++ b/public/app/features/variables/constant/ConstantVariableEditor.tsx @@ -1,9 +1,9 @@ import React, { FormEvent, PureComponent } from 'react'; +import { ConstantVariableModel } from '@grafana/data'; import { ConstantVariableForm } from 'app/features/dashboard-scene/settings/variables/components/ConstantVariableForm'; import { VariableEditorProps } from '../editor/types'; -import { ConstantVariableModel } from '../types'; export interface Props extends VariableEditorProps {} diff --git a/public/app/features/variables/constant/actions.test.ts b/public/app/features/variables/constant/actions.test.ts index a593715b404..de5911f9aa4 100644 --- a/public/app/features/variables/constant/actions.test.ts +++ b/public/app/features/variables/constant/actions.test.ts @@ -1,9 +1,11 @@ +import { ConstantVariableModel, VariableOption } from '@grafana/data'; + import { reduxTester } from '../../../../test/core/redux/reduxTester'; import { variableAdapters } from '../adapters'; import { getRootReducer, RootReducerType } from '../state/helpers'; import { toKeyedAction } from '../state/keyedVariablesReducer'; import { addVariable, setCurrentVariableValue } from '../state/sharedReducer'; -import { ConstantVariableModel, initialVariableModelState, VariableOption } from '../types'; +import { initialVariableModelState } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { updateConstantVariableOptions } from './actions'; diff --git a/public/app/features/variables/constant/adapter.ts b/public/app/features/variables/constant/adapter.ts index cd304d46ced..17249031470 100644 --- a/public/app/features/variables/constant/adapter.ts +++ b/public/app/features/variables/constant/adapter.ts @@ -1,10 +1,11 @@ import { cloneDeep } from 'lodash'; +import { ConstantVariableModel } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; import { optionPickerFactory } from '../pickers'; import { setOptionAsCurrent, setOptionFromUrl } from '../state/actions'; -import { ConstantVariableModel } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { ConstantVariableEditor } from './ConstantVariableEditor'; diff --git a/public/app/features/variables/constant/reducer.test.ts b/public/app/features/variables/constant/reducer.test.ts index 4b64b64e87b..88afb3e65ae 100644 --- a/public/app/features/variables/constant/reducer.test.ts +++ b/public/app/features/variables/constant/reducer.test.ts @@ -1,9 +1,10 @@ import { cloneDeep } from 'lodash'; +import { ConstantVariableModel } from '@grafana/data'; + import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { ConstantVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createConstantVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/constant/reducer.ts b/public/app/features/variables/constant/reducer.ts index 78e0ed2695e..e220142928d 100644 --- a/public/app/features/variables/constant/reducer.ts +++ b/public/app/features/variables/constant/reducer.ts @@ -1,8 +1,10 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { ConstantVariableModel, VariableHide, VariableOption } from '@grafana/data'; + import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { ConstantVariableModel, initialVariableModelState, VariableHide, VariableOption } from '../types'; +import { initialVariableModelState } from '../types'; export const initialConstantVariableModelState: ConstantVariableModel = { ...initialVariableModelState, diff --git a/public/app/features/variables/custom/CustomVariableEditor.tsx b/public/app/features/variables/custom/CustomVariableEditor.tsx index 6cdd6d5eb2d..c2a31cf0ab4 100644 --- a/public/app/features/variables/custom/CustomVariableEditor.tsx +++ b/public/app/features/variables/custom/CustomVariableEditor.tsx @@ -1,13 +1,13 @@ import React, { FormEvent, PureComponent } from 'react'; import { MapDispatchToProps, MapStateToProps } from 'react-redux'; +import { CustomVariableModel, VariableWithMultiSupport } from '@grafana/data'; import { connectWithStore } from 'app/core/utils/connectWithReduxStore'; import { CustomVariableForm } from 'app/features/dashboard-scene/settings/variables/components/CustomVariableForm'; import { StoreState } from 'app/types'; import { OnPropChangeArguments, VariableEditorProps } from '../editor/types'; import { changeVariableMultiValue } from '../state/actions'; -import { CustomVariableModel, VariableWithMultiSupport } from '../types'; interface OwnProps extends VariableEditorProps {} diff --git a/public/app/features/variables/custom/actions.test.ts b/public/app/features/variables/custom/actions.test.ts index 1e568d0d3f4..5f59d04f0a5 100644 --- a/public/app/features/variables/custom/actions.test.ts +++ b/public/app/features/variables/custom/actions.test.ts @@ -1,9 +1,11 @@ +import { CustomVariableModel, VariableOption } from '@grafana/data'; + import { reduxTester } from '../../../../test/core/redux/reduxTester'; import { variableAdapters } from '../adapters'; import { getRootReducer, RootReducerType } from '../state/helpers'; import { toKeyedAction } from '../state/keyedVariablesReducer'; import { addVariable, setCurrentVariableValue } from '../state/sharedReducer'; -import { CustomVariableModel, initialVariableModelState, VariableOption } from '../types'; +import { initialVariableModelState } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { updateCustomVariableOptions } from './actions'; diff --git a/public/app/features/variables/custom/adapter.ts b/public/app/features/variables/custom/adapter.ts index c4eb01b5276..040d2b1363d 100644 --- a/public/app/features/variables/custom/adapter.ts +++ b/public/app/features/variables/custom/adapter.ts @@ -1,11 +1,12 @@ import { cloneDeep } from 'lodash'; +import { CustomVariableModel } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; import { ALL_VARIABLE_TEXT } from '../constants'; import { optionPickerFactory } from '../pickers'; import { setOptionAsCurrent, setOptionFromUrl } from '../state/actions'; -import { CustomVariableModel } from '../types'; import { containsVariable, isAllVariable, toKeyedVariableIdentifier } from '../utils'; import { CustomVariableEditor } from './CustomVariableEditor'; diff --git a/public/app/features/variables/custom/reducer.test.ts b/public/app/features/variables/custom/reducer.test.ts index f80f1e7ebf8..d0d0d60a1bf 100644 --- a/public/app/features/variables/custom/reducer.test.ts +++ b/public/app/features/variables/custom/reducer.test.ts @@ -1,10 +1,11 @@ import { cloneDeep } from 'lodash'; +import { CustomVariableModel } from '@grafana/data'; + import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { ALL_VARIABLE_TEXT, ALL_VARIABLE_VALUE } from '../constants'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { CustomVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createCustomVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/custom/reducer.ts b/public/app/features/variables/custom/reducer.ts index 15d7d9592dd..2e295e95209 100644 --- a/public/app/features/variables/custom/reducer.ts +++ b/public/app/features/variables/custom/reducer.ts @@ -1,9 +1,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { CustomVariableModel, VariableOption } from '@grafana/data'; + import { ALL_VARIABLE_TEXT, ALL_VARIABLE_VALUE } from '../constants'; import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { CustomVariableModel, initialVariableModelState, VariableOption } from '../types'; +import { initialVariableModelState } from '../types'; export const initialCustomVariableModelState: CustomVariableModel = { ...initialVariableModelState, diff --git a/public/app/features/variables/datasource/DataSourceVariableEditor.tsx b/public/app/features/variables/datasource/DataSourceVariableEditor.tsx index 3fb6996aed3..123465aa495 100644 --- a/public/app/features/variables/datasource/DataSourceVariableEditor.tsx +++ b/public/app/features/variables/datasource/DataSourceVariableEditor.tsx @@ -1,7 +1,7 @@ import React, { FormEvent, PureComponent } from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import { SelectableValue } from '@grafana/data'; +import { DataSourceVariableModel, SelectableValue, VariableWithMultiSupport } from '@grafana/data'; import { DataSourceVariableForm } from 'app/features/dashboard-scene/settings/variables/components/DataSourceVariableForm'; import { StoreState } from '../../../types'; @@ -10,7 +10,6 @@ import { getDatasourceVariableEditorState } from '../editor/selectors'; import { OnPropChangeArguments, VariableEditorProps } from '../editor/types'; import { changeVariableMultiValue } from '../state/actions'; import { getVariablesState } from '../state/selectors'; -import { DataSourceVariableModel, VariableWithMultiSupport } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { initDataSourceVariableEditor } from './actions'; diff --git a/public/app/features/variables/datasource/adapter.ts b/public/app/features/variables/datasource/adapter.ts index e7dea3b79fe..4bca274ce96 100644 --- a/public/app/features/variables/datasource/adapter.ts +++ b/public/app/features/variables/datasource/adapter.ts @@ -1,11 +1,12 @@ import { cloneDeep } from 'lodash'; +import { DataSourceVariableModel } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; import { ALL_VARIABLE_TEXT } from '../constants'; import { optionPickerFactory } from '../pickers'; import { setOptionAsCurrent, setOptionFromUrl } from '../state/actions'; -import { DataSourceVariableModel } from '../types'; import { containsVariable, isAllVariable, toKeyedVariableIdentifier } from '../utils'; import { DataSourceVariableEditor } from './DataSourceVariableEditor'; diff --git a/public/app/features/variables/datasource/reducer.test.ts b/public/app/features/variables/datasource/reducer.test.ts index 9f775d9dd4d..2acb6e96346 100644 --- a/public/app/features/variables/datasource/reducer.test.ts +++ b/public/app/features/variables/datasource/reducer.test.ts @@ -1,13 +1,12 @@ import { cloneDeep } from 'lodash'; -import { DataSourceInstanceSettings } from '@grafana/data'; +import { DataSourceInstanceSettings, DataSourceVariableModel } from '@grafana/data'; import { getMockPlugins } from '@grafana/data/test/__mocks__/pluginMocks'; import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { getDataSourceInstanceSetting } from '../shared/testing/helpers'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { DataSourceVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createDataSourceVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/datasource/reducer.ts b/public/app/features/variables/datasource/reducer.ts index b0949752273..2414f6818c3 100644 --- a/public/app/features/variables/datasource/reducer.ts +++ b/public/app/features/variables/datasource/reducer.ts @@ -1,11 +1,17 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { DataSourceInstanceSettings, matchPluginId } from '@grafana/data'; +import { + DataSourceInstanceSettings, + DataSourceVariableModel, + matchPluginId, + VariableOption, + VariableRefresh, +} from '@grafana/data'; import { ALL_VARIABLE_TEXT, ALL_VARIABLE_VALUE } from '../constants'; import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { DataSourceVariableModel, initialVariableModelState, VariableOption, VariableRefresh } from '../types'; +import { initialVariableModelState } from '../types'; export const initialDataSourceVariableModelState: DataSourceVariableModel = { ...initialVariableModelState, diff --git a/public/app/features/variables/editor/SelectionOptionsEditor.tsx b/public/app/features/variables/editor/SelectionOptionsEditor.tsx index 75b38b68e67..7e0e4f4af81 100644 --- a/public/app/features/variables/editor/SelectionOptionsEditor.tsx +++ b/public/app/features/variables/editor/SelectionOptionsEditor.tsx @@ -1,9 +1,9 @@ import React, { ChangeEvent, FormEvent, useCallback } from 'react'; +import { VariableWithMultiSupport } from '@grafana/data'; import { SelectionOptionsForm } from 'app/features/dashboard-scene/settings/variables/components/SelectionOptionsForm'; import { KeyedVariableIdentifier } from '../state/types'; -import { VariableWithMultiSupport } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { VariableEditorProps } from './types'; diff --git a/public/app/features/variables/editor/VariableEditorEditor.tsx b/public/app/features/variables/editor/VariableEditorEditor.tsx index d36433531ef..893fa694b08 100644 --- a/public/app/features/variables/editor/VariableEditorEditor.tsx +++ b/public/app/features/variables/editor/VariableEditorEditor.tsx @@ -2,7 +2,7 @@ import React, { FormEvent, PureComponent } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { LoadingState, SelectableValue, VariableType } from '@grafana/data'; +import { LoadingState, SelectableValue, VariableHide, VariableType } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { locationService } from '@grafana/runtime'; import { Button, HorizontalGroup, Icon } from '@grafana/ui'; @@ -20,7 +20,6 @@ import { toKeyedAction } from '../state/keyedVariablesReducer'; import { getVariable, getVariablesState } from '../state/selectors'; import { changeVariableProp, changeVariableType, removeVariable } from '../state/sharedReducer'; import { KeyedVariableIdentifier } from '../state/types'; -import { VariableHide } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { ConfirmDeleteModal } from './ConfirmDeleteModal'; diff --git a/public/app/features/variables/guard.ts b/public/app/features/variables/guard.ts index a953979a33b..97890e05ce2 100644 --- a/public/app/features/variables/guard.ts +++ b/public/app/features/variables/guard.ts @@ -2,6 +2,8 @@ import { ComponentType } from 'react'; import { Observable } from 'rxjs'; import { + AdHocVariableModel, + ConstantVariableModel, DataQuery, DataQueryRequest, DataQueryResponse, @@ -9,21 +11,16 @@ import { DataSourceJsonData, DataSourceRef, MetricFindValue, + QueryVariableModel, StandardVariableQuery, VariableModel, VariableSupportType, + VariableWithMultiSupport, + VariableWithOptions, } from '@grafana/data'; import { LEGACY_VARIABLE_QUERY_EDITOR_NAME } from './editor/LegacyVariableQueryEditor'; -import { - AdHocVariableModel, - ConstantVariableModel, - QueryVariableModel, - VariableQueryEditorType, - VariableQueryEditorProps, - VariableWithMultiSupport, - VariableWithOptions, -} from './types'; +import { VariableQueryEditorType, VariableQueryEditorProps } from './types'; /** @deprecated use a if (model.type === "query") type narrowing check instead */ export const isQuery = (model: VariableModel): model is QueryVariableModel => { diff --git a/public/app/features/variables/interval/adapter.ts b/public/app/features/variables/interval/adapter.ts index a88a83b455c..0210261858d 100644 --- a/public/app/features/variables/interval/adapter.ts +++ b/public/app/features/variables/interval/adapter.ts @@ -1,10 +1,11 @@ import { cloneDeep } from 'lodash'; +import { IntervalVariableModel } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; import { optionPickerFactory } from '../pickers'; import { setOptionAsCurrent, setOptionFromUrl } from '../state/actions'; -import { IntervalVariableModel } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { IntervalVariableEditor } from './IntervalVariableEditor'; diff --git a/public/app/features/variables/interval/reducer.test.ts b/public/app/features/variables/interval/reducer.test.ts index c3542c2322b..0434c48c393 100644 --- a/public/app/features/variables/interval/reducer.test.ts +++ b/public/app/features/variables/interval/reducer.test.ts @@ -1,9 +1,10 @@ import { cloneDeep } from 'lodash'; +import { IntervalVariableModel } from '@grafana/data'; + import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { IntervalVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createIntervalVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/interval/reducer.ts b/public/app/features/variables/interval/reducer.ts index a51919d28c0..b0868e27fd3 100644 --- a/public/app/features/variables/interval/reducer.ts +++ b/public/app/features/variables/interval/reducer.ts @@ -1,9 +1,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { map } from 'lodash'; +import { IntervalVariableModel, VariableRefresh, VariableOption } from '@grafana/data'; + import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { initialVariableModelState, IntervalVariableModel, VariableOption, VariableRefresh } from '../types'; +import { initialVariableModelState } from '../types'; export const initialIntervalVariableModelState: IntervalVariableModel = { ...initialVariableModelState, diff --git a/public/app/features/variables/pickers/OptionsPicker/OptionPicker.test.tsx b/public/app/features/variables/pickers/OptionsPicker/OptionPicker.test.tsx index 316daba5c47..84fd2607cd4 100644 --- a/public/app/features/variables/pickers/OptionsPicker/OptionPicker.test.tsx +++ b/public/app/features/variables/pickers/OptionsPicker/OptionPicker.test.tsx @@ -4,12 +4,11 @@ import React from 'react'; import { Provider } from 'react-redux'; import { Store } from 'redux'; -import { LoadingState } from '@grafana/data'; +import { LoadingState, QueryVariableModel, VariableWithMultiSupport, VariableWithOptions } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { queryBuilder } from '../../shared/testing/builders'; import { getPreloadedState } from '../../state/helpers'; -import { QueryVariableModel, VariableWithMultiSupport, VariableWithOptions } from '../../types'; import { VariablePickerProps } from '../types'; import { optionPickerFactory } from './OptionsPicker'; diff --git a/public/app/features/variables/pickers/OptionsPicker/OptionsPicker.tsx b/public/app/features/variables/pickers/OptionsPicker/OptionsPicker.tsx index 2429aa97dd1..289b1d9d881 100644 --- a/public/app/features/variables/pickers/OptionsPicker/OptionsPicker.tsx +++ b/public/app/features/variables/pickers/OptionsPicker/OptionsPicker.tsx @@ -2,7 +2,7 @@ import React, { ComponentType, PureComponent } from 'react'; import { connect, ConnectedProps } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { LoadingState } from '@grafana/data'; +import { LoadingState, VariableOption, VariableWithMultiSupport, VariableWithOptions } from '@grafana/data'; import { ClickOutsideWrapper } from '@grafana/ui'; import { StoreState, ThunkDispatch } from 'app/types'; @@ -13,7 +13,6 @@ import { formatVariableLabel } from '../../shared/formatVariable'; import { toKeyedAction } from '../../state/keyedVariablesReducer'; import { getVariablesState } from '../../state/selectors'; import { KeyedVariableIdentifier } from '../../state/types'; -import { VariableOption, VariableWithMultiSupport, VariableWithOptions } from '../../types'; import { toKeyedVariableIdentifier } from '../../utils'; import { VariableInput } from '../shared/VariableInput'; import { VariableLink } from '../shared/VariableLink'; diff --git a/public/app/features/variables/pickers/OptionsPicker/actions.test.ts b/public/app/features/variables/pickers/OptionsPicker/actions.test.ts index 3b75cfcb883..eac7f227cc0 100644 --- a/public/app/features/variables/pickers/OptionsPicker/actions.test.ts +++ b/public/app/features/variables/pickers/OptionsPicker/actions.test.ts @@ -1,3 +1,4 @@ +import { QueryVariableModel, VariableSort, VariableRefresh } from '@grafana/data'; import { locationService } from '@grafana/runtime'; import { reduxTester } from '../../../../../test/core/redux/reduxTester'; @@ -7,7 +8,7 @@ import { queryBuilder } from '../../shared/testing/builders'; import { getPreloadedState, getRootReducer, RootReducerType } from '../../state/helpers'; import { toKeyedAction } from '../../state/keyedVariablesReducer'; import { addVariable, changeVariableProp, setCurrentVariableValue } from '../../state/sharedReducer'; -import { initialVariableModelState, QueryVariableModel, VariableRefresh, VariableSort } from '../../types'; +import { initialVariableModelState } from '../../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../../utils'; import { NavigationKey } from '../types'; diff --git a/public/app/features/variables/pickers/OptionsPicker/actions.ts b/public/app/features/variables/pickers/OptionsPicker/actions.ts index 35ee1aa2d6a..43ef1fdec6e 100644 --- a/public/app/features/variables/pickers/OptionsPicker/actions.ts +++ b/public/app/features/variables/pickers/OptionsPicker/actions.ts @@ -1,6 +1,6 @@ import { debounce, trim } from 'lodash'; -import { isEmptyObject, containsSearchFilter } from '@grafana/data'; +import { isEmptyObject, containsSearchFilter, VariableWithOptions, VariableOption } from '@grafana/data'; import { StoreState, ThunkDispatch, ThunkResult } from 'app/types'; import { variableAdapters } from '../../adapters'; @@ -9,7 +9,6 @@ import { toKeyedAction } from '../../state/keyedVariablesReducer'; import { getVariable, getVariablesState } from '../../state/selectors'; import { changeVariableProp, setCurrentVariableValue } from '../../state/sharedReducer'; import { KeyedVariableIdentifier } from '../../state/types'; -import { VariableOption, VariableWithOptions } from '../../types'; import { getCurrentValue, toVariablePayload } from '../../utils'; import { NavigationKey } from '../types'; diff --git a/public/app/features/variables/pickers/OptionsPicker/reducer.test.ts b/public/app/features/variables/pickers/OptionsPicker/reducer.test.ts index 9a2dfe161af..24bfeb094a9 100644 --- a/public/app/features/variables/pickers/OptionsPicker/reducer.test.ts +++ b/public/app/features/variables/pickers/OptionsPicker/reducer.test.ts @@ -1,8 +1,9 @@ import { cloneDeep } from 'lodash'; +import { QueryVariableModel, VariableOption } from '@grafana/data'; + import { reducerTester } from '../../../../../test/core/redux/reducerTester'; import { ALL_VARIABLE_TEXT, ALL_VARIABLE_VALUE } from '../../constants'; -import { QueryVariableModel, VariableOption } from '../../types'; import { cleanPickerState, diff --git a/public/app/features/variables/pickers/OptionsPicker/reducer.ts b/public/app/features/variables/pickers/OptionsPicker/reducer.ts index 57342c9010e..090517d800b 100644 --- a/public/app/features/variables/pickers/OptionsPicker/reducer.ts +++ b/public/app/features/variables/pickers/OptionsPicker/reducer.ts @@ -2,12 +2,11 @@ import uFuzzy from '@leeoniya/ufuzzy'; import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { cloneDeep, isString } from 'lodash'; -import { containsSearchFilter } from '@grafana/data'; +import { containsSearchFilter, VariableOption, VariableWithOptions } from '@grafana/data'; import { applyStateChanges } from '../../../../core/utils/applyStateChanges'; import { ALL_VARIABLE_VALUE } from '../../constants'; import { isMulti, isQuery } from '../../guard'; -import { VariableOption, VariableWithOptions } from '../../types'; export interface ToggleOption { option?: VariableOption; diff --git a/public/app/features/variables/pickers/shared/VariableOptions.tsx b/public/app/features/variables/pickers/shared/VariableOptions.tsx index 5b99e351535..48576d75c86 100644 --- a/public/app/features/variables/pickers/shared/VariableOptions.tsx +++ b/public/app/features/variables/pickers/shared/VariableOptions.tsx @@ -1,13 +1,12 @@ import { css, cx } from '@emotion/css'; import React, { PureComponent } from 'react'; -import { GrafanaTheme2 } from '@grafana/data'; +import { GrafanaTheme2, VariableOption } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { Tooltip, Themeable2, withTheme2, clearButtonStyles, stylesFactory } from '@grafana/ui'; import { Trans, t } from 'app/core/internationalization'; import { ALL_VARIABLE_VALUE } from '../../constants'; -import { VariableOption } from '../../types'; export interface Props extends React.HTMLProps, Themeable2 { multi: boolean; diff --git a/public/app/features/variables/query/QueryVariableEditor.test.tsx b/public/app/features/variables/query/QueryVariableEditor.test.tsx index 8709c8763e4..b73f83b0668 100644 --- a/public/app/features/variables/query/QueryVariableEditor.test.tsx +++ b/public/app/features/variables/query/QueryVariableEditor.test.tsx @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event'; import React from 'react'; import { MockDataSourceApi } from 'test/mocks/datasource_srv'; -import { VariableSupportType } from '@grafana/data'; +import { QueryVariableModel, VariableSupportType } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { mockDataSource } from 'app/features/alerting/unified/mocks'; import { DataSourceType } from 'app/features/alerting/unified/utils/datasource'; @@ -11,7 +11,6 @@ import { DataSourceType } from 'app/features/alerting/unified/utils/datasource'; import { NEW_VARIABLE_ID } from '../constants'; import { LegacyVariableQueryEditor } from '../editor/LegacyVariableQueryEditor'; import { KeyedVariableIdentifier } from '../state/types'; -import { QueryVariableModel } from '../types'; import { Props, QueryVariableEditorUnConnected } from './QueryVariableEditor'; import { initialQueryVariableModelState } from './reducer'; diff --git a/public/app/features/variables/query/QueryVariableEditor.tsx b/public/app/features/variables/query/QueryVariableEditor.tsx index 24ad37c2a64..36e7ff3b72f 100644 --- a/public/app/features/variables/query/QueryVariableEditor.tsx +++ b/public/app/features/variables/query/QueryVariableEditor.tsx @@ -1,7 +1,14 @@ import React, { FormEvent, PureComponent } from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import { DataSourceInstanceSettings, getDataSourceRef, SelectableValue } from '@grafana/data'; +import { + DataSourceInstanceSettings, + getDataSourceRef, + QueryVariableModel, + SelectableValue, + VariableRefresh, + VariableSort, +} from '@grafana/data'; import { QueryVariableEditorForm } from 'app/features/dashboard-scene/settings/variables/components/QueryVariableForm'; import { StoreState } from '../../../types'; @@ -11,7 +18,6 @@ import { getQueryVariableEditorState } from '../editor/selectors'; import { VariableEditorProps } from '../editor/types'; import { changeVariableMultiValue } from '../state/actions'; import { getVariablesState } from '../state/selectors'; -import { QueryVariableModel, VariableRefresh, VariableSort } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { changeQueryVariableDataSource, changeQueryVariableQuery, initQueryVariableEditor } from './actions'; diff --git a/public/app/features/variables/query/QueryVariableSortSelect.tsx b/public/app/features/variables/query/QueryVariableSortSelect.tsx index e28cbb320b8..f5e70612a27 100644 --- a/public/app/features/variables/query/QueryVariableSortSelect.tsx +++ b/public/app/features/variables/query/QueryVariableSortSelect.tsx @@ -1,9 +1,8 @@ import React, { PropsWithChildren, useMemo } from 'react'; -import { SelectableValue } from '@grafana/data'; +import { SelectableValue, VariableSort } from '@grafana/data'; import { VariableSelectField } from '../../dashboard-scene/settings/variables/components/VariableSelectField'; -import { VariableSort } from '../types'; interface Props { onChange: (option: SelectableValue) => void; diff --git a/public/app/features/variables/query/VariableQueryRunner.test.ts b/public/app/features/variables/query/VariableQueryRunner.test.ts index 1fbfe3ae31f..3604b772305 100644 --- a/public/app/features/variables/query/VariableQueryRunner.test.ts +++ b/public/app/features/variables/query/VariableQueryRunner.test.ts @@ -1,14 +1,19 @@ import { of, throwError } from 'rxjs'; import { delay } from 'rxjs/operators'; -import { DataSourceApi, getDefaultTimeRange, LoadingState, VariableSupportType } from '@grafana/data'; +import { + DataSourceApi, + getDefaultTimeRange, + LoadingState, + QueryVariableModel, + VariableSupportType, +} from '@grafana/data'; import { queryBuilder } from '../shared/testing/builders'; import { getPreloadedState } from '../state/helpers'; import { toKeyedAction } from '../state/keyedVariablesReducer'; import { initialTransactionState } from '../state/transactionReducer'; import { KeyedVariableIdentifier } from '../state/types'; -import { QueryVariableModel } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { UpdateOptionsResults, VariableQueryRunner } from './VariableQueryRunner'; diff --git a/public/app/features/variables/query/VariableQueryRunner.ts b/public/app/features/variables/query/VariableQueryRunner.ts index 2e19f68c0b5..630abc22703 100644 --- a/public/app/features/variables/query/VariableQueryRunner.ts +++ b/public/app/features/variables/query/VariableQueryRunner.ts @@ -9,6 +9,7 @@ import { DataSourceApi, LoadingState, PanelData, + QueryVariableModel, ScopedVars, } from '@grafana/data'; @@ -18,7 +19,6 @@ import { getTimeSrv } from '../../dashboard/services/TimeSrv'; import { runRequest } from '../../query/state/runRequest'; import { getLastKey, getVariable } from '../state/selectors'; import { KeyedVariableIdentifier } from '../state/types'; -import { QueryVariableModel } from '../types'; import { getTemplatedRegex } from '../utils'; import { toMetricFindValuesOperator, updateOptionsState, validateVariableSelection } from './operators'; diff --git a/public/app/features/variables/query/actions.test.tsx b/public/app/features/variables/query/actions.test.tsx index fa70a480a69..9dcdddfa5a2 100644 --- a/public/app/features/variables/query/actions.test.tsx +++ b/public/app/features/variables/query/actions.test.tsx @@ -1,6 +1,15 @@ import React from 'react'; -import { DataSourceApi, DataSourceRef, getDefaultTimeRange, LoadingState } from '@grafana/data'; +import { + DataSourceApi, + DataSourceRef, + getDefaultTimeRange, + LoadingState, + QueryVariableModel, + VariableHide, + VariableRefresh, + VariableSort, +} from '@grafana/data'; import { DataSourceSrv, setDataSourceSrv } from '@grafana/runtime'; import { reduxTester } from '../../../../test/core/redux/reduxTester'; @@ -29,7 +38,7 @@ import { variableStateFetching, } from '../state/sharedReducer'; import { variablesInitTransaction } from '../state/transactionReducer'; -import { QueryVariableModel, VariableHide, VariableQueryEditorProps, VariableRefresh, VariableSort } from '../types'; +import { VariableQueryEditorProps } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { setVariableQueryRunner, VariableQueryRunner } from './VariableQueryRunner'; diff --git a/public/app/features/variables/query/adapter.ts b/public/app/features/variables/query/adapter.ts index 6c4eb1f7563..e320eb6ed11 100644 --- a/public/app/features/variables/query/adapter.ts +++ b/public/app/features/variables/query/adapter.ts @@ -1,11 +1,12 @@ import { cloneDeep } from 'lodash'; +import { QueryVariableModel, VariableRefresh } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; import { ALL_VARIABLE_TEXT } from '../constants'; import { optionPickerFactory } from '../pickers'; import { setOptionAsCurrent, setOptionFromUrl } from '../state/actions'; -import { QueryVariableModel, VariableRefresh } from '../types'; import { containsVariable, isAllVariable, toKeyedVariableIdentifier } from '../utils'; import { QueryVariableEditor } from './QueryVariableEditor'; diff --git a/public/app/features/variables/query/operators.ts b/public/app/features/variables/query/operators.ts index cd390b7c95a..ab16fa50ff8 100644 --- a/public/app/features/variables/query/operators.ts +++ b/public/app/features/variables/query/operators.ts @@ -8,12 +8,12 @@ import { isDataFrame, MetricFindValue, PanelData, + QueryVariableModel, } from '@grafana/data'; import { ThunkDispatch } from '../../../types'; import { validateVariableSelectionState } from '../state/actions'; import { toKeyedAction } from '../state/keyedVariablesReducer'; -import { QueryVariableModel } from '../types'; import { getTemplatedRegex, toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { updateVariableOptions } from './reducer'; diff --git a/public/app/features/variables/query/queryRunners.test.ts b/public/app/features/variables/query/queryRunners.test.ts index 7a921f01f67..1169f9844ef 100644 --- a/public/app/features/variables/query/queryRunners.test.ts +++ b/public/app/features/variables/query/queryRunners.test.ts @@ -5,11 +5,10 @@ import { DataSourceApi, getDefaultTimeRange, QueryVariableModel, + VariableRefresh, VariableSupportType, } from '@grafana/data'; -import { VariableRefresh } from '../types'; - import { QueryRunners, RunnerArgs, variableDummyRefId } from './queryRunners'; describe('QueryRunners', () => { diff --git a/public/app/features/variables/query/queryRunners.ts b/public/app/features/variables/query/queryRunners.ts index 7933019b197..8f75f987e82 100644 --- a/public/app/features/variables/query/queryRunners.ts +++ b/public/app/features/variables/query/queryRunners.ts @@ -8,6 +8,7 @@ import { getDefaultTimeRange, LoadingState, PanelData, + QueryVariableModel, VariableSupportType, } from '@grafana/data'; @@ -18,7 +19,6 @@ import { hasLegacyVariableSupport, hasStandardVariableSupport, } from '../guard'; -import { QueryVariableModel } from '../types'; import { getLegacyQueryOptions } from '../utils'; export interface RunnerArgs { diff --git a/public/app/features/variables/query/reducer.test.ts b/public/app/features/variables/query/reducer.test.ts index e0f273484bd..46255eeb40a 100644 --- a/public/app/features/variables/query/reducer.test.ts +++ b/public/app/features/variables/query/reducer.test.ts @@ -1,11 +1,10 @@ import { cloneDeep } from 'lodash'; -import { MetricFindValue } from '@grafana/data'; +import { MetricFindValue, QueryVariableModel, VariableSort } from '@grafana/data'; import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { QueryVariableModel, VariableSort } from '../types'; import { toVariablePayload } from '../utils'; import { createQueryVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/query/reducer.ts b/public/app/features/variables/query/reducer.ts index a5c623c6699..4f048eca82f 100644 --- a/public/app/features/variables/query/reducer.ts +++ b/public/app/features/variables/query/reducer.ts @@ -1,12 +1,19 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { isNumber, sortBy, toLower, uniqBy } from 'lodash'; -import { MetricFindValue, stringToJsRegex } from '@grafana/data'; +import { + MetricFindValue, + QueryVariableModel, + stringToJsRegex, + VariableOption, + VariableRefresh, + VariableSort, +} from '@grafana/data'; import { ALL_VARIABLE_TEXT, ALL_VARIABLE_VALUE, NONE_VARIABLE_TEXT, NONE_VARIABLE_VALUE } from '../constants'; import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { initialVariableModelState, QueryVariableModel, VariableOption, VariableRefresh, VariableSort } from '../types'; +import { initialVariableModelState } from '../types'; interface VariableOptionsUpdate { templatedRegex: string; diff --git a/public/app/features/variables/shared/multiOptions.test.ts b/public/app/features/variables/shared/multiOptions.test.ts index f660088de10..1f42db0c30c 100644 --- a/public/app/features/variables/shared/multiOptions.test.ts +++ b/public/app/features/variables/shared/multiOptions.test.ts @@ -1,4 +1,4 @@ -import { VariableOption } from 'app/features/variables/types'; +import { VariableOption } from '@grafana/data'; import { alignCurrentWithMulti } from './multiOptions'; diff --git a/public/app/features/variables/shared/multiOptions.ts b/public/app/features/variables/shared/multiOptions.ts index 6cc80c4a031..14f4c44cef7 100644 --- a/public/app/features/variables/shared/multiOptions.ts +++ b/public/app/features/variables/shared/multiOptions.ts @@ -1,4 +1,4 @@ -import { VariableOption } from 'app/features/variables/types'; +import { VariableOption } from '@grafana/data'; export const alignCurrentWithMulti = (current: VariableOption, value: boolean): VariableOption => { if (!current) { diff --git a/public/app/features/variables/shared/testing/adHocVariableBuilder.ts b/public/app/features/variables/shared/testing/adHocVariableBuilder.ts index 724e3c19a60..0e0b30ff1c4 100644 --- a/public/app/features/variables/shared/testing/adHocVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/adHocVariableBuilder.ts @@ -1,5 +1,4 @@ -import { DataSourceRef } from '@grafana/data'; -import { AdHocVariableFilter, AdHocVariableModel } from 'app/features/variables/types'; +import { AdHocVariableFilter, AdHocVariableModel, DataSourceRef } from '@grafana/data'; import { VariableBuilder } from './variableBuilder'; diff --git a/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts b/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts index ad370b7eed5..c834fc55270 100644 --- a/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts @@ -1,4 +1,4 @@ -import { DataSourceVariableModel, QueryVariableModel, VariableRefresh } from 'app/features/variables/types'; +import { DataSourceVariableModel, QueryVariableModel, VariableRefresh } from '@grafana/data'; import { MultiVariableBuilder } from './multiVariableBuilder'; diff --git a/public/app/features/variables/shared/testing/intervalVariableBuilder.ts b/public/app/features/variables/shared/testing/intervalVariableBuilder.ts index 3979d194932..a4f63f50e81 100644 --- a/public/app/features/variables/shared/testing/intervalVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/intervalVariableBuilder.ts @@ -1,4 +1,4 @@ -import { IntervalVariableModel, VariableRefresh } from 'app/features/variables/types'; +import { IntervalVariableModel, VariableRefresh } from '@grafana/data'; import { OptionsVariableBuilder } from './optionsVariableBuilder'; diff --git a/public/app/features/variables/shared/testing/multiVariableBuilder.ts b/public/app/features/variables/shared/testing/multiVariableBuilder.ts index 3fb6309f381..3c6a19679eb 100644 --- a/public/app/features/variables/shared/testing/multiVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/multiVariableBuilder.ts @@ -1,4 +1,4 @@ -import { VariableWithMultiSupport } from 'app/features/variables/types'; +import { VariableWithMultiSupport } from '@grafana/data'; import { OptionsVariableBuilder } from './optionsVariableBuilder'; diff --git a/public/app/features/variables/shared/testing/optionsVariableBuilder.ts b/public/app/features/variables/shared/testing/optionsVariableBuilder.ts index fcb33006b88..87980a15965 100644 --- a/public/app/features/variables/shared/testing/optionsVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/optionsVariableBuilder.ts @@ -1,4 +1,4 @@ -import { VariableOption, VariableWithOptions } from 'app/features/variables/types'; +import { VariableOption, VariableWithOptions } from '@grafana/data'; import { VariableBuilder } from './variableBuilder'; diff --git a/public/app/features/variables/shared/testing/queryVariableBuilder.ts b/public/app/features/variables/shared/testing/queryVariableBuilder.ts index d7455324c97..4afbd66a147 100644 --- a/public/app/features/variables/shared/testing/queryVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/queryVariableBuilder.ts @@ -1,5 +1,4 @@ -import { DataSourceRef } from '@grafana/data'; -import { QueryVariableModel } from 'app/features/variables/types'; +import { DataSourceRef, QueryVariableModel } from '@grafana/data'; import { DatasourceVariableBuilder } from './datasourceVariableBuilder'; diff --git a/public/app/features/variables/shared/testing/textboxVariableBuilder.ts b/public/app/features/variables/shared/testing/textboxVariableBuilder.ts index 497e8741917..461658a95d1 100644 --- a/public/app/features/variables/shared/testing/textboxVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/textboxVariableBuilder.ts @@ -1,4 +1,4 @@ -import { TextBoxVariableModel } from 'app/features/variables/types'; +import { TextBoxVariableModel } from '@grafana/data'; import { OptionsVariableBuilder } from './optionsVariableBuilder'; diff --git a/public/app/features/variables/state/actions.test.ts b/public/app/features/variables/state/actions.test.ts index 14f86972547..e324fe15059 100644 --- a/public/app/features/variables/state/actions.test.ts +++ b/public/app/features/variables/state/actions.test.ts @@ -1,6 +1,6 @@ import { AnyAction } from 'redux'; -import { LoadingState } from '@grafana/data'; +import { ConstantVariableModel, LoadingState, VariableRefresh } from '@grafana/data'; import * as runtime from '@grafana/runtime'; import { DataSourceSrv, LocationService } from '@grafana/runtime'; import { BackendSrv } from 'app/core/services/backend_srv'; @@ -27,7 +27,6 @@ import { textboxBuilder, } from '../shared/testing/builders'; import { createTextBoxVariableAdapter } from '../textbox/adapter'; -import { ConstantVariableModel, VariableRefresh } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { diff --git a/public/app/features/variables/state/onTimeRangeUpdated.test.ts b/public/app/features/variables/state/onTimeRangeUpdated.test.ts index 40b6c9ab037..911630949ec 100644 --- a/public/app/features/variables/state/onTimeRangeUpdated.test.ts +++ b/public/app/features/variables/state/onTimeRangeUpdated.test.ts @@ -1,4 +1,4 @@ -import { dateTime, TimeRange } from '@grafana/data'; +import { dateTime, TimeRange, VariableRefresh } from '@grafana/data'; import { config, DataSourceSrv } from '@grafana/runtime'; import * as runtime from '@grafana/runtime'; @@ -17,7 +17,6 @@ import { createIntervalVariableAdapter } from '../interval/adapter'; import { createIntervalOptions } from '../interval/reducer'; import { createQueryVariableAdapter } from '../query/adapter'; import { constantBuilder, intervalBuilder, queryBuilder, datasourceBuilder } from '../shared/testing/builders'; -import { VariableRefresh } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { onTimeRangeUpdated, OnTimeRangeUpdatedDependencies, setOptionAsCurrent } from './actions'; diff --git a/public/app/features/variables/state/processVariable.test.ts b/public/app/features/variables/state/processVariable.test.ts index 6448f202eb4..4a7e4bed185 100644 --- a/public/app/features/variables/state/processVariable.test.ts +++ b/public/app/features/variables/state/processVariable.test.ts @@ -1,4 +1,4 @@ -import { UrlQueryMap } from '@grafana/data'; +import { UrlQueryMap, VariableRefresh } from '@grafana/data'; import { setDataSourceSrv } from '@grafana/runtime'; import { DashboardModel } from 'app/features/dashboard/state'; import { DatasourceSrv } from 'app/features/plugins/datasource_srv'; @@ -11,7 +11,6 @@ import { setVariableQueryRunner, VariableQueryRunner } from '../query/VariableQu import { createQueryVariableAdapter } from '../query/adapter'; import { updateVariableOptions } from '../query/reducer'; import { customBuilder, queryBuilder } from '../shared/testing/builders'; -import { VariableRefresh } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { initDashboardTemplating, processVariable } from './actions'; diff --git a/public/app/features/variables/state/reducers.test.ts b/public/app/features/variables/state/reducers.test.ts index 08c13a3a48c..45205a58758 100644 --- a/public/app/features/variables/state/reducers.test.ts +++ b/public/app/features/variables/state/reducers.test.ts @@ -1,13 +1,12 @@ import { createAction } from '@reduxjs/toolkit'; import { ComponentType } from 'react'; -import { VariableType } from '@grafana/data'; +import { QueryVariableModel, VariableType } from '@grafana/data'; import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { VariableAdapter, variableAdapters } from '../adapters'; import { VariableEditorProps } from '../editor/types'; import { VariablePickerProps } from '../pickers/types'; -import { QueryVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createQueryVariable } from './__tests__/fixtures'; diff --git a/public/app/features/variables/state/sharedReducer.test.ts b/public/app/features/variables/state/sharedReducer.test.ts index 6f221e21e49..5c0058d15ac 100644 --- a/public/app/features/variables/state/sharedReducer.test.ts +++ b/public/app/features/variables/state/sharedReducer.test.ts @@ -1,6 +1,13 @@ import { cloneDeep } from 'lodash'; -import { BaseVariableModel, LoadingState, VariableType } from '@grafana/data'; +import { + BaseVariableModel, + ConstantVariableModel, + LoadingState, + QueryVariableModel, + VariableOption, + VariableType, +} from '@grafana/data'; import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { variableAdapters } from '../adapters'; @@ -10,7 +17,6 @@ import { ALL_VARIABLE_TEXT, ALL_VARIABLE_VALUE } from '../constants'; import { changeVariableNameSucceeded } from '../editor/reducer'; import { createQueryVariableAdapter } from '../query/adapter'; import { initialQueryVariableModelState } from '../query/reducer'; -import { ConstantVariableModel, QueryVariableModel, VariableOption } from '../types'; import { toVariablePayload } from '../utils'; import { createConstantVariable } from './__tests__/fixtures'; diff --git a/public/app/features/variables/system/adapter.ts b/public/app/features/variables/system/adapter.ts index 71c4f341909..ce81b58a260 100644 --- a/public/app/features/variables/system/adapter.ts +++ b/public/app/features/variables/system/adapter.ts @@ -1,11 +1,11 @@ import { ComponentType } from 'react'; -import { LoadingState } from '@grafana/data'; +import { LoadingState, SystemVariable, VariableHide } from '@grafana/data'; import { VariableAdapter } from '../adapters'; import { VariableEditorProps } from '../editor/types'; import { VariablePickerProps } from '../pickers/types'; -import { initialVariableModelState, SystemVariable, VariableHide } from '../types'; +import { initialVariableModelState } from '../types'; export const createSystemVariableAdapter = (): VariableAdapter> => { return { diff --git a/public/app/features/variables/textbox/TextBoxVariableEditor.tsx b/public/app/features/variables/textbox/TextBoxVariableEditor.tsx index 4ec385d370c..7a9f3ee054b 100644 --- a/public/app/features/variables/textbox/TextBoxVariableEditor.tsx +++ b/public/app/features/variables/textbox/TextBoxVariableEditor.tsx @@ -1,11 +1,11 @@ import React, { FormEvent, ReactElement, useCallback } from 'react'; +import { TextBoxVariableModel } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { VariableLegend } from '../../dashboard-scene/settings/variables/components/VariableLegend'; import { VariableTextField } from '../../dashboard-scene/settings/variables/components/VariableTextField'; import { VariableEditorProps } from '../editor/types'; -import { TextBoxVariableModel } from '../types'; export interface Props extends VariableEditorProps {} diff --git a/public/app/features/variables/textbox/TextBoxVariablePicker.tsx b/public/app/features/variables/textbox/TextBoxVariablePicker.tsx index 54f9395cf15..4035db8b48f 100644 --- a/public/app/features/variables/textbox/TextBoxVariablePicker.tsx +++ b/public/app/features/variables/textbox/TextBoxVariablePicker.tsx @@ -1,6 +1,6 @@ import React, { ChangeEvent, FocusEvent, KeyboardEvent, ReactElement, useCallback, useEffect, useState } from 'react'; -import { isEmptyObject } from '@grafana/data'; +import { TextBoxVariableModel, isEmptyObject } from '@grafana/data'; import { Input } from '@grafana/ui'; import { t } from 'app/core/internationalization'; import { useDispatch } from 'app/types'; @@ -10,7 +10,6 @@ import { VARIABLE_PREFIX } from '../constants'; import { VariablePickerProps } from '../pickers/types'; import { toKeyedAction } from '../state/keyedVariablesReducer'; import { changeVariableProp } from '../state/sharedReducer'; -import { TextBoxVariableModel } from '../types'; import { toVariablePayload } from '../utils'; export interface Props extends VariablePickerProps {} diff --git a/public/app/features/variables/textbox/actions.test.ts b/public/app/features/variables/textbox/actions.test.ts index 117e41a5cb5..39e6523e17e 100644 --- a/public/app/features/variables/textbox/actions.test.ts +++ b/public/app/features/variables/textbox/actions.test.ts @@ -1,3 +1,4 @@ +import { VariableOption } from '@grafana/data'; import { locationService } from '@grafana/runtime'; import { reduxTester } from '../../../../test/core/redux/reduxTester'; @@ -6,7 +7,6 @@ import { textboxBuilder } from '../shared/testing/builders'; import { getRootReducer, RootReducerType } from '../state/helpers'; import { toKeyedAction } from '../state/keyedVariablesReducer'; import { addVariable, changeVariableProp, setCurrentVariableValue } from '../state/sharedReducer'; -import { VariableOption } from '../types'; import { toKeyedVariableIdentifier, toVariablePayload } from '../utils'; import { setTextBoxVariableOptionsFromUrl, updateTextBoxVariableOptions } from './actions'; diff --git a/public/app/features/variables/textbox/adapter.test.ts b/public/app/features/variables/textbox/adapter.test.ts index 3cede33ddfd..fa25c9836ef 100644 --- a/public/app/features/variables/textbox/adapter.test.ts +++ b/public/app/features/variables/textbox/adapter.test.ts @@ -1,6 +1,7 @@ +import { VariableHide } from '@grafana/data'; + import { variableAdapters } from '../adapters'; import { textboxBuilder } from '../shared/testing/builders'; -import { VariableHide } from '../types'; import { createTextBoxVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/textbox/adapter.ts b/public/app/features/variables/textbox/adapter.ts index 9b6784ccd9d..db5afba0db3 100644 --- a/public/app/features/variables/textbox/adapter.ts +++ b/public/app/features/variables/textbox/adapter.ts @@ -1,9 +1,10 @@ import { cloneDeep } from 'lodash'; +import { TextBoxVariableModel } from '@grafana/data'; + import { dispatch } from '../../../store/store'; import { VariableAdapter } from '../adapters'; import { setOptionAsCurrent } from '../state/actions'; -import { TextBoxVariableModel } from '../types'; import { toKeyedVariableIdentifier } from '../utils'; import { TextBoxVariableEditor } from './TextBoxVariableEditor'; diff --git a/public/app/features/variables/textbox/reducer.test.ts b/public/app/features/variables/textbox/reducer.test.ts index d8ff2eacc22..376147675c7 100644 --- a/public/app/features/variables/textbox/reducer.test.ts +++ b/public/app/features/variables/textbox/reducer.test.ts @@ -1,9 +1,10 @@ import { cloneDeep } from 'lodash'; +import { TextBoxVariableModel } from '@grafana/data'; + import { reducerTester } from '../../../../test/core/redux/reducerTester'; import { getVariableTestContext } from '../state/helpers'; import { VariablesState } from '../state/types'; -import { TextBoxVariableModel } from '../types'; import { toVariablePayload } from '../utils'; import { createTextBoxVariableAdapter } from './adapter'; diff --git a/public/app/features/variables/textbox/reducer.ts b/public/app/features/variables/textbox/reducer.ts index fb884448916..7656f6d899b 100644 --- a/public/app/features/variables/textbox/reducer.ts +++ b/public/app/features/variables/textbox/reducer.ts @@ -1,8 +1,10 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { TextBoxVariableModel } from '@grafana/data'; + import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { initialVariableModelState, TextBoxVariableModel } from '../types'; +import { initialVariableModelState } from '../types'; export const initialTextBoxVariableModelState: TextBoxVariableModel = { ...initialVariableModelState, diff --git a/public/app/features/variables/types.ts b/public/app/features/variables/types.ts index f943bf1efd4..c25dacb0459 100644 --- a/public/app/features/variables/types.ts +++ b/public/app/features/variables/types.ts @@ -10,52 +10,7 @@ import { VariableHide, TypedVariableModel, } from '@grafana/data'; -export { - /** @deprecated Import from @grafana/data instead */ - VariableRefresh, - /** @deprecated Import from @grafana/data instead */ - VariableSort, - /** @deprecated Import from @grafana/data instead */ - VariableHide, - /** @deprecated Import from @grafana/data instead */ - AdHocVariableFilter, - /** @deprecated Import from @grafana/data instead */ - AdHocVariableModel, - /** @deprecated Import from @grafana/data instead */ - VariableOption, - /** @deprecated Import from @grafana/data instead */ - IntervalVariableModel, - /** @deprecated Import from @grafana/data instead */ - CustomVariableModel, - /** @deprecated Import from @grafana/data instead */ - DataSourceVariableModel, - /** @deprecated Import from @grafana/data instead */ - QueryVariableModel, - /** @deprecated Import from @grafana/data instead */ - TextBoxVariableModel, - /** @deprecated Import from @grafana/data instead */ - ConstantVariableModel, - /** @deprecated Import from @grafana/data instead */ - VariableWithMultiSupport, - /** @deprecated Import from @grafana/data instead */ - VariableWithOptions, - /** @deprecated Import from @grafana/data instead */ - DashboardProps, - /** @deprecated Import from @grafana/data instead */ - DashboardVariableModel, - /** @deprecated Import from @grafana/data instead */ - OrgProps, - /** @deprecated Import from @grafana/data instead */ - OrgVariableModel, - /** @deprecated Import from @grafana/data instead */ - UserProps, - /** @deprecated Import from @grafana/data instead */ - UserVariableModel, - /** @deprecated Import from @grafana/data instead */ - SystemVariable, - /** @deprecated Import from @grafana/data instead */ - BaseVariableModel as VariableModel, -} from '@grafana/data'; +export { BaseVariableModel as VariableModel } from '@grafana/data'; import { TemplateSrv } from '@grafana/runtime'; import { NEW_VARIABLE_ID } from './constants'; diff --git a/public/app/features/variables/utils.test.ts b/public/app/features/variables/utils.test.ts index ada7fd4e3db..12a6e1d9aaa 100644 --- a/public/app/features/variables/utils.test.ts +++ b/public/app/features/variables/utils.test.ts @@ -1,7 +1,6 @@ -import { UrlQueryMap } from '@grafana/data'; +import { UrlQueryMap, VariableRefresh } from '@grafana/data'; import { locationService } from '@grafana/runtime'; -import { VariableRefresh } from './types'; import { containsVariable, ensureStringValues,