feat(editor): Use website as the main templates repository (#8591)

This commit is contained in:
Milorad FIlipović
2024-02-09 13:47:43 +01:00
committed by GitHub
parent 5ab34fe335
commit 79b09fdf84
12 changed files with 281 additions and 154 deletions

View File

@@ -118,6 +118,7 @@ import { useUIStore } from '@/stores/ui.store';
import { useUsersStore } from '@/stores/users.store';
import { useVersionsStore } from '@/stores/versions.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useTemplatesStore } from '@/stores/templates.store';
import ExecutionsUsage from '@/components/ExecutionsUsage.vue';
import BecomeTemplateCreatorCta from '@/components/BecomeTemplateCreatorCta/BecomeTemplateCreatorCta.vue';
import MainSidebarSourceControl from '@/components/MainSidebarSourceControl.vue';
@@ -162,6 +163,7 @@ export default defineComponent({
useCloudPlanStore,
useSourceControlStore,
useBecomeTemplateCreatorStore,
useTemplatesStore,
),
logoPath(): string {
if (this.isCollapsed) return this.basePath + 'n8n-logo-collapsed.svg';
@@ -225,13 +227,28 @@ export default defineComponent({
const regularItems: IMenuItem[] = [
workflows,
{
// Link to in-app templates, available if custom templates are enabled
id: 'templates',
icon: 'box-open',
label: this.$locale.baseText('mainSidebar.templates'),
position: 'top',
available: this.settingsStore.isTemplatesEnabled,
available:
this.settingsStore.isTemplatesEnabled && this.templatesStore.hasCustomTemplatesHost,
route: { to: { name: VIEWS.TEMPLATES } },
},
{
// Link to website templates, available if custom templates are not enabled
id: 'templates',
icon: 'box-open',
label: this.$locale.baseText('mainSidebar.templates'),
position: 'top',
available:
this.settingsStore.isTemplatesEnabled && !this.templatesStore.hasCustomTemplatesHost,
link: {
href: this.templatesStore.getWebsiteTemplateRepositoryURL,
target: '_blank',
},
},
{
id: 'credentials',
icon: 'key',

View File

@@ -58,6 +58,7 @@ import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import type { SimplifiedNodeType } from '@/Interface';
import type { INodeTypeDescription } from 'n8n-workflow';
import { NodeConnectionType } from 'n8n-workflow';
import { useTemplatesStore } from '@/stores/templates.store';
export interface NodeViewItemSection {
key: string;
@@ -116,6 +117,7 @@ function getAiNodesBySubcategory(nodes: INodeTypeDescription[], subcategory: str
export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
const i18n = useI18n();
const nodeTypesStore = useNodeTypesStore();
const templatesStore = useTemplatesStore();
const chainNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_CHAINS);
const agentNodes = getAiNodesBySubcategory(nodeTypesStore.allLatestNodeTypes, AI_CATEGORY_AGENTS);
@@ -124,7 +126,9 @@ export function AIView(_nodes: SimplifiedNodeType[]): NodeView {
value: AI_NODE_CREATOR_VIEW,
title: i18n.baseText('nodeCreator.aiPanel.aiNodes'),
subtitle: i18n.baseText('nodeCreator.aiPanel.selectAiNode'),
info: i18n.baseText('nodeCreator.aiPanel.infoBox'),
info: i18n.baseText('nodeCreator.aiPanel.infoBox', {
interpolate: { link: templatesStore.getWebsiteCategoryURL('ai') },
}),
items: [
...chainNodes,
...agentNodes,