Sha256: b7638575237b704b8df77beb85da9894d22766fb2d5b44fbcd23c3657fe1dfe6

Contents?: true

Size: 1.59 KB

Versions: 16

Compression:

Stored size: 1.59 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Tabs, Tab, TabTitleText } from '@patternfly/react-core';
import { useHistory } from 'react-router-dom';
import SkeletonLoader from 'foremanReact/components/common/SkeletonLoader';

import SecondaryTabRoutes from './components/SecondaryTabRoutes';
import { SECONDARY_TABS } from './constants';
import './AnsibleHostDetail.scss';

const AnsibleHostDetail = ({
  response,
  status,
  router,
  location: { pathname },
  history,
}) => {
  const hashHistory = useHistory();
  return (
    <SkeletonLoader status={status} skeletonProps={{ count: 5 }}>
      {response?.id && (
        <>
          <Tabs
            className="ansible-host-details-tabs"
            onSelect={(evt, subTab) => hashHistory.push(subTab)}
            activeKey={pathname?.split('/')[2]}
            isSecondary
          >
            {SECONDARY_TABS.map(({ key, title }) => (
              <Tab
                key={key}
                eventKey={key}
                title={<TabTitleText>{title}</TabTitleText>}
              />
            ))}
          </Tabs>
          <SecondaryTabRoutes
            response={response}
            router={router}
            history={history}
          />
        </>
      )}
    </SkeletonLoader>
  );
};

AnsibleHostDetail.propTypes = {
  response: PropTypes.object.isRequired,
  status: PropTypes.string.isRequired,
  location: PropTypes.object,
  router: PropTypes.object.isRequired,
  history: PropTypes.object.isRequired,
};

AnsibleHostDetail.defaultProps = {
  location: { pathname: '' },
};

export default AnsibleHostDetail;

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_ansible-7.1.8 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.7 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.6 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.5 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.4 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-9.0.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.3 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-9.0.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.2 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-8.0.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-8.0.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.0.4 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.1.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.0.3 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-7.0.2 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js