AdHocFilters: Use queries in ad hoc filters api calls (#87624)

This commit is contained in:
Dominik Prokop 2024-05-10 14:54:07 +02:00 committed by GitHub
parent fa95b41715
commit 39aafde8cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -126,6 +126,9 @@ describe('transformSaveModelToScene', () => {
expect(scene.state?.$variables?.state.variables).toHaveLength(2);
expect(scene.state?.$variables?.getByName('constant')).toBeInstanceOf(ConstantVariable);
expect(scene.state?.$variables?.getByName('CoolFilters')).toBeInstanceOf(AdHocFiltersVariable);
expect(
(scene.state?.$variables?.getByName('CoolFilters') as AdHocFiltersVariable).state.useQueriesAsFilterForOptions
).toBe(true);
expect(dashboardControls).toBeDefined();
expect(dashboardControls.state.refreshPicker.state.intervals).toEqual(defaultTimePickerConfig.refresh_intervals);
@ -936,6 +939,7 @@ describe('transformSaveModelToScene', () => {
baseFilters: [{ key: 'baseFilterTest', operator: '=', value: 'test' }],
datasource: { uid: 'gdev-prometheus', type: 'prometheus' },
applyMode: 'auto',
useQueriesAsFilterForOptions: true,
});
});
@ -1018,6 +1022,7 @@ describe('transformSaveModelToScene', () => {
value: '3',
},
],
useQueriesAsFilterForOptions: true,
});
});

View File

@ -319,6 +319,7 @@ export function createSceneVariableFromVariableModel(variable: TypedVariableMode
filters: variable.filters ?? [],
baseFilters: variable.baseFilters ?? [],
defaultKeys: variable.defaultKeys,
useQueriesAsFilterForOptions: true,
});
}
if (variable.type === 'custom') {