mirror of https://github.com/grafana/grafana.git
Scenes: Fix incorrect panel context.app during panel edit (#101567)
This commit is contained in:
parent
6accf13597
commit
a604602b55
|
@ -11,7 +11,16 @@ import { getDashboardSceneFor, getPanelIdForVizPanel, getQueryRunnerFor } from '
|
|||
import { DashboardScene } from './DashboardScene';
|
||||
|
||||
export function setDashboardPanelContext(vizPanel: VizPanel, context: PanelContext) {
|
||||
const dashboard = getDashboardSceneFor(vizPanel);
|
||||
context.app = dashboard.state.isEditing ? CoreApp.PanelEditor : CoreApp.Dashboard;
|
||||
|
||||
dashboard.subscribeToState((state) => {
|
||||
if (state.isEditing) {
|
||||
context.app = CoreApp.PanelEditor;
|
||||
} else {
|
||||
context.app = CoreApp.Dashboard;
|
||||
}
|
||||
});
|
||||
|
||||
context.canAddAnnotations = () => {
|
||||
const dashboard = getDashboardSceneFor(vizPanel);
|
||||
|
|
Loading…
Reference in New Issue