diff --git a/awx/ui/client/features/credentials/add-edit-credentials.controller.js b/awx/ui/client/features/credentials/add-edit-credentials.controller.js
index 8c47d40637..306c60bfab 100644
--- a/awx/ui/client/features/credentials/add-edit-credentials.controller.js
+++ b/awx/ui/client/features/credentials/add-edit-credentials.controller.js
@@ -221,6 +221,7 @@ function AddEditCredentialsController (
vm.form[field].tagMode = true;
vm.form[field].asTag = false;
vm.form[field]._value = '';
+ vm.form[field]._tagValue = '';
vm.inputSources.items = vm.inputSources.items
.filter(({ input_field_name }) => input_field_name !== field);
};
@@ -239,7 +240,13 @@ function AddEditCredentialsController (
vm.inputSources.credentialName = name;
vm.inputSources.credentialTypeId = credential_type_id;
vm.inputSources._value = credential_type_id;
+ } else {
+ vm.inputSources.credentialId = null;
+ vm.inputSources.credentialName = null;
+ vm.inputSources.credentialTypeId = null;
+ vm.inputSources._value = null;
}
+
setInputSourceTab('credential');
vm.inputSources.field = field;
};
@@ -324,7 +331,8 @@ function AddEditCredentialsController (
vm.inputSources.metadataInputs = null;
unsetInputSourceTabs();
// We've linked this field to a credential, so display value as a credential tag
- vm.form[field]._value = credentialName;
+ vm.form[field]._value = '';
+ vm.form[field]._tagValue = credentialName;
vm.form[field].asTag = true;
};
diff --git a/awx/ui/client/lib/components/input/secret.directive.js b/awx/ui/client/lib/components/input/secret.directive.js
index 01b16d412b..1d1384fcfc 100644
--- a/awx/ui/client/lib/components/input/secret.directive.js
+++ b/awx/ui/client/lib/components/input/secret.directive.js
@@ -21,17 +21,13 @@ function AtInputSecretController (baseInputController) {
scope = _scope_;
scope.type = 'password';
+ scope.state._show = false;
if (!scope.state._value || scope.state._promptOnLaunch) {
scope.mode = 'input';
- scope.state._buttonText = vm.strings.get('SHOW');
-
- vm.toggle = vm.toggleShowHide;
} else {
scope.mode = 'encrypted';
- scope.state._buttonText = vm.strings.get('REPLACE');
scope.state._placeholder = vm.strings.get('ENCRYPTED');
- vm.toggle = vm.toggleRevertReplace;
}
vm.check();
@@ -41,15 +37,28 @@ function AtInputSecretController (baseInputController) {
scope.state._isBeingReplaced = !scope.state._isBeingReplaced;
vm.onRevertReplaceToggle();
+
+ if (scope.state._isBeingReplaced) {
+ if (scope.type !== 'password') {
+ vm.toggleShowHide();
+ }
+ }
};
vm.toggleShowHide = () => {
if (scope.type === 'password') {
scope.type = 'text';
- scope.state._buttonText = vm.strings.get('HIDE');
+ scope.state._show = true;
} else {
scope.type = 'password';
- scope.state._buttonText = vm.strings.get('SHOW');
+ scope.state._show = false;
+ }
+ };
+
+ vm.onLookupClick = () => {
+ if (scope.state._onInputLookup) {
+ const { id, label, required, type } = scope.state;
+ scope.state._onInputLookup({ id, label, required, type });
}
};
}
diff --git a/awx/ui/client/lib/components/input/secret.partial.html b/awx/ui/client/lib/components/input/secret.partial.html
index fa529f08a9..3a0fc29c89 100644
--- a/awx/ui/client/lib/components/input/secret.partial.html
+++ b/awx/ui/client/lib/components/input/secret.partial.html
@@ -3,18 +3,25 @@