Skip to content

Commit 03d13e3

Browse files
Merge branch 'w2p-113996_Improvements-submission-sections-7.6' into w2p-113996_Improvements-submission-sections-main
2 parents 39d2a75 + 713564b commit 03d13e3

18 files changed

+46
-7
lines changed

src/app/core/config/models/config-submission-section.model.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export class SubmissionSectionModel extends ConfigObject {
4141
@autoserialize
4242
sectionType: SectionsType;
4343

44+
/**
45+
* A string representing the type this section extends
46+
*/
47+
@autoserialize
48+
extendsSectionType: SectionsType;
49+
4450
/**
4551
* The [SubmissionSectionVisibility] object for this section
4652
*/

src/app/core/submission/submission-response-parsing.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ export class SubmissionResponseParsingService extends BaseResponseParsingService
141141
// Iterate over all workspaceitem's sections
142142
Object.keys(item.sections)
143143
.forEach((sectionId) => {
144-
if (typeof item.sections[sectionId] === 'object' && (isNotEmpty(item.sections[sectionId]) &&
145-
// When Upload section is disabled, add to submission only if there are files
146-
(!item.sections[sectionId].hasOwnProperty('files') || isNotEmpty((item.sections[sectionId] as any).files)))) {
147-
144+
if (typeof item.sections[sectionId] === 'object' && (isNotEmpty(item.sections[sectionId]))) {
148145
const sectiondata = Object.create({});
149146
// Iterate over all sections property
150147
Object.keys(item.sections[sectionId])

src/app/submission/objects/submission-objects.actions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export class InitSectionAction implements Action {
121121
config: string;
122122
mandatory: boolean;
123123
sectionType: SectionsType;
124+
extendsSectionType: SectionsType;
124125
visibility: SectionVisibility;
125126
enabled: boolean;
126127
data: WorkspaceitemSectionDataType;
@@ -142,6 +143,8 @@ export class InitSectionAction implements Action {
142143
* the section's mandatory
143144
* @param sectionType
144145
* the section's type
146+
* @param extendsSectionType
147+
* the type of the section it extends
145148
* @param visibility
146149
* the section's visibility
147150
* @param enabled
@@ -157,11 +160,12 @@ export class InitSectionAction implements Action {
157160
config: string,
158161
mandatory: boolean,
159162
sectionType: SectionsType,
163+
extendsSectionType: SectionsType,
160164
visibility: SectionVisibility,
161165
enabled: boolean,
162166
data: WorkspaceitemSectionDataType,
163167
errors: SubmissionSectionError[]) {
164-
this.payload = { submissionId, sectionId, header, config, mandatory, sectionType, visibility, enabled, data, errors };
168+
this.payload = { submissionId, sectionId, header, config, mandatory, sectionType, extendsSectionType, visibility, enabled, data, errors };
165169
}
166170
}
167171

src/app/submission/objects/submission-objects.effects.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ describe('SubmissionObjectEffects test suite', () => {
161161
config,
162162
sectionDefinition.mandatory,
163163
sectionDefinition.sectionType,
164+
sectionDefinition.extendsSectionType,
164165
sectionDefinition.visibility,
165166
enabled,
166167
sectionData,

src/app/submission/objects/submission-objects.effects.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export class SubmissionObjectEffects {
116116
config,
117117
sectionDefinition.mandatory,
118118
sectionDefinition.sectionType,
119+
sectionDefinition.extendsSectionType,
119120
sectionDefinition.visibility,
120121
enabled,
121122
sectionData,

src/app/submission/objects/submission-objects.reducer.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ describe('submissionReducer test suite', () => {
238238
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
239239
mandatory: true,
240240
sectionType: 'submission-form',
241+
extendsSectionType: undefined,
241242
visibility: undefined,
242243
collapsed: false,
243244
enabled: true,
@@ -259,6 +260,7 @@ describe('submissionReducer test suite', () => {
259260
true,
260261
SectionsType.SubmissionForm,
261262
undefined,
263+
undefined,
262264
true,
263265
{},
264266
null);

src/app/submission/objects/submission-objects.reducer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ function initSection(state: SubmissionObjectState, action: InitSectionAction): S
566566
config: action.payload.config,
567567
mandatory: action.payload.mandatory,
568568
sectionType: action.payload.sectionType,
569+
extendsSectionType: action.payload.extendsSectionType,
569570
visibility: action.payload.visibility,
570571
collapsed: false,
571572
enabled: action.payload.enabled,

src/app/submission/objects/submission-section-object.model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export interface SubmissionSectionObject {
2727
*/
2828
sectionType: SectionsType;
2929

30+
/**
31+
* The type this section extends
32+
*/
33+
extendsSectionType: SectionsType;
34+
3035
/**
3136
* The section visibility
3237
*/

src/app/submission/sections/cc-license/submission-section-cc-licenses.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('SubmissionSectionCcLicensesComponent', () => {
4040
header: 'test header',
4141
id: 'test section id',
4242
sectionType: SectionsType.SubmissionForm,
43+
extendsSectionType: undefined,
4344
};
4445

4546
const submissionCcLicenses: SubmissionCcLicence[] = [

src/app/submission/sections/container/section-container.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const sectionObject: SectionDataObject = {
5151
header: 'submit.progressbar.describe.stepone',
5252
id: 'traditionalpageone',
5353
sectionType: SectionsType.SubmissionForm,
54+
extendsSectionType: undefined,
5455
};
5556

5657
describe('SubmissionSectionContainerComponent test suite', () => {

src/app/submission/sections/form/section-form.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const sectionObject: SectionDataObject = {
8484
header: 'submit.progressbar.describe.stepone',
8585
id: 'traditionalpageone',
8686
sectionType: SectionsType.SubmissionForm,
87+
extendsSectionType: undefined,
8788
};
8889

8990
const testFormConfiguration = {

src/app/submission/sections/identifiers/section-identifiers.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const sectionObject: SectionDataObject = {
114114
header: 'submission.sections.submit.progressbar.identifiers',
115115
id: 'identifiers',
116116
sectionType: SectionsType.Identifiers,
117+
extendsSectionType: undefined,
117118
sectionVisibility: null,
118119
};
119120

src/app/submission/sections/license/section-license.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ const sectionObject: SectionDataObject = {
112112
header: 'submit.progressbar.describe.license',
113113
id: 'license',
114114
sectionType: SectionsType.License,
115+
extendsSectionType: undefined,
115116
};
116117

117118
const dynamicFormControlEvent: DynamicFormControlEvent = {

src/app/submission/sections/models/section-data.model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export interface SectionDataObject {
4747
*/
4848
sectionType: SectionsType;
4949

50+
/**
51+
* The type this section extends
52+
*/
53+
extendsSectionType: SectionsType;
54+
5055
/**
5156
* Eventually additional fields
5257
*/

src/app/submission/sections/sections.service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ export class SectionsService {
388388
return this.store.select(submissionObjectFromIdSelector(submissionId)).pipe(
389389
filter((submissionState: SubmissionObjectEntry) => isNotUndefined(submissionState)),
390390
map((submissionState: SubmissionObjectEntry) => {
391-
return isNotUndefined(submissionState.sections) && isNotUndefined(findKey(submissionState.sections, { sectionType: sectionType }));
391+
return isNotUndefined(submissionState.sections) &&
392+
(isNotUndefined(findKey(submissionState.sections, { sectionType: sectionType })) ||
393+
isNotUndefined(findKey(submissionState.sections, { extendsSectionType: sectionType })));
392394
}),
393395
distinctUntilChanged());
394396
}
@@ -404,7 +406,7 @@ export class SectionsService {
404406
filter((submissionState: SubmissionObjectEntry) => isNotUndefined(submissionState)),
405407
map((submissionState: SubmissionObjectEntry) => {
406408
return isNotUndefined(submissionState.sections) && isNotUndefined(submissionState.sections[sectionId])
407-
&& submissionState.sections[sectionId].sectionType === sectionType;
409+
&& (submissionState.sections[sectionId].sectionType === sectionType || submissionState.sections[sectionId].extendsSectionType === sectionType);
408410
}),
409411
distinctUntilChanged());
410412
}

src/app/submission/sections/upload/section-upload.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ describe('SubmissionSectionUploadComponent test suite', () => {
115115
header: 'submit.progressbar.describe.upload',
116116
id: 'upload-id',
117117
sectionType: SectionsType.Upload,
118+
extendsSectionType: undefined,
118119
};
119120
submissionId = mockSubmissionId;
120121
collectionId = mockSubmissionCollectionId;

src/app/submission/submission.service.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ describe('SubmissionService test suite', () => {
605605
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/keyinformation',
606606
mandatory: true,
607607
sectionType: 'submission-form',
608+
extendsSectionType: undefined,
608609
data: {},
609610
errorsToShow: [],
610611
serverValidationErrors: [],
@@ -615,6 +616,7 @@ describe('SubmissionService test suite', () => {
615616
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/indexing',
616617
mandatory: false,
617618
sectionType: 'submission-form',
619+
extendsSectionType: undefined,
618620
data: {},
619621
errorsToShow: [],
620622
serverValidationErrors: [],
@@ -625,6 +627,7 @@ describe('SubmissionService test suite', () => {
625627
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/publicationchannel',
626628
mandatory: true,
627629
sectionType: 'submission-form',
630+
extendsSectionType: undefined,
628631
data: {},
629632
errorsToShow: [],
630633
serverValidationErrors: [],
@@ -635,6 +638,7 @@ describe('SubmissionService test suite', () => {
635638
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/acknowledgement',
636639
mandatory: false,
637640
sectionType: 'submission-form',
641+
extendsSectionType: undefined,
638642
data: {},
639643
errorsToShow: [],
640644
serverValidationErrors: [],
@@ -645,6 +649,7 @@ describe('SubmissionService test suite', () => {
645649
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/identifiers',
646650
mandatory: false,
647651
sectionType: 'submission-form',
652+
extendsSectionType: undefined,
648653
data: {},
649654
errorsToShow: [],
650655
serverValidationErrors: [],
@@ -655,6 +660,7 @@ describe('SubmissionService test suite', () => {
655660
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/references',
656661
mandatory: false,
657662
sectionType: 'submission-form',
663+
extendsSectionType: undefined,
658664
data: {},
659665
errorsToShow: [],
660666
serverValidationErrors: [],
@@ -665,6 +671,7 @@ describe('SubmissionService test suite', () => {
665671
config: 'https://rest.api/dspace-spring-rest/api/config/submissionuploads/upload',
666672
mandatory: true,
667673
sectionType: 'upload',
674+
extendsSectionType: undefined,
668675
data: {},
669676
errorsToShow: [],
670677
serverValidationErrors: [],
@@ -675,6 +682,7 @@ describe('SubmissionService test suite', () => {
675682
config: '',
676683
mandatory: true,
677684
sectionType: 'license',
685+
extendsSectionType: undefined,
678686
data: {},
679687
errorsToShow: [],
680688
serverValidationErrors: [],

src/app/submission/submission.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ export class SubmissionService {
321321
sectionObject.header = sections[sectionId].header;
322322
sectionObject.id = sectionId;
323323
sectionObject.sectionType = sections[sectionId].sectionType;
324+
sectionObject.extendsSectionType = sections[sectionId].extendsSectionType;
324325
availableSections.push(sectionObject);
325326
});
326327
return availableSections;

0 commit comments

Comments
 (0)