Variables: Fixes issue with All variable not being resolved (#27151)

* Variables: Fixes issue with All variable not being resolved

* Tests: update tests according to changes
This commit is contained in:
Hugo Häggmark
2020-08-24 00:29:21 -07:00
committed by GitHub
parent 69df8b424c
commit 09a1af3f91
9 changed files with 142 additions and 48 deletions

View File

@@ -9,7 +9,7 @@ import { OptionsPicker } from '../pickers';
import { QueryVariableEditor } from './QueryVariableEditor';
import { updateQueryVariableOptions } from './actions';
import { ALL_VARIABLE_TEXT, toVariableIdentifier } from '../state/types';
import { containsVariable } from '../utils';
import { containsVariable, isAllVariable } from '../utils';
export const createQueryVariableAdapter = (): VariableAdapter<QueryVariableModel> => {
return {
@@ -42,7 +42,7 @@ export const createQueryVariableAdapter = (): VariableAdapter<QueryVariableModel
return rest;
},
getValueForUrl: variable => {
if (variable.current.text === ALL_VARIABLE_TEXT) {
if (isAllVariable(variable)) {
return ALL_VARIABLE_TEXT;
}
return variable.current.value;