From cf099bf3a468553abf9ccaf0fb5e3fd65c5fc092 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 18 Jul 2022 12:29:17 +0300 Subject: [PATCH 1/5] fix: Fixed entering edit mode after refresh. --- packages/editor-ui/src/components/RunData.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue index d0e41b86906bc..d927bf592aab5 100644 --- a/packages/editor-ui/src/components/RunData.vue +++ b/packages/editor-ui/src/components/RunData.vue @@ -362,7 +362,7 @@ import { INodeExecutionData, INodeTypeDescription, IRunData, - IRunExecutionData, + IRunExecutionData, PinData, } from 'n8n-workflow'; import { @@ -727,8 +727,9 @@ export default mixins( localStorage.setItem(LOCAL_STORAGE_PIN_DATA_DISCOVERY_CANVAS_FLAG, 'true'); }, enterEditMode({ origin }: EnterEditModeArgs) { - const data = this.rawInputData && this.rawInputData.length > 0 - ? this.convertToJson(this.rawInputData) + const inputData = this.pinData ? this.pinData as PinData : this.convertToJson(this.rawInputData); + const data = inputData.length > 0 + ? inputData : TEST_PIN_DATA; this.$store.commit('ui/setOutputPanelEditModeEnabled', true); From 227ff01a834b10cf791ed96ba1557dbe91a2e096 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 18 Jul 2022 12:31:41 +0300 Subject: [PATCH 2/5] fix: Fixed type error during build. --- packages/cli/test/integration/shared/types.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/test/integration/shared/types.d.ts b/packages/cli/test/integration/shared/types.d.ts index 1b31e598a4783..d628f7bf17888 100644 --- a/packages/cli/test/integration/shared/types.d.ts +++ b/packages/cli/test/integration/shared/types.d.ts @@ -17,6 +17,7 @@ type EndpointGroup = | 'owner' | 'passwordReset' | 'credentials' + | 'workflows' | 'publicApi'; export type CredentialPayload = { From 9ca0a6eb5442bff8cf004a63712ceaad04ac0e8f Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 18 Jul 2022 12:36:47 +0300 Subject: [PATCH 3/5] fix: RunData import formatting. --- packages/editor-ui/src/components/RunData.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue index d927bf592aab5..77a3acf0cad3b 100644 --- a/packages/editor-ui/src/components/RunData.vue +++ b/packages/editor-ui/src/components/RunData.vue @@ -362,7 +362,8 @@ import { INodeExecutionData, INodeTypeDescription, IRunData, - IRunExecutionData, PinData, + IRunExecutionData, + PinData, } from 'n8n-workflow'; import { From eb4486fdbbffc4e654de7218258b8ffb1a958753 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 18 Jul 2022 12:46:39 +0300 Subject: [PATCH 4/5] chore: Updated pin data types. --- packages/editor-ui/src/components/RunData.vue | 2 +- packages/editor-ui/src/components/mixins/pinData.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue index 77a3acf0cad3b..7eda024845e4a 100644 --- a/packages/editor-ui/src/components/RunData.vue +++ b/packages/editor-ui/src/components/RunData.vue @@ -728,7 +728,7 @@ export default mixins( localStorage.setItem(LOCAL_STORAGE_PIN_DATA_DISCOVERY_CANVAS_FLAG, 'true'); }, enterEditMode({ origin }: EnterEditModeArgs) { - const inputData = this.pinData ? this.pinData as PinData : this.convertToJson(this.rawInputData); + const inputData = this.pinData ? this.pinData : this.convertToJson(this.rawInputData); const data = inputData.length > 0 ? inputData : TEST_PIN_DATA; diff --git a/packages/editor-ui/src/components/mixins/pinData.ts b/packages/editor-ui/src/components/mixins/pinData.ts index dbc0af2b66d56..d558bd7d84306 100644 --- a/packages/editor-ui/src/components/mixins/pinData.ts +++ b/packages/editor-ui/src/components/mixins/pinData.ts @@ -1,6 +1,6 @@ import Vue from 'vue'; import { INodeUi } from "@/Interface"; -import { IDataObject } from "n8n-workflow"; +import {IDataObject, PinData} from "n8n-workflow"; import {stringSizeInBytes} from "@/components/helpers"; import {MAX_WORKFLOW_PINNED_DATA_SIZE, PIN_DATA_NODE_TYPES_DENYLIST} from "@/constants"; @@ -11,7 +11,7 @@ interface PinDataContext { export const pinData = (Vue as Vue.VueConstructor).extend({ computed: { - pinData (): IDataObject | undefined { + pinData (): PinData[string] | undefined { return this.node ? this.$store.getters['pinDataByNodeName'](this.node!.name) : undefined; }, hasPinData (): boolean { From 465032fd2a996d888a7a72af5e3e821c0b31eb1a Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 18 Jul 2022 13:13:56 +0300 Subject: [PATCH 5/5] fix: Added missing type to stringSizeInBytes. --- packages/editor-ui/src/components/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/helpers.ts b/packages/editor-ui/src/components/helpers.ts index 7ed61fe2e2448..0817ba759a737 100644 --- a/packages/editor-ui/src/components/helpers.ts +++ b/packages/editor-ui/src/components/helpers.ts @@ -69,7 +69,7 @@ export function isNumber(value: unknown): value is number { return typeof value === 'number'; } -export function stringSizeInBytes(input: string | IDataObject | undefined): number { +export function stringSizeInBytes(input: string | IDataObject | IDataObject[] | undefined): number { if (input === undefined) return 0; return new Blob([typeof input === 'string' ? input : JSON.stringify(input)]).size;