migrate UmbDictionaryStore to UmbContextAlias

This commit is contained in:
Jacob Overgaard
2023-01-17 16:28:32 +01:00
parent de3ea8b791
commit 0c5d4e225a
3 changed files with 10 additions and 4 deletions

View File

@@ -21,7 +21,7 @@ import { UmbMemberTypeStore, UMB_MEMBER_TYPE_STORE_CONTEXT_ALIAS } from './membe
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, UMB_MEMBER_GROUP_STORE_CONTEXT_ALIAS } from './members/member-groups/member-group.store';
import { UmbDictionaryStore } from './translation/dictionary/dictionary.store';
import { UmbDictionaryStore, UMB_DICTIONARY_STORE_CONTEXT_ALIAS } from './translation/dictionary/dictionary.store';
import { UmbDocumentBlueprintStore } from './documents/document-blueprints/document-blueprint.store';
import { UmbSectionStore, UMB_SECTION_STORE_CONTEXT_ALIAS } from './shared/components/section/section.store';
@@ -75,7 +75,7 @@ export class UmbBackofficeElement extends UmbLitElement {
this.provideContext(UMB_MEMBER_GROUP_STORE_CONTEXT_ALIAS, new UmbMemberGroupStore(this));
this.provideContext(UMB_SECTION_STORE_CONTEXT_ALIAS, new UmbSectionStore());
this.provideContext(UMB_CURRENT_USER_HISTORY_STORE_CONTEXT_ALIAS, new UmbCurrentUserHistoryStore());
this.provideContext('umbDictionaryStore', new UmbDictionaryStore(this));
this.provideContext(UMB_DICTIONARY_STORE_CONTEXT_ALIAS, new UmbDictionaryStore(this));
this.provideContext('umbDocumentBlueprintStore', new UmbDocumentBlueprintStore(this));
}

View File

@@ -2,6 +2,9 @@ import { map, Observable } from 'rxjs';
import { UmbDataStoreBase } from '../../../core/stores/store';
import { DictionaryResource, EntityTreeItem } from '@umbraco-cms/backend-api';
import { tryExecuteAndNotify } from '@umbraco-cms/resources';
import { UmbContextAlias } from '@umbraco-cms/context-api';
export const STORE_ALIAS = 'umbDictionaryStore';
/**
* @export
@@ -10,7 +13,7 @@ import { tryExecuteAndNotify } from '@umbraco-cms/resources';
* @description - Data Store for Dictionary Items.
*/
export class UmbDictionaryStore extends UmbDataStoreBase<EntityTreeItem> {
public readonly storeAlias = 'umbDictionaryStore';
public readonly storeAlias = STORE_ALIAS;
/**
* @description - Get the root of the tree.
@@ -48,3 +51,5 @@ export class UmbDictionaryStore extends UmbDataStoreBase<EntityTreeItem> {
return this.items.pipe(map((items) => items.filter((item) => item.parentKey === key)));
}
}
export const UMB_DICTIONARY_STORE_CONTEXT_ALIAS = new UmbContextAlias<UmbDictionaryStore>(STORE_ALIAS);

View File

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