diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts index ff9d645a17..46d3471ea3 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/entity-actions/unpublish.action.ts @@ -77,15 +77,17 @@ export class UmbUnpublishDocumentEntityAction extends UmbEntityActionBase if (variantIds.length) { const publishingRepository = new UmbDocumentPublishingRepository(this._host); - await publishingRepository.unpublish(this.args.unique, variantIds); + const { error } = await publishingRepository.unpublish(this.args.unique, variantIds); - const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); - const event = new UmbRequestReloadStructureForEntityEvent({ - unique: this.args.unique, - entityType: this.args.entityType, - }); + if (!error) { + const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const event = new UmbRequestReloadStructureForEntityEvent({ + unique: this.args.unique, + entityType: this.args.entityType, + }); - actionEventContext.dispatchEvent(event); + actionEventContext.dispatchEvent(event); + } } } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts index 3c5c94c536..634f3d8bad 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.element.ts @@ -1,4 +1,5 @@ import type { UmbDocumentTreeItemModel, UmbDocumentTreeItemVariantModel } from '../types.js'; +import { DocumentVariantStateModel } from '@umbraco-cms/backoffice/external/backend-api'; import { css, html, nothing, customElement, state, classMap } from '@umbraco-cms/backoffice/external/lit'; import type { UmbAppLanguageContext } from '@umbraco-cms/backoffice/language'; import { UMB_APP_LANGUAGE_CONTEXT } from '@umbraco-cms/backoffice/language'; @@ -31,7 +32,7 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase { this._currentCulture = value; - this._variant = this.#getVariant(value); + this._variant = this.#findVariant(value); }); } @@ -41,7 +42,7 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase x.culture === culture); } @@ -56,16 +57,22 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase ({ variantId })), ); - const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); - const event = new UmbRequestReloadStructureForEntityEvent({ - unique: this.getUnique()!, - entityType: this.getEntityType(), - }); + if (!error) { + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + const event = new UmbRequestReloadStructureForEntityEvent({ + unique: this.getUnique()!, + entityType: this.getEntityType(), + }); - eventContext.dispatchEvent(event); + eventContext.dispatchEvent(event); + } } async #handleSave() { @@ -826,6 +828,12 @@ export class UmbDocumentWorkspaceContext } public async publishWithDescendants() { + const unique = this.getUnique(); + if (!unique) throw new Error('Unique is missing'); + + const entityType = this.getEntityType(); + if (!entityType) throw new Error('Entity type is missing'); + const { options, selected } = await this.#determineVariantOptions(); const modalManagerContext = await this.getContext(UMB_MODAL_MANAGER_CONTEXT); @@ -847,13 +855,30 @@ export class UmbDocumentWorkspaceContext if (!variantIds.length) return; - const unique = this.getUnique(); - if (!unique) throw new Error('Unique is missing'); - await this.publishingRepository.publishWithDescendants( + const { error } = await this.publishingRepository.publishWithDescendants( unique, variantIds, result.includeUnpublishedDescendants ?? false, ); + + if (!error) { + const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT); + + // request reload of this entity + const structureEvent = new UmbRequestReloadStructureForEntityEvent({ + entityType, + unique, + }); + + // request reload of the children + const childrenEvent = new UmbRequestReloadChildrenOfEntityEvent({ + entityType, + unique, + }); + + eventContext.dispatchEvent(structureEvent); + eventContext.dispatchEvent(childrenEvent); + } } async delete() { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/views/info/document-workspace-view-info.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/views/info/document-workspace-view-info.element.ts index c6a42baecf..f19154a2aa 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/views/info/document-workspace-view-info.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/views/info/document-workspace-view-info.element.ts @@ -206,7 +206,6 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement { #renderGeneralSection() { const editDocumentTypePath = this._routeBuilder?.({ entityType: 'document-type' }) ?? ''; - const editTemplatePath = this._routeBuilder?.({ entityType: 'template' }) ?? ''; return html`
@@ -224,6 +223,20 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement {
+ ${this.#renderTemplateInput()} +
+ Id + ${this._documentUnique} +
+ `; + } + + #renderTemplateInput() { + if (this._allowedTemplates?.length === 0) return nothing; + + const editTemplatePath = this._routeBuilder?.({ entityType: 'template' }) ?? ''; + + return html`
Template ${this._templateUnique @@ -247,10 +260,6 @@ export class UmbDocumentWorkspaceViewInfoElement extends UmbLitElement { @click=${this.#openTemplatePicker}> `}
-
- Id - ${this._documentUnique} -
`; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/tags/components/tags-input/tags-input.element.ts b/src/Umbraco.Web.UI.Client/src/packages/tags/components/tags-input/tags-input.element.ts index bbe9e20bae..2c51692616 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/tags/components/tags-input/tags-input.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/tags/components/tags-input/tags-input.element.ts @@ -393,7 +393,6 @@ export class UmbTagsInputElement extends UUIFormControlMixin(UmbLitElement, '') } #matchlist { - display: none; display: flex; flex-direction: column; background-color: var(--uui-color-surface); @@ -403,6 +402,7 @@ export class UmbTagsInputElement extends UUIFormControlMixin(UmbLitElement, '') top: var(--uui-size-space-6); border-radius: var(--uui-border-radius); border: 1px solid var(--uui-color-border); + z-index: 10; } #matchlist label { diff --git a/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/disable/disable-user.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/disable/disable-user.repository.ts index d7c94c6beb..81bc35ff41 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/disable/disable-user.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/disable/disable-user.repository.ts @@ -1,10 +1,14 @@ import { UmbUserRepositoryBase } from '../user-repository-base.js'; +import { UmbUserItemRepository } from '../item/index.js'; import { UmbDisableUserServerDataSource } from './disable-user.server.data-source.js'; +import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UserStateModel } from '@umbraco-cms/backoffice/external/backend-api'; export class UmbDisableUserRepository extends UmbUserRepositoryBase { #disableSource: UmbDisableUserServerDataSource; + #localize = new UmbLocalizationController(this); + #userItemRepository = new UmbUserItemRepository(this); constructor(host: UmbControllerHost) { super(host); @@ -18,11 +22,22 @@ export class UmbDisableUserRepository extends UmbUserRepositoryBase { const { data, error } = await this.#disableSource.disable(ids); if (!error) { + const { data: items } = await this.#userItemRepository.requestItems(ids); + if (!items) throw new Error('Could not load user item'); + + // TODO: get state from item when available ids.forEach((id) => { this.detailStore?.updateItem(id, { state: UserStateModel.DISABLED }); }); - const notification = { data: { message: `User disabled` } }; + let message = this.#localize.term('speechBubbles_disableUsersSuccess', items.length); + + if (items.length === 1) { + const names = items?.map((item) => item.name).join(', '); + message = this.#localize.term('speechBubbles_disableUserSuccess', names); + } + + const notification = { data: { message } }; this.notificationContext?.peek('positive', notification); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/enable/enable-user.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/enable/enable-user.repository.ts index 2728c4807d..4c871e5fd5 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/enable/enable-user.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/user/user/repository/enable/enable-user.repository.ts @@ -1,10 +1,14 @@ import { UmbUserRepositoryBase } from '../user-repository-base.js'; +import { UmbUserItemRepository } from '../item/index.js'; import { UmbEnableUserServerDataSource } from './enable-user.server.data-source.js'; +import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api'; import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api'; import { UserStateModel } from '@umbraco-cms/backoffice/external/backend-api'; export class UmbEnableUserRepository extends UmbUserRepositoryBase { #enableSource: UmbEnableUserServerDataSource; + #localize = new UmbLocalizationController(this); + #userItemRepository = new UmbUserItemRepository(this); constructor(host: UmbControllerHost) { super(host); @@ -18,11 +22,22 @@ export class UmbEnableUserRepository extends UmbUserRepositoryBase { const { data, error } = await this.#enableSource.enable(ids); if (!error) { + const { data: items } = await this.#userItemRepository.requestItems(ids); + if (!items) throw new Error('Could not load user item'); + + // TODO: get state from item when available ids.forEach((id) => { this.detailStore?.updateItem(id, { state: UserStateModel.ACTIVE }); }); - const notification = { data: { message: `User disabled` } }; + let message = this.#localize.term('speechBubbles_enableUsersSuccess', items.length); + + if (items.length === 1) { + const names = items?.map((item) => item.name).join(', '); + message = this.#localize.term('speechBubbles_enableUserSuccess', names); + } + + const notification = { data: { message } }; this.notificationContext?.peek('positive', notification); }