summaryrefslogtreecommitdiffstats
path: root/web/react/components/navbar_dropdown.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components/navbar_dropdown.jsx')
-rw-r--r--web/react/components/navbar_dropdown.jsx80
1 files changed, 51 insertions, 29 deletions
diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx
index 99cdfa1ad..4c01d2c43 100644
--- a/web/react/components/navbar_dropdown.jsx
+++ b/web/react/components/navbar_dropdown.jsx
@@ -7,7 +7,6 @@ var UserStore = require('../stores/user_store.jsx');
var TeamStore = require('../stores/team_store.jsx');
var Constants = require('../utils/constants.jsx');
-import {config} from '../utils/config.js';
function getStateFromStores() {
return {teams: UserStore.getTeams(), currentTeam: TeamStore.getCurrent()};
@@ -31,12 +30,12 @@ export default class NavbarDropdown extends React.Component {
UserStore.addTeamsChangeListener(this.onListenerChange);
TeamStore.addChangeListener(this.onListenerChange);
- $(React.findDOMNode(this.refs.dropdown)).on('hide.bs.dropdown', function resetDropdown() {
+ $(React.findDOMNode(this.refs.dropdown)).on('hide.bs.dropdown', () => {
this.blockToggle = true;
- setTimeout(function blockTimeout() {
+ setTimeout(() => {
this.blockToggle = false;
- }.bind(this), 100);
- }.bind(this));
+ }, 100);
+ });
}
componentWillUnmount() {
UserStore.removeTeamsChangeListener(this.onListenerChange);
@@ -54,12 +53,16 @@ export default class NavbarDropdown extends React.Component {
var teamLink = '';
var inviteLink = '';
var manageLink = '';
+ var sysAdminLink = '';
+ var adminDivider = '';
var currentUser = UserStore.getCurrentUser();
var isAdmin = false;
+ var isSystemAdmin = false;
var teamSettings = null;
if (currentUser != null) {
- isAdmin = currentUser.roles.indexOf('admin') > -1;
+ isAdmin = Utils.isAdmin(currentUser.roles);
+ isSystemAdmin = Utils.isInRole(currentUser.roles, 'system_admin');
inviteLink = (
<li>
@@ -68,7 +71,7 @@ export default class NavbarDropdown extends React.Component {
data-toggle='modal'
data-target='#invite_member'
>
- Invite New Member
+ {'Invite New Member'}
</a>
</li>
);
@@ -83,7 +86,7 @@ export default class NavbarDropdown extends React.Component {
data-title='Team Invite'
data-value={Utils.getWindowLocationOrigin() + '/signup_user_complete/?id=' + currentUser.team_id}
>
- Get Team Invite Link
+ {'Get Team Invite Link'}
</a>
</li>
);
@@ -98,19 +101,36 @@ export default class NavbarDropdown extends React.Component {
data-toggle='modal'
data-target='#team_members'
>
- Manage Team
+ {'Manage Team'}
+ </a>
+ </li>
+ );
+
+ adminDivider = (<li className='divider'></li>);
+
+ teamSettings = (
+ <li>
+ <a
+ href='#'
+ data-toggle='modal'
+ data-target='#team_settings'
+ >
+ {'Team Settings'}
+ </a>
+ </li>
+ );
+ }
+
+ if (isSystemAdmin) {
+ sysAdminLink = (
+ <li>
+ <a
+ href='/admin_console'
+ >
+ {'System Console'}
</a>
</li>
);
- teamSettings = (<li>
- <a
- href='#'
- data-toggle='modal'
- data-target='#team_settings'
- >
- Team Settings
- </a>
- </li>);
}
var teams = [];
@@ -124,9 +144,9 @@ export default class NavbarDropdown extends React.Component {
);
if (this.state.teams.length > 1 && this.state.currentTeam) {
var curTeamName = this.state.currentTeam.name;
- this.state.teams.forEach(function listTeams(teamName) {
+ this.state.teams.forEach((teamName) => {
if (teamName !== curTeamName) {
- teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>Switch to {teamName}</a></li>);
+ teams.push(<li key={teamName}><a href={Utils.getWindowLocationOrigin() + '/' + teamName}>{'Switch to ' + teamName}</a></li>);
}
});
}
@@ -136,7 +156,7 @@ export default class NavbarDropdown extends React.Component {
target='_blank'
href={Utils.getWindowLocationOrigin() + '/signup_team'}
>
- Create a New Team
+ {'Create a New Team'}
</a>
</li>);
@@ -168,37 +188,39 @@ export default class NavbarDropdown extends React.Component {
data-toggle='modal'
data-target='#user_settings'
>
- Account Settings
+ {'Account Settings'}
</a>
</li>
- {teamSettings}
{inviteLink}
{teamLink}
- {manageLink}
<li>
<a
href='#'
onClick={this.handleLogoutClick}
>
- Logout
+ {'Logout'}
</a>
</li>
+ {adminDivider}
+ {teamSettings}
+ {manageLink}
+ {sysAdminLink}
{teams}
<li className='divider'></li>
<li>
<a
target='_blank'
- href={config.HelpLink}
+ href='/static/help/help.html'
>
- Help
+ {'Help'}
</a>
</li>
<li>
<a
target='_blank'
- href={config.ReportProblemLink}
+ href='/static/help/report_problem.html'
>
- Report a Problem
+ {'Report a Problem'}
</a>
</li>
</ul>