mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
Fix merge conflicts and linting errors
This commit is contained in:
@@ -53,7 +53,7 @@ describe('<Breadcrumb />', () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
routes.forEach(([location, crumbLength]) => {
|
routes.forEach(([location, crumbLength]) => {
|
||||||
const breadcrumbWrapper = mount(
|
breadcrumbWrapper = mount(
|
||||||
<MemoryRouter initialEntries={[location]}>
|
<MemoryRouter initialEntries={[location]}>
|
||||||
<Breadcrumbs
|
<Breadcrumbs
|
||||||
breadcrumbConfig={config}
|
breadcrumbConfig={config}
|
||||||
@@ -63,8 +63,6 @@ describe('<Breadcrumb />', () => {
|
|||||||
|
|
||||||
expect(breadcrumbWrapper.find('BreadcrumbItem')).toHaveLength(crumbLength);
|
expect(breadcrumbWrapper.find('BreadcrumbItem')).toHaveLength(crumbLength);
|
||||||
breadcrumbWrapper.unmount();
|
breadcrumbWrapper.unmount();
|
||||||
})
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
import React, { Fragment } from 'react';
|
|
||||||
import { Trans } from '@lingui/macro';
|
|
||||||
import {
|
|
||||||
PageSection,
|
|
||||||
PageSectionVariants,
|
|
||||||
Breadcrumb,
|
|
||||||
BreadcrumbItem,
|
|
||||||
BreadcrumbHeading
|
|
||||||
} from '@patternfly/react-core';
|
|
||||||
import {
|
|
||||||
Link
|
|
||||||
} from 'react-router-dom';
|
|
||||||
|
|
||||||
import getTabName from '../utils';
|
|
||||||
|
|
||||||
const OrganizationBreadcrumb = ({ parentObj, organization, currentTab, location }) => {
|
|
||||||
const { light } = PageSectionVariants;
|
|
||||||
let breadcrumb = '';
|
|
||||||
if (parentObj !== 'loading') {
|
|
||||||
const generateCrumb = (noLastLink = false) => (
|
|
||||||
<Fragment>
|
|
||||||
{parentObj
|
|
||||||
.map(({ url, name }, index) => {
|
|
||||||
let elem;
|
|
||||||
if (noLastLink && parentObj.length - 1 === index) {
|
|
||||||
elem = (<BreadcrumbHeading className="heading" key={name}>{name}</BreadcrumbHeading>);
|
|
||||||
} else {
|
|
||||||
elem = (
|
|
||||||
<BreadcrumbItem key={name}>
|
|
||||||
<Link
|
|
||||||
key={name}
|
|
||||||
to={{ pathname: url, state: { breadcrumb: parentObj, organization } }}
|
|
||||||
>
|
|
||||||
{name}
|
|
||||||
</Link>
|
|
||||||
</BreadcrumbItem>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return elem;
|
|
||||||
})
|
|
||||||
.reduce((prev, curr) => [prev, curr])}
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (currentTab && currentTab !== 'details') {
|
|
||||||
breadcrumb = (
|
|
||||||
<Fragment>
|
|
||||||
{generateCrumb()}
|
|
||||||
<BreadcrumbHeading className="heading">
|
|
||||||
{getTabName(currentTab)}
|
|
||||||
</BreadcrumbHeading>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
} else if (location.pathname.indexOf('edit') > -1) {
|
|
||||||
breadcrumb = (
|
|
||||||
<Fragment>
|
|
||||||
{generateCrumb()}
|
|
||||||
<BreadcrumbHeading className="heading">
|
|
||||||
<Trans>Edit</Trans>
|
|
||||||
</BreadcrumbHeading>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
} else if (location.pathname.indexOf('add') > -1) {
|
|
||||||
breadcrumb = (
|
|
||||||
<Fragment>
|
|
||||||
{generateCrumb()}
|
|
||||||
<BreadcrumbHeading className="heading">
|
|
||||||
<Trans>Add</Trans>
|
|
||||||
</BreadcrumbHeading>
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
breadcrumb = (
|
|
||||||
<Fragment>
|
|
||||||
{generateCrumb(true)}
|
|
||||||
</Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<PageSection variant={light} className="pf-m-condensed">
|
|
||||||
<Breadcrumb>{breadcrumb}</Breadcrumb>
|
|
||||||
</PageSection>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default OrganizationBreadcrumb;
|
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import { Trans } from '@lingui/macro';
|
|
||||||
import {
|
import {
|
||||||
PageSection,
|
PageSection,
|
||||||
PageSectionVariants,
|
|
||||||
Title,
|
|
||||||
Form,
|
Form,
|
||||||
FormGroup,
|
FormGroup,
|
||||||
TextInput,
|
TextInput,
|
||||||
@@ -22,8 +19,6 @@ import { ConfigContext } from '../../../context';
|
|||||||
import Lookup from '../../../components/Lookup';
|
import Lookup from '../../../components/Lookup';
|
||||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||||
|
|
||||||
const { light } = PageSectionVariants;
|
|
||||||
|
|
||||||
const format = (data) => {
|
const format = (data) => {
|
||||||
const results = data.results.map((result) => ({
|
const results = data.results.map((result) => ({
|
||||||
id: result.id,
|
id: result.id,
|
||||||
@@ -132,12 +127,6 @@ class OrganizationAdd extends React.Component {
|
|||||||
const enabled = name.length > 0; // TODO: add better form validation
|
const enabled = name.length > 0; // TODO: add better form validation
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
|
||||||
<PageSection variant={light} className="pf-m-condensed">
|
|
||||||
<Title size="2xl">
|
|
||||||
<Trans>Organization Add</Trans>
|
|
||||||
</Title>
|
|
||||||
</PageSection>
|
|
||||||
<PageSection>
|
<PageSection>
|
||||||
<Card>
|
<Card>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
@@ -197,7 +186,6 @@ class OrganizationAdd extends React.Component {
|
|||||||
</CardBody>
|
</CardBody>
|
||||||
</Card>
|
</Card>
|
||||||
</PageSection>
|
</PageSection>
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user