1
1
import classNames from 'classnames' ;
2
2
import React , { PureComponent , CSSProperties } from 'react' ;
3
3
import ReactGridLayout , { ItemCallback } from 'react-grid-layout' ;
4
+ import { connect } from 'react-redux' ;
4
5
import AutoSizer from 'react-virtualized-auto-sizer' ;
5
6
import { Subscription } from 'rxjs' ;
6
7
7
8
import { config } from '@grafana/runtime' ;
8
9
import { GRID_CELL_HEIGHT , GRID_CELL_VMARGIN , GRID_COLUMN_COUNT } from 'app/core/constants' ;
9
10
import { contextSrv } from 'app/core/services/context_srv' ;
11
+ import { StoreState } from 'app/types' ;
10
12
import { DashboardPanelsChangedEvent } from 'app/types/events' ;
11
13
12
14
import { AddLibraryPanelWidget } from '../components/AddLibraryPanelWidget' ;
@@ -24,8 +26,10 @@ export interface Props {
24
26
editPanel : PanelModel | null ;
25
27
viewPanel : PanelModel | null ;
26
28
hidePanelMenus ?: boolean ;
29
+ isFnDashboard ?: boolean ;
27
30
}
28
- export class DashboardGrid extends PureComponent < Props > {
31
+
32
+ export class Component extends PureComponent < Props > {
29
33
private panelMap : { [ key : string ] : PanelModel } = { } ;
30
34
private eventSubs = new Subscription ( ) ;
31
35
private windowHeight = 1200 ;
@@ -216,7 +220,7 @@ export class DashboardGrid extends PureComponent<Props> {
216
220
} ;
217
221
218
222
render ( ) {
219
- const { isEditable, dashboard } = this . props ;
223
+ const { isEditable, dashboard, isFnDashboard } = this . props ;
220
224
221
225
if ( config . featureToggles . emptyDashboardPage && dashboard . panels . length === 0 ) {
222
226
return < DashboardEmpty dashboard = { dashboard } canCreate = { isEditable } /> ;
@@ -249,7 +253,7 @@ export class DashboardGrid extends PureComponent<Props> {
249
253
< ReactGridLayout
250
254
width = { width }
251
255
isDraggable = { draggable }
252
- isResizable = { isEditable }
256
+ isResizable = { isFnDashboard ? true : isEditable }
253
257
containerPadding = { [ 0 , 0 ] }
254
258
useCSSTransforms = { true }
255
259
margin = { [ GRID_CELL_VMARGIN , GRID_CELL_VMARGIN ] }
@@ -336,3 +340,11 @@ function translateGridHeightToScreenHeight(gridHeight: number): number {
336
340
}
337
341
338
342
GrafanaGridItem . displayName = 'GridItemWithDimensions' ;
343
+
344
+ function mapStateToProps ( ) {
345
+ return ( state : StoreState ) => ( {
346
+ isFnDashboard : state . fnGlobalState . FNDashboard ,
347
+ } ) ;
348
+ }
349
+
350
+ export const DashboardGrid = connect ( mapStateToProps ) ( Component ) ;
0 commit comments