mirror of
https://github.com/ansible/awx.git
synced 2026-03-08 05:01:09 -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,37 +245,42 @@ function CredentialForm({
|
|||||||
};
|
};
|
||||||
|
|
||||||
Object.values(credentialTypes).forEach(credentialType => {
|
Object.values(credentialTypes).forEach(credentialType => {
|
||||||
const fields = credentialType.inputs.fields || [];
|
if (!credential.id || credential.credential_type === credentialType.id) {
|
||||||
fields.forEach(
|
const fields = credentialType.inputs.fields || [];
|
||||||
({ ask_at_runtime, type, id, choices, default: defaultValue }) => {
|
fields.forEach(
|
||||||
if (credential?.inputs && id in credential.inputs) {
|
({ ask_at_runtime, type, id, choices, default: defaultValue }) => {
|
||||||
if (ask_at_runtime) {
|
if (credential?.inputs && id in credential.inputs) {
|
||||||
initialValues.passwordPrompts[id] =
|
if (ask_at_runtime) {
|
||||||
credential.inputs[id] === 'ASK' || false;
|
initialValues.passwordPrompts[id] =
|
||||||
}
|
credential.inputs[id] === 'ASK' || false;
|
||||||
initialValues.inputs[id] = credential.inputs[id];
|
initialValues.inputs[id] =
|
||||||
} else {
|
credential.inputs[id] === 'ASK' ? '' : credential.inputs[id];
|
||||||
switch (type) {
|
} else {
|
||||||
case 'string':
|
initialValues.inputs[id] = credential.inputs[id];
|
||||||
initialValues.inputs[id] = defaultValue || '';
|
}
|
||||||
break;
|
} else {
|
||||||
case 'boolean':
|
switch (type) {
|
||||||
initialValues.inputs[id] = defaultValue || false;
|
case 'string':
|
||||||
break;
|
initialValues.inputs[id] = defaultValue || '';
|
||||||
default:
|
break;
|
||||||
break;
|
case 'boolean':
|
||||||
}
|
initialValues.inputs[id] = defaultValue || false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (choices) {
|
if (choices) {
|
||||||
initialValues.inputs[id] = defaultValue;
|
initialValues.inputs[id] = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ask_at_runtime) {
|
if (ask_at_runtime) {
|
||||||
initialValues.passwordPrompts[id] = false;
|
initialValues.passwordPrompts[id] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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