mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScenes: Fix queryOptions interval not resetting on empty minInterval (#95659)
* Fix queryOptions interval not resetting on empty minInterval * fix * refactor + tests
This commit is contained in:
parent
3dfbae7331
commit
d9dfa3ece3
@ -520,6 +520,27 @@ describe('PanelDataQueriesTab', () => {
|
||||
});
|
||||
expect(dataObj.state.minInterval).toBe('1s');
|
||||
});
|
||||
|
||||
it('should update min interval to undefined if empty input', async () => {
|
||||
const { queriesTab } = await setupScene('panel-1');
|
||||
const dataObj = queriesTab.queryRunner;
|
||||
|
||||
expect(dataObj.state.maxDataPoints).toBeUndefined();
|
||||
|
||||
queriesTab.onQueryOptionsChange({
|
||||
dataSource: { name: 'grafana-testdata', type: 'grafana-testdata-datasource', default: true },
|
||||
queries: [],
|
||||
minInterval: '1s',
|
||||
});
|
||||
expect(dataObj.state.minInterval).toBe('1s');
|
||||
|
||||
queriesTab.onQueryOptionsChange({
|
||||
dataSource: { name: 'grafana-testdata', type: 'grafana-testdata-datasource', default: true },
|
||||
queries: [],
|
||||
minInterval: null,
|
||||
});
|
||||
expect(dataObj.state.minInterval).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('query caching', () => {
|
||||
|
@ -201,8 +201,8 @@ export class PanelDataQueriesTab extends SceneObjectBase<PanelDataQueriesTabStat
|
||||
dataObjStateUpdate.maxDataPoints = options.maxDataPoints ?? undefined;
|
||||
}
|
||||
|
||||
if (options.minInterval !== dataObj.state.minInterval && options.minInterval !== null) {
|
||||
dataObjStateUpdate.minInterval = options.minInterval;
|
||||
if (options.minInterval !== dataObj.state.minInterval) {
|
||||
dataObjStateUpdate.minInterval = options.minInterval ?? undefined;
|
||||
}
|
||||
|
||||
const timeFrom = options.timeRange?.from ?? undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user