mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #14705 from grafana/panel-size-fixes
Fixed issues with panel size in edit mode, fixes #14703
This commit is contained in:
commit
24ee10ca01
public
app/features
sass/components
@ -160,14 +160,14 @@ export class DashboardPanel extends PureComponent<Props, State> {
|
||||
return (
|
||||
<div className={containerClass}>
|
||||
<PanelResizer
|
||||
isEditing={!!isEditing}
|
||||
isEditing={isEditing}
|
||||
panel={panel}
|
||||
render={(panelHeight: number | 'inherit') => (
|
||||
render={styles => (
|
||||
<div
|
||||
className={panelWrapperClass}
|
||||
onMouseEnter={this.onMouseEnter}
|
||||
onMouseLeave={this.onMouseLeave}
|
||||
style={{ height: panelHeight }}
|
||||
style={styles}
|
||||
>
|
||||
{plugin.exports.Panel && this.renderReactPanel()}
|
||||
{plugin.exports.PanelCtrl && this.renderAngularPanel()}
|
||||
|
@ -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<Props, State> {
|
||||
prevEditorHeight: number;
|
||||
throttledChangeHeight: (height: number) => void;
|
||||
throttledResizeDone: () => void;
|
||||
noStyles: object = {};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -65,7 +66,7 @@ export class PanelResizer extends PureComponent<Props, State> {
|
||||
|
||||
return (
|
||||
<>
|
||||
{render(isEditing ? editorHeight : 'inherit')}
|
||||
{render(isEditing ? {height: editorHeight} : this.noStyles)}
|
||||
{isEditing && (
|
||||
<div className="panel-editor-container__resizer">
|
||||
<Draggable axis="y" grid={[100, 1]} onDrag={this.onDrag} position={{ x: 0, y: 0 }}>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
&--view {
|
||||
flex: 1 1 0;
|
||||
height: 80%;
|
||||
height: 90%;
|
||||
margin: 0 $dashboard-padding;
|
||||
padding-top: $dashboard-padding;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user