mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 09:05:45 -06:00
* Fixed issue with multi value. * Made some refactorings after feedback from Torkel and Hugo. * minor refactorings. * changed so we don't make the current value to array if multi is false. * added snapshot to contain v23. * Fixed so we always use the correct type when setting value for multi/non-multi. * added some more tests. * added tests. * some small adjustments after feedback
15 lines
582 B
TypeScript
15 lines
582 B
TypeScript
import { QueryVariableModel, VariableModel, AdHocVariableModel, VariableWithMultiSupport } from '../templating/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 isMulti = (model: VariableModel): model is VariableWithMultiSupport => {
|
|
const withMulti = model as VariableWithMultiSupport;
|
|
return withMulti.hasOwnProperty('multi') && typeof withMulti.multi === 'boolean';
|
|
};
|