From c0157f645ea02cf37d7b4d2521390fa464d5af0f Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Fri, 10 Oct 2025 12:53:03 +0300 Subject: [PATCH] refactor(editor): Extract `workflowHistory` code to features (no-changelog) (#20587) --- packages/frontend/editor-ui/src/components/Modals.vue | 2 +- .../workflowHistory/__tests__/utils.ts} | 0 .../components}/WorkflowHistoryContent.test.ts | 4 ++-- .../components}/WorkflowHistoryContent.vue | 2 +- .../components}/WorkflowHistoryList.test.ts | 4 ++-- .../workflowHistory/components}/WorkflowHistoryList.vue | 2 +- .../components}/WorkflowHistoryListItem.test.ts | 4 ++-- .../components}/WorkflowHistoryListItem.vue | 0 .../components}/WorkflowHistoryVersionRestoreModal.vue | 0 .../workflowHistory}/views/WorkflowHistory.test.ts | 9 +++------ .../workflowHistory}/views/WorkflowHistory.vue | 6 +++--- .../workflowHistory}/workflowHistory.store.test.ts | 2 +- .../workflowHistory}/workflowHistory.store.ts | 0 packages/frontend/editor-ui/src/router.ts | 3 ++- 14 files changed, 18 insertions(+), 20 deletions(-) rename packages/frontend/editor-ui/src/{stores/__tests__/utils/workflowHistoryTestUtils.ts => features/workflowHistory/__tests__/utils.ts} (100%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryContent.test.ts (93%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryContent.vue (97%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryList.test.ts (96%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryList.vue (97%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryListItem.test.ts (93%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryListItem.vue (100%) rename packages/frontend/editor-ui/src/{components/WorkflowHistory => features/workflowHistory/components}/WorkflowHistoryVersionRestoreModal.vue (100%) rename packages/frontend/editor-ui/src/{ => features/workflowHistory}/views/WorkflowHistory.test.ts (96%) rename packages/frontend/editor-ui/src/{ => features/workflowHistory}/views/WorkflowHistory.vue (97%) rename packages/frontend/editor-ui/src/{stores => features/workflowHistory}/workflowHistory.store.test.ts (91%) rename packages/frontend/editor-ui/src/{stores => features/workflowHistory}/workflowHistory.store.ts (100%) diff --git a/packages/frontend/editor-ui/src/components/Modals.vue b/packages/frontend/editor-ui/src/components/Modals.vue index ebeabd50ea9..ccfc64ef3c2 100644 --- a/packages/frontend/editor-ui/src/components/Modals.vue +++ b/packages/frontend/editor-ui/src/components/Modals.vue @@ -89,7 +89,7 @@ import UpdatesPanel from '@/components/UpdatesPanel.vue'; import WhatsNewModal from '@/components/WhatsNewModal.vue'; import WorkflowActivationConflictingWebhookModal from '@/components/WorkflowActivationConflictingWebhookModal.vue'; import WorkflowExtractionNameModal from '@/components/WorkflowExtractionNameModal.vue'; -import WorkflowHistoryVersionRestoreModal from '@/components/WorkflowHistory/WorkflowHistoryVersionRestoreModal.vue'; +import WorkflowHistoryVersionRestoreModal from '@/features/workflowHistory/components/WorkflowHistoryVersionRestoreModal.vue'; import WorkflowSettings from '@/components/WorkflowSettings.vue'; import WorkflowShareModal from '@/components/WorkflowShareModal.ee.vue'; import WorkflowDiffModal from '@/features/workflow-diff/WorkflowDiffModal.vue'; diff --git a/packages/frontend/editor-ui/src/stores/__tests__/utils/workflowHistoryTestUtils.ts b/packages/frontend/editor-ui/src/features/workflowHistory/__tests__/utils.ts similarity index 100% rename from packages/frontend/editor-ui/src/stores/__tests__/utils/workflowHistoryTestUtils.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/__tests__/utils.ts diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.test.ts b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryContent.test.ts similarity index 93% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.test.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryContent.test.ts index a26fa60f73b..4a77cc2e87a 100644 --- a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.test.ts +++ b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryContent.test.ts @@ -5,9 +5,9 @@ import { waitFor } from '@testing-library/vue'; import userEvent from '@testing-library/user-event'; import type { UserAction } from '@n8n/design-system'; import { createComponentRenderer } from '@/__tests__/render'; -import WorkflowHistoryContent from '@/components/WorkflowHistory/WorkflowHistoryContent.vue'; +import WorkflowHistoryContent from './WorkflowHistoryContent.vue'; import type { WorkflowHistoryActionTypes } from '@n8n/rest-api-client/api/workflowHistory'; -import { workflowVersionDataFactory } from '@/stores/__tests__/utils/workflowHistoryTestUtils'; +import { workflowVersionDataFactory } from '../__tests__/utils'; import type { IWorkflowDb } from '@/Interface'; import type { IUser } from 'n8n-workflow'; import { useProjectsStore } from '@/stores/projects.store'; diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryContent.vue similarity index 97% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryContent.vue index 14cc063949a..7b16657a67a 100644 --- a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue +++ b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryContent.vue @@ -7,7 +7,7 @@ import type { WorkflowVersionId, } from '@n8n/rest-api-client/api/workflowHistory'; import WorkflowPreview from '@/components/WorkflowPreview.vue'; -import WorkflowHistoryListItem from '@/components/WorkflowHistory/WorkflowHistoryListItem.vue'; +import WorkflowHistoryListItem from './WorkflowHistoryListItem.vue'; import { useI18n } from '@n8n/i18n'; import type { IUser } from 'n8n-workflow'; diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.test.ts b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryList.test.ts similarity index 96% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.test.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryList.test.ts index d27064eb4f7..3f7666759e0 100644 --- a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.test.ts +++ b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryList.test.ts @@ -4,9 +4,9 @@ import { createPinia, setActivePinia } from 'pinia'; import { faker } from '@faker-js/faker'; import type { UserAction } from '@n8n/design-system'; import { createComponentRenderer } from '@/__tests__/render'; -import WorkflowHistoryList from '@/components/WorkflowHistory/WorkflowHistoryList.vue'; +import WorkflowHistoryList from './WorkflowHistoryList.vue'; import type { WorkflowHistoryActionTypes } from '@n8n/rest-api-client/api/workflowHistory'; -import { workflowHistoryDataFactory } from '@/stores/__tests__/utils/workflowHistoryTestUtils'; +import { workflowHistoryDataFactory } from '../__tests__/utils'; import type { IUser } from 'n8n-workflow'; vi.stubGlobal( diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryList.vue similarity index 97% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryList.vue index bc103c8ade4..459d21fa2ac 100644 --- a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue +++ b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryList.vue @@ -8,7 +8,7 @@ import type { WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, } from '@n8n/rest-api-client/api/workflowHistory'; -import WorkflowHistoryListItem from '@/components/WorkflowHistory/WorkflowHistoryListItem.vue'; +import WorkflowHistoryListItem from './WorkflowHistoryListItem.vue'; import type { IUser } from 'n8n-workflow'; import { I18nT } from 'vue-i18n'; diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryListItem.test.ts b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryListItem.test.ts similarity index 93% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryListItem.test.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryListItem.test.ts index 201d9348164..eb09aa7d380 100644 --- a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryListItem.test.ts +++ b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryListItem.test.ts @@ -2,9 +2,9 @@ import { createPinia, setActivePinia } from 'pinia'; import userEvent from '@testing-library/user-event'; import type { UserAction } from '@n8n/design-system'; import { createComponentRenderer } from '@/__tests__/render'; -import WorkflowHistoryListItem from '@/components/WorkflowHistory/WorkflowHistoryListItem.vue'; +import WorkflowHistoryListItem from './WorkflowHistoryListItem.vue'; import type { WorkflowHistoryActionTypes } from '@n8n/rest-api-client/api/workflowHistory'; -import { workflowHistoryDataFactory } from '@/stores/__tests__/utils/workflowHistoryTestUtils'; +import { workflowHistoryDataFactory } from '../__tests__/utils'; import { type IUser } from 'n8n-workflow'; const actionTypes: WorkflowHistoryActionTypes = ['restore', 'clone', 'open', 'download']; diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryListItem.vue b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryListItem.vue similarity index 100% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryListItem.vue rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryListItem.vue diff --git a/packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryVersionRestoreModal.vue b/packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryVersionRestoreModal.vue similarity index 100% rename from packages/frontend/editor-ui/src/components/WorkflowHistory/WorkflowHistoryVersionRestoreModal.vue rename to packages/frontend/editor-ui/src/features/workflowHistory/components/WorkflowHistoryVersionRestoreModal.vue diff --git a/packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts b/packages/frontend/editor-ui/src/features/workflowHistory/views/WorkflowHistory.test.ts similarity index 96% rename from packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/views/WorkflowHistory.test.ts index 435382ebb24..04a71b16e74 100644 --- a/packages/frontend/editor-ui/src/views/WorkflowHistory.test.ts +++ b/packages/frontend/editor-ui/src/features/workflowHistory/views/WorkflowHistory.test.ts @@ -8,15 +8,12 @@ import { useRoute, useRouter } from 'vue-router'; import { faker } from '@faker-js/faker'; import { createComponentRenderer } from '@/__tests__/render'; import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils'; -import WorkflowHistoryPage from '@/views/WorkflowHistory.vue'; -import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store'; +import WorkflowHistoryPage from './WorkflowHistory.vue'; +import { useWorkflowHistoryStore } from '../workflowHistory.store'; import { useWorkflowsStore } from '@/stores/workflows.store'; import { STORES } from '@n8n/stores'; import { VIEWS } from '@/constants'; -import { - workflowHistoryDataFactory, - workflowVersionDataFactory, -} from '@/stores/__tests__/utils/workflowHistoryTestUtils'; +import { workflowHistoryDataFactory, workflowVersionDataFactory } from '../__tests__/utils'; import type { WorkflowVersion } from '@n8n/rest-api-client/api/workflowHistory'; import type { IWorkflowDb } from '@/Interface'; import { telemetry } from '@/plugins/telemetry'; diff --git a/packages/frontend/editor-ui/src/views/WorkflowHistory.vue b/packages/frontend/editor-ui/src/features/workflowHistory/views/WorkflowHistory.vue similarity index 97% rename from packages/frontend/editor-ui/src/views/WorkflowHistory.vue rename to packages/frontend/editor-ui/src/features/workflowHistory/views/WorkflowHistory.vue index a2c357b11a0..8df90516139 100644 --- a/packages/frontend/editor-ui/src/views/WorkflowHistory.vue +++ b/packages/frontend/editor-ui/src/features/workflowHistory/views/WorkflowHistory.vue @@ -12,9 +12,9 @@ import type { WorkflowHistory, WorkflowVersion, } from '@n8n/rest-api-client/api/workflowHistory'; -import WorkflowHistoryList from '@/components/WorkflowHistory/WorkflowHistoryList.vue'; -import WorkflowHistoryContent from '@/components/WorkflowHistory/WorkflowHistoryContent.vue'; -import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store'; +import WorkflowHistoryList from '../components/WorkflowHistoryList.vue'; +import WorkflowHistoryContent from '../components/WorkflowHistoryContent.vue'; +import { useWorkflowHistoryStore } from '../workflowHistory.store'; import { useUIStore } from '@/stores/ui.store'; import { useWorkflowsStore } from '@/stores/workflows.store'; import { telemetry } from '@/plugins/telemetry'; diff --git a/packages/frontend/editor-ui/src/stores/workflowHistory.store.test.ts b/packages/frontend/editor-ui/src/features/workflowHistory/workflowHistory.store.test.ts similarity index 91% rename from packages/frontend/editor-ui/src/stores/workflowHistory.store.test.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/workflowHistory.store.test.ts index b146b9902ff..2c0f7f86b8b 100644 --- a/packages/frontend/editor-ui/src/stores/workflowHistory.store.test.ts +++ b/packages/frontend/editor-ui/src/features/workflowHistory/workflowHistory.store.test.ts @@ -1,6 +1,6 @@ import { createPinia, setActivePinia } from 'pinia'; import type { FrontendSettings } from '@n8n/api-types'; -import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store'; +import { useWorkflowHistoryStore } from './workflowHistory.store'; import { useSettingsStore } from '@/stores/settings.store'; describe('Workflow history store', () => { diff --git a/packages/frontend/editor-ui/src/stores/workflowHistory.store.ts b/packages/frontend/editor-ui/src/features/workflowHistory/workflowHistory.store.ts similarity index 100% rename from packages/frontend/editor-ui/src/stores/workflowHistory.store.ts rename to packages/frontend/editor-ui/src/features/workflowHistory/workflowHistory.store.ts diff --git a/packages/frontend/editor-ui/src/router.ts b/packages/frontend/editor-ui/src/router.ts index 4875d9753b9..5db083b1a8d 100644 --- a/packages/frontend/editor-ui/src/router.ts +++ b/packages/frontend/editor-ui/src/router.ts @@ -67,7 +67,8 @@ const SettingsSourceControl = async () => const SettingsExternalSecrets = async () => await import('@/features/externalSecrets/views/SettingsExternalSecrets.vue'); const WorkerView = async () => await import('./views/WorkerView.vue'); -const WorkflowHistory = async () => await import('@/views/WorkflowHistory.vue'); +const WorkflowHistory = async () => + await import('@/features/workflowHistory/views/WorkflowHistory.vue'); const WorkflowOnboardingView = async () => await import('@/views/WorkflowOnboardingView.vue'); const EvaluationsView = async () => await import('@/features/evaluation.ee/views/EvaluationsView.vue');