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;
redirectText?: string;
};
export interface ITab {
value: string | number;
label?: string;
href?: string,
icon?: string;
align?: 'right';
};

View file

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