Skip to content

Commit

Permalink
Added link to telescope
Browse files Browse the repository at this point in the history
  • Loading branch information
Jovert Lota Palonpon committed Apr 13, 2019
1 parent 95be53d commit f55cba1
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 5 deletions.
31 changes: 27 additions & 4 deletions resources/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,27 @@ class App extends Component {
user: {},
username: '',

errorResponse: {},
successfulResponse: {},
monitoringEnabled: false,
responseInterceptor: null,
};

/**
* Determine if monitoring is enabled.
*
* @return {undefined}
*/
monitoringEnabled = () => {
const configItem = document.querySelector(
'meta[name=TELESCOPE_ENABLED]',
);

if (configItem) {
this.setState({
monitoringEnabled: Boolean(configItem.content),
});
}
};

/**
* Remove the response interceptor.
*
Expand Down Expand Up @@ -101,7 +117,9 @@ class App extends Component {
user: {},
});
}
} catch (error) {}
} catch (error) {
//
}
};

/**
Expand Down Expand Up @@ -230,10 +248,15 @@ class App extends Component {
});

return response.data;
} catch (error) {}
} catch (error) {
//
}
};

async componentDidMount() {
// Toggle monitoring.
this.monitoringEnabled();

// Listen for all API responses.
this.addResponseInterceptor();

Expand Down
25 changes: 24 additions & 1 deletion resources/js/views/__backoffice/partials/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
Menu as MenuIcon,
Notifications as NotificationsIcon,
Settings as SettingsIcon,
Update as UpdateIcon,
} from '@material-ui/icons';

import * as RandomUtils from '../../../utils/Random';
Expand Down Expand Up @@ -231,7 +232,12 @@ const Header = props => {
accountMenuOpen,
} = props;

const { user, nightMode, handleNightmodeToggled } = pageProps;
const {
user,
monitoringEnabled,
nightMode,
handleNightmodeToggled,
} = pageProps;

const skeletonProps = {
color: colors.grey[400],
Expand Down Expand Up @@ -432,6 +438,23 @@ const Header = props => {
</Typography>
</Grid>

{monitoringEnabled && (
<Grid item>
<Tooltip
title={Lang.get('navigation.monitoring')}
>
<IconButton
href="/telescope"
target="_blank"
rel="noreferrer"
color="inherit"
>
<UpdateIcon />
</IconButton>
</Tooltip>
</Grid>
)}

<Grid item>
<Tooltip
title={Lang.get('navigation.notifications')}
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
'send_link' => 'Send Link',
'reset' => 'Reset',

'monitoring' => 'Monitoring',

'notifications' => 'Notifications',

'locale' => 'Locale',
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/fil/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
'send_link' => 'I-send ang Link',
'reset' => 'I-reset',

'monitoring' => 'Pagsubaybay',

'notifications' => 'Mga Abiso',

'locale' => 'Lokal',
Expand Down
2 changes: 2 additions & 0 deletions resources/views/__backoffice/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<meta name="sw-filepath" content="/service-worker.js">
@endif

<meta name="TELESCOPE_ENABLED" content="{{ config('telescope.enabled') }}">

<!-- Title -->
<title>{{ config('app.name') }}</title>

Expand Down

0 comments on commit f55cba1

Please sign in to comment.