| 472 | } |
| 473 | |
| 474 | const removeIntegration = (integration: any, id: string) => { |
| 475 | const env = integration.flagsmithEnvironment |
| 476 | ? (ProjectStore.getEnvironment( |
| 477 | integration.flagsmithEnvironment, |
| 478 | ) as Environment | null) |
| 479 | : null |
| 480 | const name = env?.name |
| 481 | openConfirm({ |
| 482 | body: ( |
| 483 | <span> |
| 484 | This will remove your integration from the{' '} |
| 485 | {integration.flagsmithEnvironment ? 'environment ' : 'project'} |
| 486 | {name ? <strong>{name}</strong> : ''}, it will no longer receive data. |
| 487 | Are you sure? |
| 488 | </span> |
| 489 | ), |
| 490 | destructive: true, |
| 491 | onYes: () => { |
| 492 | if (organisationId) { |
| 493 | _data |
| 494 | .delete( |
| 495 | `${Project.api}organisations/${organisationId}/integrations/${id}/${integration.id}/`, |
| 496 | ) |
| 497 | .then(fetch) |
| 498 | } else if (integration.flagsmithEnvironment) { |
| 499 | _data |
| 500 | .delete( |
| 501 | `${Project.api}environments/${integration.flagsmithEnvironment}/integrations/${id}/${integration.id}/`, |
| 502 | ) |
| 503 | .then(fetch) |
| 504 | } else { |
| 505 | _data |
| 506 | .delete( |
| 507 | `${Project.api}projects/${props.projectId}/integrations/${id}/${integration.id}/`, |
| 508 | ) |
| 509 | .then(fetch) |
| 510 | } |
| 511 | }, |
| 512 | title: 'Delete integration', |
| 513 | yesText: 'Confirm', |
| 514 | }) |
| 515 | } |
| 516 | |
| 517 | const addIntegration = ( |
| 518 | integration: any, |