mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
AzureMonitor: Clear queries if header value changes (#67916)
Clear queries if header value changes
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user