feat(templates): migrate cloud template dialog to hub list/detail API

Replace static index.json template loading on cloud with the hub
workflows API (GET /api/hub/workflows for listing, GET
/api/hub/workflows/{share_id} for workflow JSON).

- Add listHubWorkflows, listAllHubWorkflows, getHubWorkflowDetail to api.ts
- Create adapter to convert HubWorkflowSummary to TemplateInfo
- Branch on isCloud in workflowTemplatesStore.fetchCoreTemplates()
- Update thumbnail URL resolution for absolute hub URLs
- Update workflow JSON loading to use detail API via shareId
- Add shareId-based fallback in URL template loader
This commit is contained in:
dante01yoon
2026-03-28 21:51:42 +09:00
parent 4c59a5e424
commit 654167c980
11 changed files with 395 additions and 2 deletions

View File

@@ -2,9 +2,11 @@ import { useToast } from 'primevue/usetoast'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import { isCloud } from '@/platform/distribution/types'
import { clearPreservedQuery } from '@/platform/navigation/preservedQueryManager'
import { PRESERVED_QUERY_NAMESPACES } from '@/platform/navigation/preservedQueryNamespaces'
import { useTelemetry } from '@/platform/telemetry'
import { useWorkflowTemplatesStore } from '@/platform/workflow/templates/repositories/workflowTemplatesStore'
// eslint-disable-next-line import-x/no-restricted-paths
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
@@ -108,11 +110,23 @@ export function useTemplateUrlLoader() {
try {
await templateWorkflows.loadTemplates()
const success = await templateWorkflows.loadWorkflowTemplate(
let success = await templateWorkflows.loadWorkflowTemplate(
templateParam,
sourceParam
)
// On cloud, if name-based lookup fails, try by shareId (hub templates)
if (!success && isCloud) {
const store = useWorkflowTemplatesStore()
const templateByShareId = store.getTemplateByShareId(templateParam)
if (templateByShareId) {
success = await templateWorkflows.loadWorkflowTemplate(
templateByShareId.name,
templateByShareId.sourceModule
)
}
}
if (!success) {
toast.add({
severity: 'error',