فهرست منبع

Reduce re-renderings when changing view modes

Torkel Ödegaard 7 سال پیش
والد
کامیت
c5f9d8092f
2فایلهای تغییر یافته به همراه11 افزوده شده و 7 حذف شده
  1. 6 6
      public/app/features/dashboard/dashgrid/DashboardGrid.tsx
  2. 5 1
      public/app/plugins/panel/graph2/module.tsx

+ 6 - 6
public/app/features/dashboard/dashgrid/DashboardGrid.tsx

@@ -21,15 +21,14 @@ function GridWrapper({
   className,
   isResizable,
   isDraggable,
+  isFullscreen,
 }) {
-  if (size.width === 0) {
-    console.log('size is zero!');
-  }
-
   const width = size.width > 0 ? size.width : lastGridWidth;
   if (width !== lastGridWidth) {
-    onWidthChange();
-    lastGridWidth = width;
+    if (!isFullscreen && Math.abs(width - lastGridWidth) > 8) {
+      onWidthChange();
+      lastGridWidth = width;
+    }
   }
 
   return (
@@ -197,6 +196,7 @@ export class DashboardGrid extends React.Component<DashboardGridProps, any> {
         onDragStop={this.onDragStop}
         onResize={this.onResize}
         onResizeStop={this.onResizeStop}
+        isFullscreen={this.props.dashboard.meta.fullscreen}
       >
         {this.renderPanels()}
       </SizedReactLayoutGrid>

+ 5 - 1
public/app/plugins/panel/graph2/module.tsx

@@ -36,7 +36,11 @@ export class Graph2 extends PureComponent<Props> {
 
 export class TextOptions extends PureComponent<any> {
   render() {
-    return <p>Text2 Options component</p>;
+    return (
+      <div className="section gf-form-group">
+        <h5 className="section-heading">Draw Modes</h5>
+      </div>
+    );
   }
 }