mirror of
https://github.com/ansible/awx.git
synced 2026-07-04 04:48:02 -02:30
Fixes bug where cred password fiield was displaying ASK
This commit is contained in:
committed by
Shane McDonald
parent
29d57ea403
commit
f4bc69d5f7
@@ -245,6 +245,7 @@ function CredentialForm({
|
|||||||
};
|
};
|
||||||
|
|
||||||
Object.values(credentialTypes).forEach(credentialType => {
|
Object.values(credentialTypes).forEach(credentialType => {
|
||||||
|
if (!credential.id || credential.credential_type === credentialType.id) {
|
||||||
const fields = credentialType.inputs.fields || [];
|
const fields = credentialType.inputs.fields || [];
|
||||||
fields.forEach(
|
fields.forEach(
|
||||||
({ ask_at_runtime, type, id, choices, default: defaultValue }) => {
|
({ ask_at_runtime, type, id, choices, default: defaultValue }) => {
|
||||||
@@ -252,8 +253,11 @@ function CredentialForm({
|
|||||||
if (ask_at_runtime) {
|
if (ask_at_runtime) {
|
||||||
initialValues.passwordPrompts[id] =
|
initialValues.passwordPrompts[id] =
|
||||||
credential.inputs[id] === 'ASK' || false;
|
credential.inputs[id] === 'ASK' || false;
|
||||||
}
|
initialValues.inputs[id] =
|
||||||
|
credential.inputs[id] === 'ASK' ? '' : credential.inputs[id];
|
||||||
|
} else {
|
||||||
initialValues.inputs[id] = credential.inputs[id];
|
initialValues.inputs[id] = credential.inputs[id];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'string':
|
case 'string':
|
||||||
@@ -276,6 +280,7 @@ function CredentialForm({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.values(inputSources).forEach(inputSource => {
|
Object.values(inputSources).forEach(inputSource => {
|
||||||
|
|||||||
@@ -30,13 +30,15 @@ function CredentialInput({ fieldOptions, credentialKind, ...rest }) {
|
|||||||
const [fileName, setFileName] = useState('');
|
const [fileName, setFileName] = useState('');
|
||||||
const [fileIsUploading, setFileIsUploading] = useState(false);
|
const [fileIsUploading, setFileIsUploading] = useState(false);
|
||||||
const [subFormField, meta, helpers] = useField(`inputs.${fieldOptions.id}`);
|
const [subFormField, meta, helpers] = useField(`inputs.${fieldOptions.id}`);
|
||||||
|
const [passwordPromptsField] = useField(`passwordPrompts.${fieldOptions.id}`);
|
||||||
const isValid = !(meta.touched && meta.error);
|
const isValid = !(meta.touched && meta.error);
|
||||||
|
|
||||||
const RevertReplaceButton = (
|
const RevertReplaceButton = (
|
||||||
<>
|
<>
|
||||||
{meta.initialValue &&
|
{meta.initialValue &&
|
||||||
meta.initialValue !== '' &&
|
meta.initialValue !== '' &&
|
||||||
!meta.initialValue.credential && (
|
!meta.initialValue.credential &&
|
||||||
|
!passwordPromptsField.value && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
id={`credential-${fieldOptions.id}-replace-tooltip`}
|
id={`credential-${fieldOptions.id}-replace-tooltip`}
|
||||||
content={meta.value !== meta.initialValue ? t`Revert` : t`Replace`}
|
content={meta.value !== meta.initialValue ? t`Revert` : t`Replace`}
|
||||||
|
|||||||
Reference in New Issue
Block a user