Compare commits

...

1 Commits

Author SHA1 Message Date
Haris Rozajac
af064ae377 revert adding ds ref by default 2025-11-25 13:42:48 -07:00
2 changed files with 17 additions and 17 deletions

View File

@@ -89,13 +89,13 @@ export function QueryVariableEditorForm({
onQueryChange(query); onQueryChange(query);
} }
if (!datasourceRef) { // if (!datasourceRef) {
const instanceSettings = getDataSourceSrv().getInstanceSettings({ type: datasource.type, uid: datasource.uid }); // const instanceSettings = getDataSourceSrv().getInstanceSettings({ type: datasource.type, uid: datasource.uid });
if (instanceSettings) { // if (instanceSettings) {
onDataSourceChange(instanceSettings); // onDataSourceChange(instanceSettings);
} // }
} // }
return { datasource, VariableQueryEditor }; return { datasource, VariableQueryEditor };
}, [datasourceRef]); }, [datasourceRef]);

View File

@@ -148,19 +148,19 @@ describe('QueryVariableEditor', () => {
expect(staticOptionsToggle).toBeInTheDocument(); expect(staticOptionsToggle).toBeInTheDocument();
}); });
it('should update the variable with default datasource when opening editor', async () => { // it('should update the variable with default datasource when opening editor', async () => {
const onRunQueryMock = jest.fn(); // const onRunQueryMock = jest.fn();
const variable = new QueryVariable({ datasource: undefined, query: '' }); // const variable = new QueryVariable({ datasource: undefined, query: '' });
await setup({ // await setup({
variable, // variable,
onRunQuery: onRunQueryMock, // onRunQuery: onRunQueryMock,
}); // });
await waitFor(async () => { // await waitFor(async () => {
expect(variable.state.datasource).not.toBe(undefined); // expect(variable.state.datasource).not.toBe(undefined);
}); // });
}); // });
it('should update the variable with default query for the selected DS', async () => { it('should update the variable with default query for the selected DS', async () => {
const onRunQueryMock = jest.fn(); const onRunQueryMock = jest.fn();