Skip to content

Commit

Permalink
Merge pull request #3729 from n8n-io/fix-pin-data-enter-edit-mode
Browse files Browse the repository at this point in the history
Fix pin data enter edit mode
  • Loading branch information
alexgrozav authored Jul 18, 2022
2 parents 724f700 + 465032f commit 7083829
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/cli/test/integration/shared/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type EndpointGroup =
| 'owner'
| 'passwordReset'
| 'credentials'
| 'workflows'
| 'publicApi';

export type CredentialPayload = {
Expand Down
6 changes: 4 additions & 2 deletions packages/editor-ui/src/components/RunData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ import {
INodeTypeDescription,
IRunData,
IRunExecutionData,
PinData,
} from 'n8n-workflow';
import {
Expand Down Expand Up @@ -727,8 +728,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 : this.convertToJson(this.rawInputData);
const data = inputData.length > 0
? inputData
: TEST_PIN_DATA;
this.$store.commit('ui/setOutputPanelEditModeEnabled', true);
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/components/mixins/pinData.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -11,7 +11,7 @@ interface PinDataContext {

export const pinData = (Vue as Vue.VueConstructor<Vue & PinDataContext>).extend({
computed: {
pinData (): IDataObject | undefined {
pinData (): PinData[string] | undefined {
return this.node ? this.$store.getters['pinDataByNodeName'](this.node!.name) : undefined;
},
hasPinData (): boolean {
Expand Down

0 comments on commit 7083829

Please sign in to comment.