diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity.ts index b77ddcfce0..6bb724db00 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity.ts @@ -1,7 +1,5 @@ export const UMB_TEMPLATE_ROOT_ENTITY_TYPE = 'template-root'; export const UMB_TEMPLATE_ENTITY_TYPE = 'template'; -export const UMB_TEMPLATE_FOLDER_ENTITY_TYPE = 'template-folder'; export type UmbTemplateEntityType = typeof UMB_TEMPLATE_ENTITY_TYPE; export type UmbTemplateRootEntityType = typeof UMB_TEMPLATE_ROOT_ENTITY_TYPE; -export type UmbTemplateFolderEntityType = typeof UMB_TEMPLATE_FOLDER_ENTITY_TYPE; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/manifests.ts index ca6e077e34..80939b7dd6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/manifests.ts @@ -38,7 +38,7 @@ const tree: ManifestTree = { const treeItem: ManifestTreeItem = { type: 'treeItem', - kind: 'entity', + kind: 'unique', alias: 'Umb.TreeItem.Template', name: 'Template Tree Item', meta: { diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/reload-tree-item-children/manifests.ts index 180da25ef5..d1b3b478af 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/reload-tree-item-children/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/reload-tree-item-children/manifests.ts @@ -1,8 +1,4 @@ -import { - UMB_TEMPLATE_ROOT_ENTITY_TYPE, - UMB_TEMPLATE_ENTITY_TYPE, - UMB_TEMPLATE_FOLDER_ENTITY_TYPE, -} from '../../entity.js'; +import { UMB_TEMPLATE_ROOT_ENTITY_TYPE, UMB_TEMPLATE_ENTITY_TYPE } from '../../entity.js'; import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; @@ -17,7 +13,7 @@ export const manifests: Array = [ icon: 'icon-refresh', label: 'Reload children...', repositoryAlias: 'Umb.Repository.Template.Tree', - entityTypes: [UMB_TEMPLATE_ROOT_ENTITY_TYPE, UMB_TEMPLATE_ENTITY_TYPE, UMB_TEMPLATE_FOLDER_ENTITY_TYPE], + entityTypes: [UMB_TEMPLATE_ROOT_ENTITY_TYPE, UMB_TEMPLATE_ENTITY_TYPE], }, }, ]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.repository.ts index 4fa3640b12..a726147c6b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.repository.ts @@ -16,7 +16,7 @@ export class UmbTemplateTreeRepository async requestTreeRoot() { const data: UmbTemplateTreeRootModel = { - id: null, + unique: null, entityType: UMB_TEMPLATE_ROOT_ENTITY_TYPE, name: 'Templates', hasChildren: true, diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.server.data-source.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.server.data-source.ts index 026461555f..c97e37e255 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.server.data-source.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.server.data-source.ts @@ -1,3 +1,4 @@ +import { UMB_TEMPLATE_ENTITY_TYPE } from '../entity.js'; import type { UmbTemplateTreeItemModel } from './types.js'; import { UmbTreeServerDataSourceBase } from '@umbraco-cms/backoffice/tree'; import type { NamedEntityTreeItemResponseModel } from '@umbraco-cms/backoffice/backend-api'; @@ -44,10 +45,10 @@ const getChildrenOf = (parentUnique: string | null) => { const mapper = (item: NamedEntityTreeItemResponseModel): UmbTemplateTreeItemModel => { return { - id: item.id, - parentId: item.parent ? item.parent.id : null, + unique: item.id, + parentUnique: item.parent ? item.parent.id : null, name: item.name, - entityType: 'template', + entityType: UMB_TEMPLATE_ENTITY_TYPE, hasChildren: item.hasChildren, isFolder: false, }; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.store.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.store.ts index a878f3eb9b..ca16f4e581 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.store.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/template-tree.store.ts @@ -1,6 +1,6 @@ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; -import { UmbEntityTreeStore } from '@umbraco-cms/backoffice/tree'; +import { UmbUniqueTreeStore } from '@umbraco-cms/backoffice/tree'; /** * @export @@ -8,7 +8,7 @@ import { UmbEntityTreeStore } from '@umbraco-cms/backoffice/tree'; * @extends {UmbStoreBase} * @description - Tree Data Store for Template Items */ -export class UmbTemplateTreeStore extends UmbEntityTreeStore { +export class UmbTemplateTreeStore extends UmbUniqueTreeStore { /** * Creates an instance of UmbTemplateTreeStore. * @param {UmbControllerHostElement} host diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/types.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/types.ts index 4287456d4c..67e6f03d6f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/types.ts @@ -1,5 +1,10 @@ -import type { UmbEntityTreeItemModel, UmbEntityTreeRootModel } from '@umbraco-cms/backoffice/tree'; +import type { UmbTemplateEntityType, UmbTemplateRootEntityType } from '../entity.js'; +import type { UmbUniqueTreeItemModel, UmbUniqueTreeRootModel } from '@umbraco-cms/backoffice/tree'; -export interface UmbTemplateTreeItemModel extends UmbEntityTreeItemModel {} -// TODO: TREE STORE TYPE PROBLEM: -export interface UmbTemplateTreeRootModel extends UmbEntityTreeRootModel {} +export interface UmbTemplateTreeItemModel extends UmbUniqueTreeItemModel { + entityType: UmbTemplateEntityType; +} + +export interface UmbTemplateTreeRootModel extends UmbUniqueTreeRootModel { + entityType: UmbTemplateRootEntityType; +}