From 2a3235690e0ea20b29b7693997987c636ca558f3 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Tue, 11 Jul 2017 19:20:40 -0400 Subject: [PATCH] Removed logic comparing credential_type integer --- .../job-submission.controller.js | 67 ++++++++----------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/awx/ui/client/src/job-submission/job-submission.controller.js b/awx/ui/client/src/job-submission/job-submission.controller.js index ae1b699512..5572b860c2 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -73,49 +73,10 @@ export default $scope.ssh_password_required = false; $scope.ssh_key_unlock_required = false; $scope.become_password_required = false; - $scope.vault_password_required = false; $scope.ssh_password = ""; $scope.ssh_key_unlock = ""; $scope.become_password = ""; - $scope.vault_password = ""; - }; - - var updateRequiredPasswords = function() { - if($scope.selected_credentials.machine) { - if($scope.selected_credentials.machine.id === $scope.defaults.credential.id) { - clearRequiredPasswords(); - for(var i=0; i<$scope.passwords_needed_to_start.length; i++) { - var password = $scope.passwords_needed_to_start[i]; - switch(password) { - case "ssh_password": - $scope.ssh_password_required = true; - break; - case "ssh_key_unlock": - $scope.ssh_key_unlock_required = true; - break; - case "become_password": - $scope.become_password_required = true; - break; - case "vault_password": - $scope.vault_password_required = true; - break; - } - } - } - else { - if(parseInt($scope.selected_credentials.machine.credential_type) === 1){ - $scope.ssh_password_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.password === "ASK") ? true : false; - $scope.ssh_key_unlock_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.ssh_key_unlock === "ASK") ? true : false; - $scope.become_password_required = $scope.selected_credentials.machine.inputs && ($scope.selected_credentials.machine.inputs.become_password === "ASK") ? true : false; - $scope.vault_password_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.vault_password === "ASK") ? true : false; - } - else { - clearRequiredPasswords(); - } - } - } - }; var launchJob = function() { @@ -158,7 +119,33 @@ export default } $scope.$watch('selected_credentials.machine', function(){ - updateRequiredPasswords(); + if($scope.selected_credentials.machine) { + if($scope.selected_credentials.machine.id === $scope.defaults.credential.id) { + clearRequiredPasswords(); + for(var i=0; i<$scope.passwords_needed_to_start.length; i++) { + var password = $scope.passwords_needed_to_start[i]; + switch(password) { + case "ssh_password": + $scope.ssh_password_required = true; + break; + case "ssh_key_unlock": + $scope.ssh_key_unlock_required = true; + break; + case "become_password": + $scope.become_password_required = true; + break; + } + } + } + else { + $scope.ssh_password_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.password === "ASK") ? true : false; + $scope.ssh_key_unlock_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.ssh_key_unlock === "ASK") ? true : false; + $scope.become_password_required = $scope.selected_credentials.machine.inputs && ($scope.selected_credentials.machine.inputs.become_password === "ASK") ? true : false; + } + } + else { + clearRequiredPasswords(); + } }); // Get the job or job_template record