Skip to content

Commit 819e693

Browse files
dspace-botrootatarix83
authored
[Port dspace-8_x] Fix issue with submission sections visibility (#3761)
* Removing position-fixed bootstrap class so that navbar links are available again (cherry picked from commit 351abaa) (cherry picked from commit 5c4df87) * A new approach so that the elements of the ds-file-dropzone-no-uploader component don't overlap the navbar and make it inaccessible (cherry picked from commit 2c259f5) (cherry picked from commit ee5af8f) * [DURACOM-291] fix submission section visibility in order to rely on the configured section scope (cherry picked from commit 8e8979a) * Removing position-fixed bootstrap class so that navbar links are available again (cherry picked from commit 351abaa) (cherry picked from commit 3ecec3a) * A new approach so that the elements of the ds-file-dropzone-no-uploader component don't overlap the navbar and make it inaccessible (cherry picked from commit 2c259f5) (cherry picked from commit 25e2c76) --------- Co-authored-by: root <[email protected]> Co-authored-by: Giuseppe Digilio <[email protected]>
1 parent 6380f13 commit 819e693

13 files changed

+536
-88
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,16 @@ import {
44
inheritSerialization,
55
} from 'cerialize';
66

7+
import {
8+
SectionScope,
9+
SectionVisibility,
10+
} from '../../../submission/objects/section-visibility.model';
711
import { SectionsType } from '../../../submission/sections/sections-type';
812
import { typedObject } from '../../cache/builders/build-decorators';
913
import { HALLink } from '../../shared/hal-link.model';
1014
import { ConfigObject } from './config.model';
1115
import { SUBMISSION_SECTION_TYPE } from './config-type';
1216

13-
/**
14-
* An interface that define section visibility and its properties.
15-
*/
16-
export interface SubmissionSectionVisibility {
17-
main: any;
18-
other: any;
19-
}
20-
2117
@typedObject
2218
@inheritSerialization(ConfigObject)
2319
export class SubmissionSectionModel extends ConfigObject {
@@ -35,17 +31,23 @@ export class SubmissionSectionModel extends ConfigObject {
3531
@autoserialize
3632
mandatory: boolean;
3733

34+
/**
35+
* The submission scope for this section
36+
*/
37+
@autoserialize
38+
scope: SectionScope;
39+
3840
/**
3941
* A string representing the kind of section object
4042
*/
4143
@autoserialize
4244
sectionType: SectionsType;
4345

4446
/**
45-
* The [SubmissionSectionVisibility] object for this section
47+
* The [SectionVisibility] object for this section
4648
*/
4749
@autoserialize
48-
visibility: SubmissionSectionVisibility;
50+
visibility: SectionVisibility;
4951

5052
/**
5153
* The {@link HALLink}s for this SubmissionSectionModel

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ import {
2222

2323
import { AuthService } from '../../core/auth/auth.service';
2424
import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model';
25-
import {
26-
SubmissionSectionModel,
27-
SubmissionSectionVisibility,
28-
} from '../../core/config/models/config-submission-section.model';
25+
import { SubmissionSectionModel } from '../../core/config/models/config-submission-section.model';
2926
import { Collection } from '../../core/shared/collection.model';
3027
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
3128
import { Item } from '../../core/shared/item.model';
@@ -38,6 +35,7 @@ import {
3835
} from '../../shared/empty.util';
3936
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
4037
import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model';
38+
import { SectionVisibility } from '../objects/section-visibility.model';
4139
import { SubmissionError } from '../objects/submission-error.model';
4240
import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
4341
import { SubmissionSectionContainerComponent } from '../sections/container/section-container.component';
@@ -233,7 +231,7 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
233231
/**
234232
* Returns the visibility object of the collection section
235233
*/
236-
private getCollectionVisibility(): SubmissionSectionVisibility {
234+
private getCollectionVisibility(): SectionVisibility {
237235
const submissionSectionModel: SubmissionSectionModel =
238236
this.submissionDefinition.sections.page.find(
239237
(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: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import {
1111
} from '../../core/submission/models/workspaceitem-sections.model';
1212
import { type } from '../../shared/ngrx/type';
1313
import { SectionsType } from '../sections/sections-type';
14-
import { SectionVisibility } from './section-visibility.model';
14+
import {
15+
SectionScope,
16+
SectionVisibility,
17+
} from './section-visibility.model';
1518
import { SubmissionError } from './submission-error.model';
1619
import { SubmissionSectionError } from './submission-section-error.model';
1720

@@ -120,6 +123,7 @@ export class InitSectionAction implements Action {
120123
header: string;
121124
config: string;
122125
mandatory: boolean;
126+
scope: SectionScope;
123127
sectionType: SectionsType;
124128
visibility: SectionVisibility;
125129
enabled: boolean;
@@ -140,6 +144,8 @@ export class InitSectionAction implements Action {
140144
* the section's config
141145
* @param mandatory
142146
* the section's mandatory
147+
* @param scope
148+
* the section's scope
143149
* @param sectionType
144150
* the section's type
145151
* @param visibility
@@ -156,12 +162,13 @@ export class InitSectionAction implements Action {
156162
header: string,
157163
config: string,
158164
mandatory: boolean,
165+
scope: SectionScope,
159166
sectionType: SectionsType,
160167
visibility: SectionVisibility,
161168
enabled: boolean,
162169
data: WorkspaceitemSectionDataType,
163170
errors: SubmissionSectionError[]) {
164-
this.payload = { submissionId, sectionId, header, config, mandatory, sectionType, visibility, enabled, data, errors };
171+
this.payload = { submissionId, sectionId, header, config, mandatory, scope, sectionType, visibility, enabled, data, errors };
165172
}
166173
}
167174

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ describe('SubmissionObjectEffects test suite', () => {
167167
sectionDefinition.header,
168168
config,
169169
sectionDefinition.mandatory,
170+
sectionDefinition.scope,
170171
sectionDefinition.sectionType,
171172
sectionDefinition.visibility,
172173
enabled,

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
sectionDefinition.header,
117117
config,
118118
sectionDefinition.mandatory,
119+
sectionDefinition.scope,
119120
sectionDefinition.sectionType,
120121
sectionDefinition.visibility,
121122
enabled,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ describe('submissionReducer test suite', () => {
237237
header: 'submit.progressbar.describe.stepone',
238238
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
239239
mandatory: true,
240+
scope: null,
240241
sectionType: 'submission-form',
241242
visibility: undefined,
242243
collapsed: false,
@@ -257,6 +258,7 @@ describe('submissionReducer test suite', () => {
257258
'submit.progressbar.describe.stepone',
258259
'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
259260
true,
261+
null,
260262
SectionsType.SubmissionForm,
261263
undefined,
262264
true,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ function initSection(state: SubmissionObjectState, action: InitSectionAction): S
565565
header: action.payload.header,
566566
config: action.payload.config,
567567
mandatory: action.payload.mandatory,
568+
scope: action.payload.scope,
568569
sectionType: action.payload.sectionType,
569570
visibility: action.payload.visibility,
570571
collapsed: false,

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

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

69
/**
@@ -22,6 +25,11 @@ export interface SubmissionSectionObject {
2225
*/
2326
mandatory: boolean;
2427

28+
/**
29+
* The submission scope for this section
30+
*/
31+
scope: SectionScope;
32+
2533
/**
2634
* The section type
2735
*/

0 commit comments

Comments
 (0)