diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 134186fe4..22a6799bf 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -72,9 +72,9 @@ export class AppComponent implements OnInit { if (session.account.type === AccountType.AWS || session.account.type === AccountType.AWS_TRUSTER) { if (session.account.parent === undefined) { if (session.account.idpUrl === '' || session.account.idpUrl === null || session.account.idpUrl === undefined) { - session.account.idpUrl = workspace.idpUrl[0].id; // We force the first + session.account.idpUrl = workspace.idpUrl.filter(u => (u !== null && u !== undefined))[0].id; // We force the first } else { - const found = workspace.idpUrl.filter(u => u.url === session.account.idpUrl)[0]; + const found = workspace.idpUrl.filter(u => u && u.url === session.account.idpUrl)[0]; if (found) { session.account.idpUrl = found.id; } diff --git a/src/app/services/federated-account.service.ts b/src/app/services/federated-account.service.ts index ac3d2d1e6..f88cee520 100644 --- a/src/app/services/federated-account.service.ts +++ b/src/app/services/federated-account.service.ts @@ -70,7 +70,7 @@ export class FederatedAccountService extends NativeService { console.log('idpurl in workspace', workspace.idpUrl); - if (workspace.idpUrl.findIndex(i => i.id === idpUrl.id) === -1) { + if (workspace.idpUrl.findIndex(i => i && i.id === idpUrl.id) === -1) { workspace.idpUrl.push(idpUrl); } diff --git a/src/app/services/workspace.service.ts b/src/app/services/workspace.service.ts index e0faab8ec..2731763ce 100644 --- a/src/app/services/workspace.service.ts +++ b/src/app/services/workspace.service.ts @@ -147,10 +147,10 @@ export class WorkspaceService extends NativeService { const workspace = this.configurationService.getDefaultWorkspaceSync(); let idpUrl; if (session.account.parent === undefined) { - idpUrl = workspace.idpUrl.filter(u => u.id === session.account.idpUrl)[0].url; + idpUrl = workspace.idpUrl.filter(u => u && u.id === session.account.idpUrl)[0].url; } else { const parentSession = this.sessionService.getSession(session.account.parent); - idpUrl = workspace.idpUrl.filter(u => u.id === parentSession.account.idpUrl)[0].url; + idpUrl = workspace.idpUrl.filter(u => u && u.id === parentSession.account.idpUrl)[0].url; } // TODO: probably here will need to clean the partition area to force a windows refresh diff --git a/src/app/shared/profile-page/profile-page.component.html b/src/app/shared/profile-page/profile-page.component.html index 91e19e733..e918e7f29 100644 --- a/src/app/shared/profile-page/profile-page.component.html +++ b/src/app/shared/profile-page/profile-page.component.html @@ -83,6 +83,7 @@

IdP URL list

+ {{idpUrl.url}} @@ -90,6 +91,7 @@

IdP URL list

+
diff --git a/src/app/shared/profile-page/profile-page.component.ts b/src/app/shared/profile-page/profile-page.component.ts index edb78086a..add9b335f 100644 --- a/src/app/shared/profile-page/profile-page.component.ts +++ b/src/app/shared/profile-page/profile-page.component.ts @@ -153,7 +153,7 @@ export class ProfilePageComponent extends AntiMemLeak implements OnInit { } manageIdpUrl(id) { - const idpUrl = this.workspaceData.idpUrl.findIndex(u => u.id === id); + const idpUrl = this.workspaceData.idpUrl.findIndex(u => u && u.id === id); if (this.form.get('idpUrl').value !== '') { if (idpUrl === -1) { this.workspaceData.idpUrl.push({ id: uuid.v4(), url: this.form.get('idpUrl').value }); @@ -168,7 +168,7 @@ export class ProfilePageComponent extends AntiMemLeak implements OnInit { } editIdpUrl(id) { - const idpUrl = this.workspaceData.idpUrl.filter(u => u.id === id)[0]; + const idpUrl = this.workspaceData.idpUrl.filter(u => u && u.id === id)[0]; this.idpUrlValue = idpUrl; this.form.get('idpUrl').setValue(idpUrl.url); this.editingIdpUrl = true; @@ -197,7 +197,7 @@ export class ProfilePageComponent extends AntiMemLeak implements OnInit { this.appService.confirmDialog(`Deleting this Idp url will also remove these sessions:
Do you want to proceed?`, (res) => { if (res !== constants.CONFIRM_CLOSED) { this.appService.logger(`Removing idp url with id: ${id}`, LoggerLevel.INFO, this); - const idpUrl = this.workspaceData.idpUrl.findIndex(u => u.id === id); + const idpUrl = this.workspaceData.idpUrl.findIndex(u => u && u.id === id); this.workspaceData.idpUrl.splice(idpUrl, 1); this.configurationService.updateWorkspaceSync(this.workspaceData); sessions.forEach(s => {