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

added forceupdate to grid item so addpanel items rezie instantly, renamed function to copyPanel, fixed panel items height issue

Patrick O'Carroll 7 лет назад
Родитель
Сommit
0120023aba

+ 2 - 0
public/app/features/dashboard/dashgrid/DashboardGrid.tsx

@@ -152,11 +152,13 @@ export class DashboardGrid extends React.Component<DashboardGridProps, any> {
 
   onResize(layout, oldItem, newItem) {
     this.panelMap[newItem.i].updateGridPos(newItem);
+    this.triggerForceUpdate();
   }
 
   onResizeStop(layout, oldItem, newItem) {
     this.updateGridPos(newItem, layout);
     this.panelMap[newItem.i].resizeDone();
+    this.triggerForceUpdate();
   }
 
   onDragStop(layout, oldItem, newItem) {

+ 3 - 3
public/app/features/panel/panel_ctrl.ts

@@ -195,7 +195,7 @@ export class PanelCtrl {
 
       menu.push({
         text: 'Copy',
-        click: 'ctrl.addToPanelList()',
+        click: 'ctrl.copyPanel()',
         role: 'Editor',
       });
     }
@@ -260,9 +260,9 @@ export class PanelCtrl {
     });
   }
 
-  addToPanelList() {
+  copyPanel() {
     store.set(LS_PANEL_COPY_KEY, JSON.stringify(this.panel.getSaveModel()));
-    appEvents.emit('alert-success', ['Panel temporarily added to panel list']);
+    appEvents.emit('alert-success', ['Panel copied. Open new panel to paste']);
   }
 
   replacePanel(newPanel, oldPanel) {

+ 1 - 1
public/sass/components/_panel_add_panel.scss

@@ -50,7 +50,7 @@
   flex-direction: row;
   flex-wrap: wrap;
   overflow: auto;
-  height: calc(100% - 50px);
+  height: 100%;
   align-content: flex-start;
   justify-content: space-around;
   position: relative;