PanelEdit: Fix 'Actual' size by passing the correct panel size to DashboardPanel (#37885)

This commit is contained in:
Ashley Harrison 2021-08-16 16:01:54 +01:00 committed by GitHub
parent 89572926c3
commit 344c43f2e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View File

@ -239,17 +239,19 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
return <PanelEditorTableView width={width} height={height} panel={panel} dashboard={dashboard} />;
}
const panelSize = calculatePanelSize(uiState.mode, width, height, panel);
return (
<div className={styles.centeringContainer} style={{ width, height }}>
<div style={calculatePanelSize(uiState.mode, width, height, panel)} data-panelid={panel.editSourceId}>
<div style={panelSize} data-panelid={panel.editSourceId}>
<DashboardPanel
dashboard={dashboard}
panel={panel}
isEditing={true}
isViewing={false}
isInView={true}
width={width}
height={height}
width={panelSize.width}
height={panelSize.height}
/>
</div>
</div>

View File

@ -1,11 +1,10 @@
import { CSSProperties } from 'react';
import { omit } from 'lodash';
import { FieldConfigSource, PanelPlugin } from '@grafana/data';
import { PanelModel } from '../../state/PanelModel';
import { DisplayMode } from './types';
import { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from 'app/core/constants';
export function calculatePanelSize(mode: DisplayMode, width: number, height: number, panel: PanelModel): CSSProperties {
export function calculatePanelSize(mode: DisplayMode, width: number, height: number, panel: PanelModel) {
if (mode === DisplayMode.Fill) {
return { width, height };
}

View File

@ -428,7 +428,6 @@ export class PanelChrome extends Component<Props, State> {
const containerClassNames = classNames({
'panel-container': true,
'panel-container--absolute': true,
'panel-container--transparent': transparent,
'panel-container--no-title': this.hasOverlayHeader(),
[`panel-alert-state--${alertState}`]: alertState !== undefined,

View File

@ -192,7 +192,6 @@ export class PanelChromeAngularUnconnected extends PureComponent<Props, State> {
const containerClassNames = classNames({
'panel-container': true,
'panel-container--absolute': true,
'panel-container--transparent': transparent,
'panel-container--no-title': this.hasOverlayHeader(),
'panel-has-alert': panel.alert !== undefined,