fix docs in custom nodes

This commit is contained in:
Mutasem 2022-03-30 08:03:18 +02:00
parent c951ecec25
commit 0d88d9d061
2 changed files with 34 additions and 15 deletions

View file

@ -958,3 +958,11 @@ export type IFormBoxConfig = {
redirectLink?: string; redirectLink?: string;
redirectText?: string; redirectText?: string;
}; };
export interface ITab {
value: string | number;
label?: string;
href?: string,
icon?: string;
align?: 'right';
};

View file

@ -1,20 +1,6 @@
<template> <template>
<n8n-tabs <n8n-tabs
:options="[ :options="options"
{
label: $locale.baseText('nodeSettings.parameters'),
value: 'params'
},
{
label: $locale.baseText('nodeSettings.docs'),
value: 'docs',
href: documentationUrl,
},
{
icon: 'cog',
value: 'settings',
align: 'right',
}]"
:value="value" :value="value"
@input="onTabSelect" @input="onTabSelect"
/> />
@ -22,6 +8,7 @@
<script lang="ts"> <script lang="ts">
import { externalHooks } from '@/components/mixins/externalHooks'; import { externalHooks } from '@/components/mixins/externalHooks';
import { ITab } from '@/Interface';
import { INodeTypeDescription } from 'n8n-workflow'; import { INodeTypeDescription } from 'n8n-workflow';
import mixins from 'vue-typed-mixins'; import mixins from 'vue-typed-mixins';
@ -54,6 +41,30 @@ export default mixins(
return ''; return '';
}, },
options (): ITab[] {
const options: ITab[] = [
{
label: this.$locale.baseText('nodeSettings.parameters'),
value: 'params',
},
];
if (this.documentationUrl) {
options.push({
label: this.$locale.baseText('nodeSettings.docs'),
value: 'docs',
href: this.documentationUrl,
});
}
options.push(
{
icon: 'cog',
value: 'settings',
align: 'right',
},
);
return options;
},
}, },
methods: { methods: {
onTabSelect(tab: string) { onTabSelect(tab: string) {