mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Fix issue that frontend breaks with unkown nodes (#7596)
Because of recent changes does the frontend break when a node is not known.  Github issue / Community forum post (link here to close automatically): --------- Signed-off-by: Oleg Ivaniv <me@olegivaniv.com> Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -365,37 +365,39 @@ export default defineComponent({
|
||||
top: this.position[1] + 'px',
|
||||
};
|
||||
|
||||
const workflow = this.workflowsStore.getCurrentWorkflow();
|
||||
const inputs =
|
||||
NodeHelpers.getNodeInputs(workflow, this.node, this.nodeType) ||
|
||||
([] as Array<ConnectionTypes | INodeInputConfiguration>);
|
||||
const inputTypes = NodeHelpers.getConnectionTypes(inputs);
|
||||
if (this.node && this.nodeType) {
|
||||
const workflow = this.workflowsStore.getCurrentWorkflow();
|
||||
const inputs =
|
||||
NodeHelpers.getNodeInputs(workflow, this.node, this.nodeType) ||
|
||||
([] as Array<ConnectionTypes | INodeInputConfiguration>);
|
||||
const inputTypes = NodeHelpers.getConnectionTypes(inputs);
|
||||
|
||||
const nonMainInputs = inputTypes.filter((input) => input !== NodeConnectionType.Main);
|
||||
if (nonMainInputs.length) {
|
||||
const requiredNonMainInputs = inputs.filter(
|
||||
(input) => typeof input !== 'string' && input.required,
|
||||
);
|
||||
const nonMainInputs = inputTypes.filter((input) => input !== NodeConnectionType.Main);
|
||||
if (nonMainInputs.length) {
|
||||
const requiredNonMainInputs = inputs.filter(
|
||||
(input) => typeof input !== 'string' && input.required,
|
||||
);
|
||||
|
||||
let spacerCount = 0;
|
||||
if (NODE_INSERT_SPACER_BETWEEN_INPUT_GROUPS) {
|
||||
const requiredNonMainInputsCount = requiredNonMainInputs.length;
|
||||
const optionalNonMainInputsCount = nonMainInputs.length - requiredNonMainInputsCount;
|
||||
spacerCount = requiredNonMainInputsCount > 0 && optionalNonMainInputsCount > 0 ? 1 : 0;
|
||||
let spacerCount = 0;
|
||||
if (NODE_INSERT_SPACER_BETWEEN_INPUT_GROUPS) {
|
||||
const requiredNonMainInputsCount = requiredNonMainInputs.length;
|
||||
const optionalNonMainInputsCount = nonMainInputs.length - requiredNonMainInputsCount;
|
||||
spacerCount = requiredNonMainInputsCount > 0 && optionalNonMainInputsCount > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
styles['--configurable-node-input-count'] = nonMainInputs.length + spacerCount;
|
||||
}
|
||||
|
||||
styles['--configurable-node-input-count'] = nonMainInputs.length + spacerCount;
|
||||
const outputs =
|
||||
NodeHelpers.getNodeOutputs(workflow, this.node, this.nodeType) ||
|
||||
([] as Array<ConnectionTypes | INodeOutputConfiguration>);
|
||||
|
||||
const outputTypes = NodeHelpers.getConnectionTypes(outputs);
|
||||
|
||||
const mainOutputs = outputTypes.filter((output) => output === NodeConnectionType.Main);
|
||||
styles['--node-main-output-count'] = mainOutputs.length;
|
||||
}
|
||||
|
||||
const outputs =
|
||||
NodeHelpers.getNodeOutputs(workflow, this.node, this.nodeType) ||
|
||||
([] as Array<ConnectionTypes | INodeOutputConfiguration>);
|
||||
|
||||
const outputTypes = NodeHelpers.getConnectionTypes(outputs);
|
||||
|
||||
const mainOutputs = outputTypes.filter((output) => output === NodeConnectionType.Main);
|
||||
styles['--node-main-output-count'] = mainOutputs.length;
|
||||
|
||||
return styles;
|
||||
},
|
||||
nodeClass(): object {
|
||||
|
||||
Reference in New Issue
Block a user