webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js in foreman_webhooks-3.1.1 vs webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js in foreman_webhooks-3.2.0

- old
+ new

@@ -5,10 +5,11 @@ import WebhooksTable from './WebhooksTable'; import { WEBHOOK_DELETE_MODAL_ID, WEBHOOK_EDIT_MODAL_ID, + WEBHOOK_TEST_MODAL_ID, } from '../../../constants'; const WrappedWebhooksTable = props => { const { setModalOpen: setDeleteModalOpen } = useForemanModal({ id: WEBHOOK_DELETE_MODAL_ID, @@ -16,32 +17,52 @@ const { setModalOpen: setEditModalOpen } = useForemanModal({ id: WEBHOOK_EDIT_MODAL_ID, }); - const { setToDelete, setToEdit, ...rest } = props; + const { setModalOpen: setTestModalOpen } = useForemanModal({ + id: WEBHOOK_TEST_MODAL_ID, + }); + const { setToDelete, setToEdit, setToTest, ...rest } = props; + const onDeleteClick = rowData => { setToDelete(rowData); setDeleteModalOpen(); }; const onEditClick = rowData => { setToEdit(rowData); setEditModalOpen(); }; + const onTestClick = rowData => { + setToTest(rowData); + setTestModalOpen(); + }; + + const webhookActions = { + deleteWebhook: (id, name) => { + onDeleteClick({ id, name }); + }, + testWebhook: (id, name) => { + onTestClick({ id, name }); + }, + }; + return ( <WebhooksTable - onDeleteClick={onDeleteClick} onEditClick={onEditClick} + onTestClick={onTestClick} + webhookActions={webhookActions} {...rest} /> ); }; WrappedWebhooksTable.propTypes = { setToDelete: PropTypes.func.isRequired, setToEdit: PropTypes.func.isRequired, + setToTest: PropTypes.func.isRequired, }; export default WrappedWebhooksTable;