Animate NewTeamModal close
This commit is contained in:
parent
77472369c1
commit
63fe562349
|
@ -309,10 +309,9 @@ const MainPage = React.createClass({
|
||||||
authServerURL = `${tmpURL.protocol}//${tmpURL.host}`;
|
authServerURL = `${tmpURL.protocol}//${tmpURL.host}`;
|
||||||
authInfo = this.state.loginQueue[0].authInfo;
|
authInfo = this.state.loginQueue[0].authInfo;
|
||||||
}
|
}
|
||||||
var modal;
|
var modal = (
|
||||||
if (this.state.showNewTeamModal) {
|
|
||||||
modal = (
|
|
||||||
<NewTeamModal
|
<NewTeamModal
|
||||||
|
show={this.state.showNewTeamModal}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showNewTeamModal: false
|
showNewTeamModal: false
|
||||||
|
@ -329,7 +328,6 @@ const MainPage = React.createClass({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<LoginModal
|
<LoginModal
|
||||||
|
|
|
@ -3,9 +3,10 @@ const {Modal, Button, FormGroup, FormControl, ControlLabel, HelpBlock} = require
|
||||||
const validUrl = require('valid-url');
|
const validUrl = require('valid-url');
|
||||||
|
|
||||||
class NewTeamModal extends React.Component {
|
class NewTeamModal extends React.Component {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this.wasShown = false;
|
||||||
this.state = {
|
this.state = {
|
||||||
teamName: '',
|
teamName: '',
|
||||||
teamUrl: '',
|
teamUrl: '',
|
||||||
|
@ -14,6 +15,10 @@ class NewTeamModal extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
this.initializeOnShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
initializeOnShow() {
|
||||||
this.state = {
|
this.state = {
|
||||||
teamName: this.props.team ? this.props.team.name : '',
|
teamName: this.props.team ? this.props.team.name : '',
|
||||||
teamUrl: this.props.team ? this.props.team.url : '',
|
teamUrl: this.props.team ? this.props.team.url : '',
|
||||||
|
@ -105,9 +110,14 @@ class NewTeamModal extends React.Component {
|
||||||
'margin-bottom': 0
|
'margin-bottom': 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.wasShown !== this.props.show && this.props.show) {
|
||||||
|
this.initializeOnShow();
|
||||||
|
}
|
||||||
|
this.wasShown = this.props.show;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
show={true}
|
show={this.props.show}
|
||||||
id='newServerModal'
|
id='newServerModal'
|
||||||
onHide={this.props.onClose}
|
onHide={this.props.onClose}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
|
@ -193,7 +203,8 @@ NewTeamModal.propTypes = {
|
||||||
onClose: React.PropTypes.func,
|
onClose: React.PropTypes.func,
|
||||||
onSave: React.PropTypes.func,
|
onSave: React.PropTypes.func,
|
||||||
team: React.PropTypes.object,
|
team: React.PropTypes.object,
|
||||||
editMode: React.PropTypes.boolean
|
editMode: React.PropTypes.boolean,
|
||||||
|
show: React.PropTypes.boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = NewTeamModal;
|
module.exports = NewTeamModal;
|
||||||
|
|
|
@ -96,10 +96,9 @@ const TeamList = React.createClass({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
var addServerForm;
|
var addServerForm = (
|
||||||
if (this.props.showAddTeamForm || this.state.showEditTeamForm) {
|
|
||||||
addServerForm = (
|
|
||||||
<NewTeamModal
|
<NewTeamModal
|
||||||
|
show={this.props.showAddTeamForm || this.state.showEditTeamForm}
|
||||||
editMode={this.state.showEditTeamForm}
|
editMode={this.state.showEditTeamForm}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -136,9 +135,6 @@ const TeamList = React.createClass({
|
||||||
}}
|
}}
|
||||||
team={this.state.team}
|
team={this.state.team}
|
||||||
/>);
|
/>);
|
||||||
} else {
|
|
||||||
addServerForm = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeServer = this.props.teams[this.state.indexToRemoveServer];
|
const removeServer = this.props.teams[this.state.indexToRemoveServer];
|
||||||
const removeServerModal = (
|
const removeServerModal = (
|
||||||
|
|
|
@ -261,6 +261,7 @@ describe('browser/settings.html', function desc() {
|
||||||
it('should close the window after clicking cancel', () => {
|
it('should close the window after clicking cancel', () => {
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
click('#cancelNewServerModal').
|
click('#cancelNewServerModal').
|
||||||
|
pause(1000). // Animation
|
||||||
isExisting('#newServerModal').should.eventually.equal(false);
|
isExisting('#newServerModal').should.eventually.equal(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -334,8 +335,9 @@ describe('browser/settings.html', function desc() {
|
||||||
it('should add the team to the config file', (done) => {
|
it('should add the team to the config file', (done) => {
|
||||||
this.app.client.
|
this.app.client.
|
||||||
click('#saveNewServerModal').
|
click('#saveNewServerModal').
|
||||||
click('#btnSave');
|
pause(1000). // Animation
|
||||||
this.app.client.pause(1000).then(() => {
|
click('#btnSave').
|
||||||
|
pause(1000).then(() => {
|
||||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
savedConfig.teams.should.contain({
|
savedConfig.teams.should.contain({
|
||||||
name: 'TestTeam',
|
name: 'TestTeam',
|
||||||
|
|
Loading…
Reference in a new issue