mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Remove URL params when closing wizard
Remove URL params when closing wizard See: https://github.com/ansible/awx/issues/10240
This commit is contained in:
parent
0c0028541d
commit
95e796a88a
@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { useLocation, useHistory } from 'react-router-dom';
|
||||
import { t } from '@lingui/macro';
|
||||
import { useField } from 'formik';
|
||||
import {
|
||||
@ -23,6 +23,8 @@ function CredentialPluginInput(props) {
|
||||
const [showPluginWizard, setShowPluginWizard] = useState(false);
|
||||
const [inputField, meta, helpers] = useField(`inputs.${fieldOptions.id}`);
|
||||
const [passwordPromptField] = useField(`passwordPrompts.${fieldOptions.id}`);
|
||||
const location = useLocation();
|
||||
const history = useHistory();
|
||||
|
||||
const disableFieldAndButtons =
|
||||
!!passwordPromptField.value ||
|
||||
@ -32,6 +34,11 @@ function CredentialPluginInput(props) {
|
||||
meta.value === meta.initialValue
|
||||
);
|
||||
|
||||
const handlePluginWizardClose = () => {
|
||||
setShowPluginWizard(false);
|
||||
history.push(location.pathname);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{inputField?.value?.credential ? (
|
||||
@ -73,7 +80,7 @@ function CredentialPluginInput(props) {
|
||||
initialValues={
|
||||
typeof inputField.value === 'object' ? inputField.value : {}
|
||||
}
|
||||
onClose={() => setShowPluginWizard(false)}
|
||||
onClose={() => handlePluginWizardClose()}
|
||||
onSubmit={val => {
|
||||
val.touched = true;
|
||||
helpers.setValue(val);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user