Skip to content

Commit f55cba1

Browse files
author
Jovert Lota Palonpon
committed
Added link to telescope
1 parent 95be53d commit f55cba1

File tree

5 files changed

+57
-5
lines changed

5 files changed

+57
-5
lines changed

resources/js/App.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,27 @@ class App extends Component {
1717
user: {},
1818
username: '',
1919

20-
errorResponse: {},
21-
successfulResponse: {},
20+
monitoringEnabled: false,
2221
responseInterceptor: null,
2322
};
2423

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+
2541
/**
2642
* Remove the response interceptor.
2743
*
@@ -101,7 +117,9 @@ class App extends Component {
101117
user: {},
102118
});
103119
}
104-
} catch (error) {}
120+
} catch (error) {
121+
//
122+
}
105123
};
106124

107125
/**
@@ -230,10 +248,15 @@ class App extends Component {
230248
});
231249

232250
return response.data;
233-
} catch (error) {}
251+
} catch (error) {
252+
//
253+
}
234254
};
235255

236256
async componentDidMount() {
257+
// Toggle monitoring.
258+
this.monitoringEnabled();
259+
237260
// Listen for all API responses.
238261
this.addResponseInterceptor();
239262

resources/js/views/__backoffice/partials/Header.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
Menu as MenuIcon,
3636
Notifications as NotificationsIcon,
3737
Settings as SettingsIcon,
38+
Update as UpdateIcon,
3839
} from '@material-ui/icons';
3940

4041
import * as RandomUtils from '../../../utils/Random';
@@ -231,7 +232,12 @@ const Header = props => {
231232
accountMenuOpen,
232233
} = props;
233234

234-
const { user, nightMode, handleNightmodeToggled } = pageProps;
235+
const {
236+
user,
237+
monitoringEnabled,
238+
nightMode,
239+
handleNightmodeToggled,
240+
} = pageProps;
235241

236242
const skeletonProps = {
237243
color: colors.grey[400],
@@ -432,6 +438,23 @@ const Header = props => {
432438
</Typography>
433439
</Grid>
434440

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+
435458
<Grid item>
436459
<Tooltip
437460
title={Lang.get('navigation.notifications')}

resources/lang/en/navigation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'send_link' => 'Send Link',
2727
'reset' => 'Reset',
2828

29+
'monitoring' => 'Monitoring',
30+
2931
'notifications' => 'Notifications',
3032

3133
'locale' => 'Locale',

resources/lang/fil/navigation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'send_link' => 'I-send ang Link',
2727
'reset' => 'I-reset',
2828

29+
'monitoring' => 'Pagsubaybay',
30+
2931
'notifications' => 'Mga Abiso',
3032

3133
'locale' => 'Lokal',

resources/views/__backoffice/welcome.blade.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<meta name="sw-filepath" content="/service-worker.js">
2020
@endif
2121

22+
<meta name="TELESCOPE_ENABLED" content="{{ config('telescope.enabled') }}">
23+
2224
<!-- Title -->
2325
<title>{{ config('app.name') }}</title>
2426

0 commit comments

Comments
 (0)