From 6d23466d5f4d0c3c6ddebc1295f51164e86001a8 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:06:57 +0300 Subject: [PATCH] [v11.0.x] Dashboards: Fix issue with changing panel JSON from edit view (#85728) Dashboards: Fix issue with changing panel JSON from edit view (#85717) (cherry picked from commit 1b376546e2fefc7994c2b8716b647b73ff3c4e14) Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com> --- .../app/features/inspector/InspectJSONTab.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/public/app/features/inspector/InspectJSONTab.tsx b/public/app/features/inspector/InspectJSONTab.tsx index ecb5232b5c9..b49338f3843 100644 --- a/public/app/features/inspector/InspectJSONTab.tsx +++ b/public/app/features/inspector/InspectJSONTab.tsx @@ -78,22 +78,23 @@ export function InspectJSONTab({ panel, dashboard, data, onClose }: Props) { const onApplyPanelModel = useCallback(() => { if (panel && dashboard && text) { try { - if (!dashboard!.meta.canEdit) { + if (!dashboard.meta.canEdit) { appEvents.emit(AppEvents.alertError, ['Unable to apply']); } else { const updates = JSON.parse(text); - dashboard!.shouldUpdateDashboardPanelFromJSON(updates, panel!); + dashboard.shouldUpdateDashboardPanelFromJSON(updates, panel); //Report relevant updates reportPanelInspectInteraction(InspectTab.JSON, 'apply', { - panel_type_changed: panel!.type !== updates.type, - panel_id_changed: panel!.id !== updates.id, - panel_grid_pos_changed: !isEqual(panel!.gridPos, updates.gridPos), - panel_targets_changed: !isEqual(panel!.targets, updates.targets), + panel_type_changed: panel.type !== updates.type, + panel_id_changed: panel.id !== updates.id, + panel_grid_pos_changed: !isEqual(panel.gridPos, updates.gridPos), + panel_targets_changed: !isEqual(panel.targets, updates.targets), }); - panel!.restoreModel(updates); - panel!.refresh(); + panel.restoreModel(updates); + panel.configRev++; + panel.refresh(); appEvents.emit(AppEvents.alertSuccess, ['Panel model updated']); } } catch (err) {