Sha256: 5558de627c190b8b7976c0eba2f746d17c8d0a369e1a5601a86cf1fa2dd566ee
Contents?: true
Size: 1.51 KB
Versions: 5
Compression:
Stored size: 1.51 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks'; 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, }); const { setModalOpen: setEditModalOpen } = useForemanModal({ id: WEBHOOK_EDIT_MODAL_ID, }); 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 onEditClick={onEditClick} onTestClick={onTestClick} webhookActions={webhookActions} {...rest} /> ); }; WrappedWebhooksTable.propTypes = { setToDelete: PropTypes.func.isRequired, setToEdit: PropTypes.func.isRequired, setToTest: PropTypes.func.isRequired, }; export default WrappedWebhooksTable;
Version data entries
5 entries across 5 versions & 1 rubygems