[v9.2.x] Graphite: bug fix, strip white space from queries before comparing them (#60348)
Graphite: bug fix, strip white space from queries before comparing them (#60133)
strip white space from queries before comparing them
(cherry picked from commit d5d07894b1)
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
This commit is contained in:
co-authored by
Brendan O'Handley
parent
796e2e020c
commit
cdb21a3717
@@ -155,7 +155,7 @@ export function handleTargetChanged(state: GraphiteQueryEditorState): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const oldTarget = state.queryModel.target.target;
|
||||
let oldTarget = state.queryModel.target.target;
|
||||
// Interpolate from other queries:
|
||||
// Because of mixed data sources the list may contain queries for non-Graphite data sources. To ensure a valid query
|
||||
// is used for interpolation we should check required properties are passed though in theory it allows to interpolate
|
||||
@@ -164,7 +164,11 @@ export function handleTargetChanged(state: GraphiteQueryEditorState): void {
|
||||
(state.queries || []).filter((query) => 'target' in query && typeof (query as GraphiteQuery).target === 'string')
|
||||
);
|
||||
|
||||
if (state.queryModel.target.target !== oldTarget && !state.paused) {
|
||||
// remove spaces from old and new targets
|
||||
const newTarget = state.queryModel.target.target.replace(/\s+/g, '');
|
||||
oldTarget = oldTarget.replace(/\s+/g, '');
|
||||
|
||||
if (newTarget !== oldTarget && !state.paused) {
|
||||
state.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user