diff --git a/src/app/core/eperson/models/workspaceitem.resource-type.ts b/src/app/core/eperson/models/workspaceitem.resource-type.ts new file mode 100644 index 0000000000..e141d45a9f --- /dev/null +++ b/src/app/core/eperson/models/workspaceitem.resource-type.ts @@ -0,0 +1,3 @@ +import { ResourceType } from '../../shared/resource-type'; + +export const WORKSPACEITEM = new ResourceType('workspaceitem'); diff --git a/src/app/core/submission/models/workspaceitem.model.ts b/src/app/core/submission/models/workspaceitem.model.ts index 0bfacdb475..62f21cb2f3 100644 --- a/src/app/core/submission/models/workspaceitem.model.ts +++ b/src/app/core/submission/models/workspaceitem.model.ts @@ -2,7 +2,7 @@ import { deserializeAs, inheritSerialization } from 'cerialize'; import { inheritLinkAnnotations, typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { SubmissionObject } from './submission-object.model'; -import { ResourceType } from '../../shared/resource-type'; +import { WORKSPACEITEM } from '../../eperson/models/workspaceitem.resource-type'; /** * A model class for a WorkspaceItem. @@ -11,7 +11,7 @@ import { ResourceType } from '../../shared/resource-type'; @inheritSerialization(SubmissionObject) @inheritLinkAnnotations(SubmissionObject) export class WorkspaceItem extends SubmissionObject { - static type = new ResourceType('workspaceitem'); + static type = WORKSPACEITEM; /** * The universally unique identifier of this WorkspaceItem diff --git a/src/app/submission/sections/form/section-form.component.spec.ts b/src/app/submission/sections/form/section-form.component.spec.ts index beea55968c..c5205c070b 100644 --- a/src/app/submission/sections/form/section-form.component.spec.ts +++ b/src/app/submission/sections/form/section-form.component.spec.ts @@ -357,7 +357,7 @@ describe('SubmissionSectionFormComponent test suite', () => { describe('in workspace scope', () => { beforeEach(() => { // @ts-ignore - comp.submissionObject = { type: WorkspaceItem.type }; + comp.submissionObject = { type: WorkspaceItem.type.value }; }); it('should return true for unscoped fields', () => { @@ -376,7 +376,7 @@ describe('SubmissionSectionFormComponent test suite', () => { describe('in workflow scope', () => { beforeEach(() => { // @ts-ignore - comp.submissionObject = { type: WorkflowItem.type }; + comp.submissionObject = { type: WorkflowItem.type.value }; }); it('should return true when field is unscoped', () => { diff --git a/src/app/submission/sections/form/section-form.component.ts b/src/app/submission/sections/form/section-form.component.ts index 3fdc3cf486..17e44688a0 100644 --- a/src/app/submission/sections/form/section-form.component.ts +++ b/src/app/submission/sections/form/section-form.component.ts @@ -261,10 +261,10 @@ export class SubmissionSectionFormComponent extends SectionModelComponent { switch (scope) { case SubmissionScopeType.WorkspaceItem: { - return this.submissionObject.type === WorkspaceItem.type; + return (this.submissionObject as any).type === WorkspaceItem.type.value; } case SubmissionScopeType.WorkflowItem: { - return this.submissionObject.type === WorkflowItem.type; + return (this.submissionObject as any).type === WorkflowItem.type.value; } default: { return true;