clean up
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { UMB_ENTITY_CONTEXT } from './entity.context-token.js';
|
||||
import type { UmbEntityUnique } from './types.js';
|
||||
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbStringState } from '@umbraco-cms/backoffice/observable-api';
|
||||
@@ -12,7 +13,7 @@ export class UmbEntityContext extends UmbContextBase<UmbEntityContext> {
|
||||
#entityType = new UmbStringState<string | undefined>(undefined);
|
||||
public readonly entityType = this.#entityType.asObservable();
|
||||
|
||||
#unique = new UmbStringState<string | null | undefined>(undefined);
|
||||
#unique = new UmbStringState<UmbEntityUnique>(null);
|
||||
public readonly unique = this.#unique.asObservable();
|
||||
|
||||
/**
|
||||
@@ -44,16 +45,16 @@ export class UmbEntityContext extends UmbContextBase<UmbEntityContext> {
|
||||
|
||||
/**
|
||||
* Set the unique
|
||||
* @param {string | null | undefined} unique
|
||||
* @param {string | null} unique
|
||||
* @memberof UmbEntityContext
|
||||
*/
|
||||
setUnique(unique: string | null | undefined) {
|
||||
setUnique(unique: string | null) {
|
||||
this.#unique.setValue(unique);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique
|
||||
* @returns {string | null | undefined}
|
||||
* @returns {string | null}
|
||||
* @memberof UmbEntityContext
|
||||
*/
|
||||
getUnique() {
|
||||
|
||||
@@ -3,17 +3,14 @@ import type { UmbWorkspaceContext } from '../../workspace-context.interface.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import type { ManifestWorkspace } from '@umbraco-cms/backoffice/workspace';
|
||||
import { UmbEntityContext } from '@umbraco-cms/backoffice/entity';
|
||||
import { UmbEntityContext, type UmbEntityUnique } from '@umbraco-cms/backoffice/entity';
|
||||
|
||||
export abstract class UmbDefaultWorkspaceContext
|
||||
export class UmbDefaultWorkspaceContext
|
||||
extends UmbContextBase<UmbDefaultWorkspaceContext>
|
||||
implements UmbWorkspaceContext
|
||||
{
|
||||
public workspaceAlias!: string;
|
||||
|
||||
#entityType!: string;
|
||||
#unique: string | null = null;
|
||||
|
||||
#entityContext = new UmbEntityContext(this);
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
@@ -22,18 +19,23 @@ export abstract class UmbDefaultWorkspaceContext
|
||||
|
||||
set manifest(manifest: ManifestWorkspace) {
|
||||
this.workspaceAlias = manifest.alias;
|
||||
this.#entityType = manifest.meta.entityType;
|
||||
|
||||
this.#entityContext.setEntityType(this.#entityType);
|
||||
this.#entityContext.setUnique(this.#unique);
|
||||
this.setEntityType(manifest.meta.entityType);
|
||||
}
|
||||
|
||||
getUnique(): string | null {
|
||||
return this.#unique;
|
||||
setUnique(unique: UmbEntityUnique): void {
|
||||
this.#entityContext.setUnique(unique);
|
||||
}
|
||||
|
||||
getUnique(): UmbEntityUnique {
|
||||
return this.#entityContext.getUnique();
|
||||
}
|
||||
|
||||
setEntityType(entityType: string): void {
|
||||
this.#entityContext.setEntityType(entityType);
|
||||
}
|
||||
|
||||
getEntityType(): string {
|
||||
return this.#entityType;
|
||||
return this.#entityContext.getEntityType()!;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user