@@ -12,6 +12,7 @@ import { GrafanaContext, GrafanaContextType } from 'app/core/context/GrafanaCont
12
12
import { createErrorNotification } from 'app/core/copy/appNotification' ;
13
13
import { getKioskMode } from 'app/core/navigation/kiosk' ;
14
14
import { GrafanaRouteComponentProps } from 'app/core/navigation/types' ;
15
+ import { FnGlobalState } from 'app/core/reducers/fn-slice' ;
15
16
import { getNavModel } from 'app/core/selectors/navModel' ;
16
17
import { PanelModel } from 'app/features/dashboard/state' ;
17
18
import { dashboardWatcher } from 'app/features/live/dashboard/dashboardWatcher' ;
@@ -60,7 +61,10 @@ export type DashboardPageRouteSearchParams = {
60
61
} ;
61
62
62
63
export type MapStateToDashboardPageProps = MapStateToProps <
63
- Pick < DashboardState , 'initPhase' | 'initError' > & { dashboard : ReturnType < DashboardState [ 'getModel' ] > } ,
64
+ Pick < DashboardState , 'initPhase' | 'initError' > & { dashboard : ReturnType < DashboardState [ 'getModel' ] > } & Pick <
65
+ FnGlobalState ,
66
+ 'FNDashboard'
67
+ > ,
64
68
OwnProps ,
65
69
StoreState
66
70
> ;
@@ -80,6 +84,7 @@ export const mapStateToProps: MapStateToDashboardPageProps = (state) => ({
80
84
initError : state . dashboard . initError ,
81
85
dashboard : state . dashboard . getModel ( ) ,
82
86
navIndex : state . navIndex ,
87
+ FNDashboard : state . fnGlobalState . FNDashboard ,
83
88
} ) ;
84
89
85
90
const mapDispatchToProps : MapDispatchToDashboardPageProps = {
@@ -94,9 +99,7 @@ const connector = connect(mapStateToProps, mapDispatchToProps);
94
99
95
100
type OwnProps = {
96
101
isPublic ?: boolean ;
97
- isFNDashboard ?: boolean ;
98
102
controlsContainer ?: string | null ;
99
- hiddenVariables ?: string [ ] ;
100
103
fnLoader ?: ReactNode ;
101
104
} ;
102
105
@@ -141,9 +144,11 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
141
144
142
145
componentDidMount ( ) {
143
146
this . initDashboard ( ) ;
144
- const { isPublic, isFNDashboard } = this . props ;
145
- if ( ! isPublic && ! isFNDashboard ) {
146
- this . forceRouteReloadCounter = ( this . props . history . location . state as any ) ?. routeReloadCounter || 0 ;
147
+
148
+ const { isPublic, FNDashboard } = this . props ;
149
+
150
+ if ( ! isPublic && ! FNDashboard ) {
151
+ this . forceRouteReloadCounter = ( this . props . history . location ?. state as any ) ?. routeReloadCounter || 0 ;
147
152
}
148
153
}
149
154
@@ -157,7 +162,7 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
157
162
}
158
163
159
164
initDashboard ( ) {
160
- const { dashboard, isPublic, match, queryParams, isFNDashboard } = this . props ;
165
+ const { dashboard, isPublic, match, queryParams, FNDashboard } = this . props ;
161
166
162
167
if ( dashboard ) {
163
168
this . closeDashboard ( ) ;
@@ -170,7 +175,7 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
170
175
urlFolderId : queryParams . folderId ,
171
176
panelType : queryParams . panelType ,
172
177
routeName : this . props . route . routeName ,
173
- fixUrl : ! isPublic && ! isFNDashboard ,
178
+ fixUrl : ! isPublic && ! FNDashboard ,
174
179
accessToken : match . params . accessToken ,
175
180
keybindingSrv : this . context . keybindings ,
176
181
} ) ;
@@ -180,13 +185,13 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
180
185
}
181
186
182
187
componentDidUpdate ( prevProps : Props , prevState : State ) {
183
- const { dashboard, match, templateVarsChangedInUrl, isPublic, isFNDashboard } = this . props ;
188
+ const { dashboard, match, templateVarsChangedInUrl, isPublic, FNDashboard } = this . props ;
184
189
185
190
if ( ! dashboard ) {
186
191
return ;
187
192
}
188
193
189
- if ( ! isPublic && ! isFNDashboard ) {
194
+ if ( ! isPublic && ! FNDashboard ) {
190
195
const routeReloadCounter = ( this . props . history . location ?. state as any ) ?. routeReloadCounter ;
191
196
192
197
if (
@@ -372,11 +377,11 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
372
377
}
373
378
374
379
render ( ) {
375
- const { dashboard, initError, queryParams, isPublic, isFNDashboard , fnLoader } = this . props ;
380
+ const { dashboard, initError, queryParams, isPublic, FNDashboard , fnLoader } = this . props ;
376
381
const { editPanel, viewPanel, updateScrollTop, pageNav, sectionNav } = this . state ;
377
- const kioskMode = isFNDashboard ? KioskMode . FN : ! isPublic ? getKioskMode ( this . props . queryParams ) : KioskMode . Full ;
382
+ const kioskMode = FNDashboard ? KioskMode . FN : ! isPublic ? getKioskMode ( this . props . queryParams ) : KioskMode . Full ;
378
383
379
- if ( ! dashboard ) {
384
+ if ( ! dashboard ) {
380
385
return fnLoader ? < > { fnLoader } </ > : < DashboardLoading initPhase = { this . props . initPhase } /> ;
381
386
}
382
387
@@ -387,7 +392,7 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
387
392
< header data-testid = { selectors . pages . Dashboard . DashNav . navV2 } >
388
393
< DashNav
389
394
dashboard = { dashboard }
390
- title = { ! isFNDashboard ? dashboard . title : '' }
395
+ title = { ! FNDashboard ? dashboard . title : '' }
391
396
folderTitle = { dashboard . meta . folderTitle }
392
397
isFullscreen = { ! ! viewPanel }
393
398
onAddPanel = { this . onAddPanel }
@@ -420,17 +425,12 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
420
425
scrollRef = { this . setScrollRef }
421
426
scrollTop = { updateScrollTop }
422
427
>
423
- { ! isFNDashboard && < DashboardPrompt dashboard = { dashboard } /> }
428
+ { ! FNDashboard && < DashboardPrompt dashboard = { dashboard } /> }
424
429
425
430
{ initError && < DashboardFailed /> }
426
431
{ showSubMenu && (
427
432
< section aria-label = { selectors . pages . Dashboard . SubMenu . submenu } >
428
- < SubMenu
429
- dashboard = { dashboard }
430
- annotations = { dashboard . annotations . list }
431
- links = { dashboard . links }
432
- hiddenVariables = { this . props . hiddenVariables }
433
- />
433
+ < SubMenu dashboard = { dashboard } annotations = { dashboard . annotations . list } links = { dashboard . links } />
434
434
</ section >
435
435
) }
436
436
@@ -465,9 +465,9 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
465
465
}
466
466
467
467
function updateStatePageNavFromProps ( props : Props , state : State ) : State {
468
- const { dashboard, isFNDashboard } = props ;
468
+ const { dashboard, FNDashboard } = props ;
469
469
470
- if ( ! dashboard || isFNDashboard ) {
470
+ if ( ! dashboard || FNDashboard ) {
471
471
return state ;
472
472
}
473
473
0 commit comments