Commit a1e48f5f authored by Juorder Gonzalez's avatar Juorder Gonzalez Committed by GitHub

Merge pull request #285 from ZBoxApp/manager_performance

create watcher for review if account is not remove yet
parents 891fe9ab 412da2f5
...@@ -38,6 +38,9 @@ export default class EditMailBox extends React.Component { ...@@ -38,6 +38,9 @@ export default class EditMailBox extends React.Component {
this.handleRenameAccount = this.handleRenameAccount.bind(this); this.handleRenameAccount = this.handleRenameAccount.bind(this);
this.addBlurListeneronInput = this.addBlurListeneronInput.bind(this); this.addBlurListeneronInput = this.addBlurListeneronInput.bind(this);
this.getEnableAccountsFromDomain = this.getEnableAccountsFromDomain.bind(this); this.getEnableAccountsFromDomain = this.getEnableAccountsFromDomain.bind(this);
this.watcherRemoveAccount = this.watcherRemoveAccount.bind(this);
this.isRemove = false;
this.cos = Utils.getEnabledPlansByCos(ZimbraStore.getAllCos()); this.cos = Utils.getEnabledPlansByCos(ZimbraStore.getAllCos());
this.editUrlFromParams = this.props.params.domain_id ? `/domains/${this.props.params.domain_id}/mailboxes/` : '/mailboxes/'; this.editUrlFromParams = this.props.params.domain_id ? `/domains/${this.props.params.domain_id}/mailboxes/` : '/mailboxes/';
...@@ -217,6 +220,18 @@ export default class EditMailBox extends React.Component { ...@@ -217,6 +220,18 @@ export default class EditMailBox extends React.Component {
}, options); }, options);
} }
watcherRemoveAccount(id, resolve) {
setTimeout(() => {
Client.getAccount(id, () => {
if (!this.isRemove) {
this.watcherRemoveAccount(id, resolve);
}
}, () => {
return resolve(true);
});
}, 5000);
}
removeAccount() { removeAccount() {
const account = this.state.data; const account = this.state.data;
const response = { const response = {
...@@ -240,16 +255,20 @@ export default class EditMailBox extends React.Component { ...@@ -240,16 +255,20 @@ export default class EditMailBox extends React.Component {
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
// start loading // start loading
GlobalActions.emitStartLoading(); GlobalActions.emitStartLoading();
this.isRemove = false;
Client.removeAccount( Client.removeAccount(
account.id, account.id,
() => { () => {
this.isRemove = true;
return resolve(true); return resolve(true);
}, },
(error) => { (error) => {
this.isRemove = true;
return reject(error); return reject(error);
} }
); );
this.watcherRemoveAccount(account.id, resolve);
}).then(() => { }).then(() => {
if (this.isStoreEnabled) { if (this.isStoreEnabled) {
MailboxStore.removeAccount(account); MailboxStore.removeAccount(account);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment