Skip to content

Commit

Permalink
fix(editor): Fix credential display bug (#3372)
Browse files Browse the repository at this point in the history
* ⚡ Filter credentials by version

* ⚡ Reuse helper
  • Loading branch information
ivov committed May 27, 2022
1 parent 96a109a commit ed69c3c
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions packages/editor-ui/src/components/mixins/workflowHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,24 +330,25 @@ export const workflowHelpers = mixins(
if (node.credentials !== undefined && nodeType.credentials !== undefined) {
const saveCredenetials: INodeCredentials = {};
for (const nodeCredentialTypeName of Object.keys(node.credentials)) {
// todo revert to only set actually used credentials on workflow
// if (this.hasProxyAuth(node) || Object.keys(node.parameters).includes('genericAuthType')) {
// saveCredenetials[nodeCredentialTypeName] = node.credentials[nodeCredentialTypeName];
// continue;
// }

// const credentialTypeDescription = nodeType.credentials
// .find((credentialTypeDescription) => credentialTypeDescription.name === nodeCredentialTypeName);

// if (credentialTypeDescription === undefined) {
// // Credential type is not know so do not save
// continue;
// }

// if (this.displayParameter(node.parameters, credentialTypeDescription, '', node) === false) {
// // Credential should not be displayed so do also not save
// continue;
// }
if (this.hasProxyAuth(node) || Object.keys(node.parameters).includes('genericAuthType')) {
saveCredenetials[nodeCredentialTypeName] = node.credentials[nodeCredentialTypeName];
continue;
}

const credentialTypeDescription = nodeType.credentials
// filter out credentials with same name in different node versions
.filter((c) => this.displayParameter(node.parameters, c, '', node))
.find((c) => c.name === nodeCredentialTypeName);

if (credentialTypeDescription === undefined) {
// Credential type is not know so do not save
continue;
}

if (this.displayParameter(node.parameters, credentialTypeDescription, '', node) === false) {
// Credential should not be displayed so do also not save
continue;
}

saveCredenetials[nodeCredentialTypeName] = node.credentials[nodeCredentialTypeName];
}
Expand Down

0 comments on commit ed69c3c

Please sign in to comment.