preference page: Add a Loading indication for new server button. (#401)

Change the text of "Add" button to "Adding..." when a user clicks on Add button for adding new server.

Fixes: #396.
This commit is contained in:
Abhigyan Khaund
2018-01-29 23:53:10 +05:30
committed by Akash Nimare
parent 1948ba2cc3
commit 89d1344e2f
2 changed files with 3 additions and 2 deletions

View File

@@ -43,11 +43,13 @@ class NewServerForm extends BaseComponent {
}
submitFormHandler() {
this.$saveServerButton.children[1].innerHTML = 'Adding...';
DomainUtil.checkDomain(this.$newServerUrl.value).then(serverConf => {
DomainUtil.addDomain(serverConf).then(() => {
this.props.onChange(this.props.index);
});
}, errorMessage => {
this.$saveServerButton.children[1].innerHTML = 'Add';
alert(errorMessage);
});
}

View File

@@ -99,8 +99,7 @@ class DomainUtil {
checkDomain(domain, silent = false) {
if (!silent && this.duplicateDomain(domain)) {
// Do not check duplicate in silent mode
alert('This server has been added.');
return;
return Promise.reject('This server has been added.');
}
domain = this.formatUrl(domain);