Sha256: 1c6a294b6c5f6e46c94294b2fd62dd385a6b9e4c197e905adf37da8cb4721aa0

Contents?: true

Size: 1.41 KB

Versions: 60

Compression:

Stored size: 1.41 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,
  showSelectAllAlert,
  selectAll,
  clearAllSelection,
  isAllSelected,
}) => {
  if (!showSelectAllAlert) return null;
  const selectedCount = Object.keys(selectedIds).length;
  if (!selectedCount) return null;
  if (!isAllSelected) {
    return (
      <Alert
        isInline
        variant="info"
        title={sprintf(__('Recommendations selected: %s.'), selectedCount)}
        actionLinks={
          <AlertActionLink onClick={selectAll}>
            {__('Select recommendations from all pages')}
          </AlertActionLink>
        }
      />
    );
  }

  return (
    <Alert
      isInline
      variant="info"
      title={__('All recommendations are now selected.')}
      actionLinks={
        <AlertActionLink onClick={clearAllSelection}>
          {__('Clear Selection')}
        </AlertActionLink>
      }
    />
  );
};

SelectAllAlert.propTypes = {
  selectedIds: PropTypes.object,
  showSelectAllAlert: PropTypes.bool,
  selectAll: PropTypes.func.isRequired,
  clearAllSelection: PropTypes.func.isRequired,
  isAllSelected: PropTypes.bool,
};

SelectAllAlert.defaultProps = {
  selectedIds: {},
  showSelectAllAlert: false,
  isAllSelected: false,
};

export default SelectAllAlert;

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.0.3 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.59 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-11.0.2 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-11.0.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-11.0.0 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.58 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-10.0.2 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.57 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-10.0.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.56 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.55 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.54 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.53 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.52 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-8.0.52 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-9.0.51 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-8.0.51 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-7.0.48 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-7.0.47 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-8.0.50 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js