mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
handle unknown types
This commit is contained in:
parent
83b8c01e04
commit
fd886b585a
|
@ -101,7 +101,7 @@ export default mixins(
|
|||
credentialTypesNodeDescription (): INodeCredentialDescription[] {
|
||||
const node = this.node as INodeUi;
|
||||
|
||||
const activeNodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription;
|
||||
const activeNodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null;
|
||||
if (activeNodeType && activeNodeType.credentials) {
|
||||
return activeNodeType.credentials;
|
||||
}
|
||||
|
|
|
@ -353,7 +353,10 @@ export default mixins(
|
|||
} else if (parameterData.name.startsWith('parameters.')) {
|
||||
// A node parameter changed
|
||||
|
||||
const nodeType = this.$store.getters.nodeType(node.type);
|
||||
const nodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null;
|
||||
if (!nodeType) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get only the parameters which are different to the defaults
|
||||
let nodeParameters = NodeHelpers.getNodeParameters(nodeType.properties, node.parameters, false, false);
|
||||
|
|
|
@ -64,7 +64,7 @@ export default mixins(
|
|||
],
|
||||
data () {
|
||||
return {
|
||||
isMinimized: this.nodeType.name !== WEBHOOK_NODE_TYPE,
|
||||
isMinimized: this.nodeType && this.nodeType.name !== WEBHOOK_NODE_TYPE,
|
||||
showUrlFor: 'test',
|
||||
};
|
||||
},
|
||||
|
|
|
@ -203,6 +203,7 @@ import {
|
|||
IBinaryKeyData,
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeTypeDescription,
|
||||
IRunData,
|
||||
IRunExecutionData,
|
||||
ITaskData,
|
||||
|
@ -529,8 +530,8 @@ export default mixins(
|
|||
return outputIndex + 1;
|
||||
}
|
||||
|
||||
const nodeType = this.$store.getters.nodeType(this.node.type);
|
||||
if (!nodeType.hasOwnProperty('outputNames') || nodeType.outputNames.length <= outputIndex) {
|
||||
const nodeType = this.$store.getters.nodeType(this.node.type) as INodeTypeDescription | null;
|
||||
if (!nodeType || !nodeType.outputNames || nodeType.outputNames.length <= outputIndex) {
|
||||
return outputIndex + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -314,10 +314,10 @@ export const nodeBase = mixins(
|
|||
});
|
||||
},
|
||||
__addNode (node: INodeUi) {
|
||||
let nodeTypeData = this.$store.getters.nodeType(node.type);
|
||||
let nodeTypeData = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null;
|
||||
if (!nodeTypeData) {
|
||||
// If node type is not know use by default the base.noOp data to display it
|
||||
nodeTypeData = this.$store.getters.nodeType(NO_OP_NODE_TYPE);
|
||||
nodeTypeData = this.$store.getters.nodeType(NO_OP_NODE_TYPE) as INodeTypeDescription;
|
||||
}
|
||||
|
||||
this.__addInputEndpoints(node, nodeTypeData);
|
||||
|
|
|
@ -225,7 +225,7 @@ export const workflowHelpers = mixins(
|
|||
return [];
|
||||
},
|
||||
getByName: (nodeType: string): INodeType | INodeVersionedType | undefined => {
|
||||
const nodeTypeDescription = this.$store.getters.nodeType(nodeType);
|
||||
const nodeTypeDescription = this.$store.getters.nodeType(nodeType) as INodeTypeDescription | null;
|
||||
|
||||
if (nodeTypeDescription === null) {
|
||||
return undefined;
|
||||
|
@ -236,7 +236,7 @@ export const workflowHelpers = mixins(
|
|||
};
|
||||
},
|
||||
getByNameAndVersion: (nodeType: string, version?: number): INodeType | undefined => {
|
||||
const nodeTypeDescription = this.$store.getters.nodeType(nodeType, version);
|
||||
const nodeTypeDescription = this.$store.getters.nodeType(nodeType, version) as INodeTypeDescription | null;
|
||||
|
||||
if (nodeTypeDescription === null) {
|
||||
return undefined;
|
||||
|
@ -329,7 +329,7 @@ export const workflowHelpers = mixins(
|
|||
|
||||
// Get the data of the node type that we can get the default values
|
||||
// TODO: Later also has to care about the node-type-version as defaults could be different
|
||||
const nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription;
|
||||
const nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null;
|
||||
|
||||
if (nodeType !== null) {
|
||||
// Node-Type is known so we can save the parameters correctly
|
||||
|
|
|
@ -1151,7 +1151,7 @@ export default mixins(
|
|||
let yOffset = 0;
|
||||
|
||||
if (lastSelectedConnection) {
|
||||
const sourceNodeType = this.$store.getters.nodeType(lastSelectedNode.type);
|
||||
const sourceNodeType = this.$store.getters.nodeType(lastSelectedNode.type) as INodeTypeDescription | null;
|
||||
const offsets = [[-100, 100], [-140, 0, 140], [-240, -100, 100, 240]];
|
||||
if (sourceNodeType && sourceNodeType.outputs.length > 1) {
|
||||
const offset = offsets[sourceNodeType.outputs.length - 2];
|
||||
|
@ -1528,8 +1528,8 @@ export default mixins(
|
|||
const nodeName = (element as HTMLElement).dataset['name'] as string;
|
||||
const node = this.$store.getters.getNodeByName(nodeName) as INodeUi | null;
|
||||
if (node) {
|
||||
const nodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription;
|
||||
if (nodeType.inputs.length === 1) {
|
||||
const nodeType = this.$store.getters.nodeType(node.type) as INodeTypeDescription | null;
|
||||
if (nodeType && nodeType.inputs && nodeType.inputs.length === 1) {
|
||||
this.pullConnActiveNodeName = node.name;
|
||||
const endpoint = this.instance.getEndpoint(this.getInputEndpointUUID(nodeName, 0));
|
||||
|
||||
|
@ -1718,8 +1718,8 @@ export default mixins(
|
|||
|
||||
const node = this.$store.getters.getNodeByName(nodeName);
|
||||
|
||||
const nodeTypeData: INodeTypeDescription = this.$store.getters.nodeType(node.type);
|
||||
if (nodeTypeData.maxNodes !== undefined && this.getNodeTypeCount(node.type) >= nodeTypeData.maxNodes) {
|
||||
const nodeTypeData: INodeTypeDescription | null= this.$store.getters.nodeType(node.type);
|
||||
if (nodeTypeData && nodeTypeData.maxNodes !== undefined && this.getNodeTypeCount(node.type) >= nodeTypeData.maxNodes) {
|
||||
this.showMaxNodeTypeError(nodeTypeData);
|
||||
return;
|
||||
}
|
||||
|
@ -1880,8 +1880,8 @@ export default mixins(
|
|||
}
|
||||
|
||||
// connect nodes before/after deleted node
|
||||
const nodeType: INodeTypeDescription = this.$store.getters.nodeType(node.type, node.typeVersion);
|
||||
if (nodeType.outputs.length === 1
|
||||
const nodeType: INodeTypeDescription | null = this.$store.getters.nodeType(node.type, node.typeVersion);
|
||||
if (nodeType && nodeType.outputs.length === 1
|
||||
&& nodeType.inputs.length === 1) {
|
||||
const {incoming, outgoing} = this.getIncomingOutgoingConnections(node.name);
|
||||
if (incoming.length === 1 && outgoing.length === 1) {
|
||||
|
@ -2051,7 +2051,7 @@ export default mixins(
|
|||
let nodeType: INodeTypeDescription | null;
|
||||
let foundNodeIssues: INodeIssues | null;
|
||||
nodes.forEach((node) => {
|
||||
nodeType = this.$store.getters.nodeType(node.type, node.typeVersion);
|
||||
nodeType = this.$store.getters.nodeType(node.type, node.typeVersion) as INodeTypeDescription | null;
|
||||
|
||||
// Make sure that some properties always exist
|
||||
if (!node.hasOwnProperty('disabled')) {
|
||||
|
|
Loading…
Reference in a new issue