Sha256: d1ff987b49c4f9d766591d992607e9df2b38068c32a6c9097fb5950b99d343df

Contents?: true

Size: 1.23 KB

Versions: 40

Compression:

Stored size: 1.23 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button } from 'patternfly-react';
import { sprintf, translate as __ } from 'foremanReact/common/I18n';

export const SelectAllAlert = ({
  itemCount,
  perPage,
  selectAllRows,
  unselectAllRows,
  allRowsSelected,
}) => {
  const selectAllText = (
    <React.Fragment>
      {sprintf(
        'All %s tasks on this page are selected',
        Math.min(itemCount, perPage)
      )}
      <Button bsStyle="link" onClick={selectAllRows}>
        {__('Select All')}
        <b> {itemCount} </b> {__('tasks.')}
      </Button>
    </React.Fragment>
  );
  const undoSelectText = (
    <React.Fragment>
      {sprintf(__(`All %s tasks are selected. `), itemCount)}
      <Button bsStyle="link" onClick={unselectAllRows}>
        {__('Undo selection')}
      </Button>
    </React.Fragment>
  );
  const selectAlertText = allRowsSelected ? undoSelectText : selectAllText;
  return <Alert type="info">{selectAlertText}</Alert>;
};

SelectAllAlert.propTypes = {
  allRowsSelected: PropTypes.bool.isRequired,
  itemCount: PropTypes.number.isRequired,
  perPage: PropTypes.number.isRequired,
  selectAllRows: PropTypes.func.isRequired,
  unselectAllRows: PropTypes.func.isRequired,
};

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
foreman-tasks-7.1.1 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-7.2.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-7.1.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-6.0.3 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-7.0.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-6.0.2 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-4.1.6 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.2.3 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-6.0.1 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.2.2 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-6.0.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.2.1 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.3.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.2.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.1.1 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-5.1.0 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-4.1.5 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-4.1.4 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-4.1.3 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js
foreman-tasks-3.0.6 webpack/ForemanTasks/Components/TasksTable/Components/SelectAllAlert.js