1
1
import classNames from 'classnames' ;
2
2
import React from 'react' ;
3
3
import { Unsubscribable } from 'rxjs' ;
4
+ import { connect } from "react-redux"
4
5
5
6
import { selectors } from '@grafana/e2e-selectors' ;
6
7
import { getTemplateSrv , RefreshEvent } from '@grafana/runtime' ;
@@ -11,13 +12,15 @@ import { ShowConfirmModalEvent } from '../../../../types/events';
11
12
import { DashboardModel } from '../../state/DashboardModel' ;
12
13
import { PanelModel } from '../../state/PanelModel' ;
13
14
import { RowOptionsButton } from '../RowOptions/RowOptionsButton' ;
15
+ import { StoreState } from 'app/types' ;
14
16
15
17
export interface DashboardRowProps {
16
18
panel : PanelModel ;
17
19
dashboard : DashboardModel ;
20
+ isFnDashboard : boolean
18
21
}
19
22
20
- export class DashboardRow extends React . Component < DashboardRowProps > {
23
+ class Component extends React . Component < DashboardRowProps > {
21
24
sub ?: Unsubscribable ;
22
25
23
26
componentDidMount ( ) {
@@ -69,10 +72,13 @@ export class DashboardRow extends React.Component<DashboardRowProps> {
69
72
'dashboard-row--collapsed' : this . props . panel . collapsed ,
70
73
} ) ;
71
74
75
+ const { isFnDashboard} = this . props
76
+
72
77
const title = getTemplateSrv ( ) . replace ( this . props . panel . title , this . props . panel . scopedVars , 'text' ) ;
73
78
const count = this . props . panel . panels ? this . props . panel . panels . length : 0 ;
74
79
const panels = count === 1 ? 'panel' : 'panels' ;
75
- const canEdit = this . props . dashboard . meta . canEdit === true ;
80
+ const canEdit = this . props . dashboard . meta . canEdit === true && ! isFnDashboard ;
81
+
76
82
77
83
return (
78
84
< div className = { classes } data-testid = "dashboard-row-container" >
@@ -110,3 +116,13 @@ export class DashboardRow extends React.Component<DashboardRowProps> {
110
116
) ;
111
117
}
112
118
}
119
+
120
+
121
+ function mapStateToProps ( ) {
122
+ return ( state : StoreState ) => ( {
123
+ isFnDashboard : state . fnGlobalState . FNDashboard
124
+ } ) ;
125
+ }
126
+
127
+
128
+ export const DashboardRow = connect ( mapStateToProps ) ( Component ) ;
0 commit comments