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);
}
if (!datasourceRef) {
const instanceSettings = getDataSourceSrv().getInstanceSettings({ type: datasource.type, uid: datasource.uid });
// if (!datasourceRef) {
// const instanceSettings = getDataSourceSrv().getInstanceSettings({ type: datasource.type, uid: datasource.uid });
if (instanceSettings) {
onDataSourceChange(instanceSettings);
}
}
// if (instanceSettings) {
// onDataSourceChange(instanceSettings);
// }
// }
return { datasource, VariableQueryEditor };
}, [datasourceRef]);

View File

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