From de88997674e7a66d66cf39d818e6d12a91f3f974 Mon Sep 17 00:00:00 2001 From: Elias Meire Date: Mon, 12 Aug 2024 14:30:26 +0200 Subject: [PATCH] Hide credential-only nodes with supported nodes (instead of deleting) --- packages/core/bin/generate-ui-types | 7 +++++-- packages/editor-ui/src/stores/credentials.store.ts | 4 +++- packages/workflow/src/Interfaces.ts | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/bin/generate-ui-types b/packages/core/bin/generate-ui-types index 988462d604e08..8cecb6b054d74 100755 --- a/packages/core/bin/generate-ui-types +++ b/packages/core/bin/generate-ui-types @@ -33,8 +33,11 @@ function findReferencedMethods(obj, refs = {}, latestName = '') { const knownCredentials = loader.known.credentials; const credentialTypes = Object.values(loader.credentialTypes).map((data) => { const credentialType = data.type; - if (knownCredentials[credentialType.name].supportedNodes?.length > 0) { - delete credentialType.httpRequestNode; + if ( + knownCredentials[credentialType.name].supportedNodes?.length > 0 && + credentialType.httpRequestNode + ) { + credentialType.httpRequestNode.hidden = true; } return credentialType; }); diff --git a/packages/editor-ui/src/stores/credentials.store.ts b/packages/editor-ui/src/stores/credentials.store.ts index e6759466145c9..ee0846363ff81 100644 --- a/packages/editor-ui/src/stores/credentials.store.ts +++ b/packages/editor-ui/src/stores/credentials.store.ts @@ -200,7 +200,9 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => { }); const httpOnlyCredentialTypes = computed(() => { - return allCredentialTypes.value.filter((credentialType) => credentialType.httpRequestNode); + return allCredentialTypes.value.filter( + (credentialType) => credentialType.httpRequestNode && !credentialType.httpRequestNode.hidden, + ); }); // #endregion diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index ea31b06fef34b..357a50168c8fc 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -308,6 +308,7 @@ export interface ICredentialTestRequestData { type ICredentialHttpRequestNode = { name: string; docsUrl: string; + hidden?: boolean; } & ({ apiBaseUrl: string } | { apiBaseUrlPlaceholder: string }); export interface ICredentialType {