mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Fix issue with changing panel JSON from edit view (#85717)
This commit is contained in:
parent
a7f7f4787d
commit
1b376546e2
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user