Sha256: d069b22bd2d89ee24f17ef89578f8cc7f7f5918adfc70fcefb951ffe760dc208

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 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}
            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

7 entries across 7 versions & 1 rubygems

Version Path
foreman_puppet-4.1.0 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-4.0.4 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-5.0.0 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-4.0.3 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-4.0.2 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-4.0.1 webpack/src/Extends/Host/PuppetTab/index.js
foreman_puppet-4.0.0 webpack/src/Extends/Host/PuppetTab/index.js