From 9aef3f4fb1ec5cc3a33f29cab746784ee03b9eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 2 Jan 2019 10:54:57 +0100 Subject: [PATCH] Fixed issues with panel size in edit mode, fixes #14703 --- .../app/features/dashboard/dashgrid/DashboardPanel.tsx | 6 +++--- public/app/features/dashboard/dashgrid/PanelResizer.tsx | 7 ++++--- public/app/features/panel/panel_ctrl.ts | 9 ++++----- public/sass/components/_panel_editor.scss | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx index 481dd2d5e19..9de298e0799 100644 --- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx @@ -160,14 +160,14 @@ export class DashboardPanel extends PureComponent { return (
( + render={styles => (
{plugin.exports.Panel && this.renderReactPanel()} {plugin.exports.PanelCtrl && this.renderAngularPanel()} diff --git a/public/app/features/dashboard/dashgrid/PanelResizer.tsx b/public/app/features/dashboard/dashgrid/PanelResizer.tsx index 7d52076b54b..2a4bf8379a6 100644 --- a/public/app/features/dashboard/dashgrid/PanelResizer.tsx +++ b/public/app/features/dashboard/dashgrid/PanelResizer.tsx @@ -1,4 +1,4 @@ -import React, { PureComponent } from 'react'; +import React, { PureComponent } from 'react'; import { throttle } from 'lodash'; import Draggable from 'react-draggable'; @@ -6,7 +6,7 @@ import { PanelModel } from '../panel_model'; interface Props { isEditing: boolean; - render: (height: number | 'inherit') => JSX.Element; + render: (styles: object) => JSX.Element; panel: PanelModel; } @@ -19,6 +19,7 @@ export class PanelResizer extends PureComponent { prevEditorHeight: number; throttledChangeHeight: (height: number) => void; throttledResizeDone: () => void; + noStyles: object = {}; constructor(props) { super(props); @@ -65,7 +66,7 @@ export class PanelResizer extends PureComponent { return ( <> - {render(isEditing ? editorHeight : 'inherit')} + {render(isEditing ? {height: editorHeight} : this.noStyles)} {isEditing && (
diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 2bd43ee2a29..432d22fecdf 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -198,11 +198,10 @@ export class PanelCtrl { } calculatePanelHeight() { - if (this.panel.fullscreen) { - const docHeight = $('.react-grid-layout').height(); - const editHeight = Math.floor(docHeight * 0.35); - const fullscreenHeight = Math.floor(docHeight * 0.8); - this.containerHeight = this.panel.isEditing ? editHeight : fullscreenHeight; + if (this.panel.isEditing) { + this.containerHeight = $('.panel-wrapper--edit').height(); + } else if (this.panel.fullscreen) { + this.containerHeight = $('.panel-wrapper--view').height(); } else { this.containerHeight = this.panel.gridPos.h * GRID_CELL_HEIGHT + (this.panel.gridPos.h - 1) * GRID_CELL_VMARGIN; } diff --git a/public/sass/components/_panel_editor.scss b/public/sass/components/_panel_editor.scss index 615307c8a83..bfc1c4bb9b5 100644 --- a/public/sass/components/_panel_editor.scss +++ b/public/sass/components/_panel_editor.scss @@ -14,7 +14,7 @@ &--view { flex: 1 1 0; - height: 80%; + height: 90%; margin: 0 $dashboard-padding; padding-top: $dashboard-padding; }