From 92028a2b1cfb7429684d9f516d4a5eb6cd89f18d Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Mon, 28 Oct 2024 11:28:00 +0100 Subject: [PATCH 1/4] Tags matchlist on top of following markdown toolbar (#2489) Set z-index of matchlist to ensure on top of following markdown toolbar (cherry picked from commit c9f8f62b844e7f163d2d5b84d02992f9a22fc56d) --- .../packages/tags/components/tags-input/tags-input.element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 { From 9b94b4abc9aa298a6f60c46bfc536eea6d38423b Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 28 Oct 2024 11:35:32 +0100 Subject: [PATCH 2/4] Bugfix: Hide template input when there are no allowed templates (#2484) hide template input when there are no allowed templates --- .../document-workspace-view-info.element.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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} -
`; } From 18f1df46a5625fe8af8cde89747a3b944593f21a Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 28 Oct 2024 11:41:45 +0100 Subject: [PATCH 3/4] Hotfix: Publish with decendants structure reload (#2486) * ensure we always have the latest variant data * use enum value * Update document-tree-item.element.ts * only dispatch event if there is no error * reload structure after publish with descendants * only request update if it succeeds * rename private method --- .../entity-actions/unpublish.action.ts | 16 ++++--- .../tree-item/document-tree-item.element.ts | 17 ++++--- .../workspace/document-workspace.context.ts | 45 ++++++++++++++----- 3 files changed, 56 insertions(+), 22 deletions(-) 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() { From 848ddb774b8fdf72d15d270bd619627fac74c6c4 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Mon, 28 Oct 2024 11:48:32 +0100 Subject: [PATCH 4/4] Hotfix: Correct user enable notification (#2487) * show localized notification when user is enabled * localize disable messages --- .../disable/disable-user.repository.ts | 17 ++++++++++++++++- .../repository/enable/enable-user.repository.ts | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) 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); }