Merge branch 'feature/reload-tree-item' into improvement/document-model
This commit is contained in:
@@ -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));
|
||||
}),
|
||||
];
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
export class UmbCopyDataTypeEntityAction extends UmbEntityActionBase<UmbCopyDataTypeRepository> {
|
||||
#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;
|
||||
|
||||
@@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase<UmbDataTypeDetailRepository> {
|
||||
#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;
|
||||
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
export class UmbMoveDataTypeEntityAction extends UmbEntityActionBase<UmbMoveDataTypeRepository> {
|
||||
#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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -2,8 +2,8 @@ import { UmbEntityActionBase } from '../../entity-action.js';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbCopyEntityAction<T extends { copy(): Promise<void> }> extends UmbEntityActionBase<T> {
|
||||
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() {
|
||||
|
||||
@@ -10,8 +10,8 @@ export class UmbDeleteEntityAction<
|
||||
> extends UmbEntityActionBase<T> {
|
||||
#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;
|
||||
|
||||
@@ -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<T extends { move(): Promise<void> }> extends UmbEntityActionBase<T> {
|
||||
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() {
|
||||
|
||||
@@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbRenameEntityAction extends UmbEntityActionBase<UmbRenameRepository<{ unique: string }>> {
|
||||
#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;
|
||||
|
||||
@@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle
|
||||
export class UmbSortChildrenOfEntityAction<
|
||||
T extends { sortChildrenOf(): Promise<void> },
|
||||
> extends UmbEntityActionBase<T> {
|
||||
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() {
|
||||
|
||||
@@ -10,8 +10,8 @@ export class UmbTrashEntityAction<
|
||||
> extends UmbEntityActionBase<T> {
|
||||
#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;
|
||||
|
||||
@@ -30,7 +30,7 @@ export class UmbEntityActionListElement extends UmbLitElement {
|
||||
type="entityAction"
|
||||
default-element="umb-entity-action"
|
||||
.filter=${this._filter}
|
||||
.props=${{ unique: this.unique }}></umb-extension-slot>
|
||||
.props=${{ unique: this.unique, entityType: this.entityType }}></umb-extension-slot>
|
||||
`
|
||||
: '';
|
||||
}
|
||||
|
||||
@@ -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?.();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,13 @@ export interface UmbEntityAction<RepositoryType> extends UmbAction<RepositoryTyp
|
||||
}
|
||||
|
||||
export class UmbEntityActionBase<RepositoryType> extends UmbActionBase<RepositoryType> {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -7,8 +7,8 @@ import { type UmbFolderRepository, UMB_FOLDER_CREATE_MODAL } from '@umbraco-cms/
|
||||
export class UmbCreateFolderEntityAction<T extends UmbFolderRepository> extends UmbEntityActionBase<T> {
|
||||
#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;
|
||||
|
||||
@@ -8,8 +8,8 @@ import type { UmbFolderRepository } from '@umbraco-cms/backoffice/tree';
|
||||
export class UmbDeleteFolderEntityAction<T extends UmbFolderRepository> extends UmbEntityActionBase<T> {
|
||||
#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;
|
||||
|
||||
@@ -9,8 +9,8 @@ export class UmbFolderUpdateEntityAction<
|
||||
> extends UmbEntityActionBase<T> {
|
||||
#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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export { UmbReloadTreeItemChildrenEntityAction } from './reload-tree-item-children.action.js';
|
||||
export { UmbReloadTreeItemChildrenRequestEntityActionEvent } from './reload-tree-item-children-request.event.js';
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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<UmbCopyDataTypeRepository> {
|
||||
#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,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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<TreeItemType extends UmbTreeItemModelBase> = (
|
||||
x: TreeItemType,
|
||||
@@ -52,6 +55,7 @@ export class UmbTreeItemContextBase<TreeItemType extends UmbTreeItemModelBase>
|
||||
treeContext?: UmbTreeContextBase<TreeItemType>;
|
||||
#sectionContext?: UmbSectionContext;
|
||||
#sectionSidebarContext?: UmbSectionSidebarContext;
|
||||
#actionEventContext?: UmbActionEventContext;
|
||||
#getUniqueFunction: UmbTreeItemUniqueFunction<TreeItemType>;
|
||||
|
||||
constructor(host: UmbControllerHost, getUniqueFunction: UmbTreeItemUniqueFunction<TreeItemType>) {
|
||||
@@ -129,6 +133,18 @@ export class UmbTreeItemContextBase<TreeItemType extends UmbTreeItemModelBase>
|
||||
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<TreeItemType extends UmbTreeItemModelBase>
|
||||
});
|
||||
}
|
||||
|
||||
#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<any>>('UmbTreeItemContext');
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<TreeItemType extends UmbTreeItemModelBase> extends UmbBaseController {
|
||||
@@ -27,14 +31,16 @@ export class UmbTreeContextBase<TreeItemType extends UmbTreeItemModelBase>
|
||||
extends UmbBaseController
|
||||
implements UmbTreeContext<TreeItemType>
|
||||
{
|
||||
#treeRoot = new UmbObjectState<TreeItemType | undefined>(undefined);
|
||||
treeRoot = this.#treeRoot.asObservable();
|
||||
|
||||
public repository?: UmbTreeRepository<TreeItemType>;
|
||||
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<TreeItemType extends UmbTreeItemModelBase>
|
||||
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<TreeItemType extends UmbTreeItemModelBase>
|
||||
|
||||
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<TreeItemType extends UmbTreeItemModelBase>
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,19 +79,21 @@ export class UmbTreeElement extends UmbLitElement {
|
||||
private _treeRoot?: UmbTreeItemModelBase;
|
||||
|
||||
#treeContext = new UmbTreeContextBase<UmbTreeItemModelBase>(this);
|
||||
|
||||
#rootItemsObserver?: UmbObserverController<Array<UmbTreeItemModelBase>>;
|
||||
|
||||
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() {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export const UMB_DICTIONARY_ROOT_ENTITY_TYPE = 'dictionary-root';
|
||||
export const UMB_DICTIONARY_ENTITY_TYPE = 'dictionary-item';
|
||||
@@ -6,8 +6,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle
|
||||
export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase<UmbDictionaryRepository> {
|
||||
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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
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',
|
||||
|
||||
@@ -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<UmbDictionaryRepository> {
|
||||
static styles = [UmbTextStyles];
|
||||
|
||||
constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) {
|
||||
super(host, repositoryAlias, unique);
|
||||
}
|
||||
|
||||
async execute() {
|
||||
alert('refresh');
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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';
|
||||
|
||||
@@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbCreateDataTypeEntityAction extends UmbEntityActionBase<UmbDocumentTypeDetailRepository> {
|
||||
#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<UmbDocume
|
||||
this.#modalManagerContext?.open(UMB_DOCUMENT_TYPE_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export class UmbDataTypeCreateOptionsModalElement extends UmbModalBaseElement<Um
|
||||
// @ts-ignore
|
||||
// TODO: allow null for entity actions. Some actions can be executed on the root item
|
||||
this.data.parentUnique,
|
||||
this.data.entityType,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbDocumentTypeCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
entityType: string;
|
||||
}
|
||||
|
||||
export const UMB_DOCUMENT_TYPE_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbDocumentTypeCreateOptionsModalData>(
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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,
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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<UmbDocumentRepository> {
|
||||
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() {
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
export class UmbCreateDocumentEntityAction extends UmbEntityActionBase<UmbDocumentRepository> {
|
||||
#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;
|
||||
|
||||
@@ -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<UmbDocumentRepository> {
|
||||
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() {
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
export class UmbDocumentPermissionsEntityAction extends UmbEntityActionBase<UmbDocumentRepository> {
|
||||
#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;
|
||||
|
||||
@@ -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<UmbDocumentRepository> {
|
||||
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() {
|
||||
|
||||
@@ -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<UmbDocumentRepository> {
|
||||
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() {
|
||||
|
||||
@@ -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<UmbDocumentRepository> {
|
||||
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() {
|
||||
|
||||
@@ -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<UmbDocumentRepository> {
|
||||
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() {
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -8,8 +8,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbCreateMediaTypeEntityAction extends UmbEntityActionBase<UmbMediaTypeDetailRepository> {
|
||||
#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;
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle
|
||||
|
||||
export class UmbCreateRelationTypeEntityAction extends UmbEntityActionBase<UmbRelationTypeRepository> {
|
||||
// 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() {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './repository/index.js';
|
||||
export * from './entities.js';
|
||||
export * from './entity.js';
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -4,8 +4,8 @@ import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controlle
|
||||
|
||||
export class UmbLanguageCreateEntityAction extends UmbEntityActionBase<UmbLanguageRepository> {
|
||||
// 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() {
|
||||
|
||||
@@ -7,8 +7,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbPartialViewCreateOptionsEntityAction extends UmbEntityActionBase<never> {
|
||||
#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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<UmbPartialViewCreateOptionsModalData>(
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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,
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -7,8 +7,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbScriptCreateOptionsEntityAction extends UmbEntityActionBase<never> {
|
||||
#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<neve
|
||||
this.#modalManagerContext?.open(UMB_SCRIPT_CREATE_OPTIONS_MODAL, {
|
||||
data: {
|
||||
parentUnique: this.unique,
|
||||
entityType: this.entityType,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
||||
|
||||
export interface UmbScriptCreateOptionsModalData {
|
||||
parentUnique: string | null;
|
||||
entityType: string;
|
||||
}
|
||||
|
||||
export const UMB_SCRIPT_CREATE_OPTIONS_MODAL = new UmbModalToken<UmbScriptCreateOptionsModalData>(
|
||||
|
||||
@@ -31,6 +31,7 @@ export class UmbScriptCreateOptionsModalElement extends UmbModalBaseElement<UmbS
|
||||
// @ts-ignore
|
||||
// TODO: allow null for entity actions. Some actions can be executed on the root item
|
||||
this.data.parentUnique,
|
||||
this.data.entityType,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { UMB_SCRIPT_ENTITY_TYPE, UMB_SCRIPT_FOLDER_ENTITY_TYPE, UMB_SCRIPT_ROOT_
|
||||
import { UmbScriptTreeRepository } from './script-tree.repository.js';
|
||||
import { UmbScriptTreeStore } from './script-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,
|
||||
@@ -46,4 +47,11 @@ const treeItem: ManifestTreeItem = {
|
||||
},
|
||||
};
|
||||
|
||||
export const manifests = [treeRepository, treeStore, tree, treeItem, ...folderManifests];
|
||||
export const manifests = [
|
||||
treeRepository,
|
||||
treeStore,
|
||||
tree,
|
||||
treeItem,
|
||||
...folderManifests,
|
||||
...reloadTreeItemChildrenManifest,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { UMB_SCRIPT_ROOT_ENTITY_TYPE, UMB_SCRIPT_ENTITY_TYPE, UMB_SCRIPT_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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -7,8 +7,8 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
|
||||
export class UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase<never> {
|
||||
#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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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<UmbStylesheetCreateOptionsModalData>(
|
||||
|
||||
@@ -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<any>;
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -2,8 +2,8 @@ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export class UmbCreateEntityAction<T extends { copy(): Promise<void> }> extends UmbEntityActionBase<T> {
|
||||
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
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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<ManifestEntityAction> = [
|
||||
{
|
||||
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],
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
export class UmbChangeUserPasswordEntityAction extends UmbEntityActionBase<UmbChangeUserPasswordRepository> {
|
||||
#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;
|
||||
|
||||
@@ -12,8 +12,8 @@ export class UmbDisableUserEntityAction extends UmbEntityActionBase<UmbDisableUs
|
||||
#modalManager?: UmbModalManagerContext;
|
||||
#itemRepository: UmbUserItemRepository;
|
||||
|
||||
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.#itemRepository = new UmbUserItemRepository(this);
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ export class UmbEnableUserEntityAction extends UmbEntityActionBase<UmbEnableUser
|
||||
#modalManager?: UmbModalManagerContext;
|
||||
#itemRepository: UmbUserItemRepository;
|
||||
|
||||
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.#itemRepository = new UmbUserItemRepository(this);
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ export class UmbUnlockUserEntityAction extends UmbEntityActionBase<UmbUnlockUser
|
||||
#modalManager?: UmbModalManagerContext;
|
||||
#itemRepository: UmbUserItemRepository;
|
||||
|
||||
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.#itemRepository = new UmbUserItemRepository(this);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user