From fd53e3b7868234af328cd73150318fc8e7a26b89 Mon Sep 17 00:00:00 2001
From: Harrison Healey <harrisonmhealey@gmail.com>
Date: Tue, 17 May 2016 07:21:39 -0400
Subject: PLT-2257 Reorganized System Console  (#3003)

* Reorganized system console

* Fixed the names of some components

* Fixed timestamp for BrandImageSetting

* Fixed merge issues

* Updated push notification settings to match master branch

* Removed top level setting pages and moved enable Gitlab/LDAP settings onto their respective pages

* Re-added restrictDirectMessage setting to system console

* Re-added email connection test and fixed some margins

* Fixed ESLint errors

* Renamed Authentication > Onboarding to Authentication > Email in the system console

* Renamed Customization > Whitelabeling to Customization > Custom Branding in System Console

* Re-added EnableOpenServer to system console
---
 webapp/components/admin_console/team_users.jsx | 41 ++++++++++++++++----------
 1 file changed, 26 insertions(+), 15 deletions(-)

(limited to 'webapp/components/admin_console/team_users.jsx')

diff --git a/webapp/components/admin_console/team_users.jsx b/webapp/components/admin_console/team_users.jsx
index 00aa1a832..89fbd0e3a 100644
--- a/webapp/components/admin_console/team_users.jsx
+++ b/webapp/components/admin_console/team_users.jsx
@@ -1,7 +1,9 @@
 // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
 // See License.txt for license information.
 
+import AdminStore from 'stores/admin_store.jsx';
 import Client from 'utils/web_client.jsx';
+import FormError from 'components/form_error.jsx';
 import LoadingScreen from '../loading_screen.jsx';
 import UserItem from './user_item.jsx';
 import ResetPasswordModal from './reset_password_modal.jsx';
@@ -11,9 +13,17 @@ import {FormattedMessage} from 'react-intl';
 import React from 'react';
 
 export default class UserList extends React.Component {
+    static get propTypes() {
+        return {
+            params: React.PropTypes.object.isRequired
+        };
+    }
+
     constructor(props) {
         super(props);
 
+        this.onAllTeamsChange = this.onAllTeamsChange.bind(this);
+
         this.getTeamProfiles = this.getTeamProfiles.bind(this);
         this.getCurrentTeamProfiles = this.getCurrentTeamProfiles.bind(this);
         this.doPasswordReset = this.doPasswordReset.bind(this);
@@ -22,7 +32,7 @@ export default class UserList extends React.Component {
         this.getTeamMemberForUser = this.getTeamMemberForUser.bind(this);
 
         this.state = {
-            teamId: props.team.id,
+            team: AdminStore.getTeam(this.props.params.team),
             users: null,
             teamMembers: null,
             serverError: null,
@@ -35,8 +45,14 @@ export default class UserList extends React.Component {
         this.getCurrentTeamProfiles();
     }
 
+    onAllTeamsChange() {
+        this.setState({
+            team: AdminStore.getTeam(this.props.params.team)
+        });
+    }
+
     getCurrentTeamProfiles() {
-        this.getTeamProfiles(this.props.team.id);
+        this.getTeamProfiles(this.props.params.team);
     }
 
     getTeamProfiles(teamId) {
@@ -133,9 +149,8 @@ export default class UserList extends React.Component {
     }
 
     render() {
-        var serverError = '';
-        if (this.state.serverError) {
-            serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
+        if (!this.state.team) {
+            return null;
         }
 
         if (this.state.users == null || this.state.teamMembers == null) {
@@ -146,11 +161,11 @@ export default class UserList extends React.Component {
                             id='admin.userList.title'
                             defaultMessage='Users for {team}'
                             values={{
-                                team: this.props.team.name
+                                team: this.state.team.name
                             }}
                         />
                     </h3>
-                    {serverError}
+                    <FormError error={this.state.serverError}/>
                     <LoadingScreen/>
                 </div>
             );
@@ -161,7 +176,7 @@ export default class UserList extends React.Component {
 
             return (
                 <UserItem
-                    team={this.props.team}
+                    team={this.state.team}
                     key={'user_' + user.id}
                     user={user}
                     teamMember={teamMember}
@@ -177,12 +192,12 @@ export default class UserList extends React.Component {
                         id='admin.userList.title2'
                         defaultMessage='Users for {team} ({count})'
                         values={{
-                            team: this.props.team.name,
+                            team: this.state.team.name,
                             count: this.state.users.length
                         }}
                     />
                 </h3>
-                {serverError}
+                <FormError error={this.state.serverError}/>
                 <form
                     className='form-horizontal'
                     role='form'
@@ -194,7 +209,7 @@ export default class UserList extends React.Component {
                 <ResetPasswordModal
                     user={this.state.user}
                     show={this.state.showPasswordModal}
-                    team={this.props.team}
+                    team={this.state.team}
                     onModalSubmit={this.doPasswordResetSubmit}
                     onModalDismissed={this.doPasswordResetDismiss}
                 />
@@ -202,7 +217,3 @@ export default class UserList extends React.Component {
         );
     }
 }
-
-UserList.propTypes = {
-    team: React.PropTypes.object
-};
-- 
cgit v1.2.3-1-g7c22

