mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
refactor: minor change to panel json fix PR #10156
This commit is contained in:
parent
86204abbfe
commit
35c8cdf3a5
@ -191,9 +191,8 @@ export class PanelCtrl {
|
|||||||
|
|
||||||
duplicate() {
|
duplicate() {
|
||||||
this.dashboard.duplicatePanel(this.panel);
|
this.dashboard.duplicatePanel(this.panel);
|
||||||
let self = this;
|
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
self.$scope.$root.$broadcast('render');
|
this.$scope.$root.$broadcast('render');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,18 +239,16 @@ export class PanelCtrl {
|
|||||||
let index = _.findIndex(dashboard.panels, (panel) => {
|
let index = _.findIndex(dashboard.panels, (panel) => {
|
||||||
return panel.id === oldPanel.id;
|
return panel.id === oldPanel.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
let deletedPanel = dashboard.panels.splice(index, 1);
|
let deletedPanel = dashboard.panels.splice(index, 1);
|
||||||
this.dashboard.events.emit('panel-removed', deletedPanel);
|
this.dashboard.events.emit('panel-removed', deletedPanel);
|
||||||
|
|
||||||
// adding it back needs to be done in next digest
|
newPanel = new PanelModel(newPanel);
|
||||||
this.$timeout(() => {
|
newPanel.id = oldPanel.id;
|
||||||
newPanel = new PanelModel(newPanel);
|
|
||||||
newPanel.id = oldPanel.id;
|
|
||||||
|
|
||||||
dashboard.panels.splice(index, 0, newPanel);
|
dashboard.panels.splice(index, 0, newPanel);
|
||||||
dashboard.sortPanelsByGridPos();
|
dashboard.sortPanelsByGridPos();
|
||||||
dashboard.events.emit('panel-added', newPanel);
|
dashboard.events.emit('panel-added', newPanel);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sharePanel() {
|
sharePanel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user