MetaWorkspaceActionMenuItem
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import type { ConditionTypes } from '../conditions/types.js';
|
||||
import type { MetaEntityAction } from './entity-action.model.js';
|
||||
import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { ManifestElementAndApi, ManifestWithDynamicConditions } from '@umbraco-cms/backoffice/extension-api';
|
||||
import type { UmbWorkspaceAction } from '@umbraco-cms/backoffice/workspace';
|
||||
@@ -11,8 +10,7 @@ export interface ManifestWorkspaceActionMenuItem
|
||||
meta: MetaWorkspaceActionMenuItem;
|
||||
}
|
||||
|
||||
// TODO: Stop inheriting from from EntityActions, they are not equivalent as workspace actions have the workspace context available. [NL]
|
||||
export interface MetaWorkspaceActionMenuItem extends MetaEntityAction {
|
||||
export interface MetaWorkspaceActionMenuItem {
|
||||
/**
|
||||
* Define which workspace actions this menu item should be shown for.
|
||||
* @examples [
|
||||
@@ -22,4 +20,24 @@ export interface MetaWorkspaceActionMenuItem extends MetaEntityAction {
|
||||
* @required
|
||||
*/
|
||||
workspaceActions: string | string[];
|
||||
|
||||
/**
|
||||
* An icon to represent the action to be performed
|
||||
*
|
||||
* @examples [
|
||||
* "icon-box",
|
||||
* "icon-grid"
|
||||
* ]
|
||||
*/
|
||||
icon: string;
|
||||
|
||||
/**
|
||||
* The friendly name of the action to perform
|
||||
*
|
||||
* @examples [
|
||||
* "Create",
|
||||
* "Create Content Template"
|
||||
* ]
|
||||
*/
|
||||
label: string;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
|
||||
const containsAlias = Array.isArray(action.meta.workspaceActions)
|
||||
? action.meta.workspaceActions
|
||||
: [action.meta.workspaceActions].some((alias) => this.workspaceActions.includes(alias));
|
||||
const isValidEntityType = !action.meta.entityTypes.length || action.meta.entityTypes.includes(entityType);
|
||||
return containsAlias && isValidEntityType;
|
||||
//const isValidEntityType = !action.forEntityTypes.length || action.forEntityTypes.includes(entityType);
|
||||
return containsAlias; // && isValidEntityType;
|
||||
},
|
||||
(ctrls) => {
|
||||
this._actions = ctrls;
|
||||
|
||||
@@ -158,44 +158,44 @@ const workspaceActions: Array<ManifestWorkspaceAction> = [
|
||||
const workspaceActionMenuItems: Array<ManifestWorkspaceActionMenuItem> = [
|
||||
{
|
||||
type: 'workspaceActionMenuItem',
|
||||
kind: 'default',
|
||||
alias: 'Umb.Document.WorkspaceActionMenuItem.Unpublish',
|
||||
name: 'Unpublish',
|
||||
weight: 10,
|
||||
api: UmbUnpublishDocumentEntityAction,
|
||||
api: UmbDocumentSaveAndPublishWorkspaceAction,
|
||||
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
|
||||
meta: {
|
||||
workspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
label: 'Unpublish',
|
||||
icon: 'icon-globe',
|
||||
repositoryAlias: 'Umb.Repository.Document.Detail',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'workspaceActionMenuItem',
|
||||
kind: 'default',
|
||||
alias: 'Umb.Document.WorkspaceActionMenuItem.PublishWithDescendants',
|
||||
name: 'Publish with descendants',
|
||||
weight: 20,
|
||||
api: UmbPublishDocumentEntityAction,
|
||||
api: UmbDocumentSaveAndPublishWorkspaceAction,
|
||||
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
|
||||
meta: {
|
||||
workspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
label: 'Publish with descendants (TBD)',
|
||||
icon: 'icon-globe',
|
||||
repositoryAlias: 'Umb.Repository.Document.Detail',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'workspaceActionMenuItem',
|
||||
kind: 'default',
|
||||
alias: 'Umb.Document.WorkspaceActionMenuItem.SchedulePublishing',
|
||||
name: 'Schedule publishing',
|
||||
weight: 20,
|
||||
api: UmbPublishDocumentEntityAction,
|
||||
api: UmbDocumentSaveAndPublishWorkspaceAction,
|
||||
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
|
||||
meta: {
|
||||
workspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
label: 'Schedule publishing (TBD)',
|
||||
icon: 'icon-globe',
|
||||
repositoryAlias: 'Umb.Repository.Document.Detail',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -43,7 +43,7 @@ export class UmbInputEntityUserPermissionElement extends FormControlMixin(UmbLit
|
||||
umbExtensionsRegistry.byType('entityUserPermission'),
|
||||
(userPermissionManifests) => {
|
||||
this._manifests = userPermissionManifests.filter((manifest) =>
|
||||
manifest.forEntityTypes.some((x) => x === this.entityType),
|
||||
manifest.forEntityTypes.includes(this.entityType),
|
||||
);
|
||||
},
|
||||
'umbUserPermissionManifestsObserver',
|
||||
|
||||
Reference in New Issue
Block a user