fix(nodes-base): fix and harmonize all primaryDocumentation links (#4191)

* fix(nodes-base): fix and harmonize all primaryDocumentation links

* feat(workflow, cli): expose documentation links to UI via node codex

* fix(editor-ui): link to correct node and credential documentation URLs

* config(nodes-base): update 'format' script to also format node descriptor json

* chore: fix outdated links to node reference documentation
This commit is contained in:
Mike Arvela
2022-09-29 13:33:16 +03:00
committed by GitHub
parent 23bd71b82a
commit 6e8e4f5937
390 changed files with 1384 additions and 2496 deletions

View File

@@ -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;
}
return this.isCommunityNode ? `${NPM_PACKAGE_DOCS_BASE_URL}${nodeType.name.split('.')[0]}` : '';
if (this.isCommunityNode) {
return `${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;