From dff2c14aedca25c360b30bb08f0a318050a00d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 27 Feb 2018 11:34:29 +0100 Subject: [PATCH] fix: changed react-grid-layout to use grafana fork to a commit before https://github.com/STRML/react-grid-layout/commit/15503084fb7b0af826427c8c0706901e5745a39f, this fixes all the panel movement bugs, fixes #10831 --- package.json | 2 +- .../features/dashboard/dashgrid/DashboardGrid.tsx | 10 ++++++---- public/sass/components/_dashboard_grid.scss | 2 +- yarn.lock | 15 +++++++++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 5f20f8ffc73..b715d96dcde 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "prop-types": "^15.6.0", "react": "^16.2.0", "react-dom": "^16.2.0", - "react-grid-layout": "^0.16.2", + "react-grid-layout-grafana": "0.16.0", "react-highlight-words": "^0.10.0", "react-popper": "^0.7.5", "react-select": "^1.1.0", diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index 3f65c33c90d..03bf65afc6e 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import ReactGridLayout from 'react-grid-layout'; +import ReactGridLayout from 'react-grid-layout-grafana'; import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core/constants'; import { DashboardPanel } from './DashboardPanel'; import { DashboardModel } from '../dashboard_model'; @@ -50,7 +50,8 @@ function GridWrapper({ onResize={onResize} onResizeStop={onResizeStop} onDragStop={onDragStop} - onLayoutChange={onLayoutChange}> + onLayoutChange={onLayoutChange} + > {children} ); @@ -178,7 +179,7 @@ export class DashboardGrid extends React.Component { panelElements.push(
-
, + ); } @@ -196,7 +197,8 @@ export class DashboardGrid extends React.Component { onWidthChange={this.onWidthChange} onDragStop={this.onDragStop} onResize={this.onResize} - onResizeStop={this.onResizeStop}> + onResizeStop={this.onResizeStop} + > {this.renderPanels()} ); diff --git a/public/sass/components/_dashboard_grid.scss b/public/sass/components/_dashboard_grid.scss index 0a27df75164..dd81a210409 100644 --- a/public/sass/components/_dashboard_grid.scss +++ b/public/sass/components/_dashboard_grid.scss @@ -1,4 +1,4 @@ -@import '~react-grid-layout/css/styles.css'; +@import '~react-grid-layout-grafana/css/styles.css'; @import '~react-resizable/css/styles.css'; .panel-in-fullscreen { diff --git a/yarn.lock b/yarn.lock index 692eb83ea96..2de60f03c27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8275,16 +8275,23 @@ react-dom@^16.2.0: object-assign "^4.1.1" prop-types "^15.6.0" -"react-draggable@^2.2.6 || ^3.0.3", react-draggable@^3.0.3: +"react-draggable@^2.2.6 || ^3.0.3": version "3.0.3" resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-3.0.3.tgz#a6f9b3a7171981b76dadecf238316925cb9eacf4" dependencies: classnames "^2.2.5" prop-types "^15.5.10" -react-grid-layout@^0.16.2: - version "0.16.2" - resolved "https://registry.yarnpkg.com/react-grid-layout/-/react-grid-layout-0.16.2.tgz#ef09b0b6db4a9635799663658277ee2d26fa2994" +react-draggable@^3.0.3: + version "3.0.5" + resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-3.0.5.tgz#c031e0ed4313531f9409d6cd84c8ebcec0ddfe2d" + dependencies: + classnames "^2.2.5" + prop-types "^15.6.0" + +react-grid-layout-grafana@0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/react-grid-layout-grafana/-/react-grid-layout-grafana-0.16.0.tgz#12242153fcd0bb80a26af8e41694bc2fde788b3a" dependencies: classnames "2.x" lodash.isequal "^4.0.0"