diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/repository/user-group.repository.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/repository/user-group.repository.ts index 7e4eac48ec..2871c3444a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/repository/user-group.repository.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/repository/user-group.repository.ts @@ -1,11 +1,40 @@ +import { Observable } from 'rxjs'; +import { UserGroupBaseModel } from '@umbraco-cms/backoffice/backend-api'; import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller'; +import { + UmbCollectionRepository, + UmbDetailRepository, + UmbRepositoryErrorResponse, + UmbRepositoryResponse, +} from '@umbraco-cms/backoffice/repository'; // TODO: implement -export class UmbUserGroupRepository { +export class UmbUserGroupRepository implements UmbDetailRepository, UmbCollectionRepository { #host: UmbControllerHostElement; constructor(host: UmbControllerHostElement) { this.#host = host; - console.log(this.#host); + } + + createScaffold(parentId: string | null): Promise> { + throw new Error('Method not implemented.'); + } + requestById(id: string): Promise> { + throw new Error('Method not implemented.'); + } + byId(id: string): Promise> { + throw new Error('Method not implemented.'); + } + create(data: any): Promise> { + throw new Error('Method not implemented.'); + } + save(id: string, data: any): Promise { + throw new Error('Method not implemented.'); + } + delete(id: string): Promise { + throw new Error('Method not implemented.'); + } + requestCollection(filter?: any): Promise { + throw new Error('Method not implemented.'); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts index aea68ddabd..75b72a1e89 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/user-groups/workspace/user-group-workspace.context.ts @@ -11,6 +11,20 @@ export class UmbUserGroupWorkspaceContext #data = new UmbObjectState(undefined); data = this.#data.asObservable(); + constructor(host: UmbControllerHostElement) { + super(host, new UmbUserGroupRepository(host)); + } + + async load(id: string) { + console.log('load'); + + const { data } = await this.repository.requestById(id); + if (data) { + this.setIsNew(false); + this.#data.update(data); + } + } + getEntityId(): string | undefined { throw new Error('Method not implemented.'); } @@ -26,9 +40,6 @@ export class UmbUserGroupWorkspaceContext destroy(): void { throw new Error('Method not implemented.'); } - constructor(host: UmbControllerHostElement) { - super(host, new UmbUserGroupRepository(host)); - } updateProperty(alias: Alias, value: UserGroupBaseModel[Alias]) { this.#data.update({ [alias]: value });