move from general workspace context to document type context

This commit is contained in:
Lone Iversen
2023-10-09 15:30:53 +02:00
committed by Jacob Overgaard
parent 44ad430db1
commit 72317c8e31
3 changed files with 12 additions and 15 deletions

View File

@@ -15,8 +15,4 @@ export interface UmbWorkspaceContextInterface<DataType = unknown> {
isNew: Observable<boolean | undefined>;
getIsNew(): boolean | undefined;
setIsNew(value: boolean): void;
isSorting: Observable<boolean | undefined>;
getIsSorting(): boolean | undefined;
setIsSorting(value: boolean): void;
}

View File

@@ -24,9 +24,6 @@ export abstract class UmbWorkspaceContext<RepositoryType, EntityType extends Umb
#isNew = new UmbBooleanState(undefined);
isNew = this.#isNew.asObservable();
#isSorting = new UmbBooleanState(undefined);
isSorting = this.#isSorting.asObservable();
constructor(host: UmbControllerHostElement, workspaceAlias: string, repository: RepositoryType) {
super(host);
this.host = host;
@@ -46,14 +43,6 @@ export abstract class UmbWorkspaceContext<RepositoryType, EntityType extends Umb
this.#isNew.next(isNew);
}
getIsSorting() {
return this.#isSorting.getValue();
}
setIsSorting(isSorting: boolean) {
this.#isSorting.next(isSorting);
}
protected saveComplete(data: EntityType) {
if (this.modalContext) {
this.submitModal(data);

View File

@@ -8,6 +8,7 @@ import type {
} from '@umbraco-cms/backoffice/backend-api';
import { UmbControllerHostElement } from '@umbraco-cms/backoffice/controller-api';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
type EntityType = DocumentTypeResponseModel;
export class UmbDocumentTypeWorkspaceContext
@@ -37,6 +38,9 @@ export class UmbDocumentTypeWorkspaceContext
readonly structure;
#isSorting = new UmbBooleanState(undefined);
isSorting = this.#isSorting.asObservable();
constructor(host: UmbControllerHostElement) {
super(host, 'Umb.Workspace.DocumentType', new UmbDocumentTypeRepository(host));
@@ -61,6 +65,14 @@ export class UmbDocumentTypeWorkspaceContext
this.cleanup = this.structure.ownerContentTypeObservablePart((data) => data?.defaultTemplateId);
}
getIsSorting() {
return this.#isSorting.getValue();
}
setIsSorting(isSorting: boolean) {
this.#isSorting.next(isSorting);
}
getData() {
return this.structure.getOwnerContentType() || {};
}