From 9b8f124e018167a5b2a45a4dfd0913e6929b3345 Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Wed, 29 Jan 2025 20:52:21 -0800 Subject: [PATCH] Added block enable/disable state --- app/w/components/control-bar/control-bar.tsx | 29 +++++++--- .../components/action-bar/action-bar.tsx | 55 ++++++++++++++++--- stores/workflow/types.ts | 2 + stores/workflow/workflow-store.ts | 18 ++++++ 4 files changed, 86 insertions(+), 18 deletions(-) diff --git a/app/w/components/control-bar/control-bar.tsx b/app/w/components/control-bar/control-bar.tsx index 91ecc14c40..3ada77baec 100644 --- a/app/w/components/control-bar/control-bar.tsx +++ b/app/w/components/control-bar/control-bar.tsx @@ -17,6 +17,11 @@ import { useEffect, useState } from 'react' import { useWorkflowExecution } from '../../hooks/use-workflow-execution' import { useWorkflowRegistry } from '@/stores/workflow/workflow-registry' import { useRouter } from 'next/navigation' +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip' export function ControlBar() { const { notifications, getWorkflowNotifications } = useNotificationStore() @@ -70,15 +75,21 @@ export function ControlBar() { {/* Right Section - Actions */}
- + + + + + Delete Workflow + diff --git a/app/w/components/workflow-block/components/action-bar/action-bar.tsx b/app/w/components/workflow-block/components/action-bar/action-bar.tsx index b79269d08c..8422cba5b4 100644 --- a/app/w/components/workflow-block/components/action-bar/action-bar.tsx +++ b/app/w/components/workflow-block/components/action-bar/action-bar.tsx @@ -1,6 +1,11 @@ import { Button } from '@/components/ui/button' -import { Trash2, Play, Pause, RotateCcw } from 'lucide-react' +import { Trash2, Play, Circle, CircleOff } from 'lucide-react' import { useWorkflowStore } from '@/stores/workflow/workflow-store' +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip' interface ActionBarProps { blockId: string @@ -8,17 +13,49 @@ interface ActionBarProps { export function ActionBar({ blockId }: ActionBarProps) { const removeBlock = useWorkflowStore((state) => state.removeBlock) + const toggleBlockEnabled = useWorkflowStore( + (state) => state.toggleBlockEnabled + ) + const isEnabled = useWorkflowStore( + (state) => state.blocks[blockId]?.enabled ?? true + ) return (
- + + + + + Delete Block + + + + + + + + {isEnabled ? 'Disable Block' : 'Enable Block'} + + +