mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
add FormRow component; rename unwrapped components with underscore
This commit is contained in:
parent
2002d48bcc
commit
40b88da9dd
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 { MemoryRouter } from 'react-router-dom';
|
||||
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));
|
||||
|
||||
@ -94,7 +94,7 @@ describe('<OrganizationEdit />', () => {
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<OrganizationEditNoRouter
|
||||
<_OrganizationEdit
|
||||
history={history}
|
||||
organization={mockData}
|
||||
api={api}
|
||||
|
@ -3,7 +3,7 @@ import { mount } from 'enzyme';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
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));
|
||||
|
||||
@ -47,7 +47,7 @@ describe('<OrganizationAdd />', () => {
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<OrganizationAddNoRouter
|
||||
<_OrganizationAdd
|
||||
history={history}
|
||||
api={api}
|
||||
/>
|
||||
@ -68,7 +68,7 @@ describe('<OrganizationAdd />', () => {
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<OrganizationAddNoRouter
|
||||
<_OrganizationAdd
|
||||
history={history}
|
||||
api={api}
|
||||
/>
|
||||
@ -103,7 +103,7 @@ describe('<OrganizationAdd />', () => {
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<OrganizationAddNoRouter
|
||||
<_OrganizationAdd
|
||||
history={history}
|
||||
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';
|
||||
|
||||
import { ConfigContext } from '../../../context';
|
||||
import FormRow from '../../../components/FormRow';
|
||||
import FormField from '../../../components/FormField';
|
||||
import FormActionGroup from '../../../components/FormActionGroup';
|
||||
import AnsibleSelect from '../../../components/AnsibleSelect';
|
||||
@ -96,13 +97,7 @@ class OrganizationForm extends Component {
|
||||
onSubmit={this.handleSubmit}
|
||||
render={formik => (
|
||||
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridGap: '20px',
|
||||
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))'
|
||||
}}
|
||||
>
|
||||
<FormRow>
|
||||
<FormField
|
||||
id="edit-org-form-name"
|
||||
name="name"
|
||||
@ -139,7 +134,7 @@ class OrganizationForm extends Component {
|
||||
)
|
||||
)}
|
||||
</ConfigContext.Consumer>
|
||||
</div>
|
||||
</FormRow>
|
||||
<InstanceGroupsLookup
|
||||
api={api}
|
||||
value={instanceGroups}
|
||||
|
@ -84,5 +84,5 @@ OrganizationEdit.contextTypes = {
|
||||
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
||||
};
|
||||
|
||||
export { OrganizationEdit as OrganizationEditNoRouter };
|
||||
export { OrganizationEdit as _OrganizationEdit };
|
||||
export default withRouter(OrganizationEdit);
|
||||
|
@ -104,5 +104,5 @@ OrganizationAdd.contextTypes = {
|
||||
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string)
|
||||
};
|
||||
|
||||
export { OrganizationAdd as OrganizationAddNoRouter };
|
||||
export { OrganizationAdd as _OrganizationAdd };
|
||||
export default withRouter(OrganizationAdd);
|
||||
|
Loading…
Reference in New Issue
Block a user