Fixed an issue with save of repeatable scrollable-dropdown fields

This commit is contained in:
Giuseppe Digilio
2019-02-28 15:51:45 +01:00
parent 0c1effad48
commit b59bcb52a5
3 changed files with 25 additions and 14 deletions

View File

@@ -138,20 +138,22 @@ export class FormSectionComponent extends SectionModelComponent {
updateForm(sectionData: WorkspaceitemSectionDataType, errors: SubmissionSectionError[]) {
if (isNotEmpty(sectionData) && !isEqual(sectionData, this.sectionData.data) && this.hasMetadataEnrichment(sectionData)) {
this.translate.get('submission.sections.general.metadata-extracted', {sectionId: this.sectionData.id})
.pipe(take(1))
.subscribe((m) => {
this.notificationsService.info(null, m, null, true);
});
this.isUpdating = true;
this.formModel = null;
this.cdr.detectChanges();
this.initForm(sectionData);
this.checksForErrors(errors);
if (isNotEmpty(sectionData) && !isEqual(sectionData, this.sectionData.data)) {
this.sectionData.data = sectionData;
this.isUpdating = false;
this.cdr.detectChanges();
if (this.hasMetadataEnrichment(sectionData)) {
this.translate.get('submission.sections.general.metadata-extracted', { sectionId: this.sectionData.id })
.pipe(take(1))
.subscribe((m) => {
this.notificationsService.info(null, m, null, true);
});
this.isUpdating = true;
this.formModel = null;
this.cdr.detectChanges();
this.initForm(sectionData);
this.checksForErrors(errors);
this.isUpdating = false;
this.cdr.detectChanges();
}
} else if (isNotEmpty(errors) || isNotEmpty(this.sectionData.errors)) {
this.checksForErrors(errors);
}