Sha256: 08ecb9250f58e3c4623281fff295559effc01a583b153959954ddcd45f7d5cb9

Contents?: true

Size: 1.85 KB

Versions: 20

Compression:

Stored size: 1.85 KB

Contents

import React from 'react';
import { translate as __ } from 'foremanReact/common/I18n';
import { Nav, NavItem, TabPane, TabContent, TabContainer, Grid, Row, Col } from 'patternfly-react';
import { PropTypes } from 'prop-types';
import { LoadingState } from '../../../move_to_pf/LoadingState/index';

const ContentDetails = (props) => {
  const { contentDetails, schema } = props;
  const { loading } = contentDetails;

  const tabHeaders = () => {
    const tabs = schema.map(node => (
      <NavItem key={node.key} eventKey={node.key}>
        <div>{node.tabHeader}</div>
      </NavItem>
    ));
    return tabs;
  };

  const tabPanes = () => {
    const tabPane = schema.map(node => (
      <TabPane key={node.key} eventKey={node.key}>
        <Row>
          <Col sm={12}>
            {node.tabContent}
          </Col>
        </Row>
      </TabPane>
    ));
    return tabPane;
  };

  return (
    <div>
      <LoadingState
        loading={loading}
        loadingText={__('Loading')}
      >
        <TabContainer id="content-tabs-container" defaultActiveKey={1}>
          <Grid bsClass="container-fluid">
            <Row>
              <Col sm={12}>
                <Nav id="content-nav-container" bsClass="nav nav-tabs">
                  {schema && tabHeaders()}
                </Nav>
              </Col>
            </Row>
            <TabContent animation={false}>
              {schema && tabPanes()}
            </TabContent>
          </Grid>
        </TabContainer>
      </LoadingState>
    </div>
  );
};

ContentDetails.propTypes = {
  contentDetails: PropTypes.shape({
    loading: PropTypes.bool,
    name: PropTypes.string,
    profiles: PropTypes.array,
    repositories: PropTypes.array,
    artifacts: PropTypes.array,
    stream: PropTypes.string,
  }).isRequired,
  schema: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
};

export default ContentDetails;

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
katello-3.16.0.rc3.1 webpack/components/Content/Details/ContentDetails.js
katello-3.15.2 webpack/components/Content/Details/ContentDetails.js
katello-3.16.0.rc3 webpack/components/Content/Details/ContentDetails.js
katello-3.16.0.rc2.1 webpack/components/Content/Details/ContentDetails.js
katello-3.16.0.rc2 webpack/components/Content/Details/ContentDetails.js
katello-3.15.1.1 webpack/components/Content/Details/ContentDetails.js
katello-3.16.0.rc1.1 webpack/components/Content/Details/ContentDetails.js
katello-3.15.1 webpack/components/Content/Details/ContentDetails.js
katello-3.16.0.rc1 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0.1 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0.rc2 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0.rc1.3 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0.rc1.2 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0.rc1.1 webpack/components/Content/Details/ContentDetails.js
katello-3.15.0.rc1 webpack/components/Content/Details/ContentDetails.js
katello-3.14.1 webpack/components/Content/Details/ContentDetails.js
katello-3.14.0 webpack/components/Content/Details/ContentDetails.js
katello-3.14.0.rc2 webpack/components/Content/Details/ContentDetails.js
katello-3.14.0.rc1 webpack/components/Content/Details/ContentDetails.js