From 612dca8b7d696a078982ab263a434efec0f60fad Mon Sep 17 00:00:00 2001 From: twwu Date: Wed, 14 May 2025 18:20:29 +0800 Subject: [PATCH] feat: add WorkflowPreview component to Details and define graph structure in PipelineTemplateByIdResponse --- .../list/template-card/details.tsx | 5 +- web/app/components/datasets/list/index.tsx | 146 ++++++++++++++++++ web/models/pipeline.ts | 8 +- 3 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 web/app/components/datasets/list/index.tsx diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx index 43d16fd336..cbe9e785e4 100644 --- a/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx @@ -7,6 +7,7 @@ import Button from '@/app/components/base/button' import { useTranslation } from 'react-i18next' import Tooltip from '@/app/components/base/tooltip' import Loading from '@/app/components/base/loading' +import WorkflowPreview from '@/app/components/workflow/workflow-preview' type DetailsProps = { id: string @@ -39,7 +40,9 @@ const Details = ({ return (
- Pipeline Preview +
+
+ )} + {activeTab === 'api' && data && } +
+ {activeTab === 'dataset' && ( + <> + + + {showTagManagementModal && ( + + )} + + )} + {activeTab === 'api' && data && } + + {showExternalApiPanel && setShowExternalApiPanel(false)} />} + + ) +} + +export default List diff --git a/web/models/pipeline.ts b/web/models/pipeline.ts index 83d073648b..3d3110cefd 100644 --- a/web/models/pipeline.ts +++ b/web/models/pipeline.ts @@ -1,8 +1,9 @@ -import type { InputVar, InputVarType } from '@/app/components/workflow/types' +import type { Edge, InputVar, InputVarType, Node } from '@/app/components/workflow/types' import type { DSLImportMode, DSLImportStatus } from './app' import type { ChunkingMode, DatasetPermission, IconInfo } from './datasets' import type { Dependency } from '@/app/components/plugins/types' import type { AppIconSelection } from '@/app/components/base/app-icon-picker' +import type { Viewport } from 'reactflow' export type PipelineTemplateListParams = { type: 'built-in' | 'customized' @@ -27,6 +28,11 @@ export type PipelineTemplateByIdResponse = { description: string author: string // todo: TBD structure: string // todo: TBD + graph: { + nodes: Node[] + edges: Edge[] + viewport: Viewport + } export_data: string }