mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Redirect with query params and update EE form with hub image data
This commit is contained in:
@@ -100,7 +100,7 @@ const AuthorizedRoutes = ({ routeConfig }) => {
|
|||||||
|
|
||||||
const ProtectedRoute = ({ children, ...rest }) => {
|
const ProtectedRoute = ({ children, ...rest }) => {
|
||||||
const { authRedirectTo, setAuthRedirectTo } = useSession();
|
const { authRedirectTo, setAuthRedirectTo } = useSession();
|
||||||
const { pathname } = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAuthRedirectTo(authRedirectTo === '/logout' ? '/' : pathname);
|
setAuthRedirectTo(authRedirectTo === '/logout' ? '/' : pathname);
|
||||||
@@ -116,6 +116,12 @@ const ProtectedRoute = ({ children, ...rest }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAuthRedirectTo(
|
||||||
|
authRedirectTo === '/logout'
|
||||||
|
? '/'
|
||||||
|
: `${location.pathname}${location.search}`
|
||||||
|
);
|
||||||
|
|
||||||
return <Redirect to="/login" />;
|
return <Redirect to="/login" />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,21 @@ function ExecutionEnvironmentAdd() {
|
|||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
history.push(`/execution_environments`);
|
history.push(`/execution_environments`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hubParams = {
|
||||||
|
image: '',
|
||||||
|
credential: null // reverse lookup?
|
||||||
|
};
|
||||||
|
history.location.search.replace(/^\?/, '')
|
||||||
|
.split('&')
|
||||||
|
.map((s) => s.split('='))
|
||||||
|
.forEach(([key, val]) => {
|
||||||
|
if (!(key in hubParams)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hubParams[key] = decodeURIComponent(val);
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSection>
|
<PageSection>
|
||||||
<Card>
|
<Card>
|
||||||
@@ -38,6 +53,7 @@ function ExecutionEnvironmentAdd() {
|
|||||||
submitError={submitError}
|
submitError={submitError}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
me={me || {}}
|
me={me || {}}
|
||||||
|
executionEnvironment={hubParams}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Config>
|
</Config>
|
||||||
|
|||||||
Reference in New Issue
Block a user