From 639bdd2ceb799a6be6d57eb120e90bc2c0a59a97 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Mon, 9 Nov 2020 12:23:53 +0100 Subject: [PATCH] :sparkles: Allow custom documentation URLs on credentials & nodes --- packages/editor-ui/src/components/CredentialsEdit.vue | 8 ++++++-- packages/editor-ui/src/components/DataDisplay.vue | 11 +++++++++-- packages/workflow/src/Interfaces.ts | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/editor-ui/src/components/CredentialsEdit.vue b/packages/editor-ui/src/components/CredentialsEdit.vue index 49e3a12acda..6d01db51ac4 100644 --- a/packages/editor-ui/src/components/CredentialsEdit.vue +++ b/packages/editor-ui/src/components/CredentialsEdit.vue @@ -20,7 +20,7 @@ - Need help? Open credential docs + Need help? Open credential docs @@ -119,7 +119,11 @@ export default mixins( const credentialType = this.$store.getters.credentialType(credentialTypeName); if (credentialType.documentationUrl !== undefined) { - return `${credentialType.documentationUrl}`; + if (credentialType.documentationUrl.startsWith('http')) { + return credentialType.documentationUrl; + } else { + return 'https://docs.n8n.io/credentials/' + credentialType.documentationUrl + '/?utm_source=n8n_app&utm_medium=left_nav_menu&utm_campaign=create_new_credentials_modal'; + } } return undefined; }, diff --git a/packages/editor-ui/src/components/DataDisplay.vue b/packages/editor-ui/src/components/DataDisplay.vue index 6eb2b90ea36..58a7849e046 100644 --- a/packages/editor-ui/src/components/DataDisplay.vue +++ b/packages/editor-ui/src/components/DataDisplay.vue @@ -9,7 +9,7 @@
-
@@ -65,6 +65,13 @@ export default Vue.extend({ }; }, computed: { + documentationUrl (): string { + if (this.nodeType.documentationUrl && this.nodeType.documentationUrl.startsWith('http')) { + return this.nodeType.documentationUrl; + } + + return 'https://docs.n8n.io/nodes/' + (this.nodeType.documentationUrl || this.nodeType.name) + '?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=' + this.nodeType.name; + }, node (): INodeUi { return this.$store.getters.activeNode; }, diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index c6e42e0d280..492810cf2c9 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -536,6 +536,7 @@ export interface INodeTypeDescription { version: number; description: string; defaults: INodeParameters; + documentationUrl?: string; inputs: string[]; inputNames?: string[]; outputs: string[];