From 1f7816d1bbf27a8982aff94d5d0128647d3dee03 Mon Sep 17 00:00:00 2001 From: Tomi Turtiainen <10324676+tomi@users.noreply.github.com> Date: Wed, 14 Aug 2024 10:25:19 +0300 Subject: [PATCH] refactor(editor): Use form event bus everywhere Builds on top of #10367 --- packages/editor-ui/src/components/ChangePasswordModal.vue | 4 ++-- packages/editor-ui/src/components/InviteUsersModal.vue | 4 ++-- packages/editor-ui/src/components/PersonalizationModal.vue | 4 ++-- .../src/components/PromptMfaCodeModal/PromptMfaCodeModal.vue | 4 ++-- packages/editor-ui/src/views/SettingsLdapView.vue | 4 ++-- packages/editor-ui/src/views/SettingsPersonalView.vue | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/editor-ui/src/components/ChangePasswordModal.vue b/packages/editor-ui/src/components/ChangePasswordModal.vue index 24de3b5dfb18c..dc6ace63edcb6 100644 --- a/packages/editor-ui/src/components/ChangePasswordModal.vue +++ b/packages/editor-ui/src/components/ChangePasswordModal.vue @@ -34,12 +34,12 @@ import { useToast } from '@/composables/useToast'; import { CHANGE_PASSWORD_MODAL_KEY } from '../constants'; import Modal from '@/components/Modal.vue'; import { useUsersStore } from '@/stores/users.store'; -import { createEventBus } from 'n8n-design-system/utils'; +import { createFormEventBus, createEventBus } from 'n8n-design-system/utils'; import type { IFormInputs, IFormInput } from '@/Interface'; import { useI18n } from '@/composables/useI18n'; const config = ref(null); -const formBus = createEventBus(); +const formBus = createFormEventBus(); const modalBus = createEventBus(); const password = ref(''); const loading = ref(false); diff --git a/packages/editor-ui/src/components/InviteUsersModal.vue b/packages/editor-ui/src/components/InviteUsersModal.vue index dab656c95364f..fd9c70443c15c 100644 --- a/packages/editor-ui/src/components/InviteUsersModal.vue +++ b/packages/editor-ui/src/components/InviteUsersModal.vue @@ -75,7 +75,7 @@ import { import { useUsersStore } from '@/stores/users.store'; import { useSettingsStore } from '@/stores/settings.store'; import { useUIStore } from '@/stores/ui.store'; -import { createEventBus } from 'n8n-design-system/utils'; +import { createFormEventBus, createEventBus } from 'n8n-design-system/utils'; import { useClipboard } from '@/composables/useClipboard'; const NAME_EMAIL_FORMAT_REGEX = /^.* <(.*)>$/; @@ -110,7 +110,7 @@ export default defineComponent({ data() { return { config: null as IFormInputs | null, - formBus: createEventBus(), + formBus: createFormEventBus(), modalBus: createEventBus(), emails: '', role: ROLE.Member as InvitableRoleName, diff --git a/packages/editor-ui/src/components/PersonalizationModal.vue b/packages/editor-ui/src/components/PersonalizationModal.vue index a96ce34fb4e52..ce0c263dbde86 100644 --- a/packages/editor-ui/src/components/PersonalizationModal.vue +++ b/packages/editor-ui/src/components/PersonalizationModal.vue @@ -144,7 +144,7 @@ import { useUIStore } from '@/stores/ui.store'; import { useSettingsStore } from '@/stores/settings.store'; import { useRootStore } from '@/stores/root.store'; import { useUsersStore } from '@/stores/users.store'; -import { createEventBus } from 'n8n-design-system/utils'; +import { createEventBus, createFormEventBus } from 'n8n-design-system/utils'; import { usePostHog } from '@/stores/posthog.store'; import { useExternalHooks } from '@/composables/useExternalHooks'; import { useUsageStore } from '@/stores/usage.store'; @@ -180,7 +180,7 @@ export default defineComponent({ showAllIndustryQuestions: true, registerForEnterpriseTrial: false, modalBus: createEventBus(), - formBus: createEventBus(), + formBus: createFormEventBus(), domainBlocklist: [] as string[], }; }, diff --git a/packages/editor-ui/src/components/PromptMfaCodeModal/PromptMfaCodeModal.vue b/packages/editor-ui/src/components/PromptMfaCodeModal/PromptMfaCodeModal.vue index 6580fc2d66b95..a40343a8bb537 100644 --- a/packages/editor-ui/src/components/PromptMfaCodeModal/PromptMfaCodeModal.vue +++ b/packages/editor-ui/src/components/PromptMfaCodeModal/PromptMfaCodeModal.vue @@ -45,7 +45,7 @@ import { createFormEventBus } from 'n8n-design-system'; const i18n = useI18n(); -const formBus = ref(createFormEventBus()); +const formBus = createFormEventBus(); const readyToSubmit = ref(false); const formFields: IFormInputs = [ @@ -69,7 +69,7 @@ function onSubmit(values: { mfaCode: string }) { } function onClickSave() { - formBus.value.emit('submit'); + formBus.emit('submit'); } function onFormReady(isReady: boolean) { diff --git a/packages/editor-ui/src/views/SettingsLdapView.vue b/packages/editor-ui/src/views/SettingsLdapView.vue index 775967bb72e36..bdfd8247696b9 100644 --- a/packages/editor-ui/src/views/SettingsLdapView.vue +++ b/packages/editor-ui/src/views/SettingsLdapView.vue @@ -157,7 +157,7 @@ import { mapStores } from 'pinia'; import { useUsersStore } from '@/stores/users.store'; import { useSettingsStore } from '@/stores/settings.store'; import { useUIStore } from '@/stores/ui.store'; -import { createEventBus } from 'n8n-design-system/utils'; +import { createFormEventBus } from 'n8n-design-system/utils'; import type { TableColumnCtx } from 'element-plus'; type TableRow = { @@ -222,7 +222,7 @@ export default defineComponent({ loadingTable: false, hasAnyChanges: false, formInputs: null as null | IFormInputs, - formBus: createEventBus(), + formBus: createFormEventBus(), readyToSubmit: false, page: 0, loginEnabled: false, diff --git a/packages/editor-ui/src/views/SettingsPersonalView.vue b/packages/editor-ui/src/views/SettingsPersonalView.vue index 9f0146ef3cdfb..08cc4ed12896a 100644 --- a/packages/editor-ui/src/views/SettingsPersonalView.vue +++ b/packages/editor-ui/src/views/SettingsPersonalView.vue @@ -21,7 +21,7 @@ const { showToast, showError } = useToast(); const hasAnyBasicInfoChanges = ref(false); const formInputs = ref(null); -const formBus = ref(createFormEventBus()); +const formBus = createFormEventBus(); const readyToSubmit = ref(false); const currentSelectedTheme = ref(useUIStore().theme); const themeOptions = ref>([ @@ -151,7 +151,7 @@ async function updatePersonalisationSettings() { uiStore.setTheme(currentSelectedTheme.value); } function onSaveClick() { - formBus.value.emit('submit'); + formBus.emit('submit'); } function openPasswordModal() { uiStore.openModal(CHANGE_PASSWORD_MODAL_KEY);