Sha256: 23e02286dfe233f18fcb01d4d88eed02e7723b00311d6e2ca5c7b38f63b6f36b

Contents?: true

Size: 1.83 KB

Versions: 23

Compression:

Stored size: 1.83 KB

Contents

import React from 'react';
import {
  useDispatch,
} from 'react-redux';
import PropTypes from 'prop-types';
import { noop } from 'foremanReact/common/helpers';
import { translate as __ } from 'foremanReact/common/I18n';
import { Modal, ModalVariant, Button, Icon, Title, Flex } from '@patternfly/react-core';
import { ExclamationTriangleIcon } from '@patternfly/react-icons';
import { deleteActivationKey } from '../ActivationKeyActions';

const DeleteModal = ({ isModalOpen, handleModalToggle, akId }) => {
  const dispatch = useDispatch();

  const handleDelete = () => {
    dispatch(deleteActivationKey(akId));
    handleModalToggle();
    window.location.replace('/activation_keys');
  };

  return (
    <Modal
      ouiaId="ak-delete-modal"
      variant={ModalVariant.small}
      title={[
        <Flex key="delete-modal-header">
          <Icon status="warning" key="exclamation-triangle">
            <ExclamationTriangleIcon />
          </Icon>
          <Title ouiaId="ak-delete-header" key="delete-ak-title" headingLevel="h5" size="2xl">
            {__('Delete activation key?')}
          </Title>
        </Flex>,
      ]}
      isOpen={isModalOpen}
      onClose={handleModalToggle}
      actions={[
        <Button ouiaId="delete-button" key="delete" variant="danger" onClick={handleDelete}>
          {__('Delete')}
        </Button>,
        <Button ouiaId="cancel-button" key="cancel" variant="link" onClick={handleModalToggle}>
          {__('Cancel')}
        </Button>,
      ]}
    >
      {__('Activation Key will no longer be available for use. This operation cannot be undone.')}
    </Modal>
  );
};


DeleteModal.propTypes = {
  isModalOpen: PropTypes.bool,
  handleModalToggle: PropTypes.func,
  akId: PropTypes.string.isRequired,
};

DeleteModal.defaultProps = {
  isModalOpen: false,
  handleModalToggle: noop,
};

export default DeleteModal;

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
katello-4.15.0.rc2 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.15.0.rc1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.14.1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.14.0 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.14.0.rc3 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.14.0.rc2 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.14.0.rc1.1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.14.0.rc1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.13.1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.13.0 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.12.1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.13.0.rc1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.12.0 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.12.0.rc3 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.12.0.rc2 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.12.0.rc1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.11.1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.11.0 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.11.0.rc2 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js
katello-4.11.0.rc1 webpack/scenes/ActivationKeys/Details/components/DeleteModal.js