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