diff --git a/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/folder.handlers.ts b/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/folder.handlers.ts new file mode 100644 index 0000000000..565890e0b3 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/folder.handlers.ts @@ -0,0 +1,44 @@ +const { rest } = window.MockServiceWorker; +import { umbDocumentTypeMockDb } from '../../data/document-type/document-type.db.js'; +import { UMB_SLUG } from './slug.js'; +import { umbracoPath } from '@umbraco-cms/backoffice/utils'; + +export const folderHandlers = [ + rest.post(umbracoPath(`${UMB_SLUG}/folder`), async (req, res, ctx) => { + const requestBody = await req.json(); + if (!requestBody) return res(ctx.status(400, 'no body found')); + + const id = umbDocumentTypeMockDb.folder.create(requestBody); + + return res( + ctx.status(201), + ctx.set({ + Location: req.url.href + '/' + id, + 'Umb-Generated-Resource': id, + }), + ); + }), + + rest.get(umbracoPath(`${UMB_SLUG}/folder/:id`), (req, res, ctx) => { + const id = req.params.id as string; + if (!id) return res(ctx.status(400)); + const response = umbDocumentTypeMockDb.folder.read(id); + return res(ctx.status(200), ctx.json(response)); + }), + + rest.put(umbracoPath(`${UMB_SLUG}/folder/:id`), async (req, res, ctx) => { + const id = req.params.id as string; + if (!id) return res(ctx.status(400, 'no id found')); + const requestBody = await req.json(); + if (!requestBody) return res(ctx.status(400, 'no body found')); + umbDocumentTypeMockDb.folder.update(id, requestBody); + return res(ctx.status(200)); + }), + + rest.delete(umbracoPath(`${UMB_SLUG}/folder/:id`), (req, res, ctx) => { + const id = req.params.id as string; + if (!id) return res(ctx.status(400)); + umbDocumentTypeMockDb.folder.delete(id); + return res(ctx.status(200)); + }), +]; diff --git a/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/index.ts b/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/index.ts index 30239f1212..c905d34111 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/index.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/handlers/document-type/index.ts @@ -1,5 +1,6 @@ import { treeHandlers } from './tree.handlers.js'; import { detailHandlers } from './detail.handlers.js'; import { itemHandlers } from './item.handlers.js'; +import { folderHandlers } from './folder.handlers.js'; -export const handlers = [...treeHandlers, ...itemHandlers, ...detailHandlers]; +export const handlers = [...treeHandlers, ...itemHandlers, ...folderHandlers, ...detailHandlers]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/action/action.event.ts b/src/Umbraco.Web.UI.Client/src/packages/core/action/action.event.ts deleted file mode 100644 index 98a6a7713b..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/core/action/action.event.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { UmbControllerEvent } from '@umbraco-cms/backoffice/controller-api'; - -export interface UmbActionEventArgs { - unique: string; - parentUnique: string | null; // TODO: remove this when we have endpoints to support mapping a new item without reloading the parent tree item -} - -export class UmbActionEvent extends UmbControllerEvent { - #args: UmbActionEventArgs; - - public constructor(type: string, args: UmbActionEventArgs) { - super(type); - this.#args = args; - } - - getUnique(): string { - return this.#args.unique; - } - - // TODO: this can be removed when the server supports reloading a tree item without reloading the parent - getParentUnique(): string | null { - return this.#args.parentUnique; - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts index 05f892981b..79e8f1b8b6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/action/index.ts @@ -1,4 +1,3 @@ export * from './repository-action.js'; export * from './action.interface.js'; export * from './action-event.context.js'; -export * from './action.event.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/copy/copy.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/copy/copy.action.ts index 382e1b2b14..c819029c7b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/copy/copy.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/copy/copy.action.ts @@ -12,8 +12,8 @@ import { export class UmbCopyDataTypeEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/create/create.action.ts index f6df91f682..595b2f3843 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/create/create.action.ts @@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/move/move.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/move/move.action.ts index a65acb4c9b..13a39b618a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/move/move.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/entity-actions/move/move.action.ts @@ -12,8 +12,8 @@ import { export class UmbMoveDataTypeEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/manifests.ts index bee8b4e5ec..6ab730ac33 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/manifests.ts @@ -1,4 +1,5 @@ import { manifests as folderManifests } from './folder/manifests.js'; +import { manifests as reloadManifests } from './reload-tree-item-children/manifests.js'; import { UmbDataTypeTreeRepository } from './data-type-tree.repository.js'; import { UmbDataTypeTreeStore } from './data-type-tree.store.js'; import type { @@ -44,4 +45,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests, ...reloadManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..2aca5cd675 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/data-type/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,24 @@ +import { + UMB_DATA_TYPE_ENTITY_TYPE, + UMB_DATA_TYPE_FOLDER_ENTITY_TYPE, + UMB_DATA_TYPE_ROOT_ENTITY_TYPE, +} from '../../entity.js'; +import { UMB_DATA_TYPE_DETAIL_REPOSITORY_ALIAS } from '../../repository/index.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import { type ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.DataType.Tree.ReloadTreeItemChildren', + name: 'Reload Data Type Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: UMB_DATA_TYPE_DETAIL_REPOSITORY_ALIAS, + entityTypes: [UMB_DATA_TYPE_ENTITY_TYPE, UMB_DATA_TYPE_ROOT_ENTITY_TYPE, UMB_DATA_TYPE_FOLDER_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/copy/copy.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/copy/copy.action.ts index a8431cf7d9..325a9a833d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/copy/copy.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/copy/copy.action.ts @@ -2,8 +2,8 @@ import { UmbEntityActionBase } from '../../entity-action.js'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbCopyEntityAction }> extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts index 6a5e9b4fdb..ff428c2f09 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/delete/delete.action.ts @@ -10,8 +10,8 @@ export class UmbDeleteEntityAction< > extends UmbEntityActionBase { #modalManager?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); new UmbContextConsumerController(this._host, UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManager = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/move/move.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/move/move.action.ts index 3313c6fb58..bb335db76f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/move/move.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/move/move.action.ts @@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle // TODO: investigate what we need to finish the generic move action. We would need to open a picker, which requires a modal token, // maybe we can use kinds to make a specific manifest to the move action. export class UmbMoveEntityAction }> extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/rename/rename.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/rename/rename.action.ts index a718fa1d2f..80947140c0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/rename/rename.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/rename/rename.action.ts @@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbRenameEntityAction extends UmbEntityActionBase> { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/sort-children-of/sort-children-of.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/sort-children-of/sort-children-of.action.ts index 88a75fc50a..d162969d22 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/sort-children-of/sort-children-of.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/sort-children-of/sort-children-of.action.ts @@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle export class UmbSortChildrenOfEntityAction< T extends { sortChildrenOf(): Promise }, > extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/trash/trash.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/trash/trash.action.ts index c5f29fafc4..eb51e0520c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/trash/trash.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/common/trash/trash.action.ts @@ -10,8 +10,8 @@ export class UmbTrashEntityAction< > extends UmbEntityActionBase { #modalContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); new UmbContextConsumerController(this._host, UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action-list.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action-list.element.ts index 42f7ade92f..4cfd6e860f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action-list.element.ts @@ -30,7 +30,7 @@ export class UmbEntityActionListElement extends UmbLitElement { type="entityAction" default-element="umb-entity-action" .filter=${this._filter} - .props=${{ unique: this.unique }}> + .props=${{ unique: this.unique, entityType: this.entityType }}> ` : ''; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts index 7c95828fae..c5fd03d3e1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.element.ts @@ -7,6 +7,20 @@ import { createExtensionApi } from '@umbraco-cms/backoffice/extension-api'; @customElement('umb-entity-action') export class UmbEntityActionElement extends UmbLitElement { + private _entityType?: string | null; + @property({ type: String }) + public get entityType() { + return this._entityType; + } + public set entityType(value: string | undefined | null) { + const oldValue = this._entityType; + this._entityType = value; + if (oldValue !== this._entityType) { + this.#createApi(); + this.requestUpdate('entityType', oldValue); + } + } + private _unique?: string | null; @property({ type: String }) public get unique() { @@ -37,10 +51,17 @@ export class UmbEntityActionElement extends UmbLitElement { } async #createApi() { + // only create the api if we have all the required properties if (!this._manifest) return; if (this._unique === undefined) return; + if (!this._entityType) return; - this.#api = await createExtensionApi(this._manifest, [this, this._manifest.meta.repositoryAlias, this.unique]); + this.#api = await createExtensionApi(this._manifest, [ + this, + this._manifest.meta.repositoryAlias, + this.unique, + this.entityType, + ]); // TODO: Fix so when we use a HREF it does not refresh the page? this._href = await this.#api.getHref?.(); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.event.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.event.ts new file mode 100644 index 0000000000..4eafc96b78 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.event.ts @@ -0,0 +1,23 @@ +import { UmbControllerEvent } from '@umbraco-cms/backoffice/controller-api'; + +export interface UmbEntityActionEventArgs { + unique: string; + entityType: string; +} + +export class UmbEntityActionEvent extends UmbControllerEvent { + #args: UmbEntityActionEventArgs; + + public constructor(type: string, args: UmbEntityActionEventArgs) { + super(type); + this.#args = args; + } + + getEntityType(): string { + return this.#args.entityType; + } + + getUnique(): string { + return this.#args.unique; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.ts index f19e13fce3..8b2e890e32 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/entity-action.ts @@ -7,11 +7,13 @@ export interface UmbEntityAction extends UmbAction extends UmbActionBase { + entityType: string; unique: string; repositoryAlias: string; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { super(host, repositoryAlias); + this.entityType = entityType; this.unique = unique; this.repositoryAlias = repositoryAlias; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/index.ts index 3bc2e27029..194dedab02 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/entity-action/index.ts @@ -2,3 +2,4 @@ export * from './entity-action-list.element.js'; export * from './entity-action.element.js'; export * from './entity-action.js'; export * from './common/index.js'; +export * from './entity-action.event.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/create-folder/create-folder.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/create-folder/create-folder.action.ts index c869875b59..d5b7efffb6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/create-folder/create-folder.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/create-folder/create-folder.action.ts @@ -7,8 +7,8 @@ import { type UmbFolderRepository, UMB_FOLDER_CREATE_MODAL } from '@umbraco-cms/ export class UmbCreateFolderEntityAction extends UmbEntityActionBase { #modalContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); new UmbContextConsumerController(this._host, UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/delete-folder/delete-folder.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/delete-folder/delete-folder.action.ts index 47e230c8dc..076f360877 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/delete-folder/delete-folder.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/delete-folder/delete-folder.action.ts @@ -8,8 +8,8 @@ import type { UmbFolderRepository } from '@umbraco-cms/backoffice/tree'; export class UmbDeleteFolderEntityAction extends UmbEntityActionBase { #modalContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); new UmbContextConsumerController(this._host, UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/folder-update/folder-update.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/folder-update/folder-update.action.ts index 6e5a86213c..18863eb76b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/folder-update/folder-update.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/folder/entity-action/folder-update/folder-update.action.ts @@ -9,8 +9,8 @@ export class UmbFolderUpdateEntityAction< > extends UmbEntityActionBase { #modalContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); new UmbContextConsumerController(this._host, UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/index.ts index a3c11cfc66..c502da8f77 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/index.ts @@ -22,4 +22,10 @@ export * from './data-source/index.js'; // Folder export * from './folder/index.js'; +// +export { + UmbReloadTreeItemChildrenEntityAction, + UmbReloadTreeItemChildrenRequestEntityActionEvent, +} from './reload-tree-item-children/index.js'; + export { UmbTreeRepositoryBase } from './tree-repository-base.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/index.ts new file mode 100644 index 0000000000..14a1621de6 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/index.ts @@ -0,0 +1,2 @@ +export { UmbReloadTreeItemChildrenEntityAction } from './reload-tree-item-children.action.js'; +export { UmbReloadTreeItemChildrenRequestEntityActionEvent } from './reload-tree-item-children-request.event.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/reload-tree-item-children-request.event.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/reload-tree-item-children-request.event.ts new file mode 100644 index 0000000000..999b2dd669 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/reload-tree-item-children-request.event.ts @@ -0,0 +1,9 @@ +import { UmbEntityActionEvent, type UmbEntityActionEventArgs } from '@umbraco-cms/backoffice/entity-action'; + +export class UmbReloadTreeItemChildrenRequestEntityActionEvent extends UmbEntityActionEvent { + static readonly TYPE = 'reload-tree-item-children-request'; + + constructor(args: UmbEntityActionEventArgs) { + super(UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, args); + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/reload-tree-item-children.action.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/reload-tree-item-children.action.ts new file mode 100644 index 0000000000..ba0ebe7c89 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/reload-tree-item-children/reload-tree-item-children.action.ts @@ -0,0 +1,28 @@ +import type { UmbCopyDataTypeRepository } from '../../data-type/repository/copy/data-type-copy.repository.js'; +import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; +import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; +import type { UmbActionEventContext } from '@umbraco-cms/backoffice/action'; +import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; +import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree'; + +export class UmbReloadTreeItemChildrenEntityAction extends UmbEntityActionBase { + #actionEventContext?: UmbActionEventContext; + + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); + + this.consumeContext(UMB_ACTION_EVENT_CONTEXT, (instance) => { + this.#actionEventContext = instance; + }); + } + + async execute() { + if (!this.#actionEventContext) throw new Error('Action Event context is not available'); + this.#actionEventContext.dispatchEvent( + new UmbReloadTreeItemChildrenRequestEntityActionEvent({ + unique: this.unique, + entityType: this.entityType, + }), + ); + } +} diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.context.ts index a01ef5721f..24ea634a98 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.context.ts @@ -9,6 +9,9 @@ import { UmbBooleanState, UmbDeepState, UmbStringState } from '@umbraco-cms/back import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UmbBaseController } from '@umbraco-cms/backoffice/class-api'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; +import { UMB_ACTION_EVENT_CONTEXT, type UmbActionEventContext } from '@umbraco-cms/backoffice/action'; +import type { UmbEntityActionEvent } from '@umbraco-cms/backoffice/entity-action'; +import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from '@umbraco-cms/backoffice/tree'; export type UmbTreeItemUniqueFunction = ( x: TreeItemType, @@ -52,6 +55,7 @@ export class UmbTreeItemContextBase treeContext?: UmbTreeContextBase; #sectionContext?: UmbSectionContext; #sectionSidebarContext?: UmbSectionSidebarContext; + #actionEventContext?: UmbActionEventContext; #getUniqueFunction: UmbTreeItemUniqueFunction; constructor(host: UmbControllerHost, getUniqueFunction: UmbTreeItemUniqueFunction) { @@ -129,6 +133,18 @@ export class UmbTreeItemContextBase this.#observeIsSelected(); this.#observeHasChildren(); }); + + this.consumeContext(UMB_ACTION_EVENT_CONTEXT, (instance) => { + this.#actionEventContext = instance; + this.#actionEventContext.removeEventListener( + UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, + this.#onReloadRequest as EventListener, + ); + this.#actionEventContext.addEventListener( + UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, + this.#onReloadRequest as EventListener, + ); + }); } getTreeItem() { @@ -206,10 +222,26 @@ export class UmbTreeItemContextBase }); } + #onReloadRequest = (event: UmbEntityActionEvent) => { + // Only handle children request here. Root request is handled by the tree context + if (!this.unique) return; + if (event.getUnique() !== this.unique) return; + if (event.getEntityType() !== this.entityType) return; + this.requestChildren(); + }; + // TODO: use router context constructPath(pathname: string, entityType: string, unique: string | null) { return `section/${pathname}/workspace/${entityType}/edit/${unique}`; } + + destroy(): void { + this.#actionEventContext?.removeEventListener( + UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, + this.#onReloadRequest as EventListener, + ); + super.destroy(); + } } export const UMB_TREE_ITEM_CONTEXT = new UmbContextToken>('UmbTreeItemContext'); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.element.ts index d4095549a2..ffa69d14b6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item-base/tree-item-base.element.ts @@ -7,9 +7,6 @@ import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @customElement('umb-tree-item-base') export class UmbTreeItemBaseElement extends UmbLitElement { - @state() - private _iconAlias?: string; - @state() private _item?: UmbTreeItemModelBase; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.context.ts index 1a39bd4c2c..8702857f44 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.context.ts @@ -1,5 +1,7 @@ +import { UmbReloadTreeItemChildrenRequestEntityActionEvent } from './reload-tree-item-children/index.js'; import type { UmbTreeItemModelBase } from './types.js'; import type { UmbTreeRepository } from './tree-repository.interface.js'; +import { type UmbActionEventContext, UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action'; import type { Observable } from '@umbraco-cms/backoffice/external/rxjs'; import type { UmbPagedData } from '@umbraco-cms/backoffice/repository'; import { @@ -12,6 +14,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle import { UmbExtensionApiInitializer } from '@umbraco-cms/backoffice/extension-api'; import type { ProblemDetails } from '@umbraco-cms/backoffice/backend-api'; import { UmbSelectionManager } from '@umbraco-cms/backoffice/utils'; +import type { UmbEntityActionEvent } from '@umbraco-cms/backoffice/entity-action'; +import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api'; // TODO: update interface export interface UmbTreeContext extends UmbBaseController { @@ -27,14 +31,16 @@ export class UmbTreeContextBase extends UmbBaseController implements UmbTreeContext { + #treeRoot = new UmbObjectState(undefined); + treeRoot = this.#treeRoot.asObservable(); + public repository?: UmbTreeRepository; public selectableFilter?: (item: TreeItemType) => boolean = () => true; - public filter?: (item: TreeItemType) => boolean = () => true; - public readonly selection = new UmbSelectionManager(this._host); #treeAlias?: string; + #actionEventContext?: UmbActionEventContext; #initResolver?: () => void; #initialized = false; @@ -46,6 +52,20 @@ export class UmbTreeContextBase constructor(host: UmbControllerHostElement) { super(host); this.provideContext('umbTreeContext', this); + + this.consumeContext(UMB_ACTION_EVENT_CONTEXT, (instance) => { + this.#actionEventContext = instance; + this.#actionEventContext.removeEventListener( + UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, + this.#onReloadRequest as EventListener, + ); + this.#actionEventContext.addEventListener( + UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, + this.#onReloadRequest as EventListener, + ); + }); + + this.requestTreeRoot(); } // TODO: find a generic way to do this @@ -69,7 +89,13 @@ export class UmbTreeContextBase public async requestTreeRoot() { await this.#init; - return this.repository!.requestTreeRoot(); + const { data } = await this.repository!.requestTreeRoot(); + + if (data) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + this.#treeRoot.setValue(data); + } } public async requestRootItems() { @@ -121,4 +147,23 @@ export class UmbTreeContextBase }, ); } + + #onReloadRequest = (event: UmbEntityActionEvent) => { + // Only handle root request here. Items are handled by the tree item context + const treeRoot = this.#treeRoot.getValue(); + if (treeRoot === undefined) return; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + if (event.getUnique() !== treeRoot.unique) return; + if (event.getEntityType() !== treeRoot.entityType) return; + this.requestRootItems(); + }; + + destroy(): void { + this.#actionEventContext?.removeEventListener( + UmbReloadTreeItemChildrenRequestEntityActionEvent.TYPE, + this.#onReloadRequest as EventListener, + ); + super.destroy(); + } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.element.ts index 999ac69ffb..7332f200b3 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/tree/tree.element.ts @@ -79,19 +79,21 @@ export class UmbTreeElement extends UmbLitElement { private _treeRoot?: UmbTreeItemModelBase; #treeContext = new UmbTreeContextBase(this); - #rootItemsObserver?: UmbObserverController>; constructor() { super(); - this.#requestTreeRoot(); + this.#observeTreeRoot(); } - async #requestTreeRoot() { - if (!this.#treeContext?.requestTreeRoot) throw new Error('Tree does not support root'); - - const { data } = await this.#treeContext.requestTreeRoot(); - this._treeRoot = data; + #observeTreeRoot() { + this.observe( + this.#treeContext.treeRoot, + (treeRoot) => { + this._treeRoot = treeRoot; + }, + 'umbTreeRootObserver', + ); } async #observeRootItems() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entities.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entities.ts deleted file mode 100644 index b07e1f48a9..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entities.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const UMB_DICTIONARY_ROOT_ENTITY_TYPE = 'dictionary-root'; -export const UMB_DICTIONARY_ENTITY_TYPE = 'dictionary-item'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/create/create.action.ts index 95590492f5..88ff946d6a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/create/create.action.ts @@ -6,8 +6,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase { static styles = [UmbTextStyles]; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/export/export.action.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/export/export.action.ts index 77475c2e43..ed0462c005 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/export/export.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/export/export.action.ts @@ -14,8 +14,8 @@ export default class UmbExportDictionaryEntityAction extends UmbEntityActionBase #modalContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/import/import.action.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/import/import.action.ts index f17091b168..7333796c98 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/import/import.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/import/import.action.ts @@ -17,8 +17,8 @@ export default class UmbImportDictionaryEntityAction extends UmbEntityActionBase #modalContext?: UmbModalManagerContext; #treeStore?: UmbDictionaryTreeStore; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts index c797c718e9..dc40b382be 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/manifests.ts @@ -1,6 +1,5 @@ import { UMB_DICTIONARY_REPOSITORY_ALIAS } from '../repository/manifests.js'; -import { UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entities.js'; -import UmbReloadDictionaryEntityAction from './reload.action.js'; +import { UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entity.js'; import UmbImportDictionaryEntityAction from './import/import.action.js'; import UmbExportDictionaryEntityAction from './export/export.action.js'; import UmbCreateDictionaryEntityAction from './create/create.action.js'; @@ -60,19 +59,6 @@ const entityActions: Array = [ entityTypes: [UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE], }, }, - { - type: 'entityAction', - alias: 'Umb.EntityAction.Dictionary.Reload', - name: 'Reload Dictionary Entity Action', - weight: 200, - api: UmbReloadDictionaryEntityAction, - meta: { - icon: 'icon-refresh', - label: 'Reload', - repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, - entityTypes: [UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE], - }, - }, { type: 'entityAction', alias: 'Umb.EntityAction.Dictionary.Delete', diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/reload.action.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/reload.action.ts deleted file mode 100644 index c149ea901e..0000000000 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity-actions/reload.action.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { UmbDictionaryRepository } from '../repository/dictionary.repository.js'; -import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; -import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; - -export default class UmbReloadDictionaryEntityAction extends UmbEntityActionBase { - static styles = [UmbTextStyles]; - - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); - } - - async execute() { - alert('refresh'); - } -} diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity.ts new file mode 100644 index 0000000000..a2c3b1a5d7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/entity.ts @@ -0,0 +1,5 @@ +export const UMB_DICTIONARY_ROOT_ENTITY_TYPE = 'dictionary-root'; +export const UMB_DICTIONARY_ENTITY_TYPE = 'dictionary-item'; + +export type UmbDictionaryEntityType = typeof UMB_DICTIONARY_ENTITY_TYPE; +export type UmbDictionaryRootEntityType = typeof UMB_DICTIONARY_ROOT_ENTITY_TYPE; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts index ac644d838e..f787f054e5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/menu-item/manifests.ts @@ -1,4 +1,4 @@ -import { UMB_DICTIONARY_ENTITY_TYPE } from '../entities.js'; +import { UMB_DICTIONARY_ENTITY_TYPE } from '../entity.js'; import { UMB_DICTIONARY_TREE_ALIAS } from '../tree/index.js'; import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts index 878113826f..9021ff9741 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/dictionary-tree.repository.ts @@ -1,4 +1,4 @@ -import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entities.js'; +import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbDictionaryTreeServerDataSource } from './dictionary-tree.server.data-source.js'; import type { UmbDictionaryTreeItemModel, UmbDictionaryTreeRootModel } from './types.js'; import { UMB_DICTIONARY_TREE_STORE_CONTEXT } from './dictionary-tree.store.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts index e2e0185c3c..4f0604baff 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/manifests.ts @@ -1,6 +1,7 @@ -import { UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entities.js'; +import { UMB_DICTIONARY_ENTITY_TYPE, UMB_DICTIONARY_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbDictionaryTreeRepository } from './dictionary-tree.repository.js'; import { UmbDictionaryTreeStore } from './dictionary-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifests } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..3c39492a29 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,20 @@ +import { UMB_DICTIONARY_ROOT_ENTITY_TYPE, UMB_DICTIONARY_ENTITY_TYPE } from '../../entity.js'; +import { UMB_DICTIONARY_REPOSITORY_ALIAS } from '../../repository/manifests.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import { type ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Dictionary.Tree.ReloadTreeItemChildren', + name: 'Reload Dictionary Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: UMB_DICTIONARY_REPOSITORY_ALIAS, + entityTypes: [UMB_DICTIONARY_ROOT_ENTITY_TYPE, UMB_DICTIONARY_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/section.manifest.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/section.manifest.ts index 9ea2fde786..c100510717 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/section.manifest.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/section.manifest.ts @@ -1,4 +1,4 @@ -import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from './dictionary/entities.js'; +import { UMB_DICTIONARY_ROOT_ENTITY_TYPE } from './dictionary/entity.js'; import type { ManifestDashboard, ManifestSection, ManifestTypes } from '@umbraco-cms/backoffice/extension-registry'; const sectionAlias = 'Umb.Section.Dictionary'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/entity-actions/create/create.action.ts index c62e4efbfe..32610f6d97 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/entity-actions/create/create.action.ts @@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; @@ -23,6 +23,7 @@ export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase( diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/manifests.ts index a4992d329c..9a9bc9e598 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/manifests.ts @@ -6,6 +6,7 @@ import { import { UmbDocumentTypeTreeRepository } from './document-type-tree.repository.js'; import { UmbDocumentTypeTreeStore } from './document-type.tree.store.js'; import { manifests as folderManifests } from './folder/manifests.js'; +import { manifests as reloadManifests } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -54,4 +55,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests, ...reloadManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..63f50a58e8 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/document-types/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,28 @@ +import { + UMB_DOCUMENT_TYPE_ROOT_ENTITY_TYPE, + UMB_DOCUMENT_TYPE_ENTITY_TYPE, + UMB_DOCUMENT_TYPE_FOLDER_ENTITY_TYPE, +} from '../../entity.js'; +import { UMB_DOCUMENT_TYPE_DETAIL_REPOSITORY_ALIAS } from '../../repository/detail/manifests.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import { type ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.DocumentType.Tree.ReloadTreeItemChildren', + name: 'Reload Document Type Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: UMB_DOCUMENT_TYPE_DETAIL_REPOSITORY_ALIAS, + entityTypes: [ + UMB_DOCUMENT_TYPE_ROOT_ENTITY_TYPE, + UMB_DOCUMENT_TYPE_ENTITY_TYPE, + UMB_DOCUMENT_TYPE_FOLDER_ENTITY_TYPE, + ], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create-blueprint.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create-blueprint.action.ts index 39c5548097..cf37289584 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create-blueprint.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create-blueprint.action.ts @@ -3,8 +3,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbCreateDocumentBlueprintEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/create.action.ts index 022580f912..7616da850a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/create/create.action.ts @@ -11,8 +11,8 @@ import { export class UmbCreateDocumentEntityAction extends UmbEntityActionBase { #modalContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames.action.ts index 316da91393..8a6f508079 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/culture-and-hostnames.action.ts @@ -3,8 +3,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbDocumentCultureAndHostnamesEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/permissions/permissions.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/permissions/permissions.action.ts index 3a8441ceab..eeb9bf8328 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/permissions/permissions.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/permissions/permissions.action.ts @@ -11,8 +11,8 @@ import { export class UmbDocumentPermissionsEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/public-access.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/public-access.action.ts index ca4a02d65e..45ce15c494 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/public-access.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/public-access.action.ts @@ -3,8 +3,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbDocumentPublicAccessEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts index 3e150d1380..40cf961cff 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/publish.action.ts @@ -3,8 +3,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbPublishDocumentEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/rollback.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/rollback.action.ts index 08bfe60557..e54efe6ad6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/rollback.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/rollback.action.ts @@ -3,8 +3,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbRollbackDocumentEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts index d3f447258b..80f95ae09b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts @@ -3,8 +3,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbUnpublishDocumentEntityAction extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/manifests.ts index 62e7712236..616228072f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/manifests.ts @@ -1,6 +1,7 @@ import { UMB_DOCUMENT_RECYCLE_BIN_ENTITY_TYPE, UMB_DOCUMENT_RECYCLE_BIN_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbDocumentRecycleBinTreeRepository } from './document-recycle-bin-tree.repository.js'; import { UmbDocumentRecycleBinTreeStore } from './document-recycle-bin-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifests } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..2fc615bd39 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/recycle-bin/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_DOCUMENT_RECYCLE_BIN_ENTITY_TYPE, UMB_DOCUMENT_RECYCLE_BIN_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.DocumentRecycleBin.Tree.ReloadTreeItemChildren', + name: 'Reload Document Recycle Bin Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.DocumentRecycleBin.Tree', + entityTypes: [UMB_DOCUMENT_RECYCLE_BIN_ENTITY_TYPE, UMB_DOCUMENT_RECYCLE_BIN_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts index cad95f0d15..7470671496 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/manifests.ts @@ -1,6 +1,7 @@ import { UMB_DOCUMENT_ENTITY_TYPE, UMB_DOCUMENT_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbDocumentTreeRepository } from './document-tree.repository.js'; import { UmbDocumentTreeStore } from './document-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifests } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..dfd8b3f192 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,20 @@ +import { UMB_DOCUMENT_ENTITY_TYPE, UMB_DOCUMENT_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UMB_DOCUMENT_REPOSITORY_ALIAS } from '../../repository/index.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Document.Tree.ReloadTreeItemChildren', + name: 'Reload Document Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: UMB_DOCUMENT_REPOSITORY_ALIAS, + entityTypes: [UMB_DOCUMENT_ENTITY_TYPE, UMB_DOCUMENT_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts index 69ce67fac7..44a8aa2cf6 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/entity-actions/create/create.action.ts @@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbCreateMediaTypeEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/manifests.ts index b53de760d7..448ac15eba 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/manifests.ts @@ -6,7 +6,7 @@ import { import { UmbMediaTypeTreeRepository } from './media-type-tree.repository.js'; import { UmbMediaTypeTreeStore } from './media-type-tree.store.js'; import { manifests as folderManifests } from './folder/manifests.js'; - +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -51,4 +51,11 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests]; +export const manifests = [ + treeRepository, + treeStore, + tree, + treeItem, + ...folderManifests, + ...reloadTreeItemChildrenManifest, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..e53c2de2c8 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media-types/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_MEDIA_TYPE_ENTITY_TYPE, UMB_MEDIA_TYPE_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.MediaType.Tree.ReloadTreeItemChildren', + name: 'Reload Media Type Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.MediaType.Tree', + entityTypes: [UMB_MEDIA_TYPE_ENTITY_TYPE, UMB_MEDIA_TYPE_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts index 5ec3605b54..b6334b0d88 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/manifests.ts @@ -1,6 +1,7 @@ import { UMB_MEDIA_ENTITY_TYPE, UMB_MEDIA_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbMediaTreeRepository } from './media-tree.repository.js'; import { UmbMediaTreeStore } from './media-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifests } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifests]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..bb52bb908e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/media/media/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_MEDIA_ENTITY_TYPE, UMB_MEDIA_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Media.Tree.ReloadTreeItemChildren', + name: 'Reload Media Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.Media.Tree', + entityTypes: [UMB_MEDIA_ENTITY_TYPE, UMB_MEDIA_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/manifests.ts index 6f5490951f..7ffe0327c0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/manifests.ts @@ -1,6 +1,7 @@ import { UMB_MEMBER_GROUP_ENTITY_TYPE, UMB_MEMBER_GROUP_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbMemberGroupTreeRepository } from './member-group-tree.repository.js'; import { UmbMemberGroupTreeStore } from './member-group-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifest]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..9bf3ee1c42 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-groups/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_MEMBER_GROUP_ENTITY_TYPE, UMB_MEMBER_GROUP_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.MemberGroup.Tree.ReloadTreeItemChildren', + name: 'Reload Member Group Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.MemberGroup.Tree', + entityTypes: [UMB_MEMBER_GROUP_ENTITY_TYPE, UMB_MEMBER_GROUP_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/manifests.ts index 8ff56868a5..d93a6f32aa 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/manifests.ts @@ -1,6 +1,7 @@ import { UMB_MEMBER_TYPE_ENTITY_TYPE, UMB_MEMBER_TYPE_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbMemberTypeTreeRepository } from './member-type-tree.repository.js'; import { UmbMemberTypeTreeStore } from './member-type-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifest]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..d2929ce739 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/member-types/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_MEMBER_TYPE_ENTITY_TYPE, UMB_MEMBER_TYPE_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.MemberType.Tree.ReloadTreeItemChildren', + name: 'Reload Member Type Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.MemberType.Tree', + entityTypes: [UMB_MEMBER_TYPE_ENTITY_TYPE, UMB_MEMBER_TYPE_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/manifests.ts index 40fc0a89f5..fc74d4d7ce 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/manifests.ts @@ -1,6 +1,7 @@ import { UMB_MEMBER_ENTITY_TYPE, UMB_MEMBER_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbMemberTreeRepository } from './member-tree.repository.js'; import { UmbMemberTreeStore } from './member-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifest]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..7a6db10068 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/members/members/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_MEMBER_ENTITY_TYPE, UMB_MEMBER_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Member.Tree.ReloadTreeItemChildren', + name: 'Reload Member Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.Member.Tree', + entityTypes: [UMB_MEMBER_ENTITY_TYPE, UMB_MEMBER_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entity-actions/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entity-actions/create.action.ts index 21e64a478b..3c83450063 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entity-actions/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entity-actions/create.action.ts @@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle export class UmbCreateRelationTypeEntityAction extends UmbEntityActionBase { // TODO: Could EntityActions take the manifest instead, for more flexibility? - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entities.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entity.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entities.ts rename to src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/entity.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/index.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/index.ts index 7bbcc83722..48e5364e41 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/index.ts @@ -1,2 +1,2 @@ export * from './repository/index.js'; -export * from './entities.js'; +export * from './entity.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/manifests.ts index fac911101f..3f3438a75d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/manifests.ts @@ -1,6 +1,7 @@ -import { UMB_RELATION_TYPE_ENTITY_TYPE, UMB_RELATION_TYPE_ROOT_ENTITY_TYPE } from '../entities.js'; +import { UMB_RELATION_TYPE_ENTITY_TYPE, UMB_RELATION_TYPE_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbRelationTypeTreeRepository } from './relation-type-tree.repository.js'; import { UmbRelationTypeTreeStore } from './relation-type-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifest]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/relation-type-tree.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/relation-type-tree.repository.ts index 1fc833fa55..166b8b8eda 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/relation-type-tree.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/relation-type-tree.repository.ts @@ -1,4 +1,4 @@ -import { UMB_RELATION_TYPE_ROOT_ENTITY_TYPE } from '../entities.js'; +import { UMB_RELATION_TYPE_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbRelationTypeTreeServerDataSource } from './relation-type-tree.server.data-source.js'; import type { UmbRelationTypeTreeItemModel, UmbRelationTypeTreeRootModel } from './types.js'; import { UMB_RELATION_TYPE_TREE_STORE_CONTEXT } from './relation-type-tree.store.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..13db230eaf --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/relations/relation-types/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,19 @@ +import { UMB_RELATION_TYPE_ROOT_ENTITY_TYPE } from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.RelationType.Tree.ReloadTreeItemChildren', + name: 'Reload Relation Type Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.RelationType.Tree', + entityTypes: [UMB_RELATION_TYPE_ROOT_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/settings/languages/entity-actions/language-create-entity-action.ts b/src/Umbraco.Web.UI.Client/src/packages/settings/languages/entity-actions/language-create-entity-action.ts index b63433df60..c53a318619 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/settings/languages/entity-actions/language-create-entity-action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/settings/languages/entity-actions/language-create-entity-action.ts @@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle export class UmbLanguageCreateEntityAction extends UmbEntityActionBase { // TODO: Could EntityActions take the manifest instead, for more flexibility? - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } async execute() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create.action.ts index b029dc636e..8ecfb0a08c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create.action.ts @@ -7,8 +7,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbPartialViewCreateOptionsEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; @@ -22,6 +22,7 @@ export class UmbPartialViewCreateOptionsEntityAction extends UmbEntityActionBase this.#modalManagerContext?.open(UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL, { data: { parentUnique: this.unique, + entityType: this.entityType, }, }); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/index.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/index.ts index eb6016ae1a..0b9c86730b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/index.ts @@ -2,6 +2,7 @@ import { UmbModalToken } from '@umbraco-cms/backoffice/modal'; export interface UmbPartialViewCreateOptionsModalData { parentUnique: string | null; + entityType: string; } export const UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL = new UmbModalToken( diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/partial-view-create-options-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/partial-view-create-options-modal.element.ts index 4791b315e9..918ee394ba 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/partial-view-create-options-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/options-modal/partial-view-create-options-modal.element.ts @@ -35,6 +35,7 @@ export class UmbPartialViewCreateOptionsModalElement extends UmbModalBaseElement // @ts-ignore // TODO: allow null for entity actions. Some actions can be executed on the root item this.data.parentUnique, + this.data.entityType, ); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/manifests.ts index 6a93d9a45b..c208c9aa10 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/manifests.ts @@ -6,6 +6,7 @@ import { import { UmbPartialViewTreeRepository } from './partial-view-tree.repository.js'; import { UmbPartialViewTreeStore } from './partial-view-tree.store.js'; import { manifests as folderManifests } from './folder/manifests.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -50,4 +51,11 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests]; +export const manifests = [ + treeRepository, + treeStore, + tree, + treeItem, + ...folderManifests, + ...reloadTreeItemChildrenManifest, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..2f017d6156 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,27 @@ +import { + UMB_PARTIAL_VIEW_ROOT_ENTITY_TYPE, + UMB_PARTIAL_VIEW_ENTITY_TYPE, + UMB_PARTIAL_VIEW_FOLDER_ENTITY_TYPE, +} from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.PartialView.Tree.ReloadTreeItemChildren', + name: 'Reload Partial View Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.PartialView.Tree', + entityTypes: [ + UMB_PARTIAL_VIEW_ROOT_ENTITY_TYPE, + UMB_PARTIAL_VIEW_ENTITY_TYPE, + UMB_PARTIAL_VIEW_FOLDER_ENTITY_TYPE, + ], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/create.action.ts index 4ef4970f09..30f9295a63 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/create.action.ts @@ -7,8 +7,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbScriptCreateOptionsEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; @@ -22,6 +22,7 @@ export class UmbScriptCreateOptionsEntityAction extends UmbEntityActionBase( diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/options-modal/script-create-options-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/options-modal/script-create-options-modal.element.ts index b7235077f1..c3f4ca704f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/options-modal/script-create-options-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/scripts/entity-actions/create/options-modal/script-create-options-modal.element.ts @@ -31,6 +31,7 @@ export class UmbScriptCreateOptionsModalElement extends UmbModalBaseElement = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Script.Tree.ReloadTreeItemChildren', + name: 'Reload Script Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.Script.Tree', + entityTypes: [UMB_SCRIPT_ROOT_ENTITY_TYPE, UMB_SCRIPT_ENTITY_TYPE, UMB_SCRIPT_FOLDER_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/create.action.ts index 12a164d1a4..84e2f5bfcb 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/create.action.ts @@ -7,8 +7,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; export class UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase { #modalManagerContext?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManagerContext = instance; @@ -22,6 +22,7 @@ export class UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase< this.#modalManagerContext?.open(UMB_STYLESHEET_CREATE_OPTIONS_MODAL, { data: { parentUnique: this.unique, + entityType: this.entityType, }, }); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/index.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/index.ts index 96dacf0a6e..016ac5d3a8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/index.ts @@ -2,6 +2,7 @@ import { UmbModalToken } from '@umbraco-cms/backoffice/modal'; export interface UmbStylesheetCreateOptionsModalData { parentUnique: string | null; + entityType: string; } export const UMB_STYLESHEET_CREATE_OPTIONS_MODAL = new UmbModalToken( diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/stylesheet-create-options-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/stylesheet-create-options-modal.element.ts index 7fce9e42d9..cf67c40870 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/stylesheet-create-options-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/entity-actions/create/options-modal/stylesheet-create-options-modal.element.ts @@ -2,8 +2,7 @@ import { UMB_STYLESHEET_FOLDER_REPOSITORY_ALIAS } from '../../../tree/folder/ind import type { UmbStylesheetCreateOptionsModalData } from './index.js'; import { html, customElement } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbModalManagerContext} from '@umbraco-cms/backoffice/modal'; -import { UMB_MODAL_MANAGER_CONTEXT, UmbModalBaseElement } from '@umbraco-cms/backoffice/modal'; +import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal'; import { UmbCreateFolderEntityAction } from '@umbraco-cms/backoffice/tree'; @customElement('umb-stylesheet-create-options-modal') @@ -11,17 +10,8 @@ export class UmbStylesheetCreateOptionsModalElement extends UmbModalBaseElement< UmbStylesheetCreateOptionsModalData, string > { - #modalManager?: UmbModalManagerContext; #createFolderAction?: UmbCreateFolderEntityAction; - constructor() { - super(); - - this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { - this.#modalManager = instance; - }); - } - connectedCallback(): void { super.connectedCallback(); @@ -34,6 +24,7 @@ export class UmbStylesheetCreateOptionsModalElement extends UmbModalBaseElement< // @ts-ignore // TODO: allow null for entity actions. Some actions can be executed on the root item this.data.parentUnique, + this.data.entityType, ); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/manifests.ts index 9b9e9a875d..43703c840f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/manifests.ts @@ -4,6 +4,7 @@ import { UMB_STYLESHEET_ROOT_ENTITY_TYPE, } from '../entity.js'; import { manifests as folderManifests } from './folder/manifests.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import { UmbStylesheetTreeRepository } from './stylesheet-tree.repository.js'; import { UmbStylesheetTreeStore } from './stylesheet-tree.store.js'; import type { @@ -51,4 +52,11 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests]; +export const manifests = [ + treeRepository, + treeStore, + tree, + treeItem, + ...folderManifests, + ...reloadTreeItemChildrenManifest, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/reload-tree-item-children/manifests.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/reload-tree-item-children/manifests.ts new file mode 100644 index 0000000000..9222f8077c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,23 @@ +import { + UMB_STYLESHEET_ROOT_ENTITY_TYPE, + UMB_STYLESHEET_ENTITY_TYPE, + UMB_STYLESHEET_FOLDER_ENTITY_TYPE, +} from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Stylesheet.Tree.ReloadTreeItemChildren', + name: 'Reload Stylesheet Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + icon: 'icon-refresh', + label: 'Reload children...', + repositoryAlias: 'Umb.Repository.Stylesheet.Tree', + entityTypes: [UMB_STYLESHEET_ROOT_ENTITY_TYPE, UMB_STYLESHEET_ENTITY_TYPE, UMB_STYLESHEET_FOLDER_ENTITY_TYPE], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts index 35eede6b2d..2684bd4661 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/entity-actions/create/create.action.ts @@ -2,8 +2,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action'; import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api'; export class UmbCreateEntityAction }> extends UmbEntityActionBase { - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); } // TODO: can we make this a generic create action 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 9c3d943c41..ca6e077e34 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 @@ -1,6 +1,7 @@ import { UMB_TEMPLATE_ENTITY_TYPE, UMB_TEMPLATE_ROOT_ENTITY_TYPE } from '../entity.js'; import { UmbTemplateTreeRepository } from './template-tree.repository.js'; import { UmbTemplateTreeStore } from './template-tree.store.js'; +import { manifests as reloadTreeItemChildrenManifest } from './reload-tree-item-children/manifests.js'; import type { ManifestRepository, ManifestTree, @@ -45,4 +46,4 @@ const treeItem: ManifestTreeItem = { }, }; -export const manifests = [treeRepository, treeStore, tree, treeItem]; +export const manifests = [treeRepository, treeStore, tree, treeItem, ...reloadTreeItemChildrenManifest]; 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 new file mode 100644 index 0000000000..180da25ef5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/tree/reload-tree-item-children/manifests.ts @@ -0,0 +1,23 @@ +import { + UMB_TEMPLATE_ROOT_ENTITY_TYPE, + UMB_TEMPLATE_ENTITY_TYPE, + UMB_TEMPLATE_FOLDER_ENTITY_TYPE, +} from '../../entity.js'; +import { UmbReloadTreeItemChildrenEntityAction } from '@umbraco-cms/backoffice/tree'; +import type { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry'; + +export const manifests: Array = [ + { + type: 'entityAction', + alias: 'Umb.EntityAction.Template.Tree.ReloadTreeItemChildren', + name: 'Reload Template Tree Item Children Entity Action', + weight: 10, + api: UmbReloadTreeItemChildrenEntityAction, + meta: { + 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], + }, + }, +]; diff --git a/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/change-password/change-user-password.action.ts b/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/change-password/change-user-password.action.ts index 792039638c..6409bc6eec 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/change-password/change-user-password.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/change-password/change-user-password.action.ts @@ -10,8 +10,8 @@ import { export class UmbChangeUserPasswordEntityAction extends UmbEntityActionBase { #modalManager?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManager = instance; diff --git a/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/disable/disable-user.action.ts b/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/disable/disable-user.action.ts index 8baa41765e..389273d25d 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/disable/disable-user.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/user/user/entity-actions/disable/disable-user.action.ts @@ -12,8 +12,8 @@ export class UmbDisableUserEntityAction extends UmbEntityActionBase { #modalManager?: UmbModalManagerContext; - constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) { - super(host, repositoryAlias, unique); + constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string, entityType: string) { + super(host, repositoryAlias, unique, entityType); this.consumeContext(UMB_MODAL_MANAGER_CONTEXT, (instance) => { this.#modalManager = instance;