Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Port dspace-8_x] Fix issue with submission sections visibility #3761

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/app/core/config/models/config-submission-section.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ import {
inheritSerialization,
} from 'cerialize';

import {
SectionScope,
SectionVisibility,
} from '../../../submission/objects/section-visibility.model';
import { SectionsType } from '../../../submission/sections/sections-type';
import { typedObject } from '../../cache/builders/build-decorators';
import { HALLink } from '../../shared/hal-link.model';
import { ConfigObject } from './config.model';
import { SUBMISSION_SECTION_TYPE } from './config-type';

/**
* An interface that define section visibility and its properties.
*/
export interface SubmissionSectionVisibility {
main: any;
other: any;
}

@typedObject
@inheritSerialization(ConfigObject)
export class SubmissionSectionModel extends ConfigObject {
Expand All @@ -35,17 +31,23 @@ export class SubmissionSectionModel extends ConfigObject {
@autoserialize
mandatory: boolean;

/**
* The submission scope for this section
*/
@autoserialize
scope: SectionScope;

/**
* A string representing the kind of section object
*/
@autoserialize
sectionType: SectionsType;

/**
* The [SubmissionSectionVisibility] object for this section
* The [SectionVisibility] object for this section
*/
@autoserialize
visibility: SubmissionSectionVisibility;
visibility: SectionVisibility;

/**
* The {@link HALLink}s for this SubmissionSectionModel
Expand Down
8 changes: 3 additions & 5 deletions src/app/submission/form/submission-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ import {

import { AuthService } from '../../core/auth/auth.service';
import { SubmissionDefinitionsModel } from '../../core/config/models/config-submission-definitions.model';
import {
SubmissionSectionModel,
SubmissionSectionVisibility,
} from '../../core/config/models/config-submission-section.model';
import { SubmissionSectionModel } from '../../core/config/models/config-submission-section.model';
import { Collection } from '../../core/shared/collection.model';
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
import { Item } from '../../core/shared/item.model';
Expand All @@ -38,6 +35,7 @@ import {
} from '../../shared/empty.util';
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
import { UploaderOptions } from '../../shared/upload/uploader/uploader-options.model';
import { SectionVisibility } from '../objects/section-visibility.model';
import { SubmissionError } from '../objects/submission-error.model';
import { SubmissionObjectEntry } from '../objects/submission-objects.reducer';
import { SubmissionSectionContainerComponent } from '../sections/container/section-container.component';
Expand Down Expand Up @@ -233,7 +231,7 @@ export class SubmissionFormComponent implements OnChanges, OnDestroy {
/**
* Returns the visibility object of the collection section
*/
private getCollectionVisibility(): SubmissionSectionVisibility {
private getCollectionVisibility(): SectionVisibility {
const submissionSectionModel: SubmissionSectionModel =
this.submissionDefinition.sections.page.find(
(section) => isEqual(section.sectionType, SectionsType.Collection),
Expand Down
6 changes: 6 additions & 0 deletions src/app/submission/objects/section-visibility.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ export interface SectionVisibility {
main: any;
other: any;
}


export enum SectionScope {
Submission = 'SUBMISSION',
Workflow = 'WORKFLOW',
}
11 changes: 9 additions & 2 deletions src/app/submission/objects/submission-objects.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
} from '../../core/submission/models/workspaceitem-sections.model';
import { type } from '../../shared/ngrx/type';
import { SectionsType } from '../sections/sections-type';
import { SectionVisibility } from './section-visibility.model';
import {
SectionScope,
SectionVisibility,
} from './section-visibility.model';
import { SubmissionError } from './submission-error.model';
import { SubmissionSectionError } from './submission-section-error.model';

Expand Down Expand Up @@ -120,6 +123,7 @@ export class InitSectionAction implements Action {
header: string;
config: string;
mandatory: boolean;
scope: SectionScope;
sectionType: SectionsType;
visibility: SectionVisibility;
enabled: boolean;
Expand All @@ -140,6 +144,8 @@ export class InitSectionAction implements Action {
* the section's config
* @param mandatory
* the section's mandatory
* @param scope
* the section's scope
* @param sectionType
* the section's type
* @param visibility
Expand All @@ -156,12 +162,13 @@ export class InitSectionAction implements Action {
header: string,
config: string,
mandatory: boolean,
scope: SectionScope,
sectionType: SectionsType,
visibility: SectionVisibility,
enabled: boolean,
data: WorkspaceitemSectionDataType,
errors: SubmissionSectionError[]) {
this.payload = { submissionId, sectionId, header, config, mandatory, sectionType, visibility, enabled, data, errors };
this.payload = { submissionId, sectionId, header, config, mandatory, scope, sectionType, visibility, enabled, data, errors };
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ describe('SubmissionObjectEffects test suite', () => {
sectionDefinition.header,
config,
sectionDefinition.mandatory,
sectionDefinition.scope,
sectionDefinition.sectionType,
sectionDefinition.visibility,
enabled,
Expand Down
1 change: 1 addition & 0 deletions src/app/submission/objects/submission-objects.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class SubmissionObjectEffects {
sectionDefinition.header,
config,
sectionDefinition.mandatory,
sectionDefinition.scope,
sectionDefinition.sectionType,
sectionDefinition.visibility,
enabled,
Expand Down
2 changes: 2 additions & 0 deletions src/app/submission/objects/submission-objects.reducer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ describe('submissionReducer test suite', () => {
header: 'submit.progressbar.describe.stepone',
config: 'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
mandatory: true,
scope: null,
sectionType: 'submission-form',
visibility: undefined,
collapsed: false,
Expand All @@ -257,6 +258,7 @@ describe('submissionReducer test suite', () => {
'submit.progressbar.describe.stepone',
'https://rest.api/dspace-spring-rest/api/config/submissionforms/traditionalpageone',
true,
null,
SectionsType.SubmissionForm,
undefined,
true,
Expand Down
1 change: 1 addition & 0 deletions src/app/submission/objects/submission-objects.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ function initSection(state: SubmissionObjectState, action: InitSectionAction): S
header: action.payload.header,
config: action.payload.config,
mandatory: action.payload.mandatory,
scope: action.payload.scope,
sectionType: action.payload.sectionType,
visibility: action.payload.visibility,
collapsed: false,
Expand Down
10 changes: 9 additions & 1 deletion src/app/submission/objects/submission-section-object.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { WorkspaceitemSectionDataType } from '../../core/submission/models/workspaceitem-sections.model';
import { SectionsType } from '../sections/sections-type';
import { SectionVisibility } from './section-visibility.model';
import {
SectionScope,
SectionVisibility,
} from './section-visibility.model';
import { SubmissionSectionError } from './submission-section-error.model';

/**
Expand All @@ -22,6 +25,11 @@ export interface SubmissionSectionObject {
*/
mandatory: boolean;

/**
* The submission scope for this section
*/
scope: SectionScope;

/**
* The section type
*/
Expand Down
Loading
Loading