From 93e0828135036306b9eea06f02fb48344a3e9daf Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Tue, 12 Oct 2021 16:23:47 +0200 Subject: [PATCH] [CST-4591] Hide none item type entry from available entities in the collection form --- .../collection-form/collection-form.component.ts | 5 ++++- .../shared/item-relationships/item-type.resource-type.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/collection-page/collection-form/collection-form.component.ts b/src/app/collection-page/collection-form/collection-form.component.ts index c4c8635991..a802a7bdc1 100644 --- a/src/app/collection-page/collection-form/collection-form.component.ts +++ b/src/app/collection-page/collection-form/collection-form.component.ts @@ -23,6 +23,7 @@ import { ItemType } from '../../core/shared/item-relationships/item-type.model'; import { MetadataValue } from '../../core/shared/metadata.models'; import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators'; import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models'; +import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type'; /** * Form used for creating and editing collections @@ -80,7 +81,9 @@ export class CollectionFormComponent extends ComColFormComponent imp // retrieve all entity types to populate the dropdowns selection entities$.subscribe((entityTypes: ItemType[]) => { - entityTypes.forEach((type: ItemType, index: number) => { + entityTypes + .filter((type: ItemType) => type.label !== NONE_ENTITY_TYPE) + .forEach((type: ItemType, index: number) => { this.entityTypeSelection.add({ disabled: false, label: type.label, diff --git a/src/app/core/shared/item-relationships/item-type.resource-type.ts b/src/app/core/shared/item-relationships/item-type.resource-type.ts index 616dc23b73..e820bc22f4 100644 --- a/src/app/core/shared/item-relationships/item-type.resource-type.ts +++ b/src/app/core/shared/item-relationships/item-type.resource-type.ts @@ -6,5 +6,9 @@ import { ResourceType } from '../resource-type'; * Needs to be in a separate file to prevent circular * dependencies in webpack. */ - export const ITEM_TYPE = new ResourceType('entitytype'); + +/** + * The unset entity type + */ +export const NONE_ENTITY_TYPE = 'none';