1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

Ignore node-credential-issues on disabled nodes

This commit is contained in:
Jan Oberhauser 2020-02-09 23:18:44 -08:00
parent 2693b92021
commit 7ee03cf132
5 changed files with 40 additions and 37 deletions

View File

@ -13,7 +13,7 @@ export async function WorkflowCredentials(nodes: INode[]): Promise<IWorkflowCred
let node, type, name, foundCredentials;
for (node of nodes) {
if (!node.credentials) {
if (node.disabled === true || !node.credentials) {
continue;
}

View File

@ -171,15 +171,7 @@ export default mixins(nodeBase, workflowHelpers).extend({
},
methods: {
disableNode () {
// Toggle disabled flag
const updateInformation = {
name: this.data.name,
properties: {
disabled: !this.data.disabled,
},
};
this.$store.commit('updateNodeProperties', updateInformation);
this.disableNodes([this.data]);
},
executeNode () {
this.$emit('runWorkflow', this.data.name);

View File

@ -288,20 +288,6 @@ export default mixins(
}
}
},
updateNodeCredentialIssues (node: INodeUi): void {
const fullNodeIssues: INodeIssues | null = this.getNodeCredentialIssues(node);
let newIssues: INodeIssueObjectProperty | null = null;
if (fullNodeIssues !== null) {
newIssues = fullNodeIssues.credentials!;
}
this.$store.commit('setNodeIssue', {
node: node.name,
type: 'credentials',
value: newIssues,
} as INodeIssueData);
},
credentialSelected (updateInformation: INodeUpdatePropertiesInformation) {
// Update the values on the node
this.$store.commit('updateNodeProperties', updateInformation);

View File

@ -6,6 +6,7 @@ import {
INodeParameters,
INodeExecutionData,
INodeIssues,
INodeIssueData,
INodeIssueObjectProperty,
INodeProperties,
INodeTypeDescription,
@ -121,8 +122,29 @@ export const nodeHelpers = mixins(
}
},
// Updates the credential-issues of the node
updateNodeCredentialIssues(node: INodeUi): void {
const fullNodeIssues: INodeIssues | null = this.getNodeCredentialIssues(node);
let newIssues: INodeIssueObjectProperty | null = null;
if (fullNodeIssues !== null) {
newIssues = fullNodeIssues.credentials!;
}
this.$store.commit('setNodeIssue', {
node: node.name,
type: 'credentials',
value: newIssues,
} as INodeIssueData);
},
// Returns all the credential-issues of the node
getNodeCredentialIssues (node: INodeUi, nodeType?: INodeTypeDescription): INodeIssues | null {
if (node.disabled === true) {
// Node is disabled
return null;
}
if (nodeType === undefined) {
nodeType = this.$store.getters.nodeType(node.type);
}
@ -257,5 +279,20 @@ export const nodeHelpers = mixins(
return returnData;
},
disableNodes(nodes: INodeUi[]) {
for (const node of nodes) {
// Toggle disabled flag
const updateInformation = {
name: node.name,
properties: {
disabled: !node.disabled,
},
};
this.$store.commit('updateNodeProperties', updateInformation);
this.updateNodeCredentialIssues(node);
}
},
},
});

View File

@ -547,19 +547,7 @@ export default mixins(
if (this.editAllowedCheck() === false) {
return;
}
let updateInformation;
this.$store.getters.getSelectedNodes.forEach((node: INodeUi) => {
// Toggle disabled flag
updateInformation = {
name: node.name,
properties: {
disabled: !node.disabled,
},
};
this.$store.commit('updateNodeProperties', updateInformation);
});
this.disableNodes(this.$store.getters.getSelectedNodes);
},
deleteSelectedNodes () {