From: SANDHYA.JS Date: Thu, 9 Nov 2023 07:20:28 +0000 (+0530) Subject: Fix Bug 2309: VIM update issue X-Git-Tag: v14.0.1^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fv14.0;p=osm%2FNG-UI.git Fix Bug 2309: VIM update issue - 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 (cherry picked from commit 46ea49db958888a91926317adf784252695a9359) --- diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html index 7720afa..be535d2 100644 --- a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html +++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.html @@ -148,7 +148,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
-
+
diff --git a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts index 724bef2..05fe4a2 100644 --- a/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts +++ b/src/app/vim-accounts/new-vimaccount/NewVimaccountComponent.ts @@ -171,6 +171,15 @@ export class NewVimaccountComponent implements OnInit { // 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; @@ -266,6 +275,7 @@ export class NewVimaccountComponent implements OnInit { } } 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(); @@ -332,9 +342,23 @@ export class NewVimaccountComponent implements OnInit { 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(); } } diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 0bd8553..97527ec 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -284,7 +284,9 @@ "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", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 7ea835d..c6a419c 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -284,7 +284,9 @@ "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", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 7701f03..9332c26 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -284,7 +284,9 @@ "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", diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json index 04eea20..a553f38 100644 --- a/src/assets/i18n/pt.json +++ b/src/assets/i18n/pt.json @@ -284,7 +284,9 @@ "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",