diff --git a/apps/dashboard/src/components/workflow-editor/workflow-editor-provider.tsx b/apps/dashboard/src/components/workflow-editor/workflow-editor-provider.tsx index 2d344861455..943e3a4ab79 100644 --- a/apps/dashboard/src/components/workflow-editor/workflow-editor-provider.tsx +++ b/apps/dashboard/src/components/workflow-editor/workflow-editor-provider.tsx @@ -37,6 +37,23 @@ const createStep = (type: StepTypeEnum): Step => ({ _id: crypto.randomUUID(), }); +const For = ({ items, renderItem }: { items: any[]; renderItem: (item: any) => ReactNode }) => { + return <>{items.map(renderItem)}; +}; + +const Liquid = ({ template, data }: { template: string; data: any }) => { + const compiledTemplate = compileTemplate(template); + return <>{compiledTemplate(data)}; +}; + +const compileTemplate = (template: string) => { + // Implement the logic to compile the Liquid template + return (data: any) => { + // Implement the logic to render the compiled template with data + return template; + }; +}; + export const WorkflowEditorProvider = ({ children }: { children: ReactNode }) => { const changesSavedToastIdRef = useRef(); const { currentEnvironment } = useEnvironment(); @@ -125,6 +142,8 @@ export const WorkflowEditorProvider = ({ children }: { children: ReactNode }) => const value = useMemo( () => ({ addStep, + For, + Liquid, }), [addStep] ); diff --git a/apps/dashboard/src/components/workflow-editor/workflow-editor.tsx b/apps/dashboard/src/components/workflow-editor/workflow-editor.tsx index df77c2e3e77..87055ae5bec 100644 --- a/apps/dashboard/src/components/workflow-editor/workflow-editor.tsx +++ b/apps/dashboard/src/components/workflow-editor/workflow-editor.tsx @@ -39,10 +39,34 @@ export const WorkflowEditor = () => { Trigger + + + Advanced + + {steps && } + +
+

Advanced Data Manipulation

+

Use the helper components to manipulate data:

+
    +
  • + For: Loop through items and render them. +
  • +
  • + Liquid: Use Liquid templates to render dynamic content. +
  • +
+
+
); diff --git a/apps/dashboard/src/components/workflow-list.tsx b/apps/dashboard/src/components/workflow-list.tsx index 74319a3a6c7..54dcd54a55d 100644 --- a/apps/dashboard/src/components/workflow-list.tsx +++ b/apps/dashboard/src/components/workflow-list.tsx @@ -124,6 +124,7 @@ export const WorkflowList = () => { Steps Tags Last updated + Advanced Data @@ -148,6 +149,9 @@ export const WorkflowList = () => { + + + @@ -202,6 +206,9 @@ export const WorkflowList = () => { day: 'numeric', })} + + {workflow.advancedData || 'N/A'} + @@ -247,7 +254,7 @@ export const WorkflowList = () => { {workflowsQuery.data && limit < workflowsQuery.data.totalCount && ( - +
{workflowsQuery.data ? ( diff --git a/apps/dashboard/src/pages/edit-workflow.tsx b/apps/dashboard/src/pages/edit-workflow.tsx index 61ea915e0ed..374297ac2e8 100644 --- a/apps/dashboard/src/pages/edit-workflow.tsx +++ b/apps/dashboard/src/pages/edit-workflow.tsx @@ -6,7 +6,7 @@ import { Toaster } from '@/components/primitives/sonner'; import { AnimatedOutlet } from '@/components/animated-outlet'; const asideClassName = - 'text-foreground-950 flex h-full w-[300px] max-w-[350px] flex-col border-l pb-5 pt-3.5 [&_input]:text-xs [&_input]:text-neutral-600 [&_label]:text-xs [&_label]:font-medium [&_textarea]:text-xs [&_textarea]:text-neutral-600'; + 'text-foreground-950 flex h-full w-[300px] max-w-[350px] flex-col border-l pb-5 pt-3.5 [&_input]:text-xs [&_input]:text-neutral-600 [&_label]:text-xs [&_label]:font-medium [&_textarea]:text-xs [&_textarea]:text-neutral-600 [&_advanced-data]:text-xs [&_advanced-data]:text-neutral-600'; export const EditWorkflowPage = () => { return (