- Fixed this bug by adding warning message for below scenarios
1st scenario : if the config is send empty from UI it'll show the error "Atleast one config information is required"
2nd scenario: config deleting is not allowed user can change the value to true or false based on his/her requirement for this action error message will be "Disallowed operation in config update".
- Also for update load config and clear config button will be not available user can only edit his/her config.
Change-Id: Ib30aaa069f64ca3fcd1412591a4a69ae27098df2
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
(cherry picked from commit
46ea49db958888a91926317adf784252695a9359)
<div id="configurationparameters" class="row collapse mt-3" [ngbCollapse]="isCollapsed">
<div class="col-sm-12">
<div class="ngx-codemirror new-vim" [hidden]="!selectedVimType">
- <div class="form-group">
+ <div class="form-group" *ngIf="!vimID">
<button type="button" class="btn btn-warning btn-sm mr-3" (click)="checkData()">
<i class="fa fa-clone" aria-hidden="true"></i>
{{'PAGE.VIMDETAILS.LOADSAMPLECONFIG' | translate}}</button>
// 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();
}
}
"VIMHEADER": "Warnung",
"VIMCONTENT": "Diese Aktion umfasst das Laden der Beispielkonfiguration und das Löschen der aktuellen Konfiguration",
"CLEARCONTENT": "Diese Aktion beinhaltet das Löschen der aktuellen Konfiguration",
- "VIMSUBMIT": "Fortfahren"
+ "VIMSUBMIT": "Fortfahren",
+ "VIMEMPTY": "Unzulässiger Vorgang beim Konfigurationsupdate",
+ "VIMDELETE": "Es sind mindestens eine Konfigurationsinformation erforderlich"
},
"WIMACCOUNTS": {
"CREATEDSUCCESSFULLY": "WIM erfolgreich erstellt",
"VIMHEADER": "Warning",
"VIMCONTENT": "This action involves loading the sample config & deleting the present config",
"CLEARCONTENT": "This action involves deleting the present config",
- "VIMSUBMIT": "Proceed"
+ "VIMSUBMIT": "Proceed",
+ "VIMEMPTY": "Disallowed operation in config update",
+ "VIMDELETE": "At least one config information is required"
},
"WIMACCOUNTS": {
"CREATEDSUCCESSFULLY": "WIM Created Successfully",
"VIMHEADER": "Advertencia",
"VIMCONTENT": "Esta acción implica cargar la configuración de muestra y eliminar la configuración actual.",
"CLEARCONTENT": "Esta acción implica eliminar la configuración actual.",
- "VIMSUBMIT": "Proceder"
+ "VIMSUBMIT": "Proceder",
+ "VIMEMPTY": "Operación no permitida en la actualización de configuración",
+ "VIMDELETE": "Se requiere al menos una información de configuración"
},
"WIMACCOUNTS": {
"CREATEDSUCCESSFULLY": "WIM Creado correctamente",
"VIMHEADER": "Aviso",
"VIMCONTENT": "Esta ação envolve carregar a configuração de amostra e excluir a configuração atual",
"CLEARCONTENT": "Esta ação envolve a exclusão da configuração atual",
- "VIMSUBMIT": "Continuar"
+ "VIMSUBMIT": "Continuar",
+ "VIMEMPTY": "Operação não permitida na atualização de configuração",
+ "VIMDELETE": "É necessária pelo menos uma informação de configuração"
},
"WIMACCOUNTS": {
"CREATEDSUCCESSFULLY": "WIM criado com sucesso",