mirror of
https://github.com/ansible/awx.git
synced 2024-10-27 09:25:10 +03:00
excise withRouter from function components
This commit is contained in:
parent
e57991d498
commit
6eeb32a447
@ -1,5 +1,4 @@
|
||||
import React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { Formik } from 'formik';
|
||||
import { Form, Card } from '@patternfly/react-core';
|
||||
@ -67,4 +66,4 @@ function InventoryGroupForm({
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n()(withRouter(InventoryGroupForm));
|
||||
export default withI18n()(InventoryGroupForm);
|
||||
|
@ -1,6 +1,5 @@
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { Formik, useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
@ -206,4 +205,4 @@ OrganizationForm.contextTypes = {
|
||||
};
|
||||
|
||||
export { OrganizationForm as _OrganizationForm };
|
||||
export default withI18n()(withRouter(OrganizationForm));
|
||||
export default withI18n()(OrganizationForm);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withRouter, useHistory } from 'react-router-dom';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { CardBody } from '@components/Card';
|
||||
|
||||
import { TeamsAPI } from '@api';
|
||||
@ -50,5 +50,4 @@ TeamEdit.contextTypes = {
|
||||
custom_virtualenvs: PropTypes.arrayOf(PropTypes.string),
|
||||
};
|
||||
|
||||
export { TeamEdit as _TeamEdit };
|
||||
export default withRouter(TeamEdit);
|
||||
export default TeamEdit;
|
||||
|
@ -6,7 +6,6 @@ import {
|
||||
Switch,
|
||||
Route,
|
||||
Redirect,
|
||||
withRouter,
|
||||
Link,
|
||||
useLocation,
|
||||
useParams,
|
||||
@ -224,4 +223,4 @@ function Template({ i18n, me, setBreadcrumb }) {
|
||||
}
|
||||
|
||||
export { Template as _Template };
|
||||
export default withI18n()(withRouter(Template));
|
||||
export default withI18n()(Template);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { func, shape } from 'prop-types';
|
||||
@ -15,23 +15,19 @@ const QS_CONFIG = getQSConfig('inventory_sources', {
|
||||
order_by: 'name',
|
||||
});
|
||||
|
||||
function InventorySourcesList({
|
||||
history,
|
||||
i18n,
|
||||
nodeResource,
|
||||
onUpdateNodeResource,
|
||||
}) {
|
||||
function InventorySourcesList({ i18n, nodeResource, onUpdateNodeResource }) {
|
||||
const [count, setCount] = useState(0);
|
||||
const [error, setError] = useState(null);
|
||||
const [inventorySources, setInventorySources] = useState([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setIsLoading(true);
|
||||
setInventorySources([]);
|
||||
setCount(0);
|
||||
const params = parseQueryString(QS_CONFIG, history.location.search);
|
||||
const params = parseQueryString(QS_CONFIG, location.search);
|
||||
try {
|
||||
const { data } = await InventorySourcesAPI.read(params);
|
||||
setInventorySources(data.results);
|
||||
@ -42,7 +38,7 @@ function InventorySourcesList({
|
||||
setIsLoading(false);
|
||||
}
|
||||
})();
|
||||
}, [history.location]);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<PaginatedDataList
|
||||
@ -110,4 +106,4 @@ InventorySourcesList.defaultProps = {
|
||||
nodeResource: null,
|
||||
};
|
||||
|
||||
export default withI18n()(withRouter(InventorySourcesList));
|
||||
export default withI18n()(InventorySourcesList);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { func, shape } from 'prop-types';
|
||||
@ -15,23 +15,20 @@ const QS_CONFIG = getQSConfig('job_templates', {
|
||||
order_by: 'name',
|
||||
});
|
||||
|
||||
function JobTemplatesList({
|
||||
i18n,
|
||||
history,
|
||||
nodeResource,
|
||||
onUpdateNodeResource,
|
||||
}) {
|
||||
function JobTemplatesList({ i18n, nodeResource, onUpdateNodeResource }) {
|
||||
const [count, setCount] = useState(0);
|
||||
const [error, setError] = useState(null);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [jobTemplates, setJobTemplates] = useState([]);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setIsLoading(true);
|
||||
setJobTemplates([]);
|
||||
setCount(0);
|
||||
const params = parseQueryString(QS_CONFIG, history.location.search);
|
||||
const params = parseQueryString(QS_CONFIG, location.search);
|
||||
try {
|
||||
const { data } = await JobTemplatesAPI.read(params, {
|
||||
role_level: 'execute_role',
|
||||
@ -44,7 +41,7 @@ function JobTemplatesList({
|
||||
setIsLoading(false);
|
||||
}
|
||||
})();
|
||||
}, [history.location]);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<PaginatedDataList
|
||||
@ -106,4 +103,4 @@ JobTemplatesList.defaultProps = {
|
||||
nodeResource: null,
|
||||
};
|
||||
|
||||
export default withI18n()(withRouter(JobTemplatesList));
|
||||
export default withI18n()(JobTemplatesList);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { func, shape } from 'prop-types';
|
||||
@ -15,18 +15,20 @@ const QS_CONFIG = getQSConfig('projects', {
|
||||
order_by: 'name',
|
||||
});
|
||||
|
||||
function ProjectsList({ history, i18n, nodeResource, onUpdateNodeResource }) {
|
||||
function ProjectsList({ i18n, nodeResource, onUpdateNodeResource }) {
|
||||
const [count, setCount] = useState(0);
|
||||
const [error, setError] = useState(null);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [projects, setProjects] = useState([]);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setIsLoading(true);
|
||||
setProjects([]);
|
||||
setCount(0);
|
||||
const params = parseQueryString(QS_CONFIG, history.location.search);
|
||||
const params = parseQueryString(QS_CONFIG, location.search);
|
||||
try {
|
||||
const { data } = await ProjectsAPI.read(params);
|
||||
setProjects(data.results);
|
||||
@ -37,7 +39,7 @@ function ProjectsList({ history, i18n, nodeResource, onUpdateNodeResource }) {
|
||||
setIsLoading(false);
|
||||
}
|
||||
})();
|
||||
}, [history.location]);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<PaginatedDataList
|
||||
@ -109,4 +111,4 @@ ProjectsList.defaultProps = {
|
||||
nodeResource: null,
|
||||
};
|
||||
|
||||
export default withI18n()(withRouter(ProjectsList));
|
||||
export default withI18n()(ProjectsList);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { func, shape } from 'prop-types';
|
||||
@ -16,7 +16,6 @@ const QS_CONFIG = getQSConfig('workflow_job_templates', {
|
||||
});
|
||||
|
||||
function WorkflowJobTemplatesList({
|
||||
history,
|
||||
i18n,
|
||||
nodeResource,
|
||||
onUpdateNodeResource,
|
||||
@ -26,12 +25,14 @@ function WorkflowJobTemplatesList({
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [workflowJobTemplates, setWorkflowJobTemplates] = useState([]);
|
||||
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setIsLoading(true);
|
||||
setWorkflowJobTemplates([]);
|
||||
setCount(0);
|
||||
const params = parseQueryString(QS_CONFIG, history.location.search);
|
||||
const params = parseQueryString(QS_CONFIG, location.search);
|
||||
try {
|
||||
const { data } = await WorkflowJobTemplatesAPI.read(params, {
|
||||
role_level: 'execute_role',
|
||||
@ -44,7 +45,7 @@ function WorkflowJobTemplatesList({
|
||||
setIsLoading(false);
|
||||
}
|
||||
})();
|
||||
}, [history.location]);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<PaginatedDataList
|
||||
@ -110,4 +111,4 @@ WorkflowJobTemplatesList.defaultProps = {
|
||||
nodeResource: null,
|
||||
};
|
||||
|
||||
export default withI18n()(withRouter(WorkflowJobTemplatesList));
|
||||
export default withI18n()(WorkflowJobTemplatesList);
|
||||
|
@ -1,6 +1,5 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { withFormik, useField, useFormikContext } from 'formik';
|
||||
@ -639,4 +638,4 @@ const FormikApp = withFormik({
|
||||
})(JobTemplateForm);
|
||||
|
||||
export { JobTemplateForm as _JobTemplateForm };
|
||||
export default withI18n()(withRouter(FormikApp));
|
||||
export default withI18n()(FormikApp);
|
||||
|
@ -1,13 +1,15 @@
|
||||
import React, { useState } from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { CardBody } from '@components/Card';
|
||||
import UserForm from '../shared/UserForm';
|
||||
import { UsersAPI } from '@api';
|
||||
|
||||
function UserEdit({ user, history }) {
|
||||
function UserEdit({ user }) {
|
||||
const [formSubmitError, setFormSubmitError] = useState(null);
|
||||
|
||||
const history = useHistory();
|
||||
|
||||
const handleSubmit = async values => {
|
||||
setFormSubmitError(null);
|
||||
try {
|
||||
@ -34,4 +36,4 @@ function UserEdit({ user, history }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default withI18n()(withRouter(UserEdit));
|
||||
export default withI18n()(UserEdit);
|
||||
|
Loading…
Reference in New Issue
Block a user