Sha256: eb969b1d0d39b76cad4bbe3c5208e07d18d89dc6d788faa325c89f210790f858

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

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

import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';

import WebhooksTable from './WebhooksTable';
import {
  WEBHOOK_DELETE_MODAL_ID,
  WEBHOOK_EDIT_MODAL_ID,
} from '../../../constants';

const WrappedWebhooksTable = props => {
  const { setModalOpen: setDeleteModalOpen } = useForemanModal({
    id: WEBHOOK_DELETE_MODAL_ID,
  });

  const { setModalOpen: setEditModalOpen } = useForemanModal({
    id: WEBHOOK_EDIT_MODAL_ID,
  });

  const { setToDelete, setToEdit, ...rest } = props;

  const onDeleteClick = rowData => {
    setToDelete(rowData);
    setDeleteModalOpen();
  };

  const onEditClick = rowData => {
    setToEdit(rowData);
    setEditModalOpen();
  };

  return (
    <WebhooksTable
      onDeleteClick={onDeleteClick}
      onEditClick={onEditClick}
      {...rest}
    />
  );
};

WrappedWebhooksTable.propTypes = {
  setToDelete: PropTypes.func.isRequired,
  setToEdit: PropTypes.func.isRequired,
};

export default WrappedWebhooksTable;

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
foreman_webhooks-3.1.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.1.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.0.5 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-2.0.3 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.0.4 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-2.0.2 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.0.3 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.0.2 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.0.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-2.0.1 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-3.0.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-2.0.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js
foreman_webhooks-1.1.0 webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/index.js