enterprise: Raise error when removing orgs.

When a user tries to remove a preset org, we raise an error asking them
to contact their sys admin.
This commit is contained in:
Kanishk Kakar
2019-07-22 14:08:05 +05:30
committed by Akash Nimare
parent 33fadcd876
commit a7887211ac
5 changed files with 54 additions and 9 deletions

View File

@@ -285,8 +285,15 @@ class ServerManagerView {
ipcRenderer.send('reload-full-app');
}
} else if (domainsAdded.length > 0) {
// no enterprise domains added
const { title, content } = Messages.enterpriseOrgError(domainsAdded.length);
// find all orgs that failed
const failedDomains: string[] = [];
for (const org of this.presetOrgs) {
if (DomainUtil.duplicateDomain(org)) {
continue;
}
failedDomains.push(org);
}
const { title, content } = Messages.enterpriseOrgError(domainsAdded.length, failedDomains);
dialog.showErrorBox(title, content);
if (DomainUtil.getDomains().length === 0) {
// no orgs present, stop showing loading gif
@@ -721,8 +728,12 @@ class ServerManagerView {
message: 'Are you sure you want to disconnect this organization?'
}, response => {
if (response === 0) {
DomainUtil.removeDomain(index);
ipcRenderer.send('reload-full-app');
if (DomainUtil.removeDomain(index)) {
ipcRenderer.send('reload-full-app');
} else {
const { title, content } = Messages.orgRemovalError(DomainUtil.getDomain(index).url);
dialog.showErrorBox(title, content);
}
}
});
}