From 98d96f5457fe3a238f88d6d94f3ed9c22b357637 Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 19 Dec 2016 12:47:43 -0300 Subject: PLT-5021 Order System Console Teams section by Display Name (#4831) --- webapp/components/admin_console/admin_sidebar.jsx | 29 ++++++++++++++++------ .../admin_console/admin_team_members_dropdown.jsx | 5 +++- .../components/admin_console/select_team_modal.jsx | 1 + webapp/components/team_members_dropdown.jsx | 5 +++- webapp/i18n/en.json | 4 +-- 5 files changed, 32 insertions(+), 12 deletions(-) (limited to 'webapp') diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx index 2b304f11d..e8303ea0c 100644 --- a/webapp/components/admin_console/admin_sidebar.jsx +++ b/webapp/components/admin_console/admin_sidebar.jsx @@ -114,6 +114,19 @@ export default class AdminSidebar extends React.Component { document.title = Utils.localizeMessage('sidebar_right_menu.console', 'System Console') + ' - ' + currentSiteName; } + sortTeams(a, b) { + const teamA = a.display_name.toLowerCase(); + const teamB = b.display_name.toLowerCase(); + + if (teamA < teamB) { + return -1; + } + if (teamA > teamB) { + return 1; + } + return 0; + } + renderAddTeamButton() { const addTeamTooltip = ( @@ -146,18 +159,18 @@ export default class AdminSidebar extends React.Component { renderTeams() { const teams = []; + const teamsArray = []; - for (const key in this.state.selectedTeams) { - if (!this.state.selectedTeams.hasOwnProperty(key)) { - continue; + Reflect.ownKeys(this.state.selectedTeams).forEach((key) => { + if (this.state.teams[key]) { + teamsArray.push(this.state.teams[key]); } + }); - const team = this.state.teams[key]; - - if (!team) { - continue; - } + teamsArray.sort(this.sortTeams); + for (let i = 0; i < teamsArray.length; i++) { + const team = teamsArray[i]; teams.push( {serverError} diff --git a/webapp/components/admin_console/select_team_modal.jsx b/webapp/components/admin_console/select_team_modal.jsx index a661dd2f0..e407e61b4 100644 --- a/webapp/components/admin_console/select_team_modal.jsx +++ b/webapp/components/admin_console/select_team_modal.jsx @@ -24,6 +24,7 @@ export default class SelectTeamModal extends React.Component { doCancel() { this.props.onModalDismissed(); } + compare(a, b) { const teamA = a.display_name.toLowerCase(); const teamB = b.display_name.toLowerCase(); diff --git a/webapp/components/team_members_dropdown.jsx b/webapp/components/team_members_dropdown.jsx index 1ae1b8f76..b2fae4585 100644 --- a/webapp/components/team_members_dropdown.jsx +++ b/webapp/components/team_members_dropdown.jsx @@ -326,7 +326,10 @@ export default class TeamMembersDropdown extends React.Component {
{serverError} diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index 4fa66fa66..fa8fa67b9 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -857,7 +857,7 @@ "admin.user_item.confirmDemoteDescription": "If you demote yourself from the System Admin role and there is not another user with System Admin privileges, you'll need to re-assign a System Admin by accessing the Mattermost server through a terminal and running the following command.", "admin.user_item.confirmDemoteRoleTitle": "Confirm demotion from System Admin role", "admin.user_item.confirmDemotion": "Confirm Demotion", - "admin.user_item.confirmDemotionCmd": "platform -assign_role -team_name=\"yourteam\" -email=\"name@yourcompany.com\" -role=\"system_admin\"", + "admin.user_item.confirmDemotionCmd": "platform roles system_admin {username}", "admin.user_item.emailTitle": "Email: {email}", "admin.user_item.inactive": "Inactive", "admin.user_item.makeActive": "Make Active", @@ -1839,7 +1839,7 @@ "team_members_dropdown.confirmDemoteDescription": "If you demote yourself from the System Admin role and there is not another user with System Admin privileges, you'll need to re-assign a System Admin by accessing the Mattermost server through a terminal and running the following command.", "team_members_dropdown.confirmDemoteRoleTitle": "Confirm demotion from System Admin role", "team_members_dropdown.confirmDemotion": "Confirm Demotion", - "team_members_dropdown.confirmDemotionCmd": "platform -assign_role -team_name=\"yourteam\" -email=\"name@yourcompany.com\" -role=\"system_admin\"", + "team_members_dropdown.confirmDemotionCmd": "platform roles system_admin {username}", "team_members_dropdown.inactive": "Inactive", "team_members_dropdown.leave_team": "Remove From Team", "team_members_dropdown.makeActive": "Make Active", -- cgit v1.2.3-1-g7c22