write TBD on Delete action
This commit is contained in:
@@ -11,25 +11,25 @@ import { UmbDetailRepository, UmbItemRepository } from '@umbraco-cms/backoffice/
|
||||
export class UmbDeleteEntityAction<
|
||||
T extends UmbDetailRepository & UmbItemRepository<any>
|
||||
> extends UmbEntityActionBase<T> {
|
||||
#modalContext?: UmbModalManagerContext;
|
||||
#modalManager?: UmbModalManagerContext;
|
||||
|
||||
constructor(host: UmbControllerHostElement, repositoryAlias: string, unique: string) {
|
||||
super(host, repositoryAlias, unique);
|
||||
|
||||
new UmbContextConsumerController(this.host, UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => {
|
||||
this.#modalContext = instance;
|
||||
this.#modalManager = instance;
|
||||
});
|
||||
}
|
||||
|
||||
async execute() {
|
||||
if (!this.repository || !this.#modalContext) return;
|
||||
if (!this.repository || !this.#modalManager) return;
|
||||
|
||||
const { data } = await this.repository.requestItems([this.unique]);
|
||||
|
||||
if (data) {
|
||||
const item = data[0];
|
||||
|
||||
const modalContext = this.#modalContext.open(UMB_CONFIRM_MODAL, {
|
||||
const modalContext = this.#modalManager.open(UMB_CONFIRM_MODAL, {
|
||||
headline: `Delete ${item.name}`,
|
||||
content: 'Are you sure you want to delete this item?',
|
||||
color: 'danger',
|
||||
|
||||
@@ -3,7 +3,7 @@ import { manifests as createManifests } from './create/manifests.js';
|
||||
import {
|
||||
UmbCopyEntityAction,
|
||||
UmbMoveEntityAction,
|
||||
UmbTrashEntityAction,
|
||||
UmbDeleteEntityAction,
|
||||
UmbSortChildrenOfEntityAction,
|
||||
} from '@umbraco-cms/backoffice/entity-action';
|
||||
import { ManifestEntityAction } from '@umbraco-cms/backoffice/extension-registry';
|
||||
@@ -13,14 +13,14 @@ const entityType = 'document-type';
|
||||
const entityActions: Array<ManifestEntityAction> = [
|
||||
{
|
||||
type: 'entityAction',
|
||||
alias: 'Umb.EntityAction.DocumentType.Trash',
|
||||
name: 'Trash Document-Type Entity Action',
|
||||
alias: 'Umb.EntityAction.DocumentType.Delete',
|
||||
name: 'Delete Document-Type Entity Action',
|
||||
weight: 900,
|
||||
meta: {
|
||||
icon: 'umb:trash',
|
||||
label: 'Trash',
|
||||
label: 'Delete (TBD)',
|
||||
repositoryAlias: DOCUMENT_TYPE_REPOSITORY_ALIAS,
|
||||
api: UmbTrashEntityAction,
|
||||
api: UmbDeleteEntityAction,
|
||||
},
|
||||
conditions: {
|
||||
entityTypes: [entityType],
|
||||
|
||||
Reference in New Issue
Block a user