From f4c8379a38335095394afa264bc159ae9260f5df Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:04:16 +0200 Subject: [PATCH 01/13] dictionary update --- ...shboard-localization-dictionary.element.ts | 36 ++++++++++--------- .../sources/dictionary.detail.server.data.ts | 4 +-- .../dictionary-workspace-editor.element.ts | 2 +- .../workspace/dictionary-workspace.context.ts | 13 ++++--- .../workspace/dictionary-workspace.element.ts | 2 +- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dashboards/dictionary/dashboard-localization-dictionary.element.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dashboards/dictionary/dashboard-localization-dictionary.element.ts index 4fb93e300d..24fc5641cf 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dashboards/dictionary/dashboard-localization-dictionary.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dashboards/dictionary/dashboard-localization-dictionary.element.ts @@ -1,5 +1,5 @@ import { UmbDictionaryRepository } from '../../dictionary/repository/dictionary.repository.js'; -import { UmbTextStyles } from "@umbraco-cms/backoffice/style"; +import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { css, html, customElement, state, when } from '@umbraco-cms/backoffice/external/lit'; import { UmbTableConfig, UmbTableColumn, UmbTableItem } from '@umbraco-cms/backoffice/components'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @@ -8,6 +8,7 @@ import { UmbModalManagerContext, UMB_MODAL_MANAGER_CONTEXT_TOKEN, UMB_CREATE_DICTIONARY_MODAL, + UmbModalRouteRegistrationController, } from '@umbraco-cms/backoffice/modal'; import { UmbContextConsumerController } from '@umbraco-cms/backoffice/context-api'; @@ -33,6 +34,9 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { #languages: Array = []; + @state() + protected _modalRouteNewDictionary?: string; + constructor() { super(); @@ -124,7 +128,7 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { #filter(e: { target: HTMLInputElement }) { this._tableItemsFiltered = e.target.value - ? this.#tableItems.filter((t) => t.id.includes(e.target.value)) + ? this.#tableItems.filter((t) => t.id.toLocaleLowerCase().includes(e.target.value.toLocaleLowerCase())) : this.#tableItems; } @@ -136,24 +140,23 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { const modalContext = this.#modalContext?.open(UMB_CREATE_DICTIONARY_MODAL, { parentId: null }); const { name, parentId } = await modalContext.onSubmit(); + if (!name || parentId === undefined) return; - const { data: url } = await this.#repo.create({ name, parentId }); + const { data } = await this.#repo.createScaffold(null, { name }); + const { error } = await this.#repo.create(data); - if (!url) return; - //TODO: Why do we need to extract the id like this? - const id = url.substring(url.lastIndexOf('/') + 1); - - history.pushState({}, '', `/section/dictionary/workspace/dictionary-item/edit/${id}`); + if (error) return; + history.pushState({}, '', `/section/dictionary/workspace/dictionary-item/edit/${data.id}`); } render() { return html`