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 24fc5641cf..e332fc9186 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 @@ -4,13 +4,6 @@ import { css, html, customElement, state, when } from '@umbraco-cms/backoffice/e import { UmbTableConfig, UmbTableColumn, UmbTableItem } from '@umbraco-cms/backoffice/components'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import { DictionaryOverviewResponseModel, LanguageResponseModel } from '@umbraco-cms/backoffice/backend-api'; -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'; @customElement('umb-dashboard-translation-dictionary') export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { @@ -26,8 +19,6 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { #repo!: UmbDictionaryRepository; - #modalContext!: UmbModalManagerContext; - #tableItems: Array = []; #tableColumns: Array = []; @@ -39,10 +30,6 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { constructor() { super(); - - new UmbContextConsumerController(this, UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => { - this.#modalContext = instance; - }); } async connectedCallback() { @@ -132,29 +119,15 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { : this.#tableItems; } - async #create() { - // TODO: what to do if modal service is not available? - if (!this.#modalContext) return; - if (!this.#repo) return; - - const modalContext = this.#modalContext?.open(UMB_CREATE_DICTIONARY_MODAL, { parentId: null }); - - const { name, parentId } = await modalContext.onSubmit(); - - if (!name || parentId === undefined) return; - - const { data } = await this.#repo.createScaffold(null, { name }); - const { error } = await this.#repo.create(data); - - if (error) return; - history.pushState({}, '', `/section/dictionary/workspace/dictionary-item/edit/${data.id}`); - } - render() { return html` `; diff --git a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/workspace/dictionary-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/workspace/dictionary-workspace.element.ts index 0e5a4b77a2..99b9099679 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/workspace/dictionary-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/dictionary/dictionary/workspace/dictionary-workspace.element.ts @@ -20,6 +20,14 @@ export class UmbWorkspaceDictionaryElement extends UmbLitElement { this.#workspaceContext.load(id); }, }, + { + path: 'create/:parentId', + component: () => this.#element, + setup: (_component, info) => { + const parentId = info.match.params.parentId === 'null' ? null : info.match.params.parentId; + this.#workspaceContext.create(parentId); + }, + }, ]; render() {