show generic backend error status 400 on save of dmp-description

This commit is contained in:
Sofia Papacharalampous 2024-04-25 12:02:13 +03:00
parent f2a1ce4f0f
commit 2c98acb185
2 changed files with 6 additions and 2 deletions

View File

@ -667,6 +667,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
formSubmit(onSuccess?: (response) => void): void {
this.formService.removeAllBackEndErrors(this.formGroup);
this.formService.touchAllFormFields(this.formGroup);
this.tocValidationService.validateForm();
if (this.formGroup.get('label').valid && this.formGroup.get('dmpId').valid && this.formGroup.get('dmpDescriptionTemplateId').valid
&& this.formGroup.get('descriptionTemplateId').valid && this.formGroup.get('status').valid) {
this.persistEntity(onSuccess);

View File

@ -135,13 +135,16 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
if(errorResponse.error.code === ResponseErrorCode.HashConflict){
this.uiNotificationService.snackBarNotification(errorResponse.error.error, SnackBarNotificationLevel.Error);
}
if(errorResponse.error.code === ResponseErrorCode.DmpBlueprintHasNoDescriptionTemplates){
else if(errorResponse.error.code === ResponseErrorCode.DmpBlueprintHasNoDescriptionTemplates){
this.uiNotificationService.snackBarNotification(errorResponse.error.error, SnackBarNotificationLevel.Error);
}
if(errorResponse.error.code === ResponseErrorCode.DmpDescriptionTemplateCanNotRemove){
else if(errorResponse.error.code === ResponseErrorCode.DmpDescriptionTemplateCanNotRemove){
this.uiNotificationService.snackBarNotification(errorResponse.error.error, SnackBarNotificationLevel.Error);
this.refreshOnNavigateToData(null);
}
else {
this.uiNotificationService.snackBarNotification(error.getMessagesString(), SnackBarNotificationLevel.Warning);
}
this.formService.validateAllFormFields(this.formGroup);
} else {
this.uiNotificationService.snackBarNotification(error.getMessagesString(), SnackBarNotificationLevel.Warning);