+
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts
index a3f5060c32..f951626aa7 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts
@@ -134,6 +134,7 @@ export class ExistingRelationListElementComponent implements OnInit, OnChanges,
*/
ngOnChanges() {
if (hasValue(this.reoRel)) {
+ console.log('onChanges', this.reoRel.useLeftItem ? this.reoRel.relationship._links.leftItem.href : this.reoRel.relationship._links.rightItem.href);
const item$ = this.reoRel.useLeftItem ?
this.reoRel.relationship.leftItem : this.reoRel.relationship.rightItem;
this.subs.push(item$.pipe(
@@ -144,6 +145,7 @@ export class ExistingRelationListElementComponent implements OnInit, OnChanges,
this.relatedItem = item;
}));
}
+
}
/**
diff --git a/src/app/shared/form/builder/parsers/field-parser.ts b/src/app/shared/form/builder/parsers/field-parser.ts
index 3f44ce59f7..e7a269db7e 100644
--- a/src/app/shared/form/builder/parsers/field-parser.ts
+++ b/src/app/shared/form/builder/parsers/field-parser.ts
@@ -99,6 +99,7 @@ export abstract class FieldParser {
} else {
const model = this.modelFactory(this.getInitFieldValue());
+ model.submissionId = this.submissionId;
if (model.hasLanguages || isNotEmpty(model.relationship)) {
setLayout(model, 'grid', 'control', 'col');
}
diff --git a/src/app/submission/objects/submission-objects.effects.ts b/src/app/submission/objects/submission-objects.effects.ts
index 0d5c285ba0..fe9fad4846 100644
--- a/src/app/submission/objects/submission-objects.effects.ts
+++ b/src/app/submission/objects/submission-objects.effects.ts
@@ -328,10 +328,12 @@ export class SubmissionObjectEffects {
const sections: WorkspaceitemSectionsObject = (item.sections && isNotEmpty(item.sections)) ? item.sections : {};
const sectionsKeys: string[] = union(Object.keys(sections), Object.keys(errorsList));
+ const metadata = (item.item as Item).metadata;
+ const metadataKeys = Object.keys(metadata);
for (const sectionId of sectionsKeys) {
const sectionErrors = errorsList[sectionId] || [];
- const sectionData = sections[sectionId] || {};
+ let sectionData = sections[sectionId] || {};
// When Upload section is disabled, add to submission only if there are files
if (currentState.sections[sectionId].sectionType === SectionsType.Upload
@@ -340,10 +342,17 @@ export class SubmissionObjectEffects {
continue;
}
+ const sectionKeys = Object.keys(sectionData);
+ if (sectionKeys.every((key: string) => metadataKeys.includes(key))) {
+ sectionData = metadata as any;
+ }
+
+ console.log('sectionData', sectionData);
+
+
if (notify && !currentState.sections[sectionId].enabled) {
this.submissionService.notifyNewSection(submissionId, sectionId, currentState.sections[sectionId].sectionType);
}
- console.log(sectionId, sectionData);
mappedActions.push(new UpdateSectionDataAction(submissionId, sectionId, sectionData, sectionErrors));
}
});
diff --git a/src/app/submission/sections/sections.service.ts b/src/app/submission/sections/sections.service.ts
index 0296486e52..3b980c5454 100644
--- a/src/app/submission/sections/sections.service.ts
+++ b/src/app/submission/sections/sections.service.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
-import { distinctUntilChanged, filter, map, take } from 'rxjs/operators';
+import { distinctUntilChanged, filter, map, take, tap } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
import { ScrollToConfigOptions, ScrollToService } from '@nicky-lenaers/ngx-scroll-to';
@@ -175,7 +175,9 @@ export class SectionsService {
return this.store.select(submissionSectionFromIdSelector(submissionId, sectionId)).pipe(
filter((sectionObj: SubmissionSectionObject) => hasValue(sectionObj)),
map((sectionObj: SubmissionSectionObject) => sectionObj),
- distinctUntilChanged());
+ distinctUntilChanged(),
+ tap((v) => console.log('sectionStateChange', submissionId, sectionId, v)),
+ );
}
/**