Sha256: d86364da7d57e1b777cd686ff5b93bab3a865a749bd483465922d4cf9f1b9c36

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 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
        ouiaId="puppet-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

5 entries across 5 versions & 1 rubygems

Version Path
foreman_puppet-6.1.1 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-5.1.3 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-6.1.0 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-6.0.1 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-6.0.0 webpack/src/Extends/Host/PuppetTab/index.js