mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
87242: Refactor workspaceItem to submissionObject
This commit is contained in:
@@ -357,7 +357,7 @@ describe('SubmissionSectionFormComponent test suite', () => {
|
|||||||
describe('in workspace scope', () => {
|
describe('in workspace scope', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
comp.workspaceItem = { type: WorkspaceItem.type };
|
comp.submissionObject = { type: WorkspaceItem.type };
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true for unscoped fields', () => {
|
it('should return true for unscoped fields', () => {
|
||||||
@@ -376,7 +376,7 @@ describe('SubmissionSectionFormComponent test suite', () => {
|
|||||||
describe('in workflow scope', () => {
|
describe('in workflow scope', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
comp.workspaceItem = { type: WorkflowItem.type };
|
comp.submissionObject = { type: WorkflowItem.type };
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true when field is unscoped', () => {
|
it('should return true when field is unscoped', () => {
|
||||||
|
@@ -36,6 +36,7 @@ import { ConfigObject } from '../../../core/config/models/config.model';
|
|||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { SubmissionScopeType } from '../../../core/submission/submission-scope-type';
|
import { SubmissionScopeType } from '../../../core/submission/submission-scope-type';
|
||||||
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
||||||
|
import { SubmissionObject } from '../../../core/submission/models/submission-object.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents a section that contains a Form.
|
* This component represents a section that contains a Form.
|
||||||
@@ -114,7 +115,7 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
|
|||||||
*/
|
*/
|
||||||
protected subs: Subscription[] = [];
|
protected subs: Subscription[] = [];
|
||||||
|
|
||||||
protected workspaceItem: WorkspaceItem;
|
protected submissionObject: SubmissionObject;
|
||||||
/**
|
/**
|
||||||
* The FormComponent reference
|
* The FormComponent reference
|
||||||
*/
|
*/
|
||||||
@@ -175,10 +176,10 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
|
|||||||
getRemoteDataPayload())
|
getRemoteDataPayload())
|
||||||
])),
|
])),
|
||||||
take(1))
|
take(1))
|
||||||
.subscribe(([sectionData, workspaceItem]: [WorkspaceitemSectionFormObject, WorkspaceItem]) => {
|
.subscribe(([sectionData, submissionObject]: [WorkspaceitemSectionFormObject, SubmissionObject]) => {
|
||||||
if (isUndefined(this.formModel)) {
|
if (isUndefined(this.formModel)) {
|
||||||
// this.sectionData.errorsToShow = [];
|
// this.sectionData.errorsToShow = [];
|
||||||
this.workspaceItem = workspaceItem;
|
this.submissionObject = submissionObject;
|
||||||
// Is the first loading so init form
|
// Is the first loading so init form
|
||||||
this.initForm(sectionData);
|
this.initForm(sectionData);
|
||||||
this.sectionData.data = sectionData;
|
this.sectionData.data = sectionData;
|
||||||
@@ -259,10 +260,10 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
|
|||||||
|
|
||||||
switch (scope) {
|
switch (scope) {
|
||||||
case SubmissionScopeType.WorkspaceItem: {
|
case SubmissionScopeType.WorkspaceItem: {
|
||||||
return this.workspaceItem.type === WorkspaceItem.type;
|
return this.submissionObject.type === WorkspaceItem.type;
|
||||||
}
|
}
|
||||||
case SubmissionScopeType.WorkflowItem: {
|
case SubmissionScopeType.WorkflowItem: {
|
||||||
return this.workspaceItem.type === WorkflowItem.type;
|
return this.submissionObject.type === WorkflowItem.type;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user