MCPcopy
hub / github.com/electerm/electerm / handleExecute

Function handleExecute

src/client/components/batch-op/batch-op-editor.jsx:102–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 4

resetMethod · 0.80
parseMethod · 0.80
executeWorkflowMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected