@@ -15,6 +15,7 @@ import { createErrorNotification } from 'app/core/copy/appNotification';
15
15
import { getKioskMode } from 'app/core/navigation/kiosk' ;
16
16
import { GrafanaRouteComponentProps } from 'app/core/navigation/types' ;
17
17
import { ID_PREFIX } from 'app/core/reducers/navBarTree' ;
18
+ import { FnGlobalState } from 'app/core/reducers/fn-slice' ;
18
19
import { getNavModel } from 'app/core/selectors/navModel' ;
19
20
import { PanelModel } from 'app/features/dashboard/state' ;
20
21
import { dashboardWatcher } from 'app/features/live/dashboard/dashboardWatcher' ;
@@ -50,7 +51,10 @@ import 'react-grid-layout/css/styles.css';
50
51
import 'react-resizable/css/styles.css' ;
51
52
52
53
export type MapStateToDashboardPageProps = MapStateToProps <
53
- Pick < DashboardState , 'initPhase' | 'initError' > & { dashboard : ReturnType < DashboardState [ 'getModel' ] > } ,
54
+ Pick < DashboardState , 'initPhase' | 'initError' > & { dashboard : ReturnType < DashboardState [ 'getModel' ] > } & Pick <
55
+ FnGlobalState ,
56
+ 'FNDashboard'
57
+ > ,
54
58
OwnProps ,
55
59
StoreState
56
60
> ;
@@ -70,6 +74,7 @@ export const mapStateToProps: MapStateToDashboardPageProps = (state) => ({
70
74
initError : state . dashboard . initError ,
71
75
dashboard : state . dashboard . getModel ( ) ,
72
76
navIndex : state . navIndex ,
77
+ FNDashboard : state . fnGlobalState . FNDashboard ,
73
78
} ) ;
74
79
75
80
const mapDispatchToProps : MapDispatchToDashboardPageProps = {
@@ -84,9 +89,7 @@ const connector = connect(mapStateToProps, mapDispatchToProps);
84
89
85
90
type OwnProps = {
86
91
isPublic ?: boolean ;
87
- isFNDashboard ?: boolean ;
88
92
controlsContainer ?: string | null ;
89
- hiddenVariables ?: string [ ] ;
90
93
fnLoader ?: ReactNode ;
91
94
} ;
92
95
@@ -167,9 +170,11 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
167
170
168
171
componentDidMount ( ) {
169
172
this . initDashboard ( ) ;
170
- const { isPublic, isFNDashboard } = this . props ;
171
- if ( ! isPublic && ! isFNDashboard ) {
172
- this . forceRouteReloadCounter = ( this . props . history . location . state as any ) ?. routeReloadCounter || 0 ;
173
+
174
+ const { isPublic, FNDashboard } = this . props ;
175
+
176
+ if ( ! isPublic && ! FNDashboard ) {
177
+ this . forceRouteReloadCounter = ( this . props . history . location ?. state as any ) ?. routeReloadCounter || 0 ;
173
178
}
174
179
}
175
180
@@ -183,7 +188,7 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
183
188
}
184
189
185
190
initDashboard ( ) {
186
- const { dashboard, isPublic, match, queryParams, isFNDashboard } = this . props ;
191
+ const { dashboard, isPublic, match, queryParams, FNDashboard } = this . props ;
187
192
188
193
if ( dashboard ) {
189
194
this . closeDashboard ( ) ;
@@ -196,7 +201,7 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
196
201
urlFolderUid : queryParams . folderUid ,
197
202
panelType : queryParams . panelType ,
198
203
routeName : this . props . route . routeName ,
199
- fixUrl : ! isPublic && ! isFNDashboard ,
204
+ fixUrl : ! isPublic && ! FNDashboard ,
200
205
accessToken : match . params . accessToken ,
201
206
keybindingSrv : this . context . keybindings ,
202
207
} ) ;
@@ -206,13 +211,13 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
206
211
}
207
212
208
213
componentDidUpdate ( prevProps : Props , prevState : State ) {
209
- const { dashboard, match, templateVarsChangedInUrl, isPublic, isFNDashboard } = this . props ;
214
+ const { dashboard, match, templateVarsChangedInUrl, isPublic, FNDashboard } = this . props ;
210
215
211
216
if ( ! dashboard ) {
212
217
return ;
213
218
}
214
219
215
- if ( ! isPublic && ! isFNDashboard ) {
220
+ if ( ! isPublic && ! FNDashboard ) {
216
221
const routeReloadCounter = ( this . props . history . location ?. state as any ) ?. routeReloadCounter ;
217
222
218
223
if (
@@ -391,11 +396,11 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
391
396
} ;
392
397
393
398
render ( ) {
394
- const { dashboard, initError, queryParams, isPublic, isFNDashboard , fnLoader } = this . props ;
399
+ const { dashboard, initError, queryParams, isPublic, FNDashboard , fnLoader } = this . props ;
395
400
const { editPanel, viewPanel, updateScrollTop, pageNav, sectionNav } = this . state ;
396
- const kioskMode = isFNDashboard ? KioskMode . FN : ! isPublic ? getKioskMode ( this . props . queryParams ) : KioskMode . Full ;
401
+ const kioskMode = FNDashboard ? KioskMode . FN : ! isPublic ? getKioskMode ( this . props . queryParams ) : KioskMode . Full ;
397
402
398
- if ( ! dashboard ) {
403
+ if ( ! dashboard ) {
399
404
return fnLoader ? < > { fnLoader } </ > : < DashboardLoading initPhase = { this . props . initPhase } /> ;
400
405
}
401
406
@@ -406,7 +411,7 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
406
411
< header data-testid = { selectors . pages . Dashboard . DashNav . navV2 } >
407
412
< DashNav
408
413
dashboard = { dashboard }
409
- title = { ! isFNDashboard ? dashboard . title : '' }
414
+ title = { ! FNDashboard ? dashboard . title : '' }
410
415
folderTitle = { dashboard . meta . folderTitle }
411
416
isFullscreen = { ! ! viewPanel }
412
417
onAddPanel = { this . onAddPanel }
@@ -490,17 +495,12 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
490
495
className = { pageClassName }
491
496
onSetScrollRef = { this . setScrollRef }
492
497
>
493
- { ! isFNDashboard && < DashboardPrompt dashboard = { dashboard } /> }
498
+ { ! FNDashboard && < DashboardPrompt dashboard = { dashboard } /> }
494
499
495
500
{ initError && < DashboardFailed /> }
496
501
{ showSubMenu && (
497
502
< section aria-label = { selectors . pages . Dashboard . SubMenu . submenu } >
498
- < SubMenu
499
- dashboard = { dashboard }
500
- annotations = { dashboard . annotations . list }
501
- links = { dashboard . links }
502
- hiddenVariables = { this . props . hiddenVariables }
503
- />
503
+ < SubMenu dashboard = { dashboard } annotations = { dashboard . annotations . list } links = { dashboard . links } />
504
504
</ section >
505
505
) }
506
506
{ config . featureToggles . angularDeprecationUI && dashboard . hasAngularPlugins ( ) && dashboard . uid !== null && (
@@ -548,9 +548,9 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
548
548
}
549
549
550
550
function updateStatePageNavFromProps ( props : Props , state : State ) : State {
551
- const { dashboard, isFNDashboard } = props ;
551
+ const { dashboard, FNDashboard } = props ;
552
552
553
- if ( ! dashboard || isFNDashboard ) {
553
+ if ( ! dashboard || FNDashboard ) {
554
554
return state ;
555
555
}
556
556
0 commit comments