[v11.0.x] DashboardDataSource: Fixes issue where sometimes untransformed data could be returned (#87484)

DashboardDataSource: Fixes issue where sometimes untransformed data could be returned  (#87433)

* DashboardDataSource: always return a result key

* Update

* Update

(cherry picked from commit e7c39f18be)

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
pull/87485/head
grafana-delivery-bot[bot] 1 year ago committed by GitHub
parent 60611c56eb
commit 2f6080211a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      public/app/plugins/datasource/dashboard/datasource.test.ts
  2. 1
      public/app/plugins/datasource/dashboard/datasource.ts

@ -26,6 +26,16 @@ describe('DashboardDatasource', () => {
expect(rsp?.data[0].fields[0].values).toEqual([1, 2, 3]);
});
it('should always set response key', async () => {
const { observable } = setup({ refId: 'A', panelId: 1 });
let rsp: DataQueryResponse | undefined;
observable.subscribe({ next: (data) => (rsp = data) });
expect(rsp?.key).toEqual('source-ds-provider');
});
it('Can subscribe to panel data + transforms', async () => {
const { observable } = setup({ refId: 'A', panelId: 1, withTransforms: true });

@ -76,6 +76,7 @@ export class DashboardDatasource extends DataSourceApi<DashboardQuery> {
state: result.data.state,
errors: result.data.errors,
error: result.data.error,
key: 'source-ds-provider',
};
}),
finalize(cleanUp)

Loading…
Cancel
Save