Templating: removes old Angular variable system and featureToggle (#24779)

* Chore: initial commit

* Tests: fixes MetricsQueryEditor.test.tsx

* Tests: fixes cloudwatch/specs/datasource.test.ts

* Tests: fixes stackdriver/specs/datasource.test.ts

* Tests: remove refrences to CustomVariable

* Refactor: moves DefaultVariableQueryEditor

* Refactor: moves utils

* Refactor: moves types

* Refactor: removes variableSrv

* Refactor: removes feature toggle newVariables

* Refactor: removes valueSelectDropDown

* Chore: removes GeneralTabCtrl

* Chore: migrates RowOptions

* Refactor: adds RowOptionsButton

* Refactor: makes the interface more explicit

* Refactor: small changes

* Refactor: changed type as it can be any variable type

* Tests: fixes broken test

* Refactor: changes after PR comments

* Refactor: adds loading state and call to onChange in componentDidMount
This commit is contained in:
Hugo Häggmark
2020-06-04 13:44:48 +02:00
committed by GitHub
parent 6b4d1dceb0
commit 00a9af00fc
166 changed files with 678 additions and 5917 deletions

View File

@@ -12,14 +12,14 @@ import {
DataQueryResponseData,
DataSourceInstanceSettings,
dateTime,
getFieldDisplayName,
LoadingState,
toDataFrame,
getFieldDisplayName,
} from '@grafana/data';
import { PromOptions, PromQuery } from './types';
import templateSrv from 'app/features/templating/template_srv';
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { CustomVariable } from 'app/features/templating/custom_variable';
import { VariableHide } from '../../../features/variables/types';
const datasourceRequestMock = jest.fn().mockResolvedValue(createDefaultPromResponse());
@@ -447,9 +447,25 @@ describe('PrometheusDatasource', () => {
});
describe('When interpolating variables', () => {
let customVariable: CustomVariable;
let customVariable: any;
beforeEach(() => {
customVariable = new CustomVariable({}, {} as any);
customVariable = {
id: '',
global: false,
multi: false,
includeAll: false,
allValue: null,
query: '',
options: [],
current: {},
name: '',
type: 'custom',
label: null,
hide: VariableHide.dontHide,
skipUrlSync: false,
index: -1,
initLock: null,
};
});
describe('and value is a string', () => {