Sha256: 8b87fe59d6795a462ef76c759057250b8ab4078fd80ecb8c5f1ea05f42ca5a6e

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

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

import SecondaryTabRoutes from './Routes';
import { activeTab } from './helpers';
import { SECONDARY_TABS } from './constants';

const PuppetTab = ({ response, status, location: { pathname } }) => {
  const hashHistory = useHistory();
  return (
    <>
      <Tabs
        className="margin-0-24"
        onSelect={(evt, subTab) => hashHistory.push(subTab)}
        isSecondary
        activeKey={activeTab(pathname)}
      >
        {SECONDARY_TABS.map(({ key, title }) => (
          <Tab
            key={key}
            id={`puppet-subtab-${key}`}
            ouiaId={`puppet-subtab-${key}`}
            eventKey={key}
            title={<TabTitleText>{title}</TabTitleText>}
          />
        ))}
      </Tabs>
      <SecondaryTabRoutes
        hostName={response.name}
        hostInfo={response}
        status={status}
      />
    </>
  );
};

PuppetTab.propTypes = {
  response: PropTypes.object,
  status: PropTypes.string,
  location: PropTypes.shape({
    pathname: PropTypes.string,
  }),
};
PuppetTab.defaultProps = {
  location: { pathname: '' },
  response: { name: '' },
  status: STATUS.PENDING,
};

export default PuppetTab;

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_puppet-5.1.2 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-4.1.1 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-5.1.1 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-5.1.0 webpack/src/Extends/Host/PuppetTab/index.js