Skip to content

Commit 1bfa5fd

Browse files
committed
rename token and context
1 parent 40ed398 commit 1bfa5fd

File tree

12 files changed

+31
-29
lines changed

12 files changed

+31
-29
lines changed

src/packages/core/components/entity-actions-bundle/entity-actions-bundle.element.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
3131

3232
#sectionSidebarContext?: UmbSectionSidebarContext;
3333

34+
// TODO: provide the entity context on a higher level, like the root element of this entity, tree-item/workspace/... [NL]
3435
#entityContext = new UmbEntityContext(this);
3536

3637
constructor() {

src/packages/core/recycle-bin/conditions/is-not-trashed/entity-is-not-trashed.condition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UMB_ENTITY_IS_TRASHED_CONTEXT } from '../../contexts/is-trashed/index.js';
1+
import { UMB_IS_TRASHED_ENTITY_CONTEXT } from '../../contexts/is-trashed/index.js';
22
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
33
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
44
import type {
@@ -18,7 +18,7 @@ export class UmbEntityIsNotTrashedCondition
1818
// and therefore the condition is permitted
1919
this.permitted = true;
2020

21-
this.consumeContext(UMB_ENTITY_IS_TRASHED_CONTEXT, (context) => {
21+
this.consumeContext(UMB_IS_TRASHED_ENTITY_CONTEXT, (context) => {
2222
this.observe(context.isTrashed, (isTrashed) => {
2323
this.permitted = isTrashed === false;
2424
});

src/packages/core/recycle-bin/conditions/is-trashed/entity-is-trashed.condition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UMB_ENTITY_IS_TRASHED_CONTEXT } from '../../contexts/is-trashed/index.js';
1+
import { UMB_IS_TRASHED_ENTITY_CONTEXT } from '../../contexts/is-trashed/index.js';
22
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
33
import type {
44
UmbConditionConfigBase,
@@ -11,7 +11,7 @@ export class UmbIsTrashedCondition extends UmbConditionBase<UmbConditionConfigBa
1111
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<UmbConditionConfigBase>) {
1212
super(host, args);
1313

14-
this.consumeContext(UMB_ENTITY_IS_TRASHED_CONTEXT, (context) => {
14+
this.consumeContext(UMB_IS_TRASHED_ENTITY_CONTEXT, (context) => {
1515
this.observe(context.isTrashed, (isTrashed) => {
1616
this.permitted = isTrashed === true;
1717
});

src/packages/core/recycle-bin/contexts/is-trashed/entity-is-trashed.context-token.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { UmbEntityIsTrashedContext } from './entity-is-trashed.context.js';
2-
export { UMB_ENTITY_IS_TRASHED_CONTEXT } from './entity-is-trashed.context-token.js';
1+
export { UmbIsTrashedEntityContext } from './is-trashed.entity-context.js';
2+
export { UMB_IS_TRASHED_ENTITY_CONTEXT } from './is-trashed.entity-context-token.js';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { UmbIsTrashedEntityContext } from './is-trashed.entity-context.js';
2+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
3+
4+
export const UMB_IS_TRASHED_ENTITY_CONTEXT = new UmbContextToken<UmbIsTrashedEntityContext>(
5+
'UmbEntityContext',
6+
'isTrashed',
7+
);

src/packages/core/recycle-bin/contexts/is-trashed/entity-is-trashed.context.ts renamed to src/packages/core/recycle-bin/contexts/is-trashed/is-trashed.entity-context.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { UMB_ENTITY_IS_TRASHED_CONTEXT } from './entity-is-trashed.context-token.js';
1+
import { UMB_IS_TRASHED_ENTITY_CONTEXT } from './is-trashed.entity-context-token.js';
22
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
33
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
44
import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
55

66
/**
7-
* Represents the context for the isTrashed state
7+
* A entity context for the isTrashed state.
88
* @export
9-
* @class UmbIsTrashedContext
10-
* @extends {UmbContextBase<UmbEntityIsTrashedContext>}
11-
* @implements {UmbEntityIsTrashedContext}
9+
* @class UmbIsTrashedEntityContext
10+
* @extends {UmbContextBase<UmbIsTrashedEntityContext>}
11+
* @implements {UmbIsTrashedEntityContext}
1212
*/
13-
export class UmbEntityIsTrashedContext extends UmbContextBase<UmbEntityIsTrashedContext> {
13+
export class UmbIsTrashedEntityContext extends UmbContextBase<UmbIsTrashedEntityContext> {
1414
#isTrashed = new UmbBooleanState(false);
1515
isTrashed = this.#isTrashed.asObservable();
1616

1717
constructor(host: UmbControllerHost) {
18-
super(host, UMB_ENTITY_IS_TRASHED_CONTEXT);
18+
super(host, UMB_IS_TRASHED_ENTITY_CONTEXT);
1919
}
2020

2121
/**

src/packages/core/recycle-bin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export type {
1313
UmbRecycleBinOriginalParentRequestArgs,
1414
} from './types.js';
1515

16-
export { UmbEntityIsTrashedContext, UMB_ENTITY_IS_TRASHED_CONTEXT } from './contexts/is-trashed/index.js';
16+
export { UmbIsTrashedEntityContext, UMB_IS_TRASHED_ENTITY_CONTEXT } from './contexts/is-trashed/index.js';
1717
export { UMB_ENTITY_IS_NOT_TRASHED_CONDITION_ALIAS } from './conditions/is-not-trashed/constants.js';
1818
export { UMB_ENTITY_IS_TRASHED_CONDITION_ALIAS } from './conditions/is-trashed/constants.js';

src/packages/documents/documents/tree/tree-item/document-tree-item.context.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { UmbDocumentTreeItemModel } from '../types.js';
22
import { UmbDefaultTreeItemContext } from '@umbraco-cms/backoffice/tree';
33
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
4-
import { UmbEntityIsTrashedContext } from '@umbraco-cms/backoffice/recycle-bin';
4+
import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin';
55

66
export class UmbDocumentTreeItemContext extends UmbDefaultTreeItemContext<UmbDocumentTreeItemModel> {
7-
#isTrashedContext = new UmbEntityIsTrashedContext(this);
7+
// TODO: Provide this together with the EntityContext, ideally this takes part via a extension-type [NL]
8+
#isTrashedContext = new UmbIsTrashedEntityContext(this);
89

910
constructor(host: UmbControllerHost) {
1011
super(host);

src/packages/documents/documents/workspace/document-workspace.context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { UmbDocumentBlueprintDetailRepository } from '@umbraco-cms/backoffice/do
5858
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
5959
import type { UmbContentWorkspaceContext } from '@umbraco-cms/backoffice/content';
6060
import type { UmbDocumentTypeDetailModel } from '@umbraco-cms/backoffice/document-type';
61-
import { UmbEntityIsTrashedContext } from '@umbraco-cms/backoffice/recycle-bin';
61+
import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin';
6262

6363
type EntityType = UmbDocumentDetailModel;
6464
export class UmbDocumentWorkspaceContext
@@ -157,7 +157,7 @@ export class UmbDocumentWorkspaceContext
157157
// TODO: this should be set up for all entity workspace contexts in a base class
158158
#entityContext = new UmbEntityContext(this);
159159
// TODO: this might not be the correct place to spin this up
160-
#isTrashedContext = new UmbEntityIsTrashedContext(this);
160+
#isTrashedContext = new UmbIsTrashedEntityContext(this);
161161

162162
constructor(host: UmbControllerHost) {
163163
super(host, UMB_DOCUMENT_WORKSPACE_ALIAS);

0 commit comments

Comments
 (0)