Sha256: aca1140ed492a65cc02302100606464044d5d3547d5354097aa5726bd3fc189b

Contents?: true

Size: 1.58 KB

Versions: 51

Compression:

Stored size: 1.58 KB

Contents

import React, { useState } from 'react';
import {
  GridItem,
  Label,
} from '@patternfly/react-core';

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

import HostsModal from './HostsModal';

const Hosts = ({
  contentHosts, hostsWithoutContent,
}) => {
  const [modalHosts, setModalHosts] = useState(false);
  const [modalIgnored, setModalIgnored] = useState(false);

  const titleHosts = __('Hosts to update');
  const titleIgnored = __('Ignored hosts');

  return (
    <>
      <GridItem span={7}>
        {hostsWithoutContent.length > 0 &&
        <p>
          { __('Some hosts are not registered as content hosts and will be ignored.') }
        </p>
}
        {contentHosts.length > 0 && (<Label color="green" href="#" onClick={() => setModalHosts(true)}>{titleHosts}: {contentHosts.length}</Label>)}
        {' '}
        {hostsWithoutContent.length > 0 && (<Label color="orange" href="#" onClick={() => setModalIgnored(true)}>{titleIgnored}: {hostsWithoutContent.length}</Label>)}

        <HostsModal
          hosts={contentHosts}
          isOpen={modalHosts}
          setModalOpenState={setModalHosts}
          modalTitle={titleHosts}
        />
        <HostsModal
          hosts={hostsWithoutContent}
          isOpen={modalIgnored}
          setModalOpenState={setModalIgnored}
          modalTitle={titleIgnored}
        />
      </GridItem>
    </>
  );
};

Hosts.propTypes = {
  contentHosts: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
  hostsWithoutContent: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
};

export default Hosts;

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
katello-4.16.0 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.15.1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.16.0.rc2 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.16.0.rc1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.3 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.2 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.15.0 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.15.0.rc2 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.15.0.rc1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.0 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.0.rc3 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.0.rc2 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.0.rc1.1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.14.0.rc1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.13.1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.13.0 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.12.1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.13.0.rc1 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js
katello-4.12.0 webpack/scenes/Hosts/ChangeContentSource/components/Hosts.js