Sha256: 9e1e3e8f39a881ec65a955d9c095eec7fda3343a8d60f655267ef36d5f3f9102

Contents?: true

Size: 1.77 KB

Versions: 64

Compression:

Stored size: 1.77 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { translate as __, sprintf } from 'foremanReact/common/I18n';
import { ClickConfirmation } from '../common/ClickConfirmation';
import { UNLOCK_MODAL, FORCE_UNLOCK_MODAL } from './TaskActionsConstants';

const confirmationMessage = __(
  'I understand that this may cause harm and have working database backups of all backend services.'
);

export const UnlockModal = ({ onClick, id }) => (
  <ClickConfirmation
    id={id}
    title={__('Unlock')}
    body={__(
      "This will unlock the resources that the task is running against. Please note that this might lead to inconsistent state and should be used with caution, after making sure that the task can't be resumed."
    )}
    confirmationMessage={confirmationMessage}
    confirmAction={__('Unlock')}
    onClick={onClick}
    confirmType="warning"
  />
);

export const ForceUnlockModal = ({ onClick, id, selectedRowsLen }) => (
  <ClickConfirmation
    id={id}
    title={__('Force Unlock')}
    body={sprintf(
      __(
        `Resources for %s task(s) will be unlocked and will not prevent other tasks from being run. As the task(s) might be still running, it should be avoided to use this unless you are really sure the task(s) got stuck.`
      ),
      selectedRowsLen
    )}
    confirmationMessage={confirmationMessage}
    confirmAction={__('Force Unlock')}
    onClick={onClick}
    confirmType="danger"
  />
);

UnlockModal.propTypes = {
  onClick: PropTypes.func.isRequired,
  id: PropTypes.string,
};

ForceUnlockModal.propTypes = {
  onClick: PropTypes.func.isRequired,
  id: PropTypes.string,
  selectedRowsLen: PropTypes.number,
};

UnlockModal.defaultProps = {
  id: UNLOCK_MODAL,
};

ForceUnlockModal.defaultProps = {
  id: FORCE_UNLOCK_MODAL,
  selectedRowsLen: 1,
};

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
foreman-tasks-10.0.1 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-10.0.0 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.2.3 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.2.2 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.2.1 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.2.0 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.1.1 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.0.4 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.1.0 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.0.2 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.0.1 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.3.3 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-9.0.0 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.2.1 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.1.4 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.3.2 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.3.1 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.1.3 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.3.0 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js
foreman-tasks-8.2.0 webpack/ForemanTasks/Components/TaskActions/UnlockModals.js