()
| 100 | }, [value]) |
| 101 | |
| 102 | const handleExecute = async () => { |
| 103 | if (!value || executing) return |
| 104 | setExecuting(true) |
| 105 | const runner = refsStatic.get('batch-op-runner') |
| 106 | runner?.reset() |
| 107 | refsStatic.get('batch-op-logs')?.setLogs({ steps: [], currentIndex: 0, status: 'running' }) |
| 108 | try { |
| 109 | let workflows |
| 110 | try { |
| 111 | workflows = JSON.parse(value) |
| 112 | if (!Array.isArray(workflows)) throw new Error('Workflow must be an array') |
| 113 | } catch (e) { |
| 114 | message.error('Invalid workflow JSON: ' + e.message) |
| 115 | refsStatic.get('batch-op-logs')?.reset() |
| 116 | return |
| 117 | } |
| 118 | await runner.executeWorkflow(workflows) |
| 119 | message.success('Workflow execution completed') |
| 120 | } catch (err) { |
| 121 | if (err.message !== 'Workflow aborted') { |
| 122 | message.error('Workflow execution failed: ' + err.message) |
| 123 | } |
| 124 | } finally { |
| 125 | setExecuting(false) |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | const handleTemplate = useCallback(() => { |
| 130 | setValue(workflowExample) |
nothing calls this directly
no test coverage detected