Sha256: 1c6a294b6c5f6e46c94294b2fd62dd385a6b9e4c197e905adf37da8cb4721aa0

Contents?: true

Size: 1.41 KB

Versions: 62

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

62 entries across 62 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.41 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.39 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.38 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.35 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.37 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.36 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.35 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.34 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.33 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.32 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.32 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.31 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.31 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.30 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.30 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.29 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.29 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-5.0.28 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.27 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js
foreman_rh_cloud-4.0.26 webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js