mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 04:10:44 -03:30
Redirect with query params and update EE form with hub image data
This commit is contained in:
parent
7eefa897b3
commit
8e34898b4e
@ -100,7 +100,7 @@ const AuthorizedRoutes = ({ routeConfig }) => {
|
||||
|
||||
const ProtectedRoute = ({ children, ...rest }) => {
|
||||
const { authRedirectTo, setAuthRedirectTo } = useSession();
|
||||
const { pathname } = useLocation();
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
setAuthRedirectTo(authRedirectTo === '/logout' ? '/' : pathname);
|
||||
@ -116,6 +116,12 @@ const ProtectedRoute = ({ children, ...rest }) => {
|
||||
);
|
||||
}
|
||||
|
||||
setAuthRedirectTo(
|
||||
authRedirectTo === '/logout'
|
||||
? '/'
|
||||
: `${location.pathname}${location.search}`
|
||||
);
|
||||
|
||||
return <Redirect to="/login" />;
|
||||
};
|
||||
|
||||
|
||||
@ -27,6 +27,21 @@ function ExecutionEnvironmentAdd() {
|
||||
const handleCancel = () => {
|
||||
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 (
|
||||
<PageSection>
|
||||
<Card>
|
||||
@ -38,6 +53,7 @@ function ExecutionEnvironmentAdd() {
|
||||
submitError={submitError}
|
||||
onCancel={handleCancel}
|
||||
me={me || {}}
|
||||
executionEnvironment={hubParams}
|
||||
/>
|
||||
)}
|
||||
</Config>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user