Skip to content

Commit

Permalink
Template Variables: Input field in dashboard does not send network re…
Browse files Browse the repository at this point in the history
…quests for query var with ${__searchFilter} (#67839)


Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
  • Loading branch information
polibb and ivanortegaalba committed May 9, 2023
1 parent 8c6b5a4 commit 6137e45
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions public/app/features/variables/pickers/OptionsPicker/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,24 @@ export const filterOrSearchOptions = (
const { id, queryValue } = getVariablesState(rootStateKey, getState()).optionsPicker;
const identifier: KeyedVariableIdentifier = { id, rootStateKey: rootStateKey, type: 'query' };
const variable = getVariable(identifier, getState());
if (!hasOptions(variable)) {

if (!('options' in variable)) {
return;
}

const { query, options } = variable;
dispatch(toKeyedAction(rootStateKey, updateSearchQuery(searchQuery)));

if (trim(queryValue) === trim(searchQuery)) {
return;
}

if (containsSearchFilter(query)) {
const { query, options } = variable;

const queryTarget = typeof query === 'string' ? query : query.target;
if (containsSearchFilter(queryTarget)) {
return searchForOptionsWithDebounce(dispatch, getState, searchQuery, rootStateKey);
}

return dispatch(toKeyedAction(rootStateKey, updateOptionsAndFilter(options)));
};
};
Expand Down

0 comments on commit 6137e45

Please sign in to comment.