From 431fdd4babc818b488efd90703a9673a94e2a6db Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Wed, 15 May 2024 18:17:50 -0600 Subject: [PATCH] Canvas: Adhere editing state to dashboard editable state (#87883) --- public/app/plugins/panel/canvas/CanvasPanel.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/canvas/CanvasPanel.tsx b/public/app/plugins/panel/canvas/CanvasPanel.tsx index 195838a4231..c5f534a0823 100644 --- a/public/app/plugins/panel/canvas/CanvasPanel.tsx +++ b/public/app/plugins/panel/canvas/CanvasPanel.tsx @@ -7,6 +7,7 @@ import { PanelContext, PanelContextRoot } from '@grafana/ui'; import { CanvasFrameOptions } from 'app/features/canvas'; import { ElementState } from 'app/features/canvas/runtime/element'; import { Scene } from 'app/features/canvas/runtime/scene'; +import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv'; import { PanelEditEnteredEvent, PanelEditExitedEvent } from 'app/types/events'; import { SetBackground } from './components/SetBackground'; @@ -61,11 +62,16 @@ export class CanvasPanel extends Component { moveableAction: false, }; + // TODO: Will need to update this approach for dashboard scenes + // migration (new dashboard edit experience) + const dashboard = getDashboardSrv().getCurrent(); + const allowEditing = this.props.options.inlineEditing && dashboard?.editable; + // Only the initial options are ever used. // later changes are all controlled by the scene this.scene = new Scene( this.props.options.root, - this.props.options.inlineEditing, + allowEditing, this.props.options.showAdvancedTypes, this.props.options.panZoom, this.props.options.infinitePan,