fix: remove import cycle.

This commit is contained in:
Alex Grozav 2023-07-21 12:03:40 +03:00
parent 206289a7b0
commit beea77229c
6 changed files with 17 additions and 18 deletions

View file

@ -1,6 +1,6 @@
import PersonalizationModal from '@/components/PersonalizationModal.vue'; import PersonalizationModal from '@/components/PersonalizationModal.vue';
import { createTestingPinia } from '@pinia/testing'; import { createTestingPinia } from '@pinia/testing';
import { PERSONALIZATION_MODAL_KEY } from '@/constants'; import { PERSONALIZATION_MODAL_KEY, STORES } from '@/constants';
import { retry } from '@/__tests__/utils'; import { retry } from '@/__tests__/utils';
import { createComponentRenderer } from '@/__tests__/render'; import { createComponentRenderer } from '@/__tests__/render';
import { fireEvent } from '@testing-library/vue'; import { fireEvent } from '@testing-library/vue';
@ -8,12 +8,12 @@ import { fireEvent } from '@testing-library/vue';
const renderComponent = createComponentRenderer(PersonalizationModal, { const renderComponent = createComponentRenderer(PersonalizationModal, {
pinia: createTestingPinia({ pinia: createTestingPinia({
initialState: { initialState: {
ui: { [STORES.UI]: {
modals: { modals: {
[PERSONALIZATION_MODAL_KEY]: { open: true }, [PERSONALIZATION_MODAL_KEY]: { open: true },
}, },
}, },
settings: { [STORES.SETTINGS]: {
settings: { settings: {
templates: { templates: {
host: '', host: '',

View file

@ -58,11 +58,11 @@ import { useNDVStore } from '@/stores/ndv.store';
import { useTemplatesStore } from '@/stores/templates.store'; import { useTemplatesStore } from '@/stores/templates.store';
import { useNodeTypesStore } from '@/stores/nodeTypes.store'; import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { useWorkflowsEEStore } from '@/stores/workflows.ee.store'; import { useWorkflowsEEStore } from '@/stores/workflows.ee.store';
import { useEnvironmentsStore } from '@/stores/environments.ee.store';
import { useUsersStore } from '@/stores/users.store'; import { useUsersStore } from '@/stores/users.store';
import type { IPermissions } from '@/permissions';
import { getWorkflowPermissions } from '@/permissions'; import { getWorkflowPermissions } from '@/permissions';
import type { IPermissions } from '@/permissions';
import type { ICredentialsResponse } from '@/Interface'; import type { ICredentialsResponse } from '@/Interface';
import { useEnvironmentsStore } from '@/stores';
export function resolveParameter( export function resolveParameter(
parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[],

View file

@ -2,7 +2,6 @@ import { CLOUD_BASE_URL_PRODUCTION, CLOUD_BASE_URL_STAGING, STORES } from '@/con
import type { IRestApiContext, RootState } from '@/Interface'; import type { IRestApiContext, RootState } from '@/Interface';
import type { IDataObject } from 'n8n-workflow'; import type { IDataObject } from 'n8n-workflow';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { useNodeTypesStore } from './nodeTypes.store';
const { VUE_APP_URL_BASE_API } = import.meta.env; const { VUE_APP_URL_BASE_API } = import.meta.env;
@ -62,15 +61,6 @@ export const useRootStore = defineStore(STORES.ROOT, {
sessionId: this.sessionId, sessionId: this.sessionId,
}; };
}, },
/**
* Getter for node default names ending with a number: `'S3'`, `'Magento 2'`, etc.
*/
nativelyNumberSuffixedDefaults: (): string[] => {
return useNodeTypesStore().allNodeTypes.reduce<string[]>((acc, cur) => {
if (/\d$/.test(cur.defaults.name as string)) acc.push(cur.defaults.name as string);
return acc;
}, []);
},
}, },
actions: { actions: {
setUrlBaseWebhook(urlBaseWebhook: string): void { setUrlBaseWebhook(urlBaseWebhook: string): void {

View file

@ -87,6 +87,15 @@ export const useNodeTypesStore = defineStore(STORES.NODE_TYPES, {
visibleNodeTypes(): INodeTypeDescription[] { visibleNodeTypes(): INodeTypeDescription[] {
return this.allLatestNodeTypes.filter((nodeType: INodeTypeDescription) => !nodeType.hidden); return this.allLatestNodeTypes.filter((nodeType: INodeTypeDescription) => !nodeType.hidden);
}, },
/**
* Getter for node default names ending with a number: `'S3'`, `'Magento 2'`, etc.
*/
nativelyNumberSuffixedDefaults(): string[] {
return this.allNodeTypes.reduce<string[]>((acc, cur) => {
if (/\d$/.test(cur.defaults.name as string)) acc.push(cur.defaults.name as string);
return acc;
}, []);
},
}, },
actions: { actions: {
setNodeTypes(newNodeTypes: INodeTypeDescription[] = []): void { setNodeTypes(newNodeTypes: INodeTypeDescription[] = []): void {

View file

@ -496,7 +496,7 @@ export default defineComponent({
useHistoryStore, useHistoryStore,
), ),
nativelyNumberSuffixedDefaults(): string[] { nativelyNumberSuffixedDefaults(): string[] {
return this.rootStore.nativelyNumberSuffixedDefaults; return this.nodeTypesStore.nativelyNumberSuffixedDefaults;
}, },
currentUser(): IUser | null { currentUser(): IUser | null {
return this.usersStore.currentUser; return this.usersStore.currentUser;

View file

@ -121,10 +121,10 @@ export default mergeConfig(
include: [ include: [
// 'src/components/__tests__/SQLEditor.test.ts', // 'src/components/__tests__/SQLEditor.test.ts',
// 'src/components/__tests__/BannersStack.test.ts', // 'src/components/__tests__/BannersStack.test.ts',
'src/components/__tests__/ExecutionFilter.test.ts', // 'src/components/__tests__/ExecutionFilter.test.ts',
// 'src/components/__tests__/ExecutionsList.test.ts', // 'src/components/__tests__/ExecutionsList.test.ts',
// 'src/components/__tests__/MainSidebarSourceControl.test.ts', // 'src/components/__tests__/MainSidebarSourceControl.test.ts',
// 'src/components/__tests__/PersonalizationModal.spec.ts', 'src/components/__tests__/PersonalizationModal.spec.ts',
// 'src/components/__tests__/ResourceMapper.test.ts', // 'src/components/__tests__/ResourceMapper.test.ts',
// 'src/components/__tests__/RunData.test.ts', // 'src/components/__tests__/RunData.test.ts',
// 'src/components/__tests__/RunDataJson.test.ts', // 'src/components/__tests__/RunDataJson.test.ts',