Sha256: 48a346657caf5b03fd7605c35275c2ec598bc379e482edce8b26b044c63b9b86

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
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

10 entries across 10 versions & 1 rubygems

Version Path
katello-3.8.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.7.1.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.7.1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.8.0 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.8.0.rc3 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.8.0.rc2 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.7.0 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.8.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.7.0.rc2 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js
katello-3.7.0.rc1 webpack/move_to_foreman/components/common/ConfirmDialog/ConfirmDialog.js