Sha256: d0f07a0e8d5b702444cda9b244498580a459447587e82de68d21fc4c64246f08

Contents?: true

Size: 1.1 KB

Versions: 15

Compression:

Stored size: 1.1 KB

Contents

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

const ConfirmDialog = (props) => {
  const {
    onCancel, cancelLabel, onConfirm, confirmLabel, confirmStyle, ...otherProps
  } = props;

  const buttons = [
    <Button
      key="cancel"
      bsStyle="default"
      className="btn-cancel"
      onClick={onCancel}
    >
      {cancelLabel}
    </Button>,
    <Button
      key="confirm"
      bsStyle={confirmStyle}
      onClick={onConfirm}
    >
      {confirmLabel}
    </Button>,
  ];

  return (
    <Dialog buttons={buttons} onCancel={onCancel} {...otherProps} />
  );
};

ConfirmDialog.propTypes = {
  ...Button.propTypes,
  onConfirm: PropTypes.func.isRequired,
  confirmLabel: PropTypes.string,
  confirmStyle: PropTypes.string,
};

ConfirmDialog.defaultProps = {
  ...Button.defaultProps,
  confirmLabel: __('Save'),
  cancelLabel: __('Cancel'),
  dangerouslySetInnerHTML: undefined,
  message: undefined,
  confirmStyle: 'primary',
};

export default ConfirmDialog;

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katello-3.11.2 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.10.2 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.10.1.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.10.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.11.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.11.0 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.11.0.rc2 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.11.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.10.0 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.10.0.rc1.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.9.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.10.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.9.0 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.9.0.rc2 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.9.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js