diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/manifests.ts index fd2a4d8bf1..a67699c745 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/manifests.ts @@ -2,8 +2,7 @@ import { UmbTemplateRepository } from '../repository/partial-views.repository'; import { PARTIAL_VIEW_REPOSITORY_ALIAS } from '../config'; import { UmbPartialViewsTreeStore } from './partial-views.tree.store'; import { UmbPartialViewsStore } from './partial-views.store'; -import { ManifestRepository } from 'libs/extensions-registry/repository.models'; -import { ManifestStore, ManifestTreeStore } from '@umbraco-cms/backoffice/extensions-registry'; +import { ManifestRepository, ManifestStore, ManifestTreeStore } from '@umbraco-cms/backoffice/extensions-registry'; const repository: ManifestRepository = { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.repository.ts index af23d46072..c1e1ee44d8 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.repository.ts @@ -81,7 +81,7 @@ export class UmbTemplateRepository implements UmbTreeRepository, UmbDetailR return { data: undefined, error }; } - const { data, error } = await this.#treeDataSource.getItems(keys); + const { data, error } = await this.#treeDataSource.getItem(keys); return { data, error, asObservable: () => this.#treeStore!.items(keys) }; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.store.ts index 4e63a23bd2..56c444e0d7 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.store.ts @@ -1,8 +1,8 @@ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; -import { ArrayState } from '@umbraco-cms/backoffice/observable-api'; +import { UmbArrayState } from '@umbraco-cms/backoffice/observable-api'; import { UmbStoreBase } from '@umbraco-cms/backoffice/store'; import type { TemplateResponseModel } from '@umbraco-cms/backoffice/backend-api'; -import type { UmbControllerHostInterface } from '@umbraco-cms/backoffice/controller'; +import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller'; import { UMB_PARTIAL_VIEW_STORE_CONTEXT_TOKEN_ALIAS } from '../config'; /** @@ -12,15 +12,17 @@ import { UMB_PARTIAL_VIEW_STORE_CONTEXT_TOKEN_ALIAS } from '../config'; * @description - Data Store for partial views */ export class UmbPartialViewsStore extends UmbStoreBase { - #data = new ArrayState([], (x) => x.key); - /** * Creates an instance of UmbPartialViewsStore. * @param {UmbControllerHostInterface} host * @memberof UmbPartialViewsStore */ - constructor(host: UmbControllerHostInterface) { - super(host, UMB_PARTIAL_VIEWS_STORE_CONTEXT_TOKEN.toString()); + constructor(host: UmbControllerHostElement) { + super( + host, + UMB_PARTIAL_VIEWS_STORE_CONTEXT_TOKEN.toString(), + new UmbArrayState([], (x) => x.id) + ); } /** @@ -29,7 +31,7 @@ export class UmbPartialViewsStore extends UmbStoreBase { * @memberof UmbPartialViewsStore */ append(template: TemplateResponseModel) { - this.#data.append([template]); + this._data.append([template]); } /** @@ -38,7 +40,7 @@ export class UmbPartialViewsStore extends UmbStoreBase { * @memberof UmbPartialViewsStore */ remove(uniques: string[]) { - this.#data.remove(uniques); + this._data.remove(uniques); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.tree.store.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.tree.store.ts index 035e75375c..46979f5686 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.tree.store.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/partial-views.tree.store.ts @@ -1,7 +1,7 @@ import { UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN_ALIAS } from '../config'; import { UmbContextToken } from '@umbraco-cms/backoffice/context-api'; import { UmbFileSystemTreeStore } from '@umbraco-cms/backoffice/store'; -import type { UmbControllerHostInterface } from '@umbraco-cms/backoffice/controller'; +import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller'; export const UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN = new UmbContextToken( UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN_ALIAS @@ -20,7 +20,7 @@ export class UmbPartialViewsTreeStore extends UmbFileSystemTreeStore { * @param {UmbControllerHostInterface} host * @memberof UmbPartialViewsTreeStore */ - constructor(host: UmbControllerHostInterface) { + constructor(host: UmbControllerHostElement) { super(host, UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT_TOKEN.toString()); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/index.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/index.ts index 1be4b13578..2a8d8c1290 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/index.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/index.ts @@ -15,5 +15,5 @@ export interface PartialViewsTreeDataSource { skip?: number | undefined; take?: number | undefined; }): Promise>; - getItems(paths: Array): Promise>; + getItem(ids: Array): Promise>; } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.detail.server.data.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.detail.server.data.ts index 0aff84c626..bbe848b399 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.detail.server.data.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.detail.server.data.ts @@ -1,16 +1,19 @@ import { PartialViewDetails } from '../../config'; -import type { UmbControllerHostInterface } from '@umbraco-cms/backoffice/controller'; +import type { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller'; import { DataSourceResponse, UmbDataSource } from '@umbraco-cms/backoffice/repository'; -export class UmbPartialViewDetailServerDataSource implements UmbDataSource { - #host: UmbControllerHostInterface; +//TODO Pass proper models +export class UmbPartialViewDetailServerDataSource + implements UmbDataSource +{ + #host: UmbControllerHostElement; /** * Creates an instance of UmbPartialViewDetailServerDataSource. * @param {UmbControllerHostInterface} host * @memberof UmbPartialViewDetailServerDataSource */ - constructor(host: UmbControllerHostInterface) { + constructor(host: UmbControllerHostElement) { this.#host = host; } @@ -33,10 +36,10 @@ export class UmbPartialViewDetailServerDataSource implements UmbDataSource> { throw new Error('Method not implemented.'); } - update(data: PartialViewDetails): Promise> { + update(unique: string, data: PartialViewDetails): Promise> { throw new Error('Method not implemented.'); } - delete(key: string): Promise> { + delete(unique: string): Promise { throw new Error('Method not implemented.'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.tree.server.data.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.tree.server.data.ts index 57a95b0e24..6ca9e554da 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.tree.server.data.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/repository/sources/partial-views.tree.server.data.ts @@ -1,12 +1,12 @@ import { PartialViewsTreeDataSource } from '.'; import { PartialViewResource, ProblemDetailsModel } from '@umbraco-cms/backoffice/backend-api'; -import { UmbControllerHostInterface } from '@umbraco-cms/backoffice/controller'; +import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller'; import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources'; export class UmbPartialViewsTreeServerDataSource implements PartialViewsTreeDataSource { - #host: UmbControllerHostInterface; + #host: UmbControllerHostElement; - constructor(host: UmbControllerHostInterface) { + constructor(host: UmbControllerHostElement) { this.#host = host; } @@ -38,16 +38,16 @@ export class UmbPartialViewsTreeServerDataSource implements PartialViewsTreeData ); } - async getItems(paths: Array) { - if (!paths) { + async getItem(id: Array) { + if (!id) { const error: ProblemDetailsModel = { title: 'Paths are missing' }; return { error }; } return tryExecuteAndNotify( this.#host, - PartialViewResource.getTreePartialViewItem({ - path: paths, + PartialViewResource.getPartialViewItem({ + id, }) ); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/workspace/partial-views-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/workspace/partial-views-workspace.context.ts index 3aa3343ce3..5e3634b785 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/workspace/partial-views-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/partial-views/workspace/partial-views-workspace.context.ts @@ -2,15 +2,27 @@ import { UmbTemplateRepository } from '../repository/partial-views.repository'; import { UmbWorkspaceContext } from '../../../shared/components/workspace/workspace-context/workspace-context'; import { createObservablePart, UmbDeepState } from '@umbraco-cms/backoffice/observable-api'; import { TemplateResponseModel } from '@umbraco-cms/backoffice/backend-api'; -import { UmbControllerHostInterface } from '@umbraco-cms/backoffice/controller'; +import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller'; -export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext { +export class UmbPartialViewsWorkspaceContext extends UmbWorkspaceContext { + getEntityId(): string | undefined { + throw new Error('Method not implemented.'); + } + getEntityType(): string { + throw new Error('Method not implemented.'); + } + save(): Promise { + throw new Error('Method not implemented.'); + } + destroy(): void { + throw new Error('Method not implemented.'); + } #data = new UmbDeepState(undefined); data = this.#data.asObservable(); name = createObservablePart(this.#data, (data) => data?.name); content = createObservablePart(this.#data, (data) => data?.content); - constructor(host: UmbControllerHostInterface) { + constructor(host: UmbControllerHostElement) { super(host, new UmbTemplateRepository(host)); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/manifests.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/manifests.ts index 74a59dc455..d981f5f1e9 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/manifests.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/manifests.ts @@ -1,4 +1,3 @@ -import { TEMPLATE_REPOSITORY_ALIAS } from '../repository/manifests'; import { UmbSaveWorkspaceAction } from '@umbraco-cms/backoffice/workspace'; import type { ManifestWorkspace, diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/template-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/template-workspace.element.ts index c45a694269..84e412696c 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/template-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/templating/templates/workspace/template-workspace.element.ts @@ -1,7 +1,9 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbRouterSlotInitEvent, IRoute, IRoutingInfo } from '@umbraco-cms/internal/router'; +import { UmbRouterSlotInitEvent } from '@umbraco-cms/internal/router'; +import type { IRoute, IRoutingInfo, PageComponent } from '@umbraco-cms/backoffice/router'; + import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; import './template-workspace-edit.element'; @@ -23,7 +25,7 @@ export class UmbTemplateWorkspaceElement extends UmbLitElement { { path: 'create/:parentKey', component: () => this.#element, - setup: async (component: HTMLElement, info: IRoutingInfo) => { + setup: (component: PageComponent, info: IRoutingInfo) => { const parentKey = info.match.params.parentKey; this.#templateWorkspaceContext.createScaffold(parentKey); }, @@ -31,7 +33,7 @@ export class UmbTemplateWorkspaceElement extends UmbLitElement { { path: 'edit/:key', component: () => this.#element, - setup: (component: HTMLElement, info: IRoutingInfo) => { + setup: (component: PageComponent, info: IRoutingInfo): void => { const key = info.match.params.key; this.#templateWorkspaceContext.load(key); },