import React, { useEffect } from 'react'; import { connect } from 'react-redux'; import cn from 'classnames'; import withPageTitle from 'HOCs/withPageTitle'; import { Button, Loader, NoContent, Icon } from 'UI'; import { init, fetchList, remove } from 'Duck/webhook'; import WebhookForm from './WebhookForm'; import ListItem from './ListItem'; import styles from './webhooks.module.css'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { confirm } from 'UI'; import { toast } from 'react-toastify'; import { useModal } from 'App/components/Modal'; function Webhooks(props) { const { webhooks, loading } = props; const { showModal, hideModal } = useModal(); const noSlackWebhooks = webhooks.filter((hook) => hook.type !== 'slack'); useEffect(() => { props.fetchList(); }, []); const init = (v) => { props.init(v); showModal(); }; const removeWebhook = async (id) => { if ( await confirm({ header: 'Confirm', confirmButton: 'Yes, delete', confirmation: `Are you sure you want to remove this webhook?`, }) ) { props.remove(id).then(() => { toast.success('Webhook removed successfully'); }); hideModal(); } }; return (

{'Webhooks'}

{/*
Leverage webhooks to push OpenReplay data to other systems.
None added yet
} size="small" show={noSlackWebhooks.size === 0} >
{noSlackWebhooks.map((webhook) => ( init(webhook)} /> ))}
); } export default connect( (state) => ({ webhooks: state.getIn(['webhooks', 'list']), loading: state.getIn(['webhooks', 'loading']), }), { init, fetchList, remove, } )(withPageTitle('Webhooks - OpenReplay Preferences')(Webhooks));