Merge branch 'feature/entity-action-kind' of https://github.com/umbraco/Umbraco.CMS.Backoffice into feature/entity-action-kind
This commit is contained in:
@@ -7,10 +7,6 @@ export interface ManifestWorkspaceActionMenuItem
|
||||
extends ManifestElementAndApi<UmbControllerHostElement, UmbWorkspaceAction>,
|
||||
ManifestWithDynamicConditions<ConditionTypes> {
|
||||
type: 'workspaceActionMenuItem';
|
||||
meta: MetaWorkspaceActionMenuItem;
|
||||
}
|
||||
|
||||
export interface MetaWorkspaceActionMenuItem {
|
||||
/**
|
||||
* Define which workspace actions this menu item should be shown for.
|
||||
* @examples [
|
||||
@@ -19,8 +15,11 @@ export interface MetaWorkspaceActionMenuItem {
|
||||
* ]
|
||||
* @required
|
||||
*/
|
||||
workspaceActions: string | string[];
|
||||
forWorkspaceActions: string | string[];
|
||||
meta: MetaWorkspaceActionMenuItem;
|
||||
}
|
||||
|
||||
export interface MetaWorkspaceActionMenuItem {
|
||||
/**
|
||||
* An icon to represent the action to be performed
|
||||
*
|
||||
|
||||
@@ -18,8 +18,8 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
|
||||
* The workspace actions to filter the available actions by.
|
||||
* @example ['Umb.WorkspaceAction.Document.Save', 'Umb.WorkspaceAction.Document.SaveAndPublishNew']
|
||||
*/
|
||||
@property({ type: Array })
|
||||
workspaceActions: Array<string> = [];
|
||||
@property({ attribute: false })
|
||||
forWorkspaceActions: Array<string> = [];
|
||||
|
||||
@property()
|
||||
look: UUIInterfaceLook = 'secondary';
|
||||
@@ -46,7 +46,7 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
|
||||
if (!this.#workspaceContext) throw new Error('No workspace context');
|
||||
|
||||
// If there are no workspace action aliases, then there is no need to initialize the actions.
|
||||
if (!this.workspaceActions.length) return;
|
||||
if (!this.forWorkspaceActions.length) return;
|
||||
|
||||
const unique = this.#workspaceContext.getUnique();
|
||||
const entityType = this.#workspaceContext.getEntityType();
|
||||
@@ -56,9 +56,9 @@ export class UmbWorkspaceActionMenuElement extends UmbLitElement {
|
||||
umbExtensionsRegistry,
|
||||
'workspaceActionMenuItem', // TODO: Stop using string for 'workspaceActionMenuItem', we need to start using Const.
|
||||
(action) => {
|
||||
const containsAlias = Array.isArray(action.meta.workspaceActions)
|
||||
? action.meta.workspaceActions
|
||||
: [action.meta.workspaceActions].some((alias) => this.workspaceActions.includes(alias));
|
||||
const containsAlias = Array.isArray(action.forWorkspaceActions)
|
||||
? action.forWorkspaceActions.some((alias) => this.forWorkspaceActions.includes(alias))
|
||||
: this.forWorkspaceActions.includes(action.forWorkspaceActions);
|
||||
//const isValidEntityType = !action.forEntityTypes.length || action.forEntityTypes.includes(entityType);
|
||||
return containsAlias; // && isValidEntityType;
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UMB_DOCUMENT_ENTITY_TYPE } from '../entity.js';
|
||||
import { UMB_DOCUMENT_WORKSPACE_HAS_COLLECTION_CONDITION } from '../conditions/document-workspace-has-collection.condition.js';
|
||||
import { UmbUnpublishDocumentEntityAction } from '../entity-actions/unpublish.action.js';
|
||||
import { UmbPublishDocumentEntityAction } from '../entity-actions/publish.action.js';
|
||||
//import { UmbUnpublishDocumentEntityAction } from '../entity-actions/unpublish.action.js';
|
||||
//import { UmbPublishDocumentEntityAction } from '../entity-actions/publish.action.js';
|
||||
import { UmbDocumentSaveAndPublishWorkspaceAction } from './actions/save-and-publish.action.js';
|
||||
//import { UmbDocumentSaveAndPreviewWorkspaceAction } from './actions/save-and-preview.action.js';
|
||||
//import { UmbSaveAndScheduleDocumentWorkspaceAction } from './actions/save-and-schedule.action.js';
|
||||
@@ -163,9 +163,8 @@ const workspaceActionMenuItems: Array<ManifestWorkspaceActionMenuItem> = [
|
||||
name: 'Unpublish',
|
||||
weight: 10,
|
||||
api: UmbDocumentSaveAndPublishWorkspaceAction,
|
||||
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
|
||||
forWorkspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
meta: {
|
||||
workspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
label: 'Unpublish',
|
||||
icon: 'icon-globe',
|
||||
},
|
||||
@@ -177,9 +176,8 @@ const workspaceActionMenuItems: Array<ManifestWorkspaceActionMenuItem> = [
|
||||
name: 'Publish with descendants',
|
||||
weight: 20,
|
||||
api: UmbDocumentSaveAndPublishWorkspaceAction,
|
||||
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
|
||||
forWorkspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
meta: {
|
||||
workspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
label: 'Publish with descendants (TBD)',
|
||||
icon: 'icon-globe',
|
||||
},
|
||||
@@ -191,9 +189,8 @@ const workspaceActionMenuItems: Array<ManifestWorkspaceActionMenuItem> = [
|
||||
name: 'Schedule publishing',
|
||||
weight: 20,
|
||||
api: UmbDocumentSaveAndPublishWorkspaceAction,
|
||||
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
|
||||
forWorkspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
meta: {
|
||||
workspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPublish',
|
||||
label: 'Schedule publishing (TBD)',
|
||||
icon: 'icon-globe',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user