[ADF-3910] Expose the identityHost as part of the setting component (#4161)

This commit is contained in:
Maurizio Vitale
2019-01-16 13:01:15 +00:00
committed by Eugenio Romano
parent a49cd76fcb
commit 28da31c550
4 changed files with 56 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ export class HostSettingsComponent implements OnInit {
providers: string[] = ['BPM', 'ECM', 'ALL'];
showSelectProviders = true;
hasIdentity = false;
form: FormGroup;
@@ -101,11 +102,14 @@ 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() {
@@ -120,6 +124,14 @@ export class HostSettingsComponent implements OnInit {
}
}
private addIdentityHostFormControl() {
if ((this.isOAUTH()) && !this.identityHost) {
const identityHostFormControl = this.createIdentityFormControl();
this.form.addControl('identityHost', identityHostFormControl);
this.hasIdentity = true;
}
}
private addECMFormControl() {
if ((this.isECM() || this.isALL()) && !this.ecmHost) {
const ecmFormControl = this.createECMFormControl();
@@ -146,6 +158,10 @@ export class HostSettingsComponent implements OnInit {
return new FormControl(this.appConfig.get<string>(AppConfigValues.BPMHOST), [Validators.required, Validators.pattern(this.HOST_REGEX)]);
}
private createIdentityFormControl(): AbstractControl {
return new FormControl(this.appConfig.get<string>(AppConfigValues.IDENTITY_HOST), [Validators.required, Validators.pattern(this.HOST_REGEX)]);
}
private createECMFormControl(): AbstractControl {
return new FormControl(this.appConfig.get<string>(AppConfigValues.ECMHOST), [Validators.required, Validators.pattern(this.HOST_REGEX)]);
}
@@ -179,6 +195,7 @@ export class HostSettingsComponent implements OnInit {
private saveOAuthValues(values: any) {
this.storageService.setItem(AppConfigValues.OAUTHCONFIG, JSON.stringify(values.oauthConfig));
this.storageService.setItem(AppConfigValues.IDENTITY_HOST, values.identityHost);
}
private saveBPMValues(values: any) {
@@ -221,6 +238,10 @@ export class HostSettingsComponent implements OnInit {
return this.oauthConfig.get('host');
}
get identityHost(): AbstractControl {
return this.form.get('identityHost');
}
get clientId(): AbstractControl {
return this.oauthConfig.get('clientId');
}