hide priv esc fields and clear their values out when no priv escalation is chosen

This commit is contained in:
John Mitchell 2015-08-26 18:56:49 -04:00
parent 2e6845769a
commit efa306d1f3
2 changed files with 11 additions and 2 deletions

View File

@ -428,6 +428,15 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $
}
master.become_method = $scope.become_method;
$scope.$watch('become_method', function(val) {
if (val !== null) {
if (val.value === "") {
$scope.become_username = "";
$scope.become_password = "";
}
}
});
for (i = 0; i < $scope.credential_kind_options.length; i++) {
if ($scope.credential_kind_options[i].value === data.kind) {
$scope.kind = $scope.credential_kind_options[i];

View File

@ -296,7 +296,7 @@ export default
"become_username": {
label: 'Privilege Escalation Username',
type: 'text',
ngShow: "kind.value == 'ssh' && become_method",
ngShow: "kind.value == 'ssh' && (become_method && become_method.value)",
addRequired: false,
editRequired: false,
autocomplete: false
@ -304,7 +304,7 @@ export default
"become_password": {
label: 'Privilege Escalation Password',
type: 'sensitive',
ngShow: "kind.value == 'ssh' && become_method",
ngShow: "kind.value == 'ssh' && (become_method && become_method.value)",
addRequired: false,
editRequired: false,
ask: true,