@@ -7,13 +7,11 @@ import {
77 DropdownMenu ,
88 DropdownMenuContent ,
99 DropdownMenuItem ,
10- DropdownMenuSeparator ,
1110 DropdownMenuTrigger ,
1211} from '@/components/ui/dropdown-menu'
1312import { Tooltip , TooltipContent , TooltipTrigger } from '@/components/ui/tooltip'
1413import { createLogger } from '@/lib/logs/console-logger'
1514import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
16- import { useWorkflowStore } from '@/stores/workflows/workflow/store'
1715import { useWorkflowYamlStore } from '@/stores/workflows/yaml/store'
1816
1917const logger = createLogger ( 'ExportControls' )
@@ -24,7 +22,6 @@ interface ExportControlsProps {
2422
2523export function ExportControls ( { disabled = false } : ExportControlsProps ) {
2624 const [ isExporting , setIsExporting ] = useState ( false )
27- const workflowState = useWorkflowStore ( )
2825 const { workflows, activeWorkflowId } = useWorkflowRegistry ( )
2926 const getYaml = useWorkflowYamlStore ( ( state ) => state . getYaml )
3027
@@ -46,43 +43,6 @@ export function ExportControls({ disabled = false }: ExportControlsProps) {
4643 }
4744 }
4845
49- const handleExportJson = async ( ) => {
50- if ( ! currentWorkflow || ! activeWorkflowId ) {
51- logger . warn ( 'No active workflow to export' )
52- return
53- }
54-
55- setIsExporting ( true )
56- try {
57- const exportData = {
58- workflow : {
59- id : activeWorkflowId ,
60- name : currentWorkflow . name ,
61- description : currentWorkflow . description ,
62- color : currentWorkflow . color ,
63- } ,
64- state : {
65- blocks : workflowState . blocks ,
66- edges : workflowState . edges ,
67- loops : workflowState . loops ,
68- parallels : workflowState . parallels ,
69- } ,
70- exportedAt : new Date ( ) . toISOString ( ) ,
71- version : '1.0' ,
72- }
73-
74- const jsonContent = JSON . stringify ( exportData , null , 2 )
75- const filename = `${ currentWorkflow . name . replace ( / [ ^ a - z 0 - 9 ] / gi, '_' ) } _workflow.json`
76-
77- downloadFile ( jsonContent , filename , 'application/json' )
78- logger . info ( 'Workflow exported as JSON' )
79- } catch ( error ) {
80- logger . error ( 'Failed to export workflow as JSON:' , error )
81- } finally {
82- setIsExporting ( false )
83- }
84- }
85-
8646 const handleExportYaml = async ( ) => {
8747 if ( ! currentWorkflow || ! activeWorkflowId ) {
8848 logger . warn ( 'No active workflow to export' )
@@ -129,20 +89,6 @@ export function ExportControls({ disabled = false }: ExportControlsProps) {
12989 </ Tooltip >
13090
13191 < DropdownMenuContent align = 'end' className = 'w-48' >
132- < DropdownMenuItem
133- onClick = { handleExportJson }
134- disabled = { isExporting || ! currentWorkflow }
135- className = 'flex cursor-pointer items-center gap-2'
136- >
137- < FileText className = 'h-4 w-4' />
138- < div className = 'flex flex-col' >
139- < span > Export as JSON</ span >
140- < span className = 'text-muted-foreground text-xs' > Full workflow data</ span >
141- </ div >
142- </ DropdownMenuItem >
143-
144- < DropdownMenuSeparator />
145-
14692 < DropdownMenuItem
14793 onClick = { handleExportYaml }
14894 disabled = { isExporting || ! currentWorkflow }
@@ -151,7 +97,7 @@ export function ExportControls({ disabled = false }: ExportControlsProps) {
15197 < FileText className = 'h-4 w-4' />
15298 < div className = 'flex flex-col' >
15399 < span > Export as YAML</ span >
154- < span className = 'text-muted-foreground text-xs' > Condensed workflow language</ span >
100+ < span className = 'text-muted-foreground text-xs' > workflow language</ span >
155101 </ div >
156102 </ DropdownMenuItem >
157103 </ DropdownMenuContent >
0 commit comments