Sha256: 6d97f48c72cf5df059f8d0c3eca3e7c6191c04407c1ad4ac3a6ddb5ba1d4ef08
Contents?: true
Size: 1.47 KB
Versions: 10
Compression:
Stored size: 1.47 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} aria-label={__('Please enable lab features to use this button')} 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
10 entries across 10 versions & 1 rubygems