mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 15:38:06 -03:30
Fix merge conflicts and linting errors
This commit is contained in:
parent
21298c8872
commit
9048c34a7d
@ -53,7 +53,7 @@ describe('<Breadcrumb />', () => {
|
||||
];
|
||||
|
||||
routes.forEach(([location, crumbLength]) => {
|
||||
const breadcrumbWrapper = mount(
|
||||
breadcrumbWrapper = mount(
|
||||
<MemoryRouter initialEntries={[location]}>
|
||||
<Breadcrumbs
|
||||
breadcrumbConfig={config}
|
||||
@ -63,8 +63,6 @@ describe('<Breadcrumb />', () => {
|
||||
|
||||
expect(breadcrumbWrapper.find('BreadcrumbItem')).toHaveLength(crumbLength);
|
||||
breadcrumbWrapper.unmount();
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -40,7 +40,7 @@ describe('<Lookup />', () => {
|
||||
data={mockData}
|
||||
/>
|
||||
</I18nProvider>
|
||||
);
|
||||
);
|
||||
const searchItem = wrapper.find('.pf-c-input-group__text#search');
|
||||
searchItem.first().simulate('click');
|
||||
wrapper.find('input[type="checkbox"]').simulate('change');
|
||||
|
||||
@ -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 { withRouter } from 'react-router-dom';
|
||||
import { Trans } from '@lingui/macro';
|
||||
import {
|
||||
PageSection,
|
||||
PageSectionVariants,
|
||||
Title,
|
||||
Form,
|
||||
FormGroup,
|
||||
TextInput,
|
||||
@ -22,8 +19,6 @@ import { ConfigContext } from '../../../context';
|
||||
import Lookup from '../../../components/Lookup';
|
||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||
|
||||
const { light } = PageSectionVariants;
|
||||
|
||||
const format = (data) => {
|
||||
const results = data.results.map((result) => ({
|
||||
id: result.id,
|
||||
@ -132,72 +127,65 @@ class OrganizationAdd extends React.Component {
|
||||
const enabled = name.length > 0; // TODO: add better form validation
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<PageSection variant={light} className="pf-m-condensed">
|
||||
<Title size="2xl">
|
||||
<Trans>Organization Add</Trans>
|
||||
</Title>
|
||||
</PageSection>
|
||||
<PageSection>
|
||||
<Card>
|
||||
<CardBody>
|
||||
<Form autoComplete="off">
|
||||
<Gallery gutter="md">
|
||||
<FormGroup
|
||||
label="Name"
|
||||
<PageSection>
|
||||
<Card>
|
||||
<CardBody>
|
||||
<Form autoComplete="off">
|
||||
<Gallery gutter="md">
|
||||
<FormGroup
|
||||
label="Name"
|
||||
isRequired
|
||||
fieldId="add-org-form-name"
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
fieldId="add-org-form-name"
|
||||
>
|
||||
<TextInput
|
||||
isRequired
|
||||
type="text"
|
||||
id="add-org-form-name"
|
||||
name="name"
|
||||
value={name}
|
||||
onChange={this.handleChange}
|
||||
type="text"
|
||||
id="add-org-form-name"
|
||||
name="name"
|
||||
value={name}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup label="Description" fieldId="add-org-form-description">
|
||||
<TextInput
|
||||
id="add-org-form-description"
|
||||
name="description"
|
||||
value={description}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup label="Instance Groups" fieldId="simple-form-instance-groups">
|
||||
<Lookup
|
||||
lookupHeader="Instance Groups"
|
||||
lookupChange={this.onLookupChange}
|
||||
data={results}
|
||||
/>
|
||||
</FormGroup>
|
||||
<ConfigContext.Consumer>
|
||||
{({ custom_virtualenvs }) => (
|
||||
<AnsibleSelect
|
||||
labelName="Ansible Environment"
|
||||
selected={custom_virtualenv}
|
||||
selectChange={this.onSelectChange}
|
||||
data={custom_virtualenvs}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup label="Description" fieldId="add-org-form-description">
|
||||
<TextInput
|
||||
id="add-org-form-description"
|
||||
name="description"
|
||||
value={description}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup label="Instance Groups" fieldId="simple-form-instance-groups">
|
||||
<Lookup
|
||||
lookupHeader="Instance Groups"
|
||||
lookupChange={this.onLookupChange}
|
||||
data={results}
|
||||
/>
|
||||
</FormGroup>
|
||||
<ConfigContext.Consumer>
|
||||
{({ custom_virtualenvs }) => (
|
||||
<AnsibleSelect
|
||||
labelName="Ansible Environment"
|
||||
selected={custom_virtualenv}
|
||||
selectChange={this.onSelectChange}
|
||||
data={custom_virtualenvs}
|
||||
/>
|
||||
)}
|
||||
</ConfigContext.Consumer>
|
||||
</Gallery>
|
||||
<ActionGroup className="at-align-right">
|
||||
<Toolbar>
|
||||
<ToolbarGroup>
|
||||
<Button className="at-C-SubmitButton" variant="primary" onClick={this.onSubmit} isDisabled={!enabled}>Save</Button>
|
||||
</ToolbarGroup>
|
||||
<ToolbarGroup>
|
||||
<Button className="at-C-CancelButton" variant="secondary" onClick={this.onCancel}>Cancel</Button>
|
||||
</ToolbarGroup>
|
||||
</Toolbar>
|
||||
</ActionGroup>
|
||||
</Form>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</PageSection>
|
||||
</Fragment>
|
||||
)}
|
||||
</ConfigContext.Consumer>
|
||||
</Gallery>
|
||||
<ActionGroup className="at-align-right">
|
||||
<Toolbar>
|
||||
<ToolbarGroup>
|
||||
<Button className="at-C-SubmitButton" variant="primary" onClick={this.onSubmit} isDisabled={!enabled}>Save</Button>
|
||||
</ToolbarGroup>
|
||||
<ToolbarGroup>
|
||||
<Button className="at-C-CancelButton" variant="secondary" onClick={this.onCancel}>Cancel</Button>
|
||||
</ToolbarGroup>
|
||||
</Toolbar>
|
||||
</ActionGroup>
|
||||
</Form>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user