rename token and context
This commit is contained in:
@@ -31,6 +31,7 @@ export class UmbEntityActionsBundleElement extends UmbLitElement {
|
||||
|
||||
#sectionSidebarContext?: UmbSectionSidebarContext;
|
||||
|
||||
// TODO: provide the entity context on a higher level, like the root element of this entity, tree-item/workspace/... [NL]
|
||||
#entityContext = new UmbEntityContext(this);
|
||||
|
||||
constructor() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UMB_ENTITY_IS_TRASHED_CONTEXT } from '../../contexts/is-trashed/index.js';
|
||||
import { UMB_IS_TRASHED_ENTITY_CONTEXT } from '../../contexts/is-trashed/index.js';
|
||||
import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type {
|
||||
@@ -18,7 +18,7 @@ export class UmbEntityIsNotTrashedCondition
|
||||
// and therefore the condition is permitted
|
||||
this.permitted = true;
|
||||
|
||||
this.consumeContext(UMB_ENTITY_IS_TRASHED_CONTEXT, (context) => {
|
||||
this.consumeContext(UMB_IS_TRASHED_ENTITY_CONTEXT, (context) => {
|
||||
this.observe(context.isTrashed, (isTrashed) => {
|
||||
this.permitted = isTrashed === false;
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UMB_ENTITY_IS_TRASHED_CONTEXT } from '../../contexts/is-trashed/index.js';
|
||||
import { UMB_IS_TRASHED_ENTITY_CONTEXT } from '../../contexts/is-trashed/index.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type {
|
||||
UmbConditionConfigBase,
|
||||
@@ -11,7 +11,7 @@ export class UmbIsTrashedCondition extends UmbConditionBase<UmbConditionConfigBa
|
||||
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<UmbConditionConfigBase>) {
|
||||
super(host, args);
|
||||
|
||||
this.consumeContext(UMB_ENTITY_IS_TRASHED_CONTEXT, (context) => {
|
||||
this.consumeContext(UMB_IS_TRASHED_ENTITY_CONTEXT, (context) => {
|
||||
this.observe(context.isTrashed, (isTrashed) => {
|
||||
this.permitted = isTrashed === true;
|
||||
});
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import type { UmbEntityIsTrashedContext } from './entity-is-trashed.context.js';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
|
||||
export const UMB_ENTITY_IS_TRASHED_CONTEXT = new UmbContextToken<UmbEntityIsTrashedContext>(
|
||||
'UmbEntityContext',
|
||||
'isTrashed',
|
||||
);
|
||||
@@ -1,2 +1,2 @@
|
||||
export { UmbEntityIsTrashedContext } from './entity-is-trashed.context.js';
|
||||
export { UMB_ENTITY_IS_TRASHED_CONTEXT } from './entity-is-trashed.context-token.js';
|
||||
export { UmbIsTrashedEntityContext } from './is-trashed.entity-context.js';
|
||||
export { UMB_IS_TRASHED_ENTITY_CONTEXT } from './is-trashed.entity-context-token.js';
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { UmbIsTrashedEntityContext } from './is-trashed.entity-context.js';
|
||||
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
||||
|
||||
export const UMB_IS_TRASHED_ENTITY_CONTEXT = new UmbContextToken<UmbIsTrashedEntityContext>(
|
||||
'UmbEntityContext',
|
||||
'isTrashed',
|
||||
);
|
||||
@@ -1,21 +1,21 @@
|
||||
import { UMB_ENTITY_IS_TRASHED_CONTEXT } from './entity-is-trashed.context-token.js';
|
||||
import { UMB_IS_TRASHED_ENTITY_CONTEXT } from './is-trashed.entity-context-token.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
|
||||
import { UmbBooleanState } from '@umbraco-cms/backoffice/observable-api';
|
||||
|
||||
/**
|
||||
* Represents the context for the isTrashed state
|
||||
* A entity context for the isTrashed state.
|
||||
* @export
|
||||
* @class UmbIsTrashedContext
|
||||
* @extends {UmbContextBase<UmbEntityIsTrashedContext>}
|
||||
* @implements {UmbEntityIsTrashedContext}
|
||||
* @class UmbIsTrashedEntityContext
|
||||
* @extends {UmbContextBase<UmbIsTrashedEntityContext>}
|
||||
* @implements {UmbIsTrashedEntityContext}
|
||||
*/
|
||||
export class UmbEntityIsTrashedContext extends UmbContextBase<UmbEntityIsTrashedContext> {
|
||||
export class UmbIsTrashedEntityContext extends UmbContextBase<UmbIsTrashedEntityContext> {
|
||||
#isTrashed = new UmbBooleanState(false);
|
||||
isTrashed = this.#isTrashed.asObservable();
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, UMB_ENTITY_IS_TRASHED_CONTEXT);
|
||||
super(host, UMB_IS_TRASHED_ENTITY_CONTEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13,6 +13,6 @@ export type {
|
||||
UmbRecycleBinOriginalParentRequestArgs,
|
||||
} from './types.js';
|
||||
|
||||
export { UmbEntityIsTrashedContext, UMB_ENTITY_IS_TRASHED_CONTEXT } from './contexts/is-trashed/index.js';
|
||||
export { UmbIsTrashedEntityContext, UMB_IS_TRASHED_ENTITY_CONTEXT } from './contexts/is-trashed/index.js';
|
||||
export { UMB_ENTITY_IS_NOT_TRASHED_CONDITION_ALIAS } from './conditions/is-not-trashed/constants.js';
|
||||
export { UMB_ENTITY_IS_TRASHED_CONDITION_ALIAS } from './conditions/is-trashed/constants.js';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import type { UmbDocumentTreeItemModel } from '../types.js';
|
||||
import { UmbDefaultTreeItemContext } from '@umbraco-cms/backoffice/tree';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbEntityIsTrashedContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
|
||||
export class UmbDocumentTreeItemContext extends UmbDefaultTreeItemContext<UmbDocumentTreeItemModel> {
|
||||
#isTrashedContext = new UmbEntityIsTrashedContext(this);
|
||||
// TODO: Provide this together with the EntityContext, ideally this takes part via a extension-type [NL]
|
||||
#isTrashedContext = new UmbIsTrashedEntityContext(this);
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
|
||||
@@ -58,7 +58,7 @@ import { UmbDocumentBlueprintDetailRepository } from '@umbraco-cms/backoffice/do
|
||||
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
|
||||
import type { UmbContentWorkspaceContext } from '@umbraco-cms/backoffice/content';
|
||||
import type { UmbDocumentTypeDetailModel } from '@umbraco-cms/backoffice/document-type';
|
||||
import { UmbEntityIsTrashedContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
|
||||
type EntityType = UmbDocumentDetailModel;
|
||||
export class UmbDocumentWorkspaceContext
|
||||
@@ -157,7 +157,7 @@ export class UmbDocumentWorkspaceContext
|
||||
// TODO: this should be set up for all entity workspace contexts in a base class
|
||||
#entityContext = new UmbEntityContext(this);
|
||||
// TODO: this might not be the correct place to spin this up
|
||||
#isTrashedContext = new UmbEntityIsTrashedContext(this);
|
||||
#isTrashedContext = new UmbIsTrashedEntityContext(this);
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, UMB_DOCUMENT_WORKSPACE_ALIAS);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { UmbMediaTreeItemModel } from '../types.js';
|
||||
import { UmbDefaultTreeItemContext } from '@umbraco-cms/backoffice/tree';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbEntityIsTrashedContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
|
||||
export class UmbMediaTreeItemContext extends UmbDefaultTreeItemContext<UmbMediaTreeItemModel> {
|
||||
#isTrashedContext = new UmbEntityIsTrashedContext(this);
|
||||
#isTrashedContext = new UmbIsTrashedEntityContext(this);
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
|
||||
@@ -26,7 +26,7 @@ import { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice
|
||||
import type { UmbMediaTypeDetailModel } from '@umbraco-cms/backoffice/media-type';
|
||||
import type { UmbContentWorkspaceContext } from '@umbraco-cms/backoffice/content';
|
||||
import { UmbEntityContext } from '@umbraco-cms/backoffice/entity';
|
||||
import { UmbEntityIsTrashedContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
import { UmbIsTrashedEntityContext } from '@umbraco-cms/backoffice/recycle-bin';
|
||||
|
||||
type EntityType = UmbMediaDetailModel;
|
||||
export class UmbMediaWorkspaceContext
|
||||
@@ -112,7 +112,7 @@ export class UmbMediaWorkspaceContext
|
||||
// TODO: this should be set up for all entity workspace contexts in a base class
|
||||
#entityContext = new UmbEntityContext(this);
|
||||
// TODO: this might not be the correct place to spin this up
|
||||
#isTrashedContext = new UmbEntityIsTrashedContext(this);
|
||||
#isTrashedContext = new UmbIsTrashedEntityContext(this);
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, 'Umb.Workspace.Media');
|
||||
|
||||
Reference in New Issue
Block a user