mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 21:37:42 -02:30
add FormRow component; rename unwrapped components with underscore
This commit is contained in:
5
__tests__/.eslintrc
Normal file
5
__tests__/.eslintrc
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"react/jsx-pascal-case": "ignore"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { I18nProvider } from '@lingui/react';
|
import { I18nProvider } from '@lingui/react';
|
||||||
import OrganizationEdit, { OrganizationEditNoRouter } from '../../../../../src/pages/Organizations/screens/Organization/OrganizationEdit';
|
import OrganizationEdit, { _OrganizationEdit } from '../../../../../src/pages/Organizations/screens/Organization/OrganizationEdit';
|
||||||
|
|
||||||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ describe('<OrganizationEdit />', () => {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
<OrganizationEditNoRouter
|
<_OrganizationEdit
|
||||||
history={history}
|
history={history}
|
||||||
organization={mockData}
|
organization={mockData}
|
||||||
api={api}
|
api={api}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { mount } from 'enzyme';
|
|||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { I18nProvider } from '@lingui/react';
|
import { I18nProvider } from '@lingui/react';
|
||||||
import { ConfigContext } from '../../../../src/context';
|
import { ConfigContext } from '../../../../src/context';
|
||||||
import OrganizationAdd, { OrganizationAddNoRouter } from '../../../../src/pages/Organizations/screens/OrganizationAdd';
|
import OrganizationAdd, { _OrganizationAdd } from '../../../../src/pages/Organizations/screens/OrganizationAdd';
|
||||||
|
|
||||||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ describe('<OrganizationAdd />', () => {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
<OrganizationAddNoRouter
|
<_OrganizationAdd
|
||||||
history={history}
|
history={history}
|
||||||
api={api}
|
api={api}
|
||||||
/>
|
/>
|
||||||
@@ -68,7 +68,7 @@ describe('<OrganizationAdd />', () => {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
<OrganizationAddNoRouter
|
<_OrganizationAdd
|
||||||
history={history}
|
history={history}
|
||||||
api={api}
|
api={api}
|
||||||
/>
|
/>
|
||||||
@@ -103,7 +103,7 @@ describe('<OrganizationAdd />', () => {
|
|||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<MemoryRouter>
|
<MemoryRouter>
|
||||||
<I18nProvider>
|
<I18nProvider>
|
||||||
<OrganizationAddNoRouter
|
<_OrganizationAdd
|
||||||
history={history}
|
history={history}
|
||||||
api={api}
|
api={api}
|
||||||
/>
|
/>
|
||||||
|
|||||||
15
src/components/FormRow.jsx
Normal file
15
src/components/FormRow.jsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function FormRow ({ children }) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'grid',
|
||||||
|
gridGap: '20px',
|
||||||
|
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
|
|
||||||
import { ConfigContext } from '../../../context';
|
import { ConfigContext } from '../../../context';
|
||||||
|
import FormRow from '../../../components/FormRow';
|
||||||
import FormField from '../../../components/FormField';
|
import FormField from '../../../components/FormField';
|
||||||
import FormActionGroup from '../../../components/FormActionGroup';
|
import FormActionGroup from '../../../components/FormActionGroup';
|
||||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||||
@@ -96,13 +97,7 @@ class OrganizationForm extends Component {
|
|||||||
onSubmit={this.handleSubmit}
|
onSubmit={this.handleSubmit}
|
||||||
render={formik => (
|
render={formik => (
|
||||||
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
||||||
<div
|
<FormRow>
|
||||||
style={{
|
|
||||||
display: 'grid',
|
|
||||||
gridGap: '20px',
|
|
||||||
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<FormField
|
<FormField
|
||||||
id="edit-org-form-name"
|
id="edit-org-form-name"
|
||||||
name="name"
|
name="name"
|
||||||
@@ -139,7 +134,7 @@ class OrganizationForm extends Component {
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</ConfigContext.Consumer>
|
</ConfigContext.Consumer>
|
||||||
</div>
|
</FormRow>
|
||||||
<InstanceGroupsLookup
|
<InstanceGroupsLookup
|
||||||
api={api}
|
api={api}
|
||||||
value={instanceGroups}
|
value={instanceGroups}
|
||||||
|
|||||||
@@ -84,5 +84,5 @@ OrganizationEdit.contextTypes = {
|
|||||||
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
||||||
};
|
};
|
||||||
|
|
||||||
export { OrganizationEdit as OrganizationEditNoRouter };
|
export { OrganizationEdit as _OrganizationEdit };
|
||||||
export default withRouter(OrganizationEdit);
|
export default withRouter(OrganizationEdit);
|
||||||
|
|||||||
@@ -104,5 +104,5 @@ OrganizationAdd.contextTypes = {
|
|||||||
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
||||||
};
|
};
|
||||||
|
|
||||||
export { OrganizationAdd as OrganizationAddNoRouter };
|
export { OrganizationAdd as _OrganizationAdd };
|
||||||
export default withRouter(OrganizationAdd);
|
export default withRouter(OrganizationAdd);
|
||||||
|
|||||||
Reference in New Issue
Block a user