entity actions
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import type { UmbWebhookDetailModel } from '../../../../../types.js';
|
||||
import { html, nothing, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
|
||||
@customElement('umb-webhook-table-entity-actions-column-layout')
|
||||
export class UmbWebhookTableEntityActionsColumnLayoutElement extends UmbLitElement {
|
||||
@property({ attribute: false })
|
||||
value!: UmbWebhookDetailModel;
|
||||
|
||||
@state()
|
||||
_isOpen = false;
|
||||
|
||||
#onActionExecuted() {
|
||||
this._isOpen = false;
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<umb-dropdown .open=${this._isOpen} compact hide-expand>
|
||||
<uui-symbol-more slot="label"></uui-symbol-more>
|
||||
<umb-entity-action-list
|
||||
@action-executed=${this.#onActionExecuted}
|
||||
entity-type=${this.value.entityType}
|
||||
unique=${ifDefined(this.value.unique)}></umb-entity-action-list>
|
||||
</umb-dropdown>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-webhook-table-entity-actions-column-layout': UmbWebhookTableEntityActionsColumnLayoutElement;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import type { UmbWebhookDetailModel } from '../../../../../types.js';
|
||||
import { html, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
|
||||
@customElement('umb-webhook-table-remove-column-layout')
|
||||
export class UmbWebhookTableRemoveColumnLayoutElement extends UmbLitElement {
|
||||
@property()
|
||||
value = '';
|
||||
|
||||
render() {
|
||||
return html` <uui-button label="remove"></uui-button> `;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'umb-webhook-table-remove-column-layout': UmbWebhookTableRemoveColumnLayoutElement;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
|
||||
import './column-layouts/boolean/webhook-table-boolean-column-layout.element.js';
|
||||
import './column-layouts/name/webhook-table-name-column-layout.element.js';
|
||||
import './column-layouts/remove/webhook-table-remove-column-layout.element.js';
|
||||
import './column-layouts/entity-actions/webhook-table-entity-actions-column-layout.element.js';
|
||||
|
||||
@customElement('umb-webhook-table-collection-view')
|
||||
export class UmbWebhookTableCollectionViewElement extends UmbLitElement {
|
||||
@@ -43,8 +43,8 @@ export class UmbWebhookTableCollectionViewElement extends UmbLitElement {
|
||||
},
|
||||
{
|
||||
name: '',
|
||||
alias: 'remove',
|
||||
elementName: 'umb-webhook-table-remove-column-layout',
|
||||
alias: 'entityActions',
|
||||
elementName: 'umb-webhook-table-entity-actions-column-layout',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -68,7 +68,6 @@ export class UmbWebhookTableCollectionViewElement extends UmbLitElement {
|
||||
}
|
||||
|
||||
#createTableItems(webhooks: Array<UmbWebhookDetailModel>) {
|
||||
console.log(webhooks);
|
||||
this._tableItems = webhooks.map((webhook, index) => {
|
||||
return {
|
||||
id: webhook.unique,
|
||||
@@ -96,8 +95,8 @@ export class UmbWebhookTableCollectionViewElement extends UmbLitElement {
|
||||
value: webhook.contentTypes,
|
||||
},
|
||||
{
|
||||
columnAlias: 'remove',
|
||||
value: webhook.unique,
|
||||
columnAlias: 'entityActions',
|
||||
value: webhook,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { UMB_WEBHOOK_DETAIL_REPOSITORY_ALIAS } from '../repository/index.js';
|
||||
import { UMB_WEBHOOK_ENTITY_TYPE } from '../entity.js';
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
const entityActions: Array<ManifestTypes> = [
|
||||
{
|
||||
type: 'entityAction',
|
||||
kind: 'delete',
|
||||
alias: 'Umb.EntityAction.Webhook.Delete',
|
||||
name: 'Delete Webhook Entity Action',
|
||||
forEntityTypes: [UMB_WEBHOOK_ENTITY_TYPE],
|
||||
meta: {
|
||||
detailRepositoryAlias: UMB_WEBHOOK_DETAIL_REPOSITORY_ALIAS,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [...entityActions];
|
||||
@@ -1,4 +1,5 @@
|
||||
export const UMB_WEBHOOK_ENTITY_TYPE = 'webhook';
|
||||
export const UMB_WEBHOOK_WORKSPACE = 'Umb.Workspace.Webhook';
|
||||
export const UMB_WEBHOOK_ROOT_ENTITY_TYPE = 'webhook-root';
|
||||
|
||||
export type UmbWebhookEntityType = typeof UMB_WEBHOOK_ENTITY_TYPE;
|
||||
|
||||
@@ -2,6 +2,7 @@ import { manifests as treeManifests } from './menu-item/manifests.js';
|
||||
import { manifests as workspaceManifests } from './workspace/manifests.js';
|
||||
import { manifests as collectionManifests } from './collection/manifests.js';
|
||||
import { manifests as repositoryManifests } from './repository/manifests.js';
|
||||
import { manifests as entityActions } from './entity-actions/manifests.js';
|
||||
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
|
||||
|
||||
export const manifests: Array<ManifestTypes> = [
|
||||
@@ -9,6 +10,7 @@ export const manifests: Array<ManifestTypes> = [
|
||||
...workspaceManifests,
|
||||
...collectionManifests,
|
||||
...repositoryManifests,
|
||||
...entityActions,
|
||||
{
|
||||
type: 'modal',
|
||||
alias: 'Umb.Modal.Webhook.Events',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UmbWebhookDetailModel } from '../../types.js';
|
||||
import type { UmbWebhookDetailModel, UmbWebhookEventModel } from '../../types.js';
|
||||
import { UmbWebhookDetailRepository } from '../../repository/index.js';
|
||||
import { UmbWebhookWorkspaceEditorElement } from './webhook-workspace-editor.element.js';
|
||||
import {
|
||||
@@ -21,7 +21,6 @@ export class UmbWebhookWorkspaceContext
|
||||
readonly data = this.#data.asObservable();
|
||||
|
||||
readonly unique = this.#data.asObservablePart((data) => data?.unique);
|
||||
readonly name = this.#data.asObservablePart((data) => data?.name);
|
||||
|
||||
readonly routes = new UmbWorkspaceRouteManager(this);
|
||||
|
||||
@@ -88,11 +87,7 @@ export class UmbWebhookWorkspaceContext
|
||||
return this.#data.getValue()?.unique;
|
||||
}
|
||||
|
||||
setName(name: string) {
|
||||
this.#data.update({ name });
|
||||
}
|
||||
|
||||
setEvents(events: string[]) {
|
||||
setEvents(events: Array<UmbWebhookEventModel>) {
|
||||
this.#data.update({ events });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user