diff --git a/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx b/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx index 1eb6db12bf7..c9d43e86725 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx @@ -24,7 +24,7 @@ import { getPanelChanges } from '../saving/getDashboardChanges'; import { DashboardGridItem, DashboardGridItemState } from '../scene/DashboardGridItem'; import { vizPanelToPanel } from '../serialization/transformSceneToSaveModel'; import { - activateInActiveParents, + activateSceneObjectAndParentTree, getDashboardSceneFor, getLibraryPanelBehavior, getPanelIdForVizPanel, @@ -68,7 +68,7 @@ export class PanelEditor extends SceneObjectBase { private _activationHandler() { const panel = this.state.panelRef.resolve(); - const deactivateParents = activateInActiveParents(panel); + const deactivateParents = activateSceneObjectAndParentTree(panel); const layoutElement = panel.parent; this.waitForPlugin(); diff --git a/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx b/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx index 679bca8cb59..c5e7dc5e6c8 100644 --- a/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx +++ b/public/app/features/dashboard-scene/scene/PanelSearchLayout.tsx @@ -7,7 +7,7 @@ import { SceneGridRow, VizPanel, sceneGraph } from '@grafana/scenes'; import { useStyles2 } from '@grafana/ui'; import { Trans } from 'app/core/internationalization'; -import { activateInActiveParents } from '../utils/utils'; +import { activateSceneObjectAndParentTree } from '../utils/utils'; import { DashboardGridItem } from './DashboardGridItem'; import { DashboardScene } from './DashboardScene'; @@ -65,7 +65,7 @@ export function PanelSearchLayout({ dashboard, panelSearch = '', panelsPerRow }: } function PanelSearchHit({ panel }: { panel: VizPanel }) { - useEffect(() => activateInActiveParents(panel), [panel]); + useEffect(() => activateSceneObjectAndParentTree(panel), [panel]); return ; } diff --git a/public/app/features/dashboard-scene/scene/ViewPanelScene.tsx b/public/app/features/dashboard-scene/scene/ViewPanelScene.tsx index 969ed5f1358..46486395aef 100644 --- a/public/app/features/dashboard-scene/scene/ViewPanelScene.tsx +++ b/public/app/features/dashboard-scene/scene/ViewPanelScene.tsx @@ -1,6 +1,6 @@ import { SceneComponentProps, SceneObjectBase, SceneObjectRef, SceneObjectState, VizPanel } from '@grafana/scenes'; -import { activateInActiveParents } from '../utils/utils'; +import { activateSceneObjectAndParentTree } from '../utils/utils'; interface ViewPanelSceneState extends SceneObjectState { panelRef: SceneObjectRef; @@ -15,7 +15,7 @@ export class ViewPanelScene extends SceneObjectBase { public _activationHandler() { const panel = this.state.panelRef.resolve(); - return activateInActiveParents(panel); + return activateSceneObjectAndParentTree(panel); } public getUrlKey() { diff --git a/public/app/features/dashboard-scene/utils/utils.ts b/public/app/features/dashboard-scene/utils/utils.ts index dfdb3cab994..09792696251 100644 --- a/public/app/features/dashboard-scene/utils/utils.ts +++ b/public/app/features/dashboard-scene/utils/utils.ts @@ -249,11 +249,11 @@ export function getLibraryPanelBehavior(vizPanel: VizPanel): LibraryPanelBehavio } /** - * Activates any inactive parents of the scene object. + * Activates any inactive ancestors of the scene object. * Useful when rendering a scene object out of context of it's parent * @returns */ -export function activateInActiveParents(so: SceneObject): CancelActivationHandler | undefined { +export function activateSceneObjectAndParentTree(so: SceneObject): CancelActivationHandler | undefined { let cancel: CancelActivationHandler | undefined; let parentCancel: CancelActivationHandler | undefined; @@ -262,7 +262,7 @@ export function activateInActiveParents(so: SceneObject): CancelActivationHandle } if (so.parent) { - parentCancel = activateInActiveParents(so.parent); + parentCancel = activateSceneObjectAndParentTree(so.parent); } cancel = so.activate(); @@ -272,3 +272,10 @@ export function activateInActiveParents(so: SceneObject): CancelActivationHandle cancel(); }; } + +/** + * @deprecated use activateSceneObjectAndParentTree instead. + * Activates any inactive ancestors of the scene object. + * Useful when rendering a scene object out of context of it's parent + */ +export const activateInActiveParents = activateSceneObjectAndParentTree; diff --git a/public/app/plugins/datasource/dashboard/datasource.ts b/public/app/plugins/datasource/dashboard/datasource.ts index 07e1f84f902..9a6b10e4457 100644 --- a/public/app/plugins/datasource/dashboard/datasource.ts +++ b/public/app/plugins/datasource/dashboard/datasource.ts @@ -10,7 +10,7 @@ import { } from '@grafana/data'; import { SceneDataProvider, SceneDataTransformer, SceneObject } from '@grafana/scenes'; import { - activateInActiveParents, + activateSceneObjectAndParentTree, findVizPanelByKey, getVizPanelKeyForPanelId, } from 'app/features/dashboard-scene/utils/utils'; @@ -73,7 +73,7 @@ export class DashboardDatasource extends DataSourceApi { sourceDataProvider?.setContainerWidth(500); } - const cleanUp = activateInActiveParents(sourceDataProvider!); + const cleanUp = activateSceneObjectAndParentTree(sourceDataProvider!); return sourceDataProvider!.getResultsStream!().pipe( map((result) => {