fix(editor): Disable data pinning on multiple output node types (#5111)

* fix: Disable data pinning on Compare Datasets node

* feat: update pin data mixin to automatically determine if multiple outputs node

* fix: remove unused node type constant
This commit is contained in:
Alex Grozav 2023-01-09 17:15:48 +02:00 committed by GitHub
parent c3422b1f84
commit 56951e83c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View file

@ -141,12 +141,7 @@ export const NON_ACTIVATABLE_TRIGGER_NODE_TYPES = [
EXECUTE_WORKFLOW_TRIGGER_NODE_TYPE,
];
export const MULTIPLE_OUTPUT_NODE_TYPES = [IF_NODE_TYPE, SWITCH_NODE_TYPE];
export const PIN_DATA_NODE_TYPES_DENYLIST = [
...MULTIPLE_OUTPUT_NODE_TYPES,
SPLIT_IN_BATCHES_NODE_TYPE,
];
export const PIN_DATA_NODE_TYPES_DENYLIST = [SPLIT_IN_BATCHES_NODE_TYPE];
// Node creator
export const CORE_NODES_CATEGORY = 'Core Nodes';

View file

@ -1,6 +1,6 @@
import Vue from 'vue';
import { INodeUi } from '@/Interface';
import { IPinData } from 'n8n-workflow';
import { INodeTypeDescription, IPinData } from 'n8n-workflow';
import { stringSizeInBytes } from '@/utils';
import { MAX_WORKFLOW_PINNED_DATA_SIZE, PIN_DATA_NODE_TYPES_DENYLIST } from '@/constants';
import { mapStores } from 'pinia';
@ -8,6 +8,7 @@ import { useWorkflowsStore } from '@/stores/workflows';
export interface IPinDataContext {
node: INodeUi;
nodeType: INodeTypeDescription;
$showError(error: Error, title: string): void;
}
@ -21,7 +22,14 @@ export const pinData = (Vue as Vue.VueConstructor<Vue & IPinDataContext>).extend
return !!this.node && typeof this.pinData !== 'undefined';
},
isPinDataNodeType(): boolean {
return !!this.node && !PIN_DATA_NODE_TYPES_DENYLIST.includes(this.node.type);
return (
!!this.node &&
!this.isMultipleOutputsNodeType &&
!PIN_DATA_NODE_TYPES_DENYLIST.includes(this.node.type)
);
},
isMultipleOutputsNodeType(): boolean {
return this.nodeType?.outputs.length > 1;
},
},
methods: {