From 4ffa3c0fa54958ccec2f2ceda897f4896cf5e904 Mon Sep 17 00:00:00 2001 From: Julia Gru <56249914+julczka@users.noreply.github.com> Date: Fri, 21 Jul 2023 17:11:14 +0200 Subject: [PATCH] fix create empty --- .../entity-actions/create/create-empty.action.ts | 2 +- .../repository/partial-views.repository.ts | 14 ++++++++++---- .../workspace/partial-views-workspace.element.ts | 1 - 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create-empty.action.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create-empty.action.ts index 85c4972003..2479e0cb80 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create-empty.action.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/entity-actions/create/create-empty.action.ts @@ -7,6 +7,6 @@ export class UmbCreateEmptyPartialViewAction } } async execute() { - history.pushState(null, '', `section/settings/workspace/partial-view/create/${this.unique ?? 'null'}/`); + history.pushState(null, '', `section/settings/workspace/partial-view/create/${this.unique ?? 'null'}/Empty`); } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/repository/partial-views.repository.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/repository/partial-views.repository.ts index a54327b016..e1100fb909 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/repository/partial-views.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/repository/partial-views.repository.ts @@ -202,14 +202,20 @@ export class UmbPartialViewsRepository createScaffold(parentId: string | null, preset: string): Promise> { return this.#detailDataSource.createScaffold(parentId, preset); } - create(data: CreatePartialViewRequestModel): Promise> { - return this.#detailDataSource.insert(data); + async create(data: CreatePartialViewRequestModel): Promise> { + const promise = this.#detailDataSource.insert(data); + await promise; + this.requestTreeItemsOf(data.parentPath ? data.parentPath : null); + return promise; } save(id: string, requestBody: UpdatePartialViewRequestModel): Promise { return this.#detailDataSource.update(id, requestBody); } - delete(id: string): Promise { - return this.#detailDataSource.delete(id); + async delete(id: string): Promise { + const promise = this.#detailDataSource.delete(id); + const parentPath = id.substring(0, id.lastIndexOf('/')); + this.requestTreeItemsOf(parentPath ? parentPath : null); + return promise; } getSnippets({ skip = 0, take = 100 }): Promise> { diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.element.ts index dfdba3d3b3..fd4e506f4b 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/partial-views/workspace/partial-views-workspace.element.ts @@ -24,7 +24,6 @@ export class UmbPartialViewsWorkspaceElement extends UmbLitElement { const parentKey = info.match.params.parentKey; const decodePath = decodeURIComponent(parentKey); const snippetName = info.match.params.snippetName; - this.#partialViewsWorkspaceContext.create(decodePath === 'null' ? null : parentKey, snippetName); new UmbWorkspaceIsNewRedirectController(