From 6a48f4f2346afa2d661212761e236dba5096908a Mon Sep 17 00:00:00 2001 From: THIS ONE IS A LITTLE BIT TRICKY KRUB Date: Fri, 25 Apr 2025 18:39:42 +0700 Subject: [PATCH] feat: add PipelineSummary component and integrate it into the multi-step form for enhanced overview of pipeline configuration --- .../create/create-pipeline-multiform.tsx | 14 +-- frontend/components/pipeline/details.tsx | 13 +- frontend/components/pipeline/summary.tsx | 118 ++++++++++++++++++ 3 files changed, 133 insertions(+), 12 deletions(-) create mode 100644 frontend/components/pipeline/summary.tsx diff --git a/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx b/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx index ded062e..eade1e1 100644 --- a/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx +++ b/frontend/app/(sidebar)/data-pipeline/create/create-pipeline-multiform.tsx @@ -9,6 +9,7 @@ import { AddDataSource } from "@/components/pipeline/add-data-source"; import { PipelineAiAssistant } from "@/components/pipeline/ai-assistant"; import { PipelineDetails } from "@/components/pipeline/details"; import { ScheduleAndInformation } from "@/components/pipeline/schedule-and-information"; +import { PipelineSummary } from "@/components/pipeline/summary"; import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { Form } from "@/components/ui/form"; @@ -21,17 +22,8 @@ const stepComponents = [ , , , -
-

- No Inputs Added Yet! -

-

- Start building your form by adding input fields. -

-
, + , + , ]; const motionVariants = { diff --git a/frontend/components/pipeline/details.tsx b/frontend/components/pipeline/details.tsx index 4349fdf..b97b06f 100644 --- a/frontend/components/pipeline/details.tsx +++ b/frontend/components/pipeline/details.tsx @@ -1,3 +1,6 @@ +"use client"; + +import { useFormContext } from "react-hook-form"; import { Card, CardContent, @@ -10,6 +13,8 @@ import { Label } from "../ui/label"; import { Textarea } from "../ui/textarea"; export function PipelineDetails() { + const { register } = useFormContext(); + return ( @@ -22,7 +27,11 @@ export function PipelineDetails() {
- +
@@ -31,6 +40,7 @@ export function PipelineDetails() { id="description" placeholder="Describe what this pipeline collects and how it will be used" rows={4} + {...register("description")} />
@@ -39,6 +49,7 @@ export function PipelineDetails() {

Separate tags with commas diff --git a/frontend/components/pipeline/summary.tsx b/frontend/components/pipeline/summary.tsx new file mode 100644 index 0000000..8dbb403 --- /dev/null +++ b/frontend/components/pipeline/summary.tsx @@ -0,0 +1,118 @@ +"use client"; + +import { Badge } from "@/components/ui/badge"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { useFormContext } from "react-hook-form"; + +export const PipelineSummary = () => { + const { getValues } = useFormContext(); + const values = getValues(); + + const tags = values.tags + ? values.tags + .split(",") + .map((tag: string) => tag.trim()) // trim each tag + .filter(Boolean) // filter out empty strings + : []; + + return ( + + + Pipeline Summary + + A quick overview of the pipeline configuration. Review before + launching. + + + + {/* details */} +

+

Pipeline Details

+
+
+ Name: {values.name || "—"} +
+
+ Description: {values.description || "—"} +
+
+ Tags: +
+ {tags.length > 0 ? ( + tags.map((tag: string, index: number) => ( + + {tag} + + )) + ) : ( +
+ No tags added +
+ )} +
+
+
+
+ + {/* data sources */} +
+

Data Sources

+ {values.dataSources && values.dataSources.length > 0 ? ( +
    + {values.dataSources.map((src: string, index: number) => ( +
  • {src}
  • + ))} +
+ ) : ( +
+ No data sources added. +
+ )} +
+ + {/* AI Assistant */} +
+

AI Assistant

+
+
+ Prompt: {values.aiPrompt || "—"} +
+
+ Mode: {values.aiMode || "Default"} +
+
+
+ + {/* schedule */} +
+

Schedule

+
+
+ Frequency: {values.schedule || "—"} +
+
+ Start Date: {values.startDate || "—"} +
+
+ Timezone: {values.timezone || "—"} +
+
+
+ + {/* form Inputs */} +
+

Form Inputs

+
+ No input fields added yet. +
+
+ + + ); +};