Skip to content

Commit 53d0d6c

Browse files
committed
move unique + entityType observable to the base class
1 parent 1ed8de8 commit 53d0d6c

File tree

18 files changed

+13
-30
lines changed

18 files changed

+13
-30
lines changed

src/packages/core/workspace/entity-detail/entity-detail-workspace-base.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { UmbEntityWorkspaceDataManager } from '../entity/entity-workspace-data-m
33
import { UMB_WORKSPACE_PATH_PATTERN } from '../paths.js';
44
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
55
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
6-
import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';
6+
import type { UmbEntityModel, UmbEntityUnique } from '@umbraco-cms/backoffice/entity';
77
import { UMB_DISCARD_CHANGES_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
88
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
99
import {
@@ -37,15 +37,18 @@ export abstract class UmbEntityDetailWorkspaceContextBase<
3737
* @memberof UmbEntityWorkspaceContextBase
3838
*/
3939
protected readonly _data = new UmbEntityWorkspaceDataManager<DetailModelType>(this);
40+
4041
public readonly data = this._data.current;
42+
public readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
43+
public readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
4144

4245
protected _getDataPromise?: Promise<any>;
4346

4447
protected _detailRepository?: DetailRepositoryType;
4548

4649
#entityType: string;
4750

48-
#parent = new UmbObjectState<{ entityType: string; unique: string | null } | undefined>(undefined);
51+
#parent = new UmbObjectState<{ entityType: string; unique: UmbEntityUnique } | undefined>(undefined);
4952
readonly parentUnique = this.#parent.asObservablePart((parent) => (parent ? parent.unique : undefined));
5053
readonly parentEntityType = this.#parent.asObservablePart((parent) => (parent ? parent.entityType : undefined));
5154

src/packages/data-type/tree/folder/workspace/data-type-folder-workspace.context.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export class UmbDataTypeFolderWorkspaceContext
1515
extends UmbEntityDetailWorkspaceContextBase<UmbFolderModel, UmbDataTypeFolderRepository>
1616
implements UmbSubmittableWorkspaceContext, UmbRoutableWorkspaceContext
1717
{
18-
public readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
19-
public readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
2018
public readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
2119

2220
constructor(host: UmbControllerHost) {

src/packages/data-type/workspace/data-type-workspace.context.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ export class UmbDataTypeWorkspaceContext
4646
implements UmbInvariantDatasetWorkspaceContext, UmbRoutableWorkspaceContext
4747
{
4848
readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
49-
readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
50-
readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
51-
5249
readonly propertyEditorUiAlias = this._data.createObservablePartOfCurrent((data) => data?.editorUiAlias);
5350
readonly propertyEditorSchemaAlias = this._data.createObservablePartOfCurrent((data) => data?.editorAlias);
5451

src/packages/dictionary/workspace/dictionary-workspace.context.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ export class UmbDictionaryWorkspaceContext
1515
extends UmbEntityDetailWorkspaceContextBase<UmbDictionaryDetailModel, UmbDictionaryDetailRepository>
1616
implements UmbSubmittableWorkspaceContext, UmbRoutableWorkspaceContext
1717
{
18-
readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
19-
readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
20-
2118
readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
2219
readonly dictionary = this._data.createObservablePartOfCurrent((data) => data);
2320

src/packages/documents/document-types/tree/folder/workspace/document-type-folder-workspace.context.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export class UmbDocumentTypeFolderWorkspaceContext
1818
extends UmbEntityDetailWorkspaceContextBase<UmbFolderModel, UmbDocumentTypeFolderRepository>
1919
implements UmbSubmittableWorkspaceContext, UmbRoutableWorkspaceContext
2020
{
21-
public readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
22-
public readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
2321
public readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
2422

2523
constructor(host: UmbControllerHost) {

src/packages/language/workspace/language/language-workspace.context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export class UmbLanguageWorkspaceContext
1717
{
1818
public readonly repository: UmbLanguageDetailRepository = new UmbLanguageDetailRepository(this);
1919

20-
readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
2120
readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
2221

2322
constructor(host: UmbControllerHost) {

src/packages/members/member-group/workspace/member-group/member-group-workspace-editor.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class UmbMemberGroupWorkspaceEditorElement extends UmbLitElement {
2727
this.#workspaceContext = workspaceContext;
2828
if (!this.#workspaceContext) return;
2929
this.observe(this.#workspaceContext.name, (name) => (this._name = name ?? ''));
30-
this.observe(this.#workspaceContext.unique, (unique) => (this._unique = unique));
30+
this.observe(this.#workspaceContext.unique, (unique) => (this._unique = unique ?? undefined));
3131
});
3232
}
3333

src/packages/members/member-group/workspace/member-group/member-group-workspace.context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export class UmbMemberGroupWorkspaceContext
1616
extends UmbEntityDetailWorkspaceContextBase<UmbMemberGroupDetailModel>
1717
implements UmbSubmittableWorkspaceContext, UmbRoutableWorkspaceContext
1818
{
19-
readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
2019
readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
2120

2221
constructor(host: UmbControllerHost) {

src/packages/templating/partial-views/workspace/partial-view-workspace.context.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export class UmbPartialViewWorkspaceContext
3131
>
3232
implements UmbSubmittableWorkspaceContext, UmbRoutableWorkspaceContext
3333
{
34-
public readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
35-
public readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
3634
public readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
3735
public readonly content = this._data.createObservablePartOfCurrent((data) => data?.content);
3836

src/packages/templating/scripts/tree/folder/workspace/script-type-folder-workspace.context.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export class UmbScriptFolderWorkspaceContext
1515
extends UmbEntityDetailWorkspaceContextBase<UmbFolderModel, UmbScriptFolderRepository>
1616
implements UmbSubmittableWorkspaceContext, UmbRoutableWorkspaceContext
1717
{
18-
public readonly unique = this._data.createObservablePartOfCurrent((data) => data?.unique);
19-
public readonly entityType = this._data.createObservablePartOfCurrent((data) => data?.entityType);
2018
public readonly name = this._data.createObservablePartOfCurrent((data) => data?.name);
2119

2220
constructor(host: UmbControllerHost) {

0 commit comments

Comments
 (0)