()
| 185 | } |
| 186 | |
| 187 | const handleDeleteFlow = async () => { |
| 188 | const confirmPayload = { |
| 189 | title: `Delete`, |
| 190 | description: `Delete ${canvasTitle} ${chatflow.name}?`, |
| 191 | confirmButtonName: 'Delete', |
| 192 | cancelButtonName: 'Cancel' |
| 193 | } |
| 194 | const isConfirmed = await confirm(confirmPayload) |
| 195 | |
| 196 | if (isConfirmed) { |
| 197 | try { |
| 198 | await chatflowsApi.deleteChatflow(chatflow.id) |
| 199 | localStorage.removeItem(`${chatflow.id}_INTERNAL`) |
| 200 | navigate('/agentflows') |
| 201 | } catch (error) { |
| 202 | enqueueSnackbar({ |
| 203 | message: typeof error.response.data === 'object' ? error.response.data.message : error.response.data, |
| 204 | options: { |
| 205 | key: new Date().getTime() + Math.random(), |
| 206 | variant: 'error', |
| 207 | persist: true, |
| 208 | action: (key) => ( |
| 209 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 210 | <IconX /> |
| 211 | </Button> |
| 212 | ) |
| 213 | } |
| 214 | }) |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | const handleSaveFlow = (chatflowName) => { |
| 220 | if (reactFlowInstance) { |
nothing calls this directly
no test coverage detected