import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import URI from 'urijs'; import { List, ListItem, Modal, Button } from '@patternfly/react-core'; import { translate as __, sprintf } from 'foremanReact/common/I18n'; import { useForemanHostsPageUrl, useForemanHostDetailsPageUrl, } from 'foremanReact/Root/Context/ForemanContext'; import { selectHosts, selectHostCount } from '../../JobWizardSelectors'; import { HOSTS_TO_PREVIEW_AMOUNT } from '../../JobWizardConstants'; export const HostPreviewModal = ({ isOpen, setIsOpen, searchQuery }) => { const hosts = useSelector(selectHosts); const hostsCount = useSelector(selectHostCount); const hostsUrl = new URI(useForemanHostsPageUrl()); const hostUrl = useForemanHostDetailsPageUrl(); return ( setIsOpen(false)} appendTo={() => document.getElementsByClassName('job-wizard')[0]} > {hosts.map(host => ( ))} {hostsCount > HOSTS_TO_PREVIEW_AMOUNT && ( )} ); }; HostPreviewModal.propTypes = { isOpen: PropTypes.bool.isRequired, setIsOpen: PropTypes.func.isRequired, searchQuery: PropTypes.string.isRequired, }; HostPreviewModal.defaultPropTypes = { searchQuery: '', };