Sha256: 07be9d6caf9373da597b3024ecb7c365744ee45d7c7506c4c53683518d827e1b
Contents?: true
Size: 1.59 KB
Versions: 9
Compression:
Stored size: 1.59 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import DefaultEmptyState from 'foremanReact/components/common/EmptyState'; import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks'; import WebhookCreateModal from '../WebhookCreateModal'; import { WEBHOOK_CREATE_MODAL_ID } from '../../../constants'; const EmptyWebhooksIndexPage = ({ search, reloadWithSearch, message: { type, text }, }) => { const { setModalOpen: setCreateModalOpen, setModalClosed: setCreateModalClosed, } = useForemanModal({ id: WEBHOOK_CREATE_MODAL_ID, }); return ( <> <WebhookCreateModal onSuccess={() => { setCreateModalClosed(); reloadWithSearch(search); }} onCancel={setCreateModalClosed} /> <DefaultEmptyState icon={type === 'error' ? 'error-circle-o' : 'add-circle-o'} header={type === 'error' ? __('Error') : __('No Results')} description={text} documentation={null} action={{ title: __('Create Webhook'), onClick: () => setCreateModalOpen(), }} /> </> ); }; EmptyWebhooksIndexPage.propTypes = { message: PropTypes.shape({ type: PropTypes.oneOf(['empty', 'error']), text: PropTypes.string, }), search: PropTypes.string, reloadWithSearch: PropTypes.func.isRequired, }; EmptyWebhooksIndexPage.defaultProps = { message: { type: 'empty', text: __('Try to create a new Webhook'), }, search: '', }; export default EmptyWebhooksIndexPage;
Version data entries
9 entries across 9 versions & 1 rubygems