diff --git a/lib/core/settings/host-settings.component.html b/lib/core/settings/host-settings.component.html index daa9b4c3ef..577ae46826 100644 --- a/lib/core/settings/host-settings.component.html +++ b/lib/core/settings/host-settings.component.html @@ -53,10 +53,15 @@ {{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }} - + + + + + + Identity Host + placeholder="http(s)://host|ip:port(/path)"> {{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }} diff --git a/lib/core/settings/host-settings.component.spec.ts b/lib/core/settings/host-settings.component.spec.ts index 629d9b08f5..3f10747d7c 100644 --- a/lib/core/settings/host-settings.component.spec.ts +++ b/lib/core/settings/host-settings.component.spec.ts @@ -336,6 +336,17 @@ describe('HostSettingsComponent', () => { bpmUrlInput.dispatchEvent(new Event('input')); }); + it('should have a required identityUrl and invalid form when the identityUrl is missing', (done) => { + component.form.statusChanges.subscribe((status: string) => { + expect(status).toEqual('INVALID'); + expect(component.identityHost.hasError('required')).toBeTruthy(); + done(); + }); + + identityUrlInput.value = ''; + identityUrlInput.dispatchEvent(new Event('input')); + }); + it('should have an invalid form when the identity url inserted is wrong', (done) => { const url = 'wrong'; diff --git a/lib/core/settings/host-settings.component.ts b/lib/core/settings/host-settings.component.ts index 27e1a04b66..8b1456114b 100644 --- a/lib/core/settings/host-settings.component.ts +++ b/lib/core/settings/host-settings.component.ts @@ -43,7 +43,6 @@ export class HostSettingsComponent implements OnInit { providers: string[] = ['BPM', 'ECM', 'ALL']; showSelectProviders = true; - hasIdentity = false; form: FormGroup; @@ -83,13 +82,16 @@ export class HostSettingsComponent implements OnInit { if (authType === 'OAUTH') { this.addOAuthFormGroup(); + this.addIdentityHostFormControl(); } this.form.get('authType').valueChanges.subscribe((value) => { if (value === 'BASIC') { this.form.removeControl('oauthConfig'); + this.form.removeControl('identityHost'); } else { this.addOAuthFormGroup(); + this.addIdentityHostFormControl(); } }); @@ -102,14 +104,11 @@ export class HostSettingsComponent implements OnInit { private removeFormGroups() { this.form.removeControl('bpmHost'); this.form.removeControl('ecmHost'); - this.form.removeControl('identityHost'); - this.hasIdentity = false; } private addFormGroups() { this.addBPMFormControl(); this.addECMFormControl(); - this.addIdentityHostFormControl(); } private addOAuthFormGroup() { @@ -125,11 +124,8 @@ export class HostSettingsComponent implements OnInit { } private addIdentityHostFormControl() { - if ((this.isOAUTH()) && !this.identityHost) { - const identityHostFormControl = this.createIdentityFormControl(); - this.form.addControl('identityHost', identityHostFormControl); - this.hasIdentity = true; - } + const identityHostFormControl = this.createIdentityFormControl(); + this.form.addControl('identityHost', identityHostFormControl); } private addECMFormControl() {