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

pull/37937/head
Ashley Harrison 4 years ago committed by GitHub
parent 89572926c3
commit 344c43f2e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
  2. 3
      public/app/features/dashboard/components/PanelEditor/utils.ts
  3. 1
      public/app/features/dashboard/dashgrid/PanelChrome.tsx
  4. 1
      public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx

@ -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>

@ -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 };
}

@ -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,

@ -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,

Loading…
Cancel
Save