Skip to content

Commit

Permalink
Update handling of vars
Browse files Browse the repository at this point in the history
  • Loading branch information
joey-grafana committed Mar 14, 2024
1 parent 2a3f437 commit 8d48c32
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/Explore/filters/FilterByVariable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,12 @@ export function renderTraceQLLabelFilters(filters: AdHocVariableFilter[]) {
}

function renderFilter(filter: AdHocVariableFilter) {
return `${filter.key}${filter.operator}"${filter.value}"`;
let val = filter.value;
// Add quotes if it's coming from the filter input and it's not already quoted.
// Adding a filter from a time series graph already has quotes. This should be handled better.
if (typeof val === 'string' && !val.startsWith('"') && !val.endsWith('"')) {
val = `"${val}"`;
}

return `${filter.key}${filter.operator}${val}`;
}

0 comments on commit 8d48c32

Please sign in to comment.