Skip to content

Commit

Permalink
[v10.0.x] AzureMonitor: Clear queries if header value changes (#67930)
Browse files Browse the repository at this point in the history
AzureMonitor: Clear queries if header value changes (#67916)

Clear queries if header value changes

(cherry picked from commit 765ae6c)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
  • Loading branch information
grafanabot and aangelisc authored May 5, 2023
1 parent 25a9d90 commit 21e0824
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ describe('Azure Monitor QueryEditor', () => {
await selectOptionInTest(metrics, 'Logs');

expect(onChange).toHaveBeenCalledWith({
...mockQuery,
refId: mockQuery.refId,
datasource: mockQuery.datasource,
queryType: AzureQueryType.LogAnalytics,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ export const QueryHeader = ({ query, onQueryChange }: QueryTypeFieldProps) => {

const handleChange = useCallback(
(change: SelectableValue<AzureQueryType>) => {
change.value &&
if (change.value && change.value !== query.queryType) {
onQueryChange({
...query,
refId: query.refId,
datasource: query.datasource,
queryType: change.value,
});
}
},
[onQueryChange, query]
);
Expand Down

0 comments on commit 21e0824

Please sign in to comment.