mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard: Making a dashboard editable does not allow resizing of panels (#59255)
* DashboardGrid should rerender ReactGridLayout when mutable dashboard updates * add missing prop to test
This commit is contained in:
@@ -17,6 +17,7 @@ import { DashboardPanel } from './DashboardPanel';
|
||||
|
||||
export interface Props {
|
||||
dashboard: DashboardModel;
|
||||
isEditable: boolean;
|
||||
editPanel: PanelModel | null;
|
||||
viewPanel: PanelModel | null;
|
||||
}
|
||||
@@ -200,7 +201,7 @@ export class DashboardGrid extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { dashboard } = this.props;
|
||||
const { isEditable } = this.props;
|
||||
|
||||
/**
|
||||
* We have a parent with "flex: 1 1 0" we need to reset it to "flex: 1 1 auto" to have the AutoSizer
|
||||
@@ -215,14 +216,13 @@ export class DashboardGrid extends PureComponent<Props, State> {
|
||||
return null;
|
||||
}
|
||||
|
||||
const draggable = width <= 769 ? false : dashboard.meta.canEdit;
|
||||
const draggable = width <= 769 ? false : isEditable;
|
||||
|
||||
/*
|
||||
Disable draggable if mobile device, solving an issue with unintentionally
|
||||
moving panels. https://github.com/grafana/grafana/issues/18497
|
||||
theme.breakpoints.md = 769
|
||||
*/
|
||||
|
||||
return (
|
||||
/**
|
||||
* The children is using a width of 100% so we need to guarantee that it is wrapped
|
||||
@@ -233,7 +233,7 @@ export class DashboardGrid extends PureComponent<Props, State> {
|
||||
<ReactGridLayout
|
||||
width={width}
|
||||
isDraggable={draggable}
|
||||
isResizable={dashboard.meta.canEdit}
|
||||
isResizable={isEditable}
|
||||
containerPadding={[0, 0]}
|
||||
useCSSTransforms={false}
|
||||
margin={[GRID_CELL_VMARGIN, GRID_CELL_VMARGIN]}
|
||||
|
||||
Reference in New Issue
Block a user