Просмотр исходного кода

fix(dashboard): fixed issue when dragging new panel to drop zone

Torkel Ödegaard 9 лет назад
Родитель
Сommit
196fdbfd31

+ 2 - 1
public/app/features/dashboard/row/row_ctrl.ts

@@ -34,6 +34,7 @@ export class DashRowCtrl {
           title: config.new_panel_title,
           type: panelId,
           id: this.dashboard.getNextPanelId(),
+          isNew: true,
         },
       };
     } else {
@@ -63,7 +64,7 @@ export class DashRowCtrl {
       this.row.panels.push(dragObject.panel);
 
       // if not new remove from source row
-      if (!dragObject.isNew) {
+      if (!dragObject.panel.isNew) {
         dragObject.row.removePanel(dragObject.panel, false);
       }
     }

+ 6 - 0
public/app/features/panel/panel_ctrl.ts

@@ -54,6 +54,12 @@ export class PanelCtrl {
       this.events.emit('panel-teardown');
       this.events.removeAllListeners();
     });
+
+    // we should do something interesting
+    // with newly added panels
+    if (this.panel.isNew) {
+      delete this.panel.isNew;
+    }
   }
 
   init() {