Sha256: 070ec3028c261f380e4eb1bfa80b548f3115a6031b99cc230ce43eba1c0fa7a5

Contents?: true

Size: 1.41 KB

Versions: 22

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

22 entries across 22 versions & 1 rubygems

Version Path
foreman_rh_cloud-3.0.33 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.32 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.29 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.28 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.26 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.25 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.24.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.24.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.24 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.24 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.23 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.23 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.22 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.22 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.21.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.21.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.21 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.20 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.19 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-3.0.18.1 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js