1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Removed logic comparing credential_type integer

This commit is contained in:
Michael Abashian 2017-07-11 19:20:40 -04:00
parent 690cb4ed6d
commit 2a3235690e

View File

@ -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