File tree Expand file tree Collapse file tree 5 files changed +57
-5
lines changed
views/__backoffice/partials Expand file tree Collapse file tree 5 files changed +57
-5
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,27 @@ class App extends Component {
17
17
user : { } ,
18
18
username : '' ,
19
19
20
- errorResponse : { } ,
21
- successfulResponse : { } ,
20
+ monitoringEnabled : false ,
22
21
responseInterceptor : null ,
23
22
} ;
24
23
24
+ /**
25
+ * Determine if monitoring is enabled.
26
+ *
27
+ * @return {undefined }
28
+ */
29
+ monitoringEnabled = ( ) => {
30
+ const configItem = document . querySelector (
31
+ 'meta[name=TELESCOPE_ENABLED]' ,
32
+ ) ;
33
+
34
+ if ( configItem ) {
35
+ this . setState ( {
36
+ monitoringEnabled : Boolean ( configItem . content ) ,
37
+ } ) ;
38
+ }
39
+ } ;
40
+
25
41
/**
26
42
* Remove the response interceptor.
27
43
*
@@ -101,7 +117,9 @@ class App extends Component {
101
117
user : { } ,
102
118
} ) ;
103
119
}
104
- } catch ( error ) { }
120
+ } catch ( error ) {
121
+ //
122
+ }
105
123
} ;
106
124
107
125
/**
@@ -230,10 +248,15 @@ class App extends Component {
230
248
} ) ;
231
249
232
250
return response . data ;
233
- } catch ( error ) { }
251
+ } catch ( error ) {
252
+ //
253
+ }
234
254
} ;
235
255
236
256
async componentDidMount ( ) {
257
+ // Toggle monitoring.
258
+ this . monitoringEnabled ( ) ;
259
+
237
260
// Listen for all API responses.
238
261
this . addResponseInterceptor ( ) ;
239
262
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import {
35
35
Menu as MenuIcon ,
36
36
Notifications as NotificationsIcon ,
37
37
Settings as SettingsIcon ,
38
+ Update as UpdateIcon ,
38
39
} from '@material-ui/icons' ;
39
40
40
41
import * as RandomUtils from '../../../utils/Random' ;
@@ -231,7 +232,12 @@ const Header = props => {
231
232
accountMenuOpen,
232
233
} = props ;
233
234
234
- const { user, nightMode, handleNightmodeToggled } = pageProps ;
235
+ const {
236
+ user,
237
+ monitoringEnabled,
238
+ nightMode,
239
+ handleNightmodeToggled,
240
+ } = pageProps ;
235
241
236
242
const skeletonProps = {
237
243
color : colors . grey [ 400 ] ,
@@ -432,6 +438,23 @@ const Header = props => {
432
438
</ Typography >
433
439
</ Grid >
434
440
441
+ { monitoringEnabled && (
442
+ < Grid item >
443
+ < Tooltip
444
+ title = { Lang . get ( 'navigation.monitoring' ) }
445
+ >
446
+ < IconButton
447
+ href = "/telescope"
448
+ target = "_blank"
449
+ rel = "noreferrer"
450
+ color = "inherit"
451
+ >
452
+ < UpdateIcon />
453
+ </ IconButton >
454
+ </ Tooltip >
455
+ </ Grid >
456
+ ) }
457
+
435
458
< Grid item >
436
459
< Tooltip
437
460
title = { Lang . get ( 'navigation.notifications' ) }
Original file line number Diff line number Diff line change 26
26
'send_link ' => 'Send Link ' ,
27
27
'reset ' => 'Reset ' ,
28
28
29
+ 'monitoring ' => 'Monitoring ' ,
30
+
29
31
'notifications ' => 'Notifications ' ,
30
32
31
33
'locale ' => 'Locale ' ,
Original file line number Diff line number Diff line change 26
26
'send_link ' => 'I-send ang Link ' ,
27
27
'reset ' => 'I-reset ' ,
28
28
29
+ 'monitoring ' => 'Pagsubaybay ' ,
30
+
29
31
'notifications ' => 'Mga Abiso ' ,
30
32
31
33
'locale ' => 'Lokal ' ,
Original file line number Diff line number Diff line change 19
19
<meta name =" sw-filepath" content =" /service-worker.js" >
20
20
@endif
21
21
22
+ <meta name =" TELESCOPE_ENABLED" content =" {{ config (' telescope.enabled' ) } }" >
23
+
22
24
<!-- Title -->
23
25
<title >{{ config (' app.name' ) } } </title >
24
26
You can’t perform that action at this time.
0 commit comments