mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 05:29:26 -02:30
Replace withRouter with react-router hooks in RoutedTabs
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shape, string, number, arrayOf, node, oneOfType } from 'prop-types';
|
import { shape, string, number, arrayOf, node, oneOfType } from 'prop-types';
|
||||||
import { Tab, Tabs as PFTabs } from '@patternfly/react-core';
|
import { Tab, Tabs as PFTabs } from '@patternfly/react-core';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
const Tabs = styled(PFTabs)`
|
const Tabs = styled(PFTabs)`
|
||||||
@@ -37,7 +37,8 @@ const Tabs = styled(PFTabs)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
function RoutedTabs(props) {
|
function RoutedTabs(props) {
|
||||||
const { history, tabsArray } = props;
|
const { tabsArray } = props;
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
const getActiveTabId = () => {
|
const getActiveTabId = () => {
|
||||||
const match = tabsArray.find(tab => tab.link === history.location.pathname);
|
const match = tabsArray.find(tab => tab.link === history.location.pathname);
|
||||||
@@ -68,12 +69,8 @@ function RoutedTabs(props) {
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
RoutedTabs.propTypes = {
|
RoutedTabs.propTypes = {
|
||||||
history: shape({
|
|
||||||
location: shape({
|
|
||||||
pathname: string.isRequired,
|
|
||||||
}).isRequired,
|
|
||||||
}).isRequired,
|
|
||||||
tabsArray: arrayOf(
|
tabsArray: arrayOf(
|
||||||
shape({
|
shape({
|
||||||
id: number.isRequired,
|
id: number.isRequired,
|
||||||
@@ -83,5 +80,4 @@ RoutedTabs.propTypes = {
|
|||||||
).isRequired,
|
).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { RoutedTabs as _RoutedTabs };
|
export default RoutedTabs;
|
||||||
export default withRouter(RoutedTabs);
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/* eslint-disable react/jsx-pascal-case */
|
/* eslint-disable react/jsx-pascal-case */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount, shallow } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import { Router } from 'react-router-dom';
|
import { Router } from 'react-router-dom';
|
||||||
import { createMemoryHistory } from 'history';
|
import { createMemoryHistory } from 'history';
|
||||||
import { Tab } from '@patternfly/react-core';
|
import RoutedTabs from './RoutedTabs';
|
||||||
import RoutedTabs, { _RoutedTabs } from './RoutedTabs';
|
|
||||||
|
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let history;
|
let history;
|
||||||
@@ -21,32 +20,24 @@ describe('<RoutedTabs />', () => {
|
|||||||
history = createMemoryHistory({
|
history = createMemoryHistory({
|
||||||
initialEntries: ['/organizations/19/teams'],
|
initialEntries: ['/organizations/19/teams'],
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
test('RoutedTabs renders successfully', () => {
|
|
||||||
wrapper = shallow(<_RoutedTabs tabsArray={tabs} history={history} />);
|
|
||||||
expect(wrapper.find(Tab)).toHaveLength(4);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Given a URL the correct tab is active', async () => {
|
|
||||||
wrapper = mount(
|
wrapper = mount(
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
<RoutedTabs tabsArray={tabs} />
|
<RoutedTabs tabsArray={tabs} />
|
||||||
</Router>
|
</Router>
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('RoutedTabs renders successfully', () => {
|
||||||
|
expect(wrapper.find('Tabs li')).toHaveLength(4);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Given a URL the correct tab is active', async () => {
|
||||||
expect(history.location.pathname).toEqual('/organizations/19/teams');
|
expect(history.location.pathname).toEqual('/organizations/19/teams');
|
||||||
expect(wrapper.find('Tabs').prop('activeKey')).toBe(3);
|
expect(wrapper.find('Tabs').prop('activeKey')).toBe(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should update history when new tab selected', async () => {
|
test('should update history when new tab selected', async () => {
|
||||||
wrapper = mount(
|
wrapper.find('Tabs').invoke('onSelect')({}, 2);
|
||||||
<Router history={history}>
|
|
||||||
<RoutedTabs tabsArray={tabs} />
|
|
||||||
</Router>
|
|
||||||
);
|
|
||||||
|
|
||||||
wrapper.find('Tabs').prop('onSelect')({}, 2);
|
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual('/organizations/19/access');
|
expect(history.location.pathname).toEqual('/organizations/19/access');
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { Card, PageSection } from '@patternfly/react-core';
|
|||||||
import {
|
import {
|
||||||
Switch,
|
Switch,
|
||||||
useParams,
|
useParams,
|
||||||
useHistory,
|
|
||||||
useLocation,
|
useLocation,
|
||||||
Route,
|
Route,
|
||||||
Redirect,
|
Redirect,
|
||||||
@@ -22,7 +21,6 @@ function Credential({ i18n, setBreadcrumb }) {
|
|||||||
const [credential, setCredential] = useState(null);
|
const [credential, setCredential] = useState(null);
|
||||||
const [contentError, setContentError] = useState(null);
|
const [contentError, setContentError] = useState(null);
|
||||||
const [hasContentLoading, setHasContentLoading] = useState(true);
|
const [hasContentLoading, setHasContentLoading] = useState(true);
|
||||||
const history = useHistory();
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
||||||
@@ -53,7 +51,7 @@ function Credential({ i18n, setBreadcrumb }) {
|
|||||||
|
|
||||||
let cardHeader = hasContentLoading ? null : (
|
let cardHeader = hasContentLoading ? null : (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton linkTo="/credentials" />
|
<CardCloseButton linkTo="/credentials" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class Host extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const { location, match, history, i18n } = this.props;
|
const { location, match, history, i18n } = this.props;
|
||||||
const { host, hasContentLoading, isInitialized, contentError } = this.state;
|
const { host, hasContentLoading, isInitialized, contentError } = this.state;
|
||||||
|
|
||||||
const tabsArray = [
|
const tabsArray = [
|
||||||
{
|
{
|
||||||
name: i18n._(t`Details`),
|
name: i18n._(t`Details`),
|
||||||
@@ -96,6 +97,7 @@ class Host extends Component {
|
|||||||
id: 3,
|
id: 3,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!history.location.pathname.startsWith('/hosts')) {
|
if (!history.location.pathname.startsWith('/hosts')) {
|
||||||
tabsArray.unshift({
|
tabsArray.unshift({
|
||||||
name: (
|
name: (
|
||||||
@@ -108,14 +110,10 @@ class Host extends Component {
|
|||||||
id: 99,
|
id: 99,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
match={match}
|
|
||||||
history={history}
|
|
||||||
labeltext={i18n._(t`Host detail tabs`)}
|
|
||||||
tabsArray={tabsArray}
|
|
||||||
/>
|
|
||||||
<CardCloseButton linkTo="/hosts" />
|
<CardCloseButton linkTo="/hosts" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -124,10 +122,6 @@ class Host extends Component {
|
|||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.pathname.endsWith('edit')) {
|
if (location.pathname.endsWith('edit')) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
@@ -150,6 +144,7 @@ class Host extends Component {
|
|||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const redirect = location.pathname.startsWith('/hosts') ? (
|
const redirect = location.pathname.startsWith('/hosts') ? (
|
||||||
<Redirect from="/hosts/:id" to="/hosts/:id/details" exact />
|
<Redirect from="/hosts/:id" to="/hosts/:id/details" exact />
|
||||||
) : (
|
) : (
|
||||||
@@ -159,6 +154,7 @@ class Host extends Component {
|
|||||||
exact
|
exact
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="awx-c-card">
|
<Card className="awx-c-card">
|
||||||
{cardHeader}
|
{cardHeader}
|
||||||
@@ -185,7 +181,7 @@ class Host extends Component {
|
|||||||
'/hosts/:id/edit',
|
'/hosts/:id/edit',
|
||||||
'/inventories/inventory/:id/hosts/:hostId/edit',
|
'/inventories/inventory/:id/hosts/:hostId/edit',
|
||||||
]}
|
]}
|
||||||
render={() => <HostEdit match={match} host={host} />}
|
render={() => <HostEdit host={host} />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{host && (
|
{host && (
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
Route,
|
Route,
|
||||||
Redirect,
|
Redirect,
|
||||||
Link,
|
Link,
|
||||||
useHistory,
|
|
||||||
useLocation,
|
useLocation,
|
||||||
useRouteMatch,
|
useRouteMatch,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
@@ -30,7 +29,6 @@ function Inventory({ i18n, setBreadcrumb }) {
|
|||||||
const [contentError, setContentError] = useState(null);
|
const [contentError, setContentError] = useState(null);
|
||||||
const [hasContentLoading, setHasContentLoading] = useState(true);
|
const [hasContentLoading, setHasContentLoading] = useState(true);
|
||||||
const [inventory, setInventory] = useState(null);
|
const [inventory, setInventory] = useState(null);
|
||||||
const history = useHistory();
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const match = useRouteMatch({
|
const match = useRouteMatch({
|
||||||
path: '/inventories/inventory/:id',
|
path: '/inventories/inventory/:id',
|
||||||
@@ -67,7 +65,7 @@ function Inventory({ i18n, setBreadcrumb }) {
|
|||||||
|
|
||||||
let cardHeader = hasContentLoading ? null : (
|
let cardHeader = hasContentLoading ? null : (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton linkTo="/inventories" />
|
<CardCloseButton linkTo="/inventories" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -80,6 +78,7 @@ function Inventory({ i18n, setBreadcrumb }) {
|
|||||||
) {
|
) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasContentLoading) {
|
if (hasContentLoading) {
|
||||||
return <ContentLoading />;
|
return <ContentLoading />;
|
||||||
}
|
}
|
||||||
@@ -117,7 +116,6 @@ function Inventory({ i18n, setBreadcrumb }) {
|
|||||||
path="/inventories/inventory/:id/details"
|
path="/inventories/inventory/:id/details"
|
||||||
render={() => (
|
render={() => (
|
||||||
<InventoryDetail
|
<InventoryDetail
|
||||||
match={match}
|
|
||||||
hasInventoryLoading={hasContentLoading}
|
hasInventoryLoading={hasContentLoading}
|
||||||
inventory={inventory}
|
inventory={inventory}
|
||||||
/>
|
/>
|
||||||
@@ -133,9 +131,7 @@ function Inventory({ i18n, setBreadcrumb }) {
|
|||||||
path="/inventories/inventory/:id/hosts"
|
path="/inventories/inventory/:id/hosts"
|
||||||
render={() => (
|
render={() => (
|
||||||
<InventoryHosts
|
<InventoryHosts
|
||||||
match={match}
|
|
||||||
setBreadcrumb={setBreadcrumb}
|
setBreadcrumb={setBreadcrumb}
|
||||||
i18n={i18n}
|
|
||||||
inventory={inventory}
|
inventory={inventory}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -155,8 +151,6 @@ function Inventory({ i18n, setBreadcrumb }) {
|
|||||||
path="/inventories/inventory/:id/groups"
|
path="/inventories/inventory/:id/groups"
|
||||||
render={() => (
|
render={() => (
|
||||||
<InventoryGroups
|
<InventoryGroups
|
||||||
location={location}
|
|
||||||
match={match}
|
|
||||||
setBreadcrumb={setBreadcrumb}
|
setBreadcrumb={setBreadcrumb}
|
||||||
inventory={inventory}
|
inventory={inventory}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { Switch, Route, withRouter, Link, Redirect } from 'react-router-dom';
|
|
||||||
import { CaretLeftIcon } from '@patternfly/react-icons';
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
Switch,
|
||||||
|
Route,
|
||||||
|
Link,
|
||||||
|
Redirect,
|
||||||
|
useLocation,
|
||||||
|
useParams,
|
||||||
|
} from 'react-router-dom';
|
||||||
|
import { CaretLeftIcon } from '@patternfly/react-icons';
|
||||||
import { GroupsAPI } from '@api';
|
import { GroupsAPI } from '@api';
|
||||||
import CardCloseButton from '@components/CardCloseButton';
|
import CardCloseButton from '@components/CardCloseButton';
|
||||||
import RoutedTabs from '@components/RoutedTabs';
|
import RoutedTabs from '@components/RoutedTabs';
|
||||||
@@ -13,15 +20,17 @@ import { TabbedCardHeader } from '@components/Card';
|
|||||||
import InventoryGroupEdit from '../InventoryGroupEdit/InventoryGroupEdit';
|
import InventoryGroupEdit from '../InventoryGroupEdit/InventoryGroupEdit';
|
||||||
import InventoryGroupDetail from '../InventoryGroupDetail/InventoryGroupDetail';
|
import InventoryGroupDetail from '../InventoryGroupDetail/InventoryGroupDetail';
|
||||||
|
|
||||||
function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
|
function InventoryGroup({ i18n, setBreadcrumb, inventory }) {
|
||||||
const [inventoryGroup, setInventoryGroup] = useState(null);
|
const [inventoryGroup, setInventoryGroup] = useState(null);
|
||||||
const [contentLoading, setContentLoading] = useState(true);
|
const [contentLoading, setContentLoading] = useState(true);
|
||||||
const [contentError, setContentError] = useState(null);
|
const [contentError, setContentError] = useState(null);
|
||||||
|
const { id: inventoryId, groupId } = useParams();
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
try {
|
try {
|
||||||
const { data } = await GroupsAPI.readDetail(match.params.groupId);
|
const { data } = await GroupsAPI.readDetail(groupId);
|
||||||
setInventoryGroup(data);
|
setInventoryGroup(data);
|
||||||
setBreadcrumb(inventory, data);
|
setBreadcrumb(inventory, data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -32,12 +41,7 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
loadData();
|
loadData();
|
||||||
}, [
|
}, [location.pathname, groupId, inventory, setBreadcrumb]);
|
||||||
history.location.pathname,
|
|
||||||
match.params.groupId,
|
|
||||||
inventory,
|
|
||||||
setBreadcrumb,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const tabsArray = [
|
const tabsArray = [
|
||||||
{
|
{
|
||||||
@@ -80,7 +84,7 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
inventoryGroup.summary_fields.inventory.id !== parseInt(match.params.id, 10)
|
inventoryGroup.summary_fields.inventory.id !== parseInt(inventoryId, 10)
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<ContentError>
|
<ContentError>
|
||||||
@@ -99,12 +103,12 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
|
|||||||
|
|
||||||
let cardHeader = null;
|
let cardHeader = null;
|
||||||
if (
|
if (
|
||||||
history.location.pathname.includes('groups/') &&
|
location.pathname.includes('groups/') &&
|
||||||
!history.location.pathname.endsWith('edit')
|
!location.pathname.endsWith('edit')
|
||||||
) {
|
) {
|
||||||
cardHeader = (
|
cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton
|
<CardCloseButton
|
||||||
linkTo={`/inventories/inventory/${inventory.id}/groups`}
|
linkTo={`/inventories/inventory/${inventory.id}/groups`}
|
||||||
/>
|
/>
|
||||||
@@ -124,15 +128,9 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
|
|||||||
<Route
|
<Route
|
||||||
key="edit"
|
key="edit"
|
||||||
path="/inventories/inventory/:id/groups/:groupId/edit"
|
path="/inventories/inventory/:id/groups/:groupId/edit"
|
||||||
render={() => {
|
>
|
||||||
return (
|
<InventoryGroupEdit inventoryGroup={inventoryGroup} />
|
||||||
<InventoryGroupEdit
|
</Route>,
|
||||||
inventory={inventory}
|
|
||||||
inventoryGroup={inventoryGroup}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
<Route
|
<Route
|
||||||
key="details"
|
key="details"
|
||||||
path="/inventories/inventory/:id/groups/:groupId/details"
|
path="/inventories/inventory/:id/groups/:groupId/details"
|
||||||
@@ -161,5 +159,5 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory, history }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { InventoryGroups as _InventoryGroups };
|
export { InventoryGroup as _InventoryGroup };
|
||||||
export default withI18n()(withRouter(InventoryGroups));
|
export default withI18n()(InventoryGroup);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class SmartInventory extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { history, i18n, location, match } = this.props;
|
const { i18n, location, match } = this.props;
|
||||||
const { contentError, hasContentLoading, inventory } = this.state;
|
const { contentError, hasContentLoading, inventory } = this.state;
|
||||||
|
|
||||||
const tabsArray = [
|
const tabsArray = [
|
||||||
@@ -76,7 +76,7 @@ class SmartInventory extends Component {
|
|||||||
|
|
||||||
let cardHeader = hasContentLoading ? null : (
|
let cardHeader = hasContentLoading ? null : (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton linkTo="/inventories" />
|
<CardCloseButton linkTo="/inventories" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -119,7 +119,6 @@ class SmartInventory extends Component {
|
|||||||
path="/inventories/smart_inventory/:id/details"
|
path="/inventories/smart_inventory/:id/details"
|
||||||
render={() => (
|
render={() => (
|
||||||
<SmartInventoryDetail
|
<SmartInventoryDetail
|
||||||
match={match}
|
|
||||||
hasSmartInventoryLoading={hasContentLoading}
|
hasSmartInventoryLoading={hasContentLoading}
|
||||||
inventory={inventory}
|
inventory={inventory}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Job extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { history, match, i18n, lookup } = this.props;
|
const { match, i18n, lookup } = this.props;
|
||||||
|
|
||||||
const { job, contentError, hasContentLoading, isInitialized } = this.state;
|
const { job, contentError, hasContentLoading, isInitialized } = this.state;
|
||||||
let jobType;
|
let jobType;
|
||||||
@@ -71,7 +71,7 @@ class Job extends Component {
|
|||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs match={match} history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton linkTo="/jobs" />
|
<CardCloseButton linkTo="/jobs" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -80,10 +80,6 @@ class Job extends Component {
|
|||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasContentLoading && contentError) {
|
if (!hasContentLoading && contentError) {
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class Organization extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { location, match, me, history, i18n } = this.props;
|
const { location, match, me, i18n } = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
organization,
|
organization,
|
||||||
@@ -131,12 +131,7 @@ class Organization extends Component {
|
|||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
match={match}
|
|
||||||
history={history}
|
|
||||||
labeltext={i18n._(t`Organization detail tabs`)}
|
|
||||||
tabsArray={tabsArray}
|
|
||||||
/>
|
|
||||||
<CardCloseButton linkTo="/organizations" />
|
<CardCloseButton linkTo="/organizations" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -145,10 +140,6 @@ class Organization extends Component {
|
|||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.pathname.endsWith('edit')) {
|
if (location.pathname.endsWith('edit')) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
@@ -185,19 +176,14 @@ class Organization extends Component {
|
|||||||
{organization && (
|
{organization && (
|
||||||
<Route
|
<Route
|
||||||
path="/organizations/:id/edit"
|
path="/organizations/:id/edit"
|
||||||
render={() => (
|
render={() => <OrganizationEdit organization={organization} />}
|
||||||
<OrganizationEdit match={match} organization={organization} />
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{organization && (
|
{organization && (
|
||||||
<Route
|
<Route
|
||||||
path="/organizations/:id/details"
|
path="/organizations/:id/details"
|
||||||
render={() => (
|
render={() => (
|
||||||
<OrganizationDetail
|
<OrganizationDetail organization={organization} />
|
||||||
match={match}
|
|
||||||
organization={organization}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class Project extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { location, match, me, history, i18n } = this.props;
|
const { location, match, me, i18n } = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
project,
|
project,
|
||||||
@@ -151,12 +151,7 @@ class Project extends Component {
|
|||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
match={match}
|
|
||||||
history={history}
|
|
||||||
labeltext={i18n._(t`Project detail tabs`)}
|
|
||||||
tabsArray={tabsArray}
|
|
||||||
/>
|
|
||||||
<CardCloseButton linkTo="/projects" />
|
<CardCloseButton linkTo="/projects" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -165,10 +160,6 @@ class Project extends Component {
|
|||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.pathname.endsWith('edit')) {
|
if (location.pathname.endsWith('edit')) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
@@ -199,7 +190,7 @@ class Project extends Component {
|
|||||||
{project && (
|
{project && (
|
||||||
<Route
|
<Route
|
||||||
path="/projects/:id/edit"
|
path="/projects/:id/edit"
|
||||||
render={() => <ProjectEdit match={match} project={project} />}
|
render={() => <ProjectEdit project={project} />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{project && (
|
{project && (
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class Team extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { location, match, history, i18n } = this.props;
|
const { location, match, i18n } = this.props;
|
||||||
|
|
||||||
const { team, contentError, hasContentLoading, isInitialized } = this.state;
|
const { team, contentError, hasContentLoading, isInitialized } = this.state;
|
||||||
|
|
||||||
@@ -71,12 +71,7 @@ class Team extends Component {
|
|||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
match={match}
|
|
||||||
history={history}
|
|
||||||
labeltext={i18n._(t`Team detail tabs`)}
|
|
||||||
tabsArray={tabsArray}
|
|
||||||
/>
|
|
||||||
<CardCloseButton linkTo="/teams" />
|
<CardCloseButton linkTo="/teams" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -85,10 +80,6 @@ class Team extends Component {
|
|||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.pathname.endsWith('edit')) {
|
if (location.pathname.endsWith('edit')) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
@@ -119,7 +110,7 @@ class Team extends Component {
|
|||||||
{team && (
|
{team && (
|
||||||
<Route
|
<Route
|
||||||
path="/teams/:id/edit"
|
path="/teams/:id/edit"
|
||||||
render={() => <TeamEdit match={match} team={team} />}
|
render={() => <TeamEdit team={team} />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{team && (
|
{team && (
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class Template extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { history, i18n, location, match, me } = this.props;
|
const { i18n, location, match, me } = this.props;
|
||||||
const {
|
const {
|
||||||
contentError,
|
contentError,
|
||||||
hasContentLoading,
|
hasContentLoading,
|
||||||
@@ -123,7 +123,7 @@ class Template extends Component {
|
|||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton linkTo="/templates" />
|
<CardCloseButton linkTo="/templates" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -165,7 +165,6 @@ class Template extends Component {
|
|||||||
path="/templates/:templateType/:id/details"
|
path="/templates/:templateType/:id/details"
|
||||||
render={() => (
|
render={() => (
|
||||||
<JobTemplateDetail
|
<JobTemplateDetail
|
||||||
match={match}
|
|
||||||
hasTemplateLoading={hasContentLoading}
|
hasTemplateLoading={hasContentLoading}
|
||||||
template={template}
|
template={template}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { history, i18n, location, match } = this.props;
|
const { i18n, location, match } = this.props;
|
||||||
const { contentError, hasContentLoading, template } = this.state;
|
const { contentError, hasContentLoading, template } = this.state;
|
||||||
|
|
||||||
const tabsArray = [
|
const tabsArray = [
|
||||||
@@ -67,7 +67,7 @@ class WorkflowJobTemplate extends Component {
|
|||||||
|
|
||||||
let cardHeader = hasContentLoading ? null : (
|
let cardHeader = hasContentLoading ? null : (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs history={history} tabsArray={tabsArray} />
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
<CardCloseButton linkTo="/templates" />
|
<CardCloseButton linkTo="/templates" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -109,7 +109,6 @@ class WorkflowJobTemplate extends Component {
|
|||||||
path="/templates/workflow_job_template/:id/details"
|
path="/templates/workflow_job_template/:id/details"
|
||||||
render={() => (
|
render={() => (
|
||||||
<WorkflowJobTemplateDetail
|
<WorkflowJobTemplateDetail
|
||||||
match={match}
|
|
||||||
hasTemplateLoading={hasContentLoading}
|
hasTemplateLoading={hasContentLoading}
|
||||||
template={template}
|
template={template}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class User extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { location, match, history, i18n } = this.props;
|
const { location, match, i18n } = this.props;
|
||||||
|
|
||||||
const { user, contentError, hasContentLoading, isInitialized } = this.state;
|
const { user, contentError, hasContentLoading, isInitialized } = this.state;
|
||||||
|
|
||||||
@@ -80,12 +80,7 @@ class User extends Component {
|
|||||||
|
|
||||||
let cardHeader = (
|
let cardHeader = (
|
||||||
<TabbedCardHeader>
|
<TabbedCardHeader>
|
||||||
<RoutedTabs
|
<RoutedTabs tabsArray={tabsArray} />
|
||||||
match={match}
|
|
||||||
history={history}
|
|
||||||
labeltext={i18n._(t`User detail tabs`)}
|
|
||||||
tabsArray={tabsArray}
|
|
||||||
/>
|
|
||||||
<CardCloseButton linkTo="/users" />
|
<CardCloseButton linkTo="/users" />
|
||||||
</TabbedCardHeader>
|
</TabbedCardHeader>
|
||||||
);
|
);
|
||||||
@@ -94,10 +89,6 @@ class User extends Component {
|
|||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
|
||||||
cardHeader = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (location.pathname.endsWith('edit')) {
|
if (location.pathname.endsWith('edit')) {
|
||||||
cardHeader = null;
|
cardHeader = null;
|
||||||
}
|
}
|
||||||
@@ -128,7 +119,7 @@ class User extends Component {
|
|||||||
{user && (
|
{user && (
|
||||||
<Route
|
<Route
|
||||||
path="/users/:id/edit"
|
path="/users/:id/edit"
|
||||||
render={() => <UserEdit match={match} user={user} />}
|
render={() => <UserEdit user={user} />}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{user && (
|
{user && (
|
||||||
|
|||||||
Reference in New Issue
Block a user