Use new team modal in settings view as defined in #400
This commit is contained in:
@@ -55,20 +55,20 @@ class NewTeamModal extends React.Component {
|
|||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
|
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
{'Please specify a team name and a valid Mattermost URL'}
|
{'Please specify a server name and a valid Mattermost URL'}
|
||||||
<form>
|
<form>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
validationState={this.getTeamNameValidationState()}
|
validationState={this.getTeamNameValidationState()}
|
||||||
>
|
>
|
||||||
<ControlLabel>{'Team Display Name'}</ControlLabel>
|
<ControlLabel>{'Server Display Name'}</ControlLabel>
|
||||||
<FormControl
|
<FormControl
|
||||||
type='text'
|
type='text'
|
||||||
value={this.state.teamName}
|
value={this.state.teamName}
|
||||||
placeholder='Team Name'
|
placeholder='Server Name'
|
||||||
onChange={this.handleTeamNameChange.bind(this)}
|
onChange={this.handleTeamNameChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
<FormControl.Feedback/>
|
<FormControl.Feedback/>
|
||||||
<HelpBlock>{'Team Name must not be empty'}</HelpBlock>
|
<HelpBlock>{'The name of the server displayed on your desktop app tab bar.'}</HelpBlock>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
validationState={this.getTeamUrlValidationState()}
|
validationState={this.getTeamUrlValidationState()}
|
||||||
@@ -81,7 +81,7 @@ class NewTeamModal extends React.Component {
|
|||||||
onChange={this.handleTeamUrlChange.bind(this)}
|
onChange={this.handleTeamUrlChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
<FormControl.Feedback/>
|
<FormControl.Feedback/>
|
||||||
<HelpBlock>{'Must be a valid URL'}</HelpBlock>
|
<HelpBlock>{'The URL of your Mattermost server. Must start with http:// or https://.'}</HelpBlock>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</form>
|
</form>
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
|
@@ -159,6 +159,7 @@ const SettingsPage = React.createClass({
|
|||||||
<TeamList
|
<TeamList
|
||||||
teams={this.state.teams}
|
teams={this.state.teams}
|
||||||
showAddTeamForm={this.state.showAddTeamForm}
|
showAddTeamForm={this.state.showAddTeamForm}
|
||||||
|
toggleAddTeamForm={this.toggleShowTeamForm}
|
||||||
onTeamsChange={this.handleTeamsChange}
|
onTeamsChange={this.handleTeamsChange}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -351,6 +352,7 @@ const SettingsPage = React.createClass({
|
|||||||
<p className='text-right'>
|
<p className='text-right'>
|
||||||
<a
|
<a
|
||||||
style={settingsPage.sectionHeadingLink}
|
style={settingsPage.sectionHeadingLink}
|
||||||
|
id='addNewServer'
|
||||||
href='#'
|
href='#'
|
||||||
onClick={this.toggleShowTeamForm}
|
onClick={this.toggleShowTeamForm}
|
||||||
>{'⊞ Add new team'}</a>
|
>{'⊞ Add new team'}</a>
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const {ListGroup} = require('react-bootstrap');
|
const {ListGroup} = require('react-bootstrap');
|
||||||
const TeamListItem = require('./TeamListItem.jsx');
|
const TeamListItem = require('./TeamListItem.jsx');
|
||||||
const TeamListItemNew = require('./TeamListItemNew.jsx');
|
const NewTeamModal = require('./NewTeamModal.jsx');
|
||||||
const RemoveServerModal = require('./RemoveServerModal.jsx');
|
const RemoveServerModal = require('./RemoveServerModal.jsx');
|
||||||
|
|
||||||
const TeamList = React.createClass({
|
const TeamList = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
onTeamsChange: React.PropTypes.func,
|
onTeamsChange: React.PropTypes.func,
|
||||||
showAddTeamForm: React.PropTypes.bool,
|
showAddTeamForm: React.PropTypes.bool,
|
||||||
teams: React.PropTypes.array
|
teams: React.PropTypes.array,
|
||||||
|
toggleAddTeamForm: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
@@ -95,12 +96,17 @@ const TeamList = React.createClass({
|
|||||||
var addTeamForm;
|
var addTeamForm;
|
||||||
if (this.props.showAddTeamForm || this.state.showTeamListItemNew) {
|
if (this.props.showAddTeamForm || this.state.showTeamListItemNew) {
|
||||||
addTeamForm = (
|
addTeamForm = (
|
||||||
<TeamListItemNew
|
<NewTeamModal
|
||||||
key={this.state.team.index}
|
onClose={this.props.toggleAddTeamForm}
|
||||||
onTeamAdd={this.handleTeamAdd}
|
onSave={(newTeam) => {
|
||||||
teamIndex={this.state.team.index}
|
this.setState({
|
||||||
teamName={this.state.team.name}
|
showNewTeamModal: false
|
||||||
teamUrl={this.state.team.url}
|
});
|
||||||
|
this.props.teams.push(newTeam);
|
||||||
|
this.render();
|
||||||
|
|
||||||
|
this.props.onTeamsChange(this.props.teams);
|
||||||
|
}}
|
||||||
/>);
|
/>);
|
||||||
} else {
|
} else {
|
||||||
addTeamForm = '';
|
addTeamForm = '';
|
||||||
|
Reference in New Issue
Block a user