From 62fb924e2d4d963424c23fd40041243bd9053527 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Thu, 20 Apr 2023 14:24:40 +0300 Subject: [PATCH 1/3] refactor: replace Vue.extend with defineComponent in editor-ui --- packages/editor-ui/src/components/AboutModal.vue | 4 ++-- .../editor-ui/src/components/ActivationModal.vue | 4 ++-- packages/editor-ui/src/components/AskAiModal.vue | 4 ++-- packages/editor-ui/src/components/Banner.vue | 4 ++-- .../src/components/CredentialEdit/CredentialInfo.vue | 4 ++-- .../components/CredentialEdit/CredentialInputs.vue | 4 ++-- packages/editor-ui/src/components/CredentialIcon.vue | 4 ++-- .../editor-ui/src/components/CredentialsSelect.vue | 4 ++-- packages/editor-ui/src/components/Draggable.vue | 4 ++-- .../editor-ui/src/components/DraggableTarget.vue | 5 +++-- .../src/components/EnterpriseEdition.ee.vue | 4 ++-- .../editor-ui/src/components/ExecutionsModal.vue | 4 ++-- .../ExecutionsView/ExecutionsLandingPage.vue | 4 ++-- .../components/ExecutionsView/ExecutionsSidebar.vue | 4 ++-- .../ExpandableInput/ExpandableInputBase.vue | 4 ++-- .../ExpandableInput/ExpandableInputEdit.vue | 7 ++++--- .../ExpandableInput/ExpandableInputPreview.vue | 4 ++-- .../ExpressionEditorModalOutput.vue | 5 +++-- .../src/components/ExpressionParameterInput.vue | 4 ++-- .../editor-ui/src/components/FeatureComingSoon.vue | 4 ++-- .../src/components/FixedCollectionParameter.vue | 12 ++++++------ packages/editor-ui/src/components/GoBackButton.vue | 4 ++-- .../editor-ui/src/components/HoverableNodeIcon.vue | 4 ++-- .../InlineExpressionEditorOutput.vue | 6 ++++-- packages/editor-ui/src/components/InlineTextEdit.vue | 4 ++-- .../src/components/IntersectionObserver.vue | 4 ++-- packages/editor-ui/src/components/Logo.vue | 4 ++-- .../editor-ui/src/components/MainHeader/TabBar.vue | 7 ++++--- packages/editor-ui/src/components/Modal.vue | 7 ++++--- packages/editor-ui/src/components/ModalDrawer.vue | 7 ++++--- packages/editor-ui/src/components/ModalRoot.vue | 4 ++-- packages/editor-ui/src/components/Modals.vue | 4 ++-- .../editor-ui/src/components/MultipleParameter.vue | 7 ++++--- .../editor-ui/src/components/Node/NodeCreation.vue | 4 ++-- packages/editor-ui/src/components/NodeIcon.vue | 4 ++-- packages/editor-ui/src/components/NodeTitle.vue | 4 ++-- .../editor-ui/src/components/PageContentWrapper.vue | 4 ++-- .../editor-ui/src/components/PanelDragButton.vue | 4 ++-- .../src/components/ParameterInputExpanded.vue | 5 +++-- .../editor-ui/src/components/ParameterInputHint.vue | 4 ++-- .../editor-ui/src/components/ParameterIssues.vue | 4 ++-- .../editor-ui/src/components/ParameterOptions.vue | 7 ++++--- .../src/components/PushConnectionTracker.vue | 4 ++-- .../ResourceLocator/ResourceLocatorDropdown.vue | 5 +++-- packages/editor-ui/src/components/RunInfo.vue | 6 +++--- packages/editor-ui/src/components/SaveButton.vue | 4 ++-- packages/editor-ui/src/components/ScopesNotice.vue | 4 ++-- packages/editor-ui/src/components/ShortenName.vue | 4 ++-- packages/editor-ui/src/components/TagsContainer.vue | 4 ++-- .../src/components/TagsManager/NoTagsView.vue | 4 ++-- .../components/TagsManager/TagsView/TagsTable.vue | 4 ++-- .../TagsManager/TagsView/TagsTableHeader.vue | 4 ++-- .../src/components/TagsManager/TagsView/TagsView.vue | 6 +++--- .../editor-ui/src/components/TemplateDetails.vue | 6 ++++-- .../src/components/TemplateDetailsBlock.vue | 4 ++-- packages/editor-ui/src/components/TextEdit.vue | 6 +++--- packages/editor-ui/src/components/TimeAgo.vue | 4 ++-- packages/editor-ui/src/components/TitledList.vue | 4 ++-- packages/editor-ui/src/components/UpdatesPanel.vue | 4 ++-- packages/editor-ui/src/components/VersionCard.vue | 4 ++-- .../src/components/__tests__/ExecutionsList.test.ts | 4 ++-- .../editor-ui/src/components/forms/CodeEditor.vue | 4 ++-- .../src/components/forms/ResourceFiltersDropdown.vue | 7 ++++--- .../components/forms/ResourceOwnershipSelect.ee.vue | 4 ++-- .../src/components/layouts/PageViewLayout.vue | 4 ++-- .../src/components/transitions/SlideTransition.vue | 4 ++-- packages/editor-ui/src/mixins/copyPaste.ts | 4 ++-- packages/editor-ui/src/mixins/debounce.ts | 4 ++-- .../editor-ui/src/mixins/deviceSupportHelpers.ts | 4 ++-- packages/editor-ui/src/mixins/emitter.ts | 4 ++-- packages/editor-ui/src/mixins/externalHooks.ts | 4 ++-- packages/editor-ui/src/mixins/restApi.ts | 4 ++-- packages/editor-ui/src/mixins/titleChange.ts | 4 ++-- packages/editor-ui/src/mixins/userHelpers.ts | 8 ++++---- packages/editor-ui/src/views/AuthView.vue | 4 ++-- packages/editor-ui/src/views/ErrorView.vue | 4 ++-- packages/editor-ui/src/views/ExecutionsView.vue | 4 ++-- .../editor-ui/src/views/SettingsFakeDoorView.vue | 4 ++-- packages/editor-ui/src/views/TemplatesView.vue | 4 ++-- 79 files changed, 189 insertions(+), 174 deletions(-) diff --git a/packages/editor-ui/src/components/AboutModal.vue b/packages/editor-ui/src/components/AboutModal.vue index f23621cea60f3..19b57c1fd0bb7 100644 --- a/packages/editor-ui/src/components/AboutModal.vue +++ b/packages/editor-ui/src/components/AboutModal.vue @@ -54,7 +54,7 @@ diff --git a/packages/editor-ui/src/components/PanelDragButton.vue b/packages/editor-ui/src/components/PanelDragButton.vue index 6413ff061e9e1..58acc80d9f09f 100644 --- a/packages/editor-ui/src/components/PanelDragButton.vue +++ b/packages/editor-ui/src/components/PanelDragButton.vue @@ -42,10 +42,10 @@ diff --git a/packages/editor-ui/src/components/TagsManager/TagsView/TagsTable.vue b/packages/editor-ui/src/components/TagsManager/TagsView/TagsTable.vue index 76af2dd73955f..e3142b5ef97b6 100644 --- a/packages/editor-ui/src/components/TagsManager/TagsView/TagsTable.vue +++ b/packages/editor-ui/src/components/TagsManager/TagsView/TagsTable.vue @@ -109,12 +109,12 @@ diff --git a/packages/editor-ui/src/mixins/copyPaste.ts b/packages/editor-ui/src/mixins/copyPaste.ts index eee52394d99ac..49c4ae830d233 100644 --- a/packages/editor-ui/src/mixins/copyPaste.ts +++ b/packages/editor-ui/src/mixins/copyPaste.ts @@ -2,10 +2,10 @@ * Captures any pasted data and sends it to method "receivedCopyPasteData" which has to be * defined on the component which uses this mixin */ -import Vue from 'vue'; +import { defineComponent } from 'vue'; import { debounce } from 'lodash-es'; -export const copyPaste = Vue.extend({ +export const copyPaste = defineComponent({ data() { return { copyPasteElementsGotCreated: false, diff --git a/packages/editor-ui/src/mixins/debounce.ts b/packages/editor-ui/src/mixins/debounce.ts index 7c491780aaf3d..217db45d7a66e 100644 --- a/packages/editor-ui/src/mixins/debounce.ts +++ b/packages/editor-ui/src/mixins/debounce.ts @@ -1,7 +1,7 @@ import { debounce } from 'lodash-es'; -import Vue from 'vue'; +import { defineComponent } from 'vue'; -export const debounceHelper = Vue.extend({ +export const debounceHelper = defineComponent({ data() { return { debouncedFunctions: [] as any[], diff --git a/packages/editor-ui/src/mixins/deviceSupportHelpers.ts b/packages/editor-ui/src/mixins/deviceSupportHelpers.ts index 6b316bf87d8f1..a8f87f8820aee 100644 --- a/packages/editor-ui/src/mixins/deviceSupportHelpers.ts +++ b/packages/editor-ui/src/mixins/deviceSupportHelpers.ts @@ -1,6 +1,6 @@ -import Vue from 'vue'; +import { defineComponent } from 'vue'; -export const deviceSupportHelpers = Vue.extend({ +export const deviceSupportHelpers = defineComponent({ data() { return { // @ts-ignore msMaxTouchPoints is deprecated but must fix tablet bugs before fixing this.. otherwise breaks touchscreen computers diff --git a/packages/editor-ui/src/mixins/emitter.ts b/packages/editor-ui/src/mixins/emitter.ts index ab645d6e10c9a..75579f7094331 100644 --- a/packages/editor-ui/src/mixins/emitter.ts +++ b/packages/editor-ui/src/mixins/emitter.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import Vue from 'vue'; +import Vue, { defineComponent } from 'vue'; function broadcast(componentName: string, eventName: string, params: any) { // @ts-ignore @@ -17,7 +17,7 @@ function broadcast(componentName: string, eventName: string, params: any) { }); } -export default Vue.extend({ +export default defineComponent({ methods: { $dispatch(componentName: string, eventName: string, params: any) { let parent = this.$parent || this.$root; diff --git a/packages/editor-ui/src/mixins/externalHooks.ts b/packages/editor-ui/src/mixins/externalHooks.ts index 5a336ae125ac8..07e6c2ba5cb92 100644 --- a/packages/editor-ui/src/mixins/externalHooks.ts +++ b/packages/editor-ui/src/mixins/externalHooks.ts @@ -2,7 +2,7 @@ import { IExternalHooks } from '@/Interface'; import { useWebhooksStore } from '@/stores/webhooks'; import { IDataObject } from 'n8n-workflow'; import { Store } from 'pinia'; -import Vue from 'vue'; +import { defineComponent } from 'vue'; declare global { interface Window { @@ -29,7 +29,7 @@ export async function runExternalHook(eventName: string, store: Store, metadata? } } -export const externalHooks = Vue.extend({ +export const externalHooks = defineComponent({ methods: { $externalHooks(): IExternalHooks { return { diff --git a/packages/editor-ui/src/mixins/restApi.ts b/packages/editor-ui/src/mixins/restApi.ts index f14d197815cc4..7663eb1a7b204 100644 --- a/packages/editor-ui/src/mixins/restApi.ts +++ b/packages/editor-ui/src/mixins/restApi.ts @@ -1,4 +1,4 @@ -import Vue from 'vue'; +import { defineComponent } from 'vue'; import { parse } from 'flatted'; import { Method } from 'axios'; @@ -55,7 +55,7 @@ function unflattenExecutionData(fullExecutionData: IExecutionFlattedResponse): I return returnData; } -export const restApi = Vue.extend({ +export const restApi = defineComponent({ computed: { ...mapStores(useRootStore), }, diff --git a/packages/editor-ui/src/mixins/titleChange.ts b/packages/editor-ui/src/mixins/titleChange.ts index 63cde777c44e3..450882ac26234 100644 --- a/packages/editor-ui/src/mixins/titleChange.ts +++ b/packages/editor-ui/src/mixins/titleChange.ts @@ -1,8 +1,8 @@ -import Vue from 'vue'; +import { defineComponent } from 'vue'; import { WorkflowTitleStatus } from '@/Interface'; -export const titleChange = Vue.extend({ +export const titleChange = defineComponent({ methods: { /** * Change title of n8n tab diff --git a/packages/editor-ui/src/mixins/userHelpers.ts b/packages/editor-ui/src/mixins/userHelpers.ts index 8ac4d45e0341f..ecf4bd6d9da8a 100644 --- a/packages/editor-ui/src/mixins/userHelpers.ts +++ b/packages/editor-ui/src/mixins/userHelpers.ts @@ -1,10 +1,10 @@ -import { IPermissions, IUser } from '@/Interface'; +import type { IPermissions } from '@/Interface'; import { isAuthorized } from '@/utils'; import { useUsersStore } from '@/stores/users'; -import Vue from 'vue'; -import { Route } from 'vue-router'; +import { defineComponent } from 'vue'; +import type { Route } from 'vue-router'; -export const userHelpers = Vue.extend({ +export const userHelpers = defineComponent({ methods: { canUserAccessRouteByName(name: string): boolean { const { route } = this.$router.resolve({ name }); diff --git a/packages/editor-ui/src/views/AuthView.vue b/packages/editor-ui/src/views/AuthView.vue index 611090cbd4cba..7a3fa27ac7f7d 100644 --- a/packages/editor-ui/src/views/AuthView.vue +++ b/packages/editor-ui/src/views/AuthView.vue @@ -22,12 +22,12 @@