+ /** Fetching the vim details from get api @protected */
+ private getVIMDetails(id: string): void {
+ this.isLocationLoadingResults = true;
+ this.restService.getResource(environment.VIMACCOUNTS_URL + '/' + id).subscribe((vimAccountsData: VimAccountDetails) => {
+ this.details = vimAccountsData;
+ if (!isNullOrUndefined(this.details.config.location)) {
+ this.configLocation = this.details.config.location;
+ if (this.configLocation.indexOf(',') !== -1) {
+ this.locationName = this.configLocation.split(',')[0];
+ this.latitude = this.configLocation.split(',')[1];
+ this.longitude = this.configLocation.split(',')[2];
+ }
+ }
+ delete this.details.config.location;
+ this.getFormControl('schema_type').disable();
+ this.getFormControl('vim_url').disable();
+ this.getFormControl('vim_type').disable();
+ this.config = { ...this.details.config };
+ this.details.vim_password = '';
+ this.setEditValue(this.details, this.checkFormKeys);
+ this.isLocationLoadingResults = false;
+ }, (error: ERRORDATA) => {
+ this.restService.handleError(error, 'get');
+ this.isLocationLoadingResults = false;
+ });
+ }
+
+ /** Set the value for the Edit Section @public */
+ public setEditValue(formValues: VimAccountDetails, checkKey: string[]): void {
+ Object.keys(formValues).forEach((name: string): void => {
+ if (checkKey.includes(name)) {
+ if (name === 'config') {
+ this.loadConfig();
+ this.getFormControl('locationName').patchValue(this.locationName);
+ this.getFormControl('latitude').patchValue(this.latitude);
+ this.getFormControl('longitude').patchValue(this.longitude);
+ }
+ else {
+ // eslint-disable-next-line security/detect-object-injection
+ this.getFormControl(name).setValue(formValues[name], { onlySelf: true });
+ this.getFormControl(name).updateValueAndValidity();
+ }
+ }
+ });
+ }
+