Added notify new section method to SubmissionService

This commit is contained in:
Giuseppe
2018-09-27 15:01:42 +02:00
parent 618e689258
commit f8620d5c12
2 changed files with 9 additions and 24 deletions

View File

@@ -124,7 +124,9 @@ export class SubmissionObjectEffects {
.map(([action, currentState]: [SaveSubmissionFormSuccessAction | SaveSubmissionSectionFormSuccessAction, any]) => {
return this.parseSaveResponse((currentState.submission as SubmissionState).objects[action.payload.submissionId], action.payload.submissionObject, action.payload.submissionId);
})
.mergeMap((actions) => Observable.from(actions));
.mergeMap((actions) => {
return Observable.from(actions);
});
@Effect() saveSection$ = this.actions$
.ofType(SubmissionObjectActionTypes.SAVE_SUBMISSION_SECTION_FORM)

View File

@@ -82,7 +82,6 @@ export class SubmissionService {
const availableSections: SectionDataObject[] = [];
Object.keys(sections)
.filter((sectionId) => !this.isSectionHidden(sections[sectionId] as SubmissionSectionObject))
// .filter((sectionId) => sections[sectionId].sectionType !== SectionsType.DetectDuplicate || isNotEmpty(sections[sectionId].data))
.forEach((sectionId) => {
const sectionObject: SectionDataObject = Object.create({});
sectionObject.config = sections[sectionId].config;
@@ -217,29 +216,13 @@ export class SubmissionService {
}
}
notifyNewSection(submissionId: string, sectionId: string, sectionType?: SectionsType) {
if (sectionType === SectionsType.DetectDuplicate) {
this.setActiveSection(submissionId, sectionId);
this.translate.get('submission.sections.detect-duplicate.duplicate-detected', {sectionId})
.take(1)
.subscribe((msg) => {
this.notificationsService.warning(null, msg, new NotificationOptions(0));
});
const config: ScrollToConfigOptions = {
target: sectionId,
offset: -70
};
this.scrollToService.scrollTo(config);
} else {
notifyNewSection(sectionId: string, sectionType?: SectionsType) {
this.translate.get('submission.sections.general.metadata-extracted-new-section', {sectionId})
.take(1)
.subscribe((msg) => {
this.notificationsService.info(null, msg, null, true);
.subscribe((m) => {
this.notificationsService.info(null, m, null, true);
});
}
}
retrieveSubmission(submissionId): Observable<SubmissionObject> {
return this.restService.getDataById(this.getSubmissionObjectLinkName(), submissionId)
.filter((submissionObjects: SubmissionObject[]) => isNotUndefined(submissionObjects))