Sha256: f620c7128e0a57b20918a6c037ab3467a55faee0941cd1c5428ddd19cbd05396

Contents?: true

Size: 1.63 KB

Versions: 15

Compression:

Stored size: 1.63 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { Route, Switch, Redirect } from 'react-router-dom';

import AnsibleVariableOverrides from './AnsibleVariableOverrides';
import RolesTab from './RolesTab';
import JobsTab from './JobsTab';
import TabLayout from './TabLayout';

import WrappedAnsibleHostInventory from './AnsibleHostInventory';
import { ANSIBLE_KEY } from '../constants';
import { route } from '../helpers';

const SecondaryTabRoutes = ({ response, router, history }) => (
  <Switch>
    <Route exact path={`/${ANSIBLE_KEY}`}>
      <Redirect to={route('roles')} />
    </Route>
    <Route path={route('roles')}>
      <TabLayout>
        <RolesTab
          hostId={response.id}
          history={history}
          canEditHost={response.permissions.edit_hosts}
        />
      </TabLayout>
    </Route>
    <Route path={route('variables')}>
      <TabLayout>
        <AnsibleVariableOverrides
          hostId={response.id}
          hostAttrs={response}
          history={history}
        />
      </TabLayout>
    </Route>
    <Route path={route('inventory')}>
      <TabLayout>
        <WrappedAnsibleHostInventory hostId={response.id} />
      </TabLayout>
    </Route>
    <Route path={route('jobs')}>
      <TabLayout>
        <JobsTab
          resourceId={response.id}
          resourceName="host"
          hostGroupId={response.hostgroup_id}
          history={history}
        />
      </TabLayout>
    </Route>
  </Switch>
);

SecondaryTabRoutes.propTypes = {
  response: PropTypes.object.isRequired,
  router: PropTypes.object.isRequired,
  history: PropTypes.object.isRequired,
};

export default SecondaryTabRoutes;

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
foreman_ansible-7.1.8 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.7 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.6 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.5 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.4 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-9.0.1 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.3 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-9.0.0 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.2 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.1 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-8.0.1 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-8.0.0 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.0.4 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.1.0 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js
foreman_ansible-7.0.3 webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js