From f752081c4fbe82bd82ea61a655ba18ad99ab85a4 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 13 Oct 2025 16:47:55 +0300 Subject: [PATCH] refactor(editor): Extract `auth` code into features (no-changelog) (#20644) --- .../confirm-password.event-bus.ts | 11 ----------- .../frontend/editor-ui/src/components/Modals.vue | 8 ++++---- .../frontend/editor-ui/src/event-bus/index.ts | 1 - .../mfa.ts => features/auth/auth.eventBus.ts} | 10 ++++++++++ .../auth}/components/ChangePasswordModal.test.ts | 2 +- .../auth}/components/ChangePasswordModal.vue | 2 +- .../components}/ConfirmPasswordModal.test.ts | 4 ++-- .../auth/components}/ConfirmPasswordModal.vue | 4 ++-- .../auth}/components/MfaSetupModal.vue | 6 +++--- .../auth/components}/PromptMfaCodeModal.vue | 4 ++-- .../ChangePasswordModal.test.ts.snap | 6 ++++++ .../ConfirmPasswordModal.test.ts.snap | 0 .../{ => features/auth}/views/AuthView.test.ts | 2 +- .../src/{ => features/auth}/views/AuthView.vue | 0 .../auth}/views/ChangePasswordView.vue | 2 +- .../auth}/views/ForgotMyPasswordView.test.ts | 2 +- .../auth}/views/ForgotMyPasswordView.vue | 0 .../src/{ => features/auth}/views/MfaView.vue | 2 +- .../auth}/views/SettingsPersonalView.test.ts | 2 +- .../auth}/views/SettingsPersonalView.vue | 8 ++++---- .../src/{ => features/auth}/views/SetupView.vue | 2 +- .../{ => features/auth}/views/SigninView.test.ts | 2 +- .../src/{ => features/auth}/views/SigninView.vue | 0 .../{ => features/auth}/views/SignoutView.vue | 0 .../{ => features/auth}/views/SignupView.test.ts | 2 +- .../src/{ => features/auth}/views/SignupView.vue | 2 +- packages/frontend/editor-ui/src/router.ts | 16 +++++++++------- .../editor-ui/src/views/SamlOnboarding.vue | 2 +- 28 files changed, 54 insertions(+), 48 deletions(-) delete mode 100644 packages/frontend/editor-ui/src/components/ConfirmPasswordModal/confirm-password.event-bus.ts rename packages/frontend/editor-ui/src/{event-bus/mfa.ts => features/auth/auth.eventBus.ts} (67%) rename packages/frontend/editor-ui/src/{ => features/auth}/components/ChangePasswordModal.test.ts (87%) rename packages/frontend/editor-ui/src/{ => features/auth}/components/ChangePasswordModal.vue (98%) rename packages/frontend/editor-ui/src/{components/ConfirmPasswordModal => features/auth/components}/ConfirmPasswordModal.test.ts (92%) rename packages/frontend/editor-ui/src/{components/ConfirmPasswordModal => features/auth/components}/ConfirmPasswordModal.vue (93%) rename packages/frontend/editor-ui/src/{ => features/auth}/components/MfaSetupModal.vue (98%) rename packages/frontend/editor-ui/src/{components/PromptMfaCodeModal => features/auth/components}/PromptMfaCodeModal.vue (95%) create mode 100644 packages/frontend/editor-ui/src/features/auth/components/__snapshots__/ChangePasswordModal.test.ts.snap rename packages/frontend/editor-ui/src/{components/ConfirmPasswordModal => features/auth/components}/__snapshots__/ConfirmPasswordModal.test.ts.snap (100%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/AuthView.test.ts (95%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/AuthView.vue (100%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/ChangePasswordView.vue (98%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/ForgotMyPasswordView.test.ts (98%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/ForgotMyPasswordView.vue (100%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/MfaView.vue (99%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SettingsPersonalView.test.ts (98%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SettingsPersonalView.vue (97%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SetupView.vue (98%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SigninView.test.ts (99%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SigninView.vue (100%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SignoutView.vue (100%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SignupView.test.ts (98%) rename packages/frontend/editor-ui/src/{ => features/auth}/views/SignupView.vue (98%) diff --git a/packages/frontend/editor-ui/src/components/ConfirmPasswordModal/confirm-password.event-bus.ts b/packages/frontend/editor-ui/src/components/ConfirmPasswordModal/confirm-password.event-bus.ts deleted file mode 100644 index 5866028ee3d..00000000000 --- a/packages/frontend/editor-ui/src/components/ConfirmPasswordModal/confirm-password.event-bus.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { createEventBus } from '@n8n/utils/event-bus'; - -export interface ConfirmPasswordClosedEventPayload { - currentPassword: string; -} - -export interface ConfirmPasswordModalEvents { - close: ConfirmPasswordClosedEventPayload | undefined; -} - -export const confirmPasswordEventBus = createEventBus(); diff --git a/packages/frontend/editor-ui/src/components/Modals.vue b/packages/frontend/editor-ui/src/components/Modals.vue index 11c0f6d4ff5..a868202f30a 100644 --- a/packages/frontend/editor-ui/src/components/Modals.vue +++ b/packages/frontend/editor-ui/src/components/Modals.vue @@ -55,8 +55,8 @@ import AboutModal from '@/components/AboutModal.vue'; import ActivationModal from '@/components/ActivationModal.vue'; import ApiKeyCreateOrEditModal from '@/components/ApiKeyCreateOrEditModal.vue'; import NewAssistantSessionModal from '@/features/assistant/components/Chat/NewAssistantSessionModal.vue'; -import ChangePasswordModal from '@/components/ChangePasswordModal.vue'; -import ConfirmPasswordModal from '@/components/ConfirmPasswordModal/ConfirmPasswordModal.vue'; +import ChangePasswordModal from '@/features/auth/components/ChangePasswordModal.vue'; +import ConfirmPasswordModal from '@/features/auth/components/ConfirmPasswordModal.vue'; import ChatEmbedModal from '@/components/ChatEmbedModal.vue'; import CommunityPackageInstallModal from '@/components/CommunityPackageInstallModal.vue'; import CommunityPackageManageConfirmModal from '@/components/CommunityPackageManageConfirmModal.vue'; @@ -74,7 +74,7 @@ import FromAiParametersModal from '@/components/FromAiParametersModal.vue'; import ImportCurlModal from '@/components/ImportCurlModal.vue'; import ImportWorkflowUrlModal from '@/components/ImportWorkflowUrlModal.vue'; import InviteUsersModal from '@/components/InviteUsersModal.vue'; -import MfaSetupModal from '@/components/MfaSetupModal.vue'; +import MfaSetupModal from '@/features/auth/components/MfaSetupModal.vue'; import ModalRoot from '@/components/ModalRoot.vue'; import NpsSurvey from '@/components/NpsSurvey.vue'; import PersonalizationModal from '@/components/PersonalizationModal.vue'; @@ -95,7 +95,7 @@ import WorkflowSettings from '@/components/WorkflowSettings.vue'; import WorkflowShareModal from '@/components/WorkflowShareModal.ee.vue'; import WorkflowDiffModal from '@/features/workflow-diff/WorkflowDiffModal.vue'; import type { EventBus } from '@n8n/utils/event-bus'; -import PromptMfaCodeModal from './PromptMfaCodeModal/PromptMfaCodeModal.vue'; +import PromptMfaCodeModal from '@/features/auth/components/PromptMfaCodeModal.vue'; import DynamicModalLoader from './DynamicModalLoader.vue'; import NodeRecommendationModalV2 from '@/experiments/templateRecoV2/components/NodeRecommendationModal.vue'; import NodeRecommendationModalV3 from '@/experiments/personalizedTemplatesV3/components/NodeRecommendationModal.vue'; diff --git a/packages/frontend/editor-ui/src/event-bus/index.ts b/packages/frontend/editor-ui/src/event-bus/index.ts index b094684a942..bf933015db1 100644 --- a/packages/frontend/editor-ui/src/event-bus/index.ts +++ b/packages/frontend/editor-ui/src/event-bus/index.ts @@ -4,5 +4,4 @@ export * from './global-link-actions'; export * from './html-editor'; export * from './import-curl'; export * from './node-view'; -export * from './mfa'; export * from './ndv'; diff --git a/packages/frontend/editor-ui/src/event-bus/mfa.ts b/packages/frontend/editor-ui/src/features/auth/auth.eventBus.ts similarity index 67% rename from packages/frontend/editor-ui/src/event-bus/mfa.ts rename to packages/frontend/editor-ui/src/features/auth/auth.eventBus.ts index eb012eafbd0..a3bd2796079 100644 --- a/packages/frontend/editor-ui/src/event-bus/mfa.ts +++ b/packages/frontend/editor-ui/src/features/auth/auth.eventBus.ts @@ -1,5 +1,15 @@ import { createEventBus } from '@n8n/utils/event-bus'; +export interface ConfirmPasswordClosedEventPayload { + currentPassword: string; +} + +export interface ConfirmPasswordModalEvents { + close: ConfirmPasswordClosedEventPayload | undefined; +} + +export const confirmPasswordEventBus = createEventBus(); + export const mfaEventBus = createEventBus(); export interface MfaModalClosedEventPayload { diff --git a/packages/frontend/editor-ui/src/components/ChangePasswordModal.test.ts b/packages/frontend/editor-ui/src/features/auth/components/ChangePasswordModal.test.ts similarity index 87% rename from packages/frontend/editor-ui/src/components/ChangePasswordModal.test.ts rename to packages/frontend/editor-ui/src/features/auth/components/ChangePasswordModal.test.ts index 7248774c81e..04a5e3dd26a 100644 --- a/packages/frontend/editor-ui/src/components/ChangePasswordModal.test.ts +++ b/packages/frontend/editor-ui/src/features/auth/components/ChangePasswordModal.test.ts @@ -1,5 +1,5 @@ import { createTestingPinia } from '@pinia/testing'; -import ChangePasswordModal from '@/components/ChangePasswordModal.vue'; +import ChangePasswordModal from './ChangePasswordModal.vue'; import type { createPinia } from 'pinia'; import { createComponentRenderer } from '@/__tests__/render'; diff --git a/packages/frontend/editor-ui/src/components/ChangePasswordModal.vue b/packages/frontend/editor-ui/src/features/auth/components/ChangePasswordModal.vue similarity index 98% rename from packages/frontend/editor-ui/src/components/ChangePasswordModal.vue rename to packages/frontend/editor-ui/src/features/auth/components/ChangePasswordModal.vue index bb46eb8428c..2e6b65138fe 100644 --- a/packages/frontend/editor-ui/src/components/ChangePasswordModal.vue +++ b/packages/frontend/editor-ui/src/features/auth/components/ChangePasswordModal.vue @@ -1,7 +1,7 @@