Use busy spinner when requesting teams

pull/21833/head
Luke Barnard 2017-01-30 16:23:52 +00:00
parent 318d871097
commit eb4d7f04e7
1 changed files with 15 additions and 1 deletions

View File

@ -67,6 +67,7 @@ module.exports = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
busy: false, busy: false,
teamServerBusy: false,
errorText: null, errorText: null,
// We remember the values entered by the user because // We remember the values entered by the user because
// the registration form will be unmounted during the // the registration form will be unmounted during the
@ -104,8 +105,11 @@ module.exports = React.createClass({
) { ) {
this._rtsClient = new RtsClient(this.props.teamServerConfig.teamServerURL); this._rtsClient = new RtsClient(this.props.teamServerConfig.teamServerURL);
this.setState({
teamServerBusy: true,
});
// GET team configurations including domains, names and icons // GET team configurations including domains, names and icons
this._rtsClient.getTeamsConfig().done((args) => { this._rtsClient.getTeamsConfig().then((args) => {
// args = [$request, $body] // args = [$request, $body]
const teamsConfig = { const teamsConfig = {
teams: args[1], teams: args[1],
@ -117,6 +121,10 @@ module.exports = React.createClass({
}); });
}, (err) => { }, (err) => {
console.error('Error retrieving config for teams', err); console.error('Error retrieving config for teams', err);
}).finally(() => {
this.setState({
teamServerBusy: false,
});
}); });
} }
}, },
@ -299,6 +307,8 @@ module.exports = React.createClass({
}, },
_getRegisterContentJsx: function() { _getRegisterContentJsx: function() {
var Spinner = sdk.getComponent("elements.Spinner");
var currStep = this.registerLogic.getStep(); var currStep = this.registerLogic.getStep();
var registerStep; var registerStep;
switch (currStep) { switch (currStep) {
@ -308,6 +318,10 @@ module.exports = React.createClass({
case "Register.STEP_m.login.dummy": case "Register.STEP_m.login.dummy":
// NB. Our 'username' prop is specifically for upgrading // NB. Our 'username' prop is specifically for upgrading
// a guest account // a guest account
if (this.state.teamServerBusy) {
registerStep = <Spinner />;
break;
}
registerStep = ( registerStep = (
<RegistrationForm <RegistrationForm
showEmail={true} showEmail={true}