// eslint-disable-next-line @typescript-eslint/no-magic-numbers
private configLength: number = 3;
+ /** Contains config length from get api @private */
+ private getConfigLength: number;
+
+ /** Contains config when update @private */
+ private updateConfig: object;
+
+ /** Contains config length when update @private */
+ private updateConfigLength: number;
+
/** Instance of the rest service @private */
private restService: RestService;
}
}
delete this.details.config.location;
+ this.getConfigLength = Object.keys(this.details.config).length;
this.getFormControl('schema_type').disable();
this.getFormControl('vim_url').disable();
this.getFormControl('vim_type').disable();
delete this.vimNewAccountForm.value.config[res];
}
});
- if (!isNullOrUndefined(this.vimID)) {
+ delete this.vimNewAccountForm.value.config.location;
+ if (!isNullOrUndefined(this.data)) {
+ this.updateConfig = jsyaml.load(this.data, { json: true });
+ if (!isNullOrUndefined(this.updateConfig)) {
+ this.updateConfigLength = Object.keys(this.updateConfig).length;
+ }
+ }
+ if (this.updateConfig === undefined) {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VIMDETAILS.VIMDELETE'));
+ this.isLocationLoadingResults = false;
+ } else if (this.getConfigLength > this.updateConfigLength) {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.VIMDETAILS.VIMEMPTY'));
+ this.isLocationLoadingResults = false;
+ }
+ if (!isNullOrUndefined(this.vimID) && ((this.getConfigLength <= this.updateConfigLength))) {
this.editVIM();
- } else {
+ } else if (isNullOrUndefined(this.vimID)) {
this.createNewVIM();
}
}