Skip to content

Commit a77f98e

Browse files
committed
[DURACOM-291] back porting of fix submission section visibility in order to rely on the configured section scope
1 parent 5c66bb9 commit a77f98e

13 files changed

Lines changed: 518 additions & 77 deletions

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@ import { typedObject } from '../../cache/builders/build-decorators';
44
import { HALLink } from '../../shared/hal-link.model';
55
import { ConfigObject } from './config.model';
66
import { SUBMISSION_SECTION_TYPE } from './config-type';
7-
8-
/**
9-
* An interface that define section visibility and its properties.
10-
*/
11-
export interface SubmissionSectionVisibility {
12-
main: any;
13-
other: any;
14-
}
7+
import { SectionScope, SectionVisibility } from '../../../submission/objects/section-visibility.model';
158

169
@typedObject
1710
@inheritSerialization(ConfigObject)
@@ -30,17 +23,23 @@ export class SubmissionSectionModel extends ConfigObject {
3023
@autoserialize
3124
mandatory: boolean;
3225

26+
/**
27+
* The submission scope for this section
28+
*/
29+
@autoserialize
30+
scope: SectionScope;
31+
3332
/**
3433
* A string representing the kind of section object
3534
*/
3635
@autoserialize
3736
sectionType: SectionsType;
3837

3938
/**
40-
* The [SubmissionSectionVisibility] object for this section
39+
* The [SectionVisibility] object for this section
4140
*/
4241
@autoserialize
43-
visibility: SubmissionSectionVisibility;
42+
visibility: SectionVisibility;
4443

4544
/**
4645
* The {@link HALLink}s for this SubmissionSectionModel

src/app/submission/form/submission-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import { Item } from '../../core/shared/item.model';
1818
import { SectionsType } from '../sections/sections-type';
1919
import { SectionsService } from '../sections/sections.service';
2020
import { SubmissionError } from '../objects/submission-error.model';
21-
import { SubmissionSectionVisibility } from './../../core/config/models/config-submission-section.model';
2221
import { SubmissionSectionModel } from './../../core/config/models/config-submission-section.model';
2322
import { VisibilityType } from '../sections/visibility-type';
2423
import isEqual from 'lodash/isEqual';
24+
import { SectionVisibility } from '../objects/section-visibility.model';
2525

2626
/**
2727
* This component represents the submission form.
@@ -196,7 +196,7 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
196196
/**
197197
* Returns the visibility object of the collection section
198198
*/
199-
private getCollectionVisibility(): SubmissionSectionVisibility {
199+
private getCollectionVisibility(): SectionVisibility {
200200
const submissionSectionModel: SubmissionSectionModel =
201201
this.submissionDefinition.sections.page.find(
202202
(section) => isEqual(section.sectionType, SectionsType.Collection)

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ export interface SectionVisibility {
55
main: any;
66
other: any;
77
}
8+
9+
10+
export enum SectionScope {
11+
Submission = 'SUBMISSION',
12+
Workflow = 'WORKFLOW',
13+
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { SubmissionObject } from '../../core/submission/models/submission-object
1111
import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model';
1212
import { SectionsType } from '../sections/sections-type';
1313
import { Item } from '../../core/shared/item.model';
14-
import { SectionVisibility } from './section-visibility.model';
14+
import { SectionScope, SectionVisibility } from './section-visibility.model';
1515
import { SubmissionError } from './submission-error.model';
1616
import { SubmissionSectionError } from './submission-section-error.model';
1717

@@ -116,6 +116,7 @@ export class InitSectionAction implements Action {
116116
header: string;
117117
config: string;
118118
mandatory: boolean;
119+
scope: SectionScope;
119120
sectionType: SectionsType;
120121
visibility: SectionVisibility;
121122
enabled: boolean;
@@ -136,6 +137,8 @@ export class InitSectionAction implements Action {
136137
* the section's config
137138
* @param mandatory
138139
* the section's mandatory
140+
* @param scope
141+
* the section's scope
139142
* @param sectionType
140143
* the section's type
141144
* @param visibility
@@ -152,12 +155,13 @@ export class InitSectionAction implements Action {
152155
header: string,
153156
config: string,
154157
mandatory: boolean,
158+
scope: SectionScope,
155159
sectionType: SectionsType,
156160
visibility: SectionVisibility,
157161
enabled: boolean,
158162
data: WorkspaceitemSectionDataType,
159163
errors: SubmissionSectionError[]) {
160-
this.payload = { submissionId, sectionId, header, config, mandatory, sectionType, visibility, enabled, data, errors };
164+
this.payload = { submissionId, sectionId, header, config, mandatory, scope, sectionType, visibility, enabled, data, errors };
161165
}
162166
}
163167

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ describe('SubmissionObjectEffects test suite', () => {
151151
sectionDefinition.header,
152152
config,
153153
sectionDefinition.mandatory,
154+
sectionDefinition.scope,
154155
sectionDefinition.sectionType,
155156
sectionDefinition.visibility,
156157
enabled,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export class SubmissionObjectEffects {
8787
sectionDefinition.header,
8888
config,
8989
sectionDefinition.mandatory,
90+
sectionDefinition.scope,
9091
sectionDefinition.sectionType,
9192
sectionDefinition.visibility,
9293
enabled,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ describe('submissionReducer test suite', () => {
233233
header: 'submit.progressbar.describe.stepone',
234234
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
235235
mandatory: true,
236+
scope: null,
236237
sectionType: 'submission-form',
237238
visibility: undefined,
238239
collapsed: false,
@@ -253,6 +254,7 @@ describe('submissionReducer test suite', () => {
253254
'submit.progressbar.describe.stepone',
254255
'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
255256
true,
257+
null,
256258
SectionsType.SubmissionForm,
257259
undefined,
258260
true,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ function initSection(state: SubmissionObjectState, action: InitSectionAction): S
548548
header: action.payload.header,
549549
config: action.payload.config,
550550
mandatory: action.payload.mandatory,
551+
scope: action.payload.scope,
551552
sectionType: action.payload.sectionType,
552553
visibility: action.payload.visibility,
553554
collapsed: false,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SectionsType } from '../sections/sections-type';
2-
import { SectionVisibility } from './section-visibility.model';
2+
import { SectionScope, SectionVisibility } from './section-visibility.model';
33
import { WorkspaceitemSectionDataType } from '../../core/submission/models/workspaceitem-sections.model';
44
import { SubmissionSectionError } from './submission-section-error.model';
55

@@ -22,6 +22,11 @@ export interface SubmissionSectionObject {
2222
*/
2323
mandatory: boolean;
2424

25+
/**
26+
* The submission scope for this section
27+
*/
28+
scope: SectionScope;
29+
2530
/**
2631
* The section type
2732
*/

0 commit comments

Comments
 (0)