-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(nodes-base): fix and harmonize all primaryDocumentation links #4191
Changes from all commits
456e374
49c0068
860ff46
d8144cb
63b8b32
a6197c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,8 +100,8 @@ import OauthButton from './OauthButton.vue'; | |
import { restApi } from '@/components/mixins/restApi'; | ||
import { addCredentialTranslation } from '@/plugins/i18n'; | ||
import mixins from 'vue-typed-mixins'; | ||
import {EnterpriseEditionFeature} from '@/constants'; | ||
import {IPermissions} from "@/permissions"; | ||
import { BUILTIN_CREDENTIALS_DOCS_URL, EnterpriseEditionFeature } from '@/constants'; | ||
import { IPermissions } from "@/permissions"; | ||
|
||
export default mixins(restApi).extend({ | ||
name: 'CredentialConfig', | ||
|
@@ -206,9 +206,9 @@ export default mixins(restApi).extend({ | |
return type.documentationUrl; | ||
} | ||
|
||
return isCommunityNode ? | ||
return isCommunityNode ? | ||
'' : // Don't show documentation link for community nodes if the URL is not an absolute path | ||
`https://docs.n8n.io/credentials/${type.documentationUrl}/?utm_source=n8n_app&utm_medium=left_nav_menu&utm_campaign=create_new_credentials_modal`; | ||
`${BUILTIN_CREDENTIALS_DOCS_URL}${type.documentationUrl}/?utm_source=n8n_app&utm_medium=left_nav_menu&utm_campaign=create_new_credentials_modal`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parametrized the credential link URL prefix. |
||
}, | ||
isGoogleOAuthType(): boolean { | ||
return this.credentialTypeName === 'googleOAuth2Api' || this.parentTypes.includes('googleOAuth2Api'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
<template> | ||
<n8n-tabs | ||
:options="options" | ||
:value="value" | ||
@input="onTabSelect" | ||
@tooltipClick="onTooltipClick" | ||
/> | ||
<n8n-tabs :options="options" :value="value" @input="onTabSelect" @tooltipClick="onTooltipClick" /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { externalHooks } from '@/components/mixins/externalHooks'; | ||
import { COMMUNITY_NODES_INSTALLATION_DOCS_URL, NPM_PACKAGE_DOCS_BASE_URL } from '@/constants'; | ||
import { BUILTIN_NODES_DOCS_URL, COMMUNITY_NODES_INSTALLATION_DOCS_URL, NPM_PACKAGE_DOCS_BASE_URL } from '@/constants'; | ||
import { INodeUi, ITab } from '@/Interface'; | ||
import { INodeTypeDescription } from 'n8n-workflow'; | ||
|
||
|
@@ -45,11 +40,21 @@ export default mixins( | |
return nodeType.documentationUrl; | ||
} | ||
|
||
if (nodeType.documentationUrl || (nodeType.name && nodeType.name.startsWith('n8n-nodes-base'))) { | ||
return 'https://docs.n8n.io/nodes/' + (nodeType.documentationUrl || nodeType.name) + '?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=' + nodeType.name; | ||
const utmTags = '?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link' + | ||
'&utm_campaign=' + nodeType.name; | ||
|
||
// Built-in node documentation available via its codex entry | ||
const primaryDocUrl = nodeType.codex?.resources?.primaryDocumentation?.[0]?.url; | ||
if (primaryDocUrl) { | ||
return primaryDocUrl + utmTags; | ||
} | ||
Comment on lines
+46
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All our built-in nodes (with the exception of the StickyNote, I think) have a primary documentation link defined in their descriptor, so let's use that directly where it applies. |
||
|
||
if (this.isCommunityNode) { | ||
return `${NPM_PACKAGE_DOCS_BASE_URL}${nodeType.name.split('.')[0]}`; | ||
} | ||
|
||
return this.isCommunityNode ? `${NPM_PACKAGE_DOCS_BASE_URL}${nodeType.name.split('.')[0]}` : ''; | ||
// Fallback to the root of the node documentation | ||
return BUILTIN_NODES_DOCS_URL + utmTags; | ||
}, | ||
isCommunityNode(): boolean { | ||
const nodeType = this.nodeType as INodeTypeDescription | null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking is that in the long run the only maintainable way is to get the doc links directly from the node descriptor (codex). I now exposed
resources.primaryDocumentation
andresources.credentialDescription
so that the UI can access and use those, instead of having to generate the URLs dynamically from parts.