Sha256: 2e1d16272691e82d154bbbb58934a5af62da7bbb14b5ce29ebf1b9857727009a

Contents?: true

Size: 1.63 KB

Versions: 102

Compression:

Stored size: 1.63 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Table } from 'react-bootstrap';
import { translate as __ } from 'foremanReact/common/I18n';
import { urlWithSearch } from 'foremanReact/common/urlHelpers';

const SubscriptionDetailAssociations = ({ subscriptionDetails }) => {
  const searchQuery = 'subscription_id="%s"'.replace('%s', subscriptionDetails.id);

  return (
    <div>
      <h2>{__('Associations')}</h2>
      <Table striped bordered condensed hover>
        <thead>
          <tr>
            <td><b>{__('Resource')}</b></td>
            <td><b>{__('Quantity')}</b></td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>{__('Content Hosts')}</td>
            <td>
              <a href={urlWithSearch('content_hosts', searchQuery)}>
                {subscriptionDetails.host_count}
              </a>
            </td>
          </tr>
          <tr>
            <td>{__('Activation Keys')}</td>
            <td>
              <a href={urlWithSearch('activation_keys', searchQuery)}>
                {subscriptionDetails.activation_keys &&
                  subscriptionDetails.activation_keys.length}
              </a>
            </td>
          </tr>
        </tbody>
      </Table>
    </div>
  );
};

SubscriptionDetailAssociations.propTypes = {
  subscriptionDetails: PropTypes.shape({
    id: PropTypes.number,
    host_count: PropTypes.number,
    // Disabling rule as existing code failed due to an eslint-plugin-react update
    // eslint-disable-next-line react/forbid-prop-types
    activation_keys: PropTypes.array,
  }).isRequired,
};

export default SubscriptionDetailAssociations;

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
katello-4.0.1.2 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.18.3.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.1.0.rc2.2 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.1.0.rc2.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.1.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.18.3 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.1.0.rc2 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.1.0.rc1.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.1.0.rc1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.0 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.0.rc3.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.0.rc3 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.18.2.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.18.2 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.17.3 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.0.rc2 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.18.1.1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-3.17.2 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js
katello-4.0.0.rc1 webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js