Sha256: a88982db83bb843ac1d29b7651f5f45163dd6f0b99247e6f833ff6883a1f8513

Contents?: true

Size: 1.62 KB

Versions: 54

Compression:

Stored size: 1.62 KB

Contents

import React, { useContext } from 'react';

import { translate as __ } from 'foremanReact/common/I18n';
import { PropTypes } from 'prop-types';
import { FormattedMessage } from 'react-intl';

import { Wizard } from '@patternfly/react-core';

import BulkDeleteContextWrapper, {
  BulkDeleteContext,
} from './BulkDeleteContextWrapper';
import {
  getVersionListString,
} from './BulkDeleteHelpers';
import bulkDeleteSteps from './bulkDeleteSteps';

const BulkDeleteModal = ({ versions, onClose }) => {
  const WizardWithContext = () => {
    const context = useContext(BulkDeleteContext);
    const versionList = getVersionListString(versions);
    const description =
      (<FormattedMessage
        id="bulk-delete-modal-title"
        values={{ versionList }}
        defaultMessage={versions.length === 1 ?
          __('Deleting version {versionList}') :
          __('Deleting versions: {versionList}')}
      />);

    return (
      <Wizard
        title={versions.length === 1 ?
          __('Delete version') :
          __('Delete versions')}
        description={description}
        steps={bulkDeleteSteps(context)}
        onGoToStep={({ id }) => context.setCurrentStep(id)}
        onNext={({ id }) => context.setCurrentStep(id)}
        onBack={({ id }) => context.setCurrentStep(id)}
        onClose={onClose}
        isOpen
      />);
  };

  return (
    <BulkDeleteContextWrapper {...{ versions, onClose }}>
      <WizardWithContext />
    </BulkDeleteContextWrapper>
  );
};

BulkDeleteModal.propTypes = {
  versions: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
  onClose: PropTypes.func.isRequired,
};
export default BulkDeleteModal;

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
katello-4.15.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.15.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.14.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.14.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.14.0.rc3 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.14.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.14.0.rc1.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.14.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.13.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.13.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.12.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.13.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.12.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.12.0.rc3 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.12.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.12.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.11.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.11.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.11.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js
katello-4.11.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteModal.js