2015-10-08 12:27:09 -04:00
|
|
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
2015-06-18 10:40:46 -04:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
2016-03-14 08:50:46 -04:00
|
|
|
import TeamStore from 'stores/team_store.jsx';
|
2015-11-19 21:12:56 -05:00
|
|
|
import ImportTab from './team_import_tab.jsx';
|
|
|
|
|
import ExportTab from './team_export_tab.jsx';
|
|
|
|
|
import GeneralTab from './team_general_tab.jsx';
|
2016-03-14 08:50:46 -04:00
|
|
|
import * as Utils from 'utils/utils.jsx';
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
2015-06-18 10:40:46 -04:00
|
|
|
|
2015-09-01 11:39:28 -04:00
|
|
|
export default class TeamSettings extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
|
|
this.onChange = this.onChange.bind(this);
|
|
|
|
|
|
|
|
|
|
this.state = {team: TeamStore.getCurrent()};
|
|
|
|
|
}
|
|
|
|
|
componentDidMount() {
|
2015-08-18 09:43:22 -04:00
|
|
|
TeamStore.addChangeListener(this.onChange);
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
componentWillUnmount() {
|
2015-08-18 09:43:22 -04:00
|
|
|
TeamStore.removeChangeListener(this.onChange);
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
onChange() {
|
2015-08-18 09:43:22 -04:00
|
|
|
var team = TeamStore.getCurrent();
|
2016-04-21 22:37:01 -07:00
|
|
|
|
2015-11-12 11:19:59 -05:00
|
|
|
if (!Utils.areObjectsEqual(this.state.team, team)) {
|
2015-09-24 10:52:32 -07:00
|
|
|
this.setState({team});
|
2015-06-18 10:40:46 -04:00
|
|
|
}
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
render() {
|
2016-02-08 07:26:10 -05:00
|
|
|
if (!this.state.team) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2015-08-18 09:43:22 -04:00
|
|
|
var result;
|
|
|
|
|
switch (this.props.activeTab) {
|
2015-09-01 11:39:28 -04:00
|
|
|
case 'general':
|
|
|
|
|
result = (
|
|
|
|
|
<div>
|
|
|
|
|
<GeneralTab
|
|
|
|
|
team={this.state.team}
|
|
|
|
|
activeSection={this.props.activeSection}
|
|
|
|
|
updateSection={this.props.updateSection}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
case 'import':
|
|
|
|
|
result = (
|
|
|
|
|
<div>
|
|
|
|
|
<ImportTab
|
|
|
|
|
team={this.state.team}
|
|
|
|
|
activeSection={this.props.activeSection}
|
|
|
|
|
updateSection={this.props.updateSection}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
break;
|
2015-08-26 12:49:07 -04:00
|
|
|
case 'export':
|
|
|
|
|
result = (
|
|
|
|
|
<div>
|
2016-02-22 08:31:10 -05:00
|
|
|
<ExportTab/>
|
2015-08-26 12:49:07 -04:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
break;
|
2015-09-01 11:39:28 -04:00
|
|
|
default:
|
|
|
|
|
result = (
|
|
|
|
|
<div/>
|
|
|
|
|
);
|
|
|
|
|
break;
|
2015-07-07 09:16:13 -04:00
|
|
|
}
|
2015-08-18 09:43:22 -04:00
|
|
|
return result;
|
2015-06-18 10:40:46 -04:00
|
|
|
}
|
2015-09-01 11:39:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TeamSettings.defaultProps = {
|
|
|
|
|
activeTab: '',
|
2015-10-27 22:18:52 -07:00
|
|
|
activeSection: ''
|
2015-09-01 11:39:28 -04:00
|
|
|
};
|
2015-10-27 22:18:52 -07:00
|
|
|
|
2015-09-01 11:39:28 -04:00
|
|
|
TeamSettings.propTypes = {
|
|
|
|
|
activeTab: React.PropTypes.string.isRequired,
|
|
|
|
|
activeSection: React.PropTypes.string.isRequired,
|
2015-10-27 22:18:52 -07:00
|
|
|
updateSection: React.PropTypes.func.isRequired
|
2015-09-01 11:39:28 -04:00
|
|
|
};
|