Sha256: f7344b16b0c7631aa1fa4afa9b8b1217a2b68f69651283bbab4498208e2ad605

Contents?: true

Size: 1.39 KB

Versions: 6

Compression:

Stored size: 1.39 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
import { ActionConfirmation } from './ActionConfirmation';
import { CANCEL, RESUME, CLOSED } from '../TasksTableConstants';

export const CancelResumeConfirm = ({
  closeModal,
  modalStatus,
  action,
  selected,
  selectedRowsLen,
}) => (
  <ActionConfirmation
    showModal={modalStatus !== CLOSED}
    closeModal={closeModal}
    title={`${modalStatus === CANCEL ? __('Cancel') : __('Resume')} ${__(
      'Selected Tasks'
    )}`}
    message={sprintf(
      __(
        `This will ${
          modalStatus === CANCEL ? 'stop' : 'resume'
        } %s tasks, putting them in the ${
          modalStatus === CANCEL ? 'canceled' : 'running'
        } state.  Are you sure?`
      ),
      selectedRowsLen
    )}
    onClick={() => {
      if (modalStatus === CANCEL) {
        action(CANCEL, selected);
      } else if (modalStatus === RESUME) {
        action(RESUME, selected);
      }
      closeModal();
    }}
    confirmAction={__('Yes')}
    abortAction={__('No')}
  />
);

CancelResumeConfirm.propTypes = {
  closeModal: PropTypes.func.isRequired,
  modalStatus: PropTypes.oneOf([CANCEL, RESUME, CLOSED]).isRequired,
  selectedRowsLen: PropTypes.number.isRequired,
  action: PropTypes.func.isRequired,
  selected: PropTypes.array.isRequired,
};

export default CancelResumeConfirm;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman-tasks-0.17.6 webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js
foreman-tasks-1.0.0 webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js
foreman-tasks-0.17.5 webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js
foreman-tasks-0.17.4 webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js
foreman-tasks-0.17.3 webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js
foreman-tasks-0.17.2 webpack/ForemanTasks/Components/TasksTable/Components/CancelResumeConfirm.js