refactor(editor): Add infix to Pinia stores (no-changelog) (#6149)
* ⚡ Add infix to Pinia stores * ⚡ Fix paths in mocks * 🐛 Fix import
This commit is contained in:
73
packages/editor-ui/src/stores/webhooks.store.ts
Normal file
73
packages/editor-ui/src/stores/webhooks.store.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { STORES } from '@/constants';
|
||||
import type { IFakeDoor, INodeUi, IRootState, NestedRecord } from '@/Interface';
|
||||
import type { IMenuItem } from 'n8n-design-system';
|
||||
import type { IWorkflowSettings } from 'n8n-workflow';
|
||||
import { defineStore } from 'pinia';
|
||||
import { useRootStore } from './n8nRoot.store';
|
||||
import { useNDVStore } from './ndv.store';
|
||||
import { useSettingsStore } from './settings.store';
|
||||
import { useUIStore } from './ui.store';
|
||||
import { useUsersStore } from './users.store';
|
||||
import { useWorkflowsStore } from './workflows.store';
|
||||
|
||||
export const useWebhooksStore = defineStore(STORES.WEBHOOKS, {
|
||||
getters: {
|
||||
globalRoleName(): string {
|
||||
return useUsersStore().globalRoleName;
|
||||
},
|
||||
getContextBasedTranslationKeys() {
|
||||
return useUIStore().contextBasedTranslationKeys;
|
||||
},
|
||||
getFakeDoorFeatures() {
|
||||
return useUIStore().fakeDoorFeatures;
|
||||
},
|
||||
isUserManagementEnabled() {
|
||||
return useSettingsStore().isUserManagementEnabled;
|
||||
},
|
||||
getFakeDoorItems(): IFakeDoor[] {
|
||||
return useUIStore().fakeDoorFeatures;
|
||||
},
|
||||
n8nMetadata(): IRootState['n8nMetadata'] {
|
||||
return useRootStore().n8nMetadata;
|
||||
},
|
||||
instanceId(): string {
|
||||
return useRootStore().instanceId;
|
||||
},
|
||||
workflowId(): string {
|
||||
return useWorkflowsStore().workflowId;
|
||||
},
|
||||
workflowName(): string {
|
||||
return useWorkflowsStore().workflowName;
|
||||
},
|
||||
activeNode(): INodeUi | null {
|
||||
return useNDVStore().activeNode;
|
||||
},
|
||||
workflowSettings(): IWorkflowSettings {
|
||||
return useWorkflowsStore().workflowSettings;
|
||||
},
|
||||
activeExecutionId(): string {
|
||||
return useWorkflowsStore().activeExecutionId || '';
|
||||
},
|
||||
nodeByName:
|
||||
(state: IRootState) =>
|
||||
(nodeName: string): INodeUi | null => {
|
||||
return useWorkflowsStore().getNodeByName(nodeName);
|
||||
},
|
||||
allNodes(): INodeUi[] {
|
||||
return useWorkflowsStore().allNodes;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
addSidebarMenuItems(menuItems: IMenuItem[]) {
|
||||
const uiStore = useUIStore();
|
||||
const updated = uiStore.sidebarMenuItems.concat(menuItems);
|
||||
uiStore.sidebarMenuItems = updated;
|
||||
},
|
||||
setFakeDoorFeatures(fakeDoors: IFakeDoor[]): void {
|
||||
useUIStore().fakeDoorFeatures = fakeDoors;
|
||||
},
|
||||
setContextBasedTranslationKeys(translations: NestedRecord<string>): void {
|
||||
useUIStore().contextBasedTranslationKeys = translations;
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user