Sha256: c5c3e94b09537de40e2932b0260c3f706d12a7545a15a889177bc39e49bea3cb

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

import React, { useState } from 'react';
import PropTypes from 'prop-types';
import {
  Icon,
  Button,
  MessageDialog,
} from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';

const DeleteTableEntry = ({
  hidden,
  disabled,
  onDeleteTableEntry,
  additionalData,
}) =>{
  if (hidden) {
    return null;
  }

  const [showModal, setShowModal] = useState(false);
  const toggleModal = () => setShowModal(!showModal);

  return (
    <span>
      <MessageDialog
        show={showModal}
        onHide={toggleModal}
        primaryAction={() => onDeleteTableEntry(additionalData)}
        secondaryAction={toggleModal}
        primaryActionButtonContent={__('Confirm')}
        secondaryActionButtonContent={__('Cancel')}
        title={__('Confirm action')}
        primaryContent={__('Are you sure you wish to delete this item?')}
      />
      <Button
        bsStyle="default"
        disabled={disabled}
        onClick={toggleModal}
      >
        <Icon type="pf" name="delete" title={__("Delete entry")} />
      </Button>
    </span>
  );
};

DeleteTableEntry.propTypes = {
  hidden: PropTypes.bool.isRequired,
  disabled: PropTypes.bool.isRequired,
  onDeleteTableEntry: PropTypes.func.isRequired,
  additionalData: PropTypes.object.isRequired,
};

export default DeleteTableEntry;

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_acd-0.9.7 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.5 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.4 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.3 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.2.3 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.2.2 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.2.1 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.2 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.1 webpack/components/common/DeleteTableEntry.js
foreman_acd-0.9.0 webpack/components/common/DeleteTableEntry.js