Sha256: 54aa2624ecc7d9d33f7cc825d8010b1ec357e4cc012551cdd77079135ab17740
Contents?: true
Size: 1.46 KB
Versions: 40
Compression:
Stored size: 1.46 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Spinner, Button } from '@patternfly/react-core'; import { ExclamationTriangleIcon, RedoIcon } from '@patternfly/react-icons'; import { STATUS } from 'foremanReact/constants'; import SyncModal from './components/Modal'; import { SYNC_BUTTON_TEXT } from '../../../../ForemanInventoryConstants'; class SyncButton extends React.Component { state = { showModal: false, }; toggleModal = () => { this.setState({ showModal: !this.state.showModal }); }; render() { const { cloudToken, handleSync, status } = this.props; const handleClick = !cloudToken ? this.toggleModal : handleSync; return ( <React.Fragment> <SyncModal show={this.state.showModal} toggleModal={this.toggleModal} /> <Button className="sync_button" onClick={handleClick} size="lg" isDisabled={status === STATUS.PENDING} variant="secondary" > {!cloudToken && ( <span> <ExclamationTriangleIcon />{' '} </span> )} {status === STATUS.PENDING ? <Spinner size="sm" /> : <RedoIcon />} {SYNC_BUTTON_TEXT} </Button> </React.Fragment> ); } } SyncButton.propTypes = { cloudToken: PropTypes.bool, handleSync: PropTypes.func.isRequired, status: PropTypes.string, }; SyncButton.defaultProps = { cloudToken: false, status: null, }; export default SyncButton;
Version data entries
40 entries across 40 versions & 1 rubygems