mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 15:45:43 -06:00
* 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
25 lines
730 B
TypeScript
25 lines
730 B
TypeScript
import {
|
|
AdHocVariableModel,
|
|
ConstantVariableModel,
|
|
QueryVariableModel,
|
|
VariableModel,
|
|
VariableWithMultiSupport,
|
|
} from './types';
|
|
|
|
export const isQuery = (model: VariableModel): model is QueryVariableModel => {
|
|
return model.type === 'query';
|
|
};
|
|
|
|
export const isAdHoc = (model: VariableModel): model is AdHocVariableModel => {
|
|
return model.type === 'adhoc';
|
|
};
|
|
|
|
export const isConstant = (model: VariableModel): model is ConstantVariableModel => {
|
|
return model.type === 'constant';
|
|
};
|
|
|
|
export const isMulti = (model: VariableModel): model is VariableWithMultiSupport => {
|
|
const withMulti = model as VariableWithMultiSupport;
|
|
return withMulti.hasOwnProperty('multi') && typeof withMulti.multi === 'boolean';
|
|
};
|