Sha256: c40d4e1b1b8f1175d9d756f0e8b285c0cf21cfddfaa4f82f531464f77d0227d5
Contents?: true
Size: 1.4 KB
Versions: 9
Compression:
Stored size: 1.4 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { isEmpty } from 'lodash'; import { Button, Popover } from '@patternfly/react-core'; import { translate as __ } from 'foremanReact/common/I18n'; import { foremanUrl } from '../../../ForemanRhCloudHelpers'; const RemediateButton = ({ isExperimentalMode, selectedIds, toggleModal }) => { const [isVisible, setVisible] = React.useState(true); const popoverContent = __( `To use this feature, please enable <a href=${foremanUrl( '/settings?search=name+%3D+lab_features' )}>Show Experimental Labs</a> in settings.` ); let button = ( <Button variant="primary" isDisabled={isEmpty(selectedIds)} onClick={() => { if (!isExperimentalMode) { setVisible(value => !value); } else { toggleModal(); } }} > {__('Remediate')} </Button> ); if (!isExperimentalMode) { button = ( <Popover isVisible={isVisible} bodyContent={ <div dangerouslySetInnerHTML={{ __html: popoverContent }} /> } > {button} </Popover> ); } return button; }; RemediateButton.propTypes = { selectedIds: PropTypes.object, isExperimentalMode: PropTypes.bool, toggleModal: PropTypes.func.isRequired, }; RemediateButton.defaultProps = { selectedIds: {}, isExperimentalMode: false, }; export default RemediateButton;
Version data entries
9 entries across 9 versions & 1 rubygems