migrate UmbMemberGroupStore to UmbContextAlias

This commit is contained in:
Jacob Overgaard
2023-01-17 16:07:00 +01:00
parent b9837c7992
commit e83eed9ec0
3 changed files with 10 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ import { UmbMediaTypeStore, UMB_MEDIA_TYPE_STORE_CONTEXT_ALIAS } from './media/m
import { UmbMemberTypeStore, UMB_MEMBER_TYPE_STORE_CONTEXT_ALIAS } from './members/member-types/member-type.store';
import { UmbDocumentStore, UMB_DOCUMENT_STORE_CONTEXT_ALIAS } from './documents/documents/document.store';
import { UmbMediaStore, UMB_MEDIA_STORE_CONTEXT_ALIAS } from './media/media/media.store';
import { UmbMemberGroupStore } from './members/member-groups/member-group.store';
import { UmbMemberGroupStore, UMB_MEMBER_GROUP_STORE_CONTEXT_ALIAS } from './members/member-groups/member-group.store';
import { UmbDictionaryStore } from './translation/dictionary/dictionary.store';
import { UmbDocumentBlueprintStore } from './documents/document-blueprints/document-blueprint.store';
@@ -69,7 +69,7 @@ export class UmbBackofficeElement extends UmbLitElement {
this.provideContext(UMB_MEMBER_TYPE_STORE_CONTEXT_ALIAS, new UmbMemberTypeStore(this));
this.provideContext(UMB_USER_STORE_CONTEXT_ALIAS, new UmbUserStore(this));
this.provideContext(UMB_USER_GROUP_STORE_CONTEXT_ALIAS, new UmbUserGroupStore(this));
this.provideContext('umbMemberGroupStore', new UmbMemberGroupStore(this));
this.provideContext(UMB_MEMBER_GROUP_STORE_CONTEXT_ALIAS, new UmbMemberGroupStore(this));
this.provideContext('umbSectionStore', new UmbSectionStore());
this.provideContext('umbCurrentUserHistoryStore', new UmbCurrentUserHistoryStore());
this.provideContext('umbDictionaryStore', new UmbDictionaryStore(this));

View File

@@ -3,9 +3,12 @@ import { UmbNodeStoreBase } from '../../../core/stores/store';
import { EntityTreeItem, MemberGroupResource } from '@umbraco-cms/backend-api';
import type { MemberGroupDetails } from '@umbraco-cms/models';
import { tryExecuteAndNotify } from '@umbraco-cms/resources';
import { UmbContextAlias } from '@umbraco-cms/context-api';
export type UmbMemberGroupStoreItemType = MemberGroupDetails | EntityTreeItem;
export const STORE_ALIAS = 'umbMemberGroupStore';
/**
* @export
* @class UmbMemberGroupStore
@@ -13,7 +16,7 @@ export type UmbMemberGroupStoreItemType = MemberGroupDetails | EntityTreeItem;
* @description - Data Store for Member Groups
*/
export class UmbMemberGroupStore extends UmbNodeStoreBase<UmbMemberGroupStoreItemType> {
public readonly storeAlias = 'umbMemberGroupStore';
public readonly storeAlias = STORE_ALIAS;
getByKey(key: string): Observable<UmbMemberGroupStoreItemType | null> {
return null as any;
@@ -33,3 +36,5 @@ export class UmbMemberGroupStore extends UmbNodeStoreBase<UmbMemberGroupStoreIte
return this.items.pipe(map((items) => items.filter((item) => item.parentKey === null)));
}
}
export const UMB_MEMBER_GROUP_STORE_CONTEXT_ALIAS = new UmbContextAlias<UmbMemberGroupStore>(STORE_ALIAS);

View File

@@ -1,3 +1,4 @@
import { STORE_ALIAS } from '../member-group.store';
import type { ManifestTree, ManifestTreeItemAction } from '@umbraco-cms/models';
const treeAlias = 'Umb.Tree.MemberGroups';
@@ -7,7 +8,7 @@ const tree: ManifestTree = {
alias: treeAlias,
name: 'Member Groups Tree',
meta: {
storeAlias: 'umbMemberGroupStore',
storeAlias: STORE_ALIAS,
},
};