mirror of https://github.com/grafana/grafana.git
				
				
				
			PanelEdit: Fix 'Actual' size by passing the correct panel size to DashboardPanel (#37885)
This commit is contained in:
		
							parent
							
								
									89572926c3
								
							
						
					
					
						commit
						344c43f2e8
					
				|  | @ -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…
	
		Reference in New Issue