Sha256: 3c76f1e803fec49a4528722051ce1fcbdedf1637acaf72c499e96e29874d8da6

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';

import { sprintf, translate as __ } from 'foremanReact/common/I18n';
import ForemanModal from 'foremanReact/components/ForemanModal';
import { foremanUrl } from 'foremanReact/common/helpers';

import { WEBHOOK_DELETE_MODAL_ID } from '../../constants';

const WebhookDeleteModal = ({ toDelete, onSuccess }) => {
  const { id, name } = toDelete;

  return (
    <ForemanModal
      id={WEBHOOK_DELETE_MODAL_ID}
      title={__('Confirm Webhook Deletion')}
      enforceFocus
      submitProps={{
        url: foremanUrl(`/api/v2/webhooks/${id}`),
        message: sprintf(__('Webhook %s was successfully deleted'), name),
        onSuccess,
        submitBtnProps: {
          bsStyle: 'danger',
          btnText: __('Delete'),
        },
      }}
    >
      {sprintf(__('You are about to delete %s. Are you sure?'), name)}
      <ForemanModal.Footer />
    </ForemanModal>
  );
};

WebhookDeleteModal.propTypes = {
  toDelete: PropTypes.object,
  onSuccess: PropTypes.func.isRequired,
};

WebhookDeleteModal.defaultProps = {
  toDelete: {},
};

export default WebhookDeleteModal;

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_webhooks-1.0.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js
foreman_webhooks-0.0.3 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js
foreman_webhooks-0.0.2 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js
foreman_webhooks-0.0.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js