Sha256: c7b03579ea8ceed480cece5359a516664d90e2b92439645f9e5f8e6a8e0f5345

Contents?: true

Size: 1.69 KB

Versions: 20

Compression:

Stored size: 1.69 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"
            ouiaId="ansible-host-details-tabs"
            onSelect={(evt, subTab) => hashHistory.push(subTab)}
            activeKey={pathname?.split('/')[2]}
            isSecondary
          >
            {SECONDARY_TABS.map(({ key, title }) => (
              <Tab
                ouiaId={`ansible-host-details-tabs-${title}`}
                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

20 entries across 20 versions & 1 rubygems

Version Path
foreman_ansible-15.0.2 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-15.0.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-15.0.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-14.2.2 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-14.2.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.7 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-14.2.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-14.1.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-14.1.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.5 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-14.0.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.4 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.3 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.2 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.1 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-13.0.0 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-12.0.7 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-12.0.6 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-12.0.5 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js
foreman_ansible-12.0.4 webpack/components/AnsibleHostDetail/AnsibleHostDetail.js