CloudWatch: Remove core imports from app/features/variables/types (#79361)

* CloudWatch: Remove core imports from app/features/variables/types

* fix import

* lint
This commit is contained in:
Kevin Yu 2023-12-13 06:46:33 -08:00 committed by GitHub
parent 147c1b8d8f
commit 9501d06edf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 5 deletions

View File

@ -10,8 +10,8 @@ import {
} from '@grafana/data';
import { getBackendSrv, setBackendSrv, DataSourceWithBackend } from '@grafana/runtime';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { initialCustomVariableModelState } from 'app/features/variables/custom/reducer';
import { initialCustomVariableModelState } from '../__mocks__/variables';
import { CloudWatchDatasource } from '../datasource';
import { CloudWatchJsonData } from '../types';

View File

@ -1,6 +1,6 @@
import { CustomVariableModel } from '@grafana/data';
import { getBackendSrv, setBackendSrv } from '@grafana/runtime';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { CustomVariableModel } from 'app/features/variables/types';
import { ResourcesAPI } from '../resources/ResourcesAPI';

View File

@ -0,0 +1,26 @@
import { BaseVariableModel, CustomVariableModel, LoadingState, VariableHide, VariableOption } from '@grafana/data';
export const initialVariableModelState: BaseVariableModel = {
id: '00000000-0000-0000-0000-000000000000',
rootStateKey: null,
name: '',
type: 'query',
global: false,
index: -1,
hide: VariableHide.dontHide,
skipUrlSync: false,
state: LoadingState.NotStarted,
error: null,
description: null,
};
export const initialCustomVariableModelState: CustomVariableModel = {
...initialVariableModelState,
type: 'custom',
multi: false,
includeAll: false,
allValue: null,
query: '',
options: [],
current: {} as VariableOption,
};

View File

@ -2,11 +2,11 @@ import { render, screen } from '@testing-library/react';
import React from 'react';
import selectEvent from 'react-select-event';
import { DataSourceInstanceSettings } from '@grafana/data';
import { CustomVariableModel, DataSourceInstanceSettings } from '@grafana/data';
import * as ui from '@grafana/ui';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { CustomVariableModel, initialVariableModelState } from '../../../../../../features/variables/types';
import { initialVariableModelState } from '../../../__mocks__/variables';
import { CloudWatchDatasource } from '../../../datasource';
import { CloudWatchJsonData, MetricEditorMode, MetricQueryType } from '../../../types';

View File

@ -3,7 +3,6 @@ import { of } from 'rxjs';
import { CustomVariableModel, getFrameDisplayName, VariableHide } from '@grafana/data';
import { dateTime } from '@grafana/data/src/datetime/moment_wrapper';
import { BackendDataSourceResponse } from '@grafana/runtime';
import { initialVariableModelState } from 'app/features/variables/types';
import * as redux from 'app/store/store';
import {
@ -17,6 +16,7 @@ import {
} from '../__mocks__/CloudWatchDataSource';
import { setupMockedMetricsQueryRunner } from '../__mocks__/MetricsQueryRunner';
import { validMetricSearchBuilderQuery, validMetricSearchCodeQuery } from '../__mocks__/queries';
import { initialVariableModelState } from '../__mocks__/variables';
import { MetricQueryType, MetricEditorMode, CloudWatchMetricsQuery, DataQueryError } from '../types';
describe('CloudWatchMetricsQueryRunner', () => {