From 772ec78349b5b6877bf681f3262951e3a4e34fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 22 Nov 2022 10:08:35 +0100 Subject: [PATCH] fix(core): Use CredentialsOverwrites when testing credentials (#4675) * fix(cli): use CredentialsOverwrites in credentials testing * fix(editor-ui): do not set credential properties if they have been overwritten --- packages/cli/src/CredentialsHelper.ts | 7 +++++++ .../src/components/CredentialEdit/CredentialEdit.vue | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/CredentialsHelper.ts b/packages/cli/src/CredentialsHelper.ts index bdc5b98f4d..771ca5bddd 100644 --- a/packages/cli/src/CredentialsHelper.ts +++ b/packages/cli/src/CredentialsHelper.ts @@ -551,6 +551,13 @@ export class CredentialsHelper extends ICredentialsHelper { }); } + if (credentialsDecrypted.data) { + credentialsDecrypted.data = CredentialsOverwrites().applyOverwrite( + credentialType, + credentialsDecrypted.data, + ); + } + if (typeof credentialTestFunction === 'function') { // The credentials get tested via a function that is defined on the node const credentialTestFunctions = NodeExecuteFunctions.getCredentialTestFunctions(); diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue index 63aa1f3a94..70187230a2 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue @@ -231,7 +231,10 @@ export default mixins(showMessage, nodeHelpers).extend({ if (this.credentialType) { for (const property of this.credentialType.properties) { - if (!this.credentialData.hasOwnProperty(property.name)) { + if ( + !this.credentialData.hasOwnProperty(property.name) && + !this.credentialType.__overwrittenProperties?.includes(property.name) + ) { Vue.set(this.credentialData, property.name, property.default as CredentialInformation); } } @@ -516,7 +519,7 @@ export default mixins(showMessage, nodeHelpers).extend({ ); } - // The properties defined on the parent credentials take presidence + // The properties defined on the parent credentials take precedence NodeHelpers.mergeNodeProperties( combineProperties, credentialTypeData.properties,