Sha256: b9c2c1002f7eadfaa0432a21799d869dd01c52c903e9fb14ea4d8d3d0a7918d1
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { Alert, AlertActionLink } from '@patternfly/react-core'; import { translate as __, sprintf } from 'foremanReact/common/I18n'; const SelectAllAlert = ({ selectedIds, itemCount, showSelectAllAlert, selectAll, clearAllSelection, isAllSelected, }) => { if (!showSelectAllAlert) return null; const selectedCount = Object.keys(selectedIds).length; if (!selectedCount) return null; if (!isAllSelected && selectedCount !== itemCount) { return ( <Alert isInline variant="info" title={sprintf( 'All %s recommendations on this page are selected.', selectedCount )} actionLinks={ <AlertActionLink onClick={selectAll}> {sprintf('Select all %s recommendations', itemCount)} </AlertActionLink> } /> ); } return ( <Alert isInline variant="info" title={sprintf('All %s recommendations are selected.', itemCount)} actionLinks={ <AlertActionLink onClick={clearAllSelection}> {__('Clear Selection')} </AlertActionLink> } /> ); }; SelectAllAlert.propTypes = { selectedIds: PropTypes.object, itemCount: PropTypes.number, showSelectAllAlert: PropTypes.bool, selectAll: PropTypes.func.isRequired, clearAllSelection: PropTypes.func.isRequired, isAllSelected: PropTypes.bool, }; SelectAllAlert.defaultProps = { selectedIds: {}, itemCount: 0, showSelectAllAlert: false, isAllSelected: false, }; export default SelectAllAlert;
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_rh_cloud-3.0.16 | webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js |
foreman_rh_cloud-3.0.15 | webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js |