mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard datasource: Activate parents of query runner when using dashboard ds (#95507)
* Activate parents of query runner when using dashboard ds * Set plugin loading util to fix test because activating the ancestors of the query runner needs to be able to load the plugin for the panel
This commit is contained in:
@@ -6,6 +6,8 @@ import {
|
||||
LoadingState,
|
||||
standardTransformersRegistry,
|
||||
} from '@grafana/data';
|
||||
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
||||
import { setPluginImportUtils } from '@grafana/runtime';
|
||||
import {
|
||||
SafeSerializableSceneObject,
|
||||
SceneDataNode,
|
||||
@@ -21,6 +23,10 @@ import { DashboardDatasource } from './datasource';
|
||||
import { DashboardQuery } from './types';
|
||||
|
||||
standardTransformersRegistry.setInit(getStandardTransformers);
|
||||
setPluginImportUtils({
|
||||
importPanelPlugin: (id: string) => Promise.resolve(getPanelPlugin({})),
|
||||
getPanelPluginFromCache: (id: string) => undefined,
|
||||
});
|
||||
|
||||
describe('DashboardDatasource', () => {
|
||||
it("should look up the other panel and subscribe to it's data", async () => {
|
||||
|
||||
@@ -9,7 +9,11 @@ import {
|
||||
ScopedVar,
|
||||
} from '@grafana/data';
|
||||
import { SceneDataProvider, SceneDataTransformer, SceneObject } from '@grafana/scenes';
|
||||
import { findVizPanelByKey, getVizPanelKeyForPanelId } from 'app/features/dashboard-scene/utils/utils';
|
||||
import {
|
||||
activateInActiveParents,
|
||||
findVizPanelByKey,
|
||||
getVizPanelKeyForPanelId,
|
||||
} from 'app/features/dashboard-scene/utils/utils';
|
||||
|
||||
import { DashboardQuery } from './types';
|
||||
|
||||
@@ -69,7 +73,7 @@ export class DashboardDatasource extends DataSourceApi<DashboardQuery> {
|
||||
sourceDataProvider?.setContainerWidth(500);
|
||||
}
|
||||
|
||||
const cleanUp = sourceDataProvider!.activate();
|
||||
const cleanUp = activateInActiveParents(sourceDataProvider!);
|
||||
|
||||
return sourceDataProvider!.getResultsStream!().pipe(
|
||||
map((result) => {
|
||||
@@ -81,7 +85,7 @@ export class DashboardDatasource extends DataSourceApi<DashboardQuery> {
|
||||
key: 'source-ds-provider',
|
||||
};
|
||||
}),
|
||||
finalize(cleanUp)
|
||||
finalize(() => cleanUp?.())
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user