adhoc form fixes

added forks input
fixed privilege escalation language, it now mimics job template
fixed a hanging issue when a non-machine credential is used
fixed reset to include the default verbosity setting
This commit is contained in:
John Mitchell 2015-04-27 10:13:25 -04:00
parent a081614c9a
commit 4bdab2d2fa
4 changed files with 45 additions and 45 deletions

View File

@ -36,6 +36,7 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
$scope.id = id;
$scope.argsPopOver = "<p>These arguments are used with the" +
" specified module.</p>";
// fix arguments help popover based on the module selected
$scope.moduleChange = function () {
// NOTE: for selenium testing link -
@ -64,20 +65,13 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
$scope.providedHostPatterns = $scope.limit;
delete $rootScope.hostPatterns;
if ($scope.removeLookUpInitialize) {
$scope.removeLookUpInitialize();
}
$scope.removeLookUpInitialize = $scope.$on('lookUpInitialize', function () {
LookUpInit({
scope: $scope,
form: form,
current_item: (!Empty($scope.credential_id)) ? $scope.credential_id : null,
list: CredentialList,
field: 'credential',
input_type: 'radio'
});
Wait('stop'); // END: form population
LookUpInit({
scope: $scope,
form: form,
current_item: (!Empty($scope.credential_id)) ? $scope.credential_id : null,
list: CredentialList,
field: 'credential',
input_type: 'radio'
});
if ($scope.removeChoicesReady) {
@ -87,9 +81,10 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
choicesReadyCount++;
if (choicesReadyCount === 2) {
// this sets the default option as specified by the controller.
// this sets the default options for the selects as specified by the controller.
$scope.verbosity = $scope.adhoc_verbosity_options[$scope.verbosity_field.default];
$scope.$emit('lookUpInitialize');
$("#forks-number").spinner("value", $scope.forks_field.default);
Wait('stop'); // END: form population
}
});
@ -212,23 +207,6 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
credential: $scope.credential,
callback: 'ContinueCred'
});
// // Launch the adhoc job
// Rest.setUrl(url);
// Rest.post(data)
// .success(function (data) {
// Wait('stop');
// $location.path("/ad_hoc_commands/" + data.id);
// })
// .error(function (data, status) {
// ProcessErrors($scope, data, status, form, { hdr: 'Error!',
// msg: 'Failed to launch adhoc command. POST returned status: ' +
// status });
// // TODO: still need to implement popping up a password prompt
// // if the credential requires it. The way that the current end-
// // point works is that I find out if I need to ask for a
// // password from POST, thus I get an error response.
// });
};
// Remove all data input into the form
@ -239,6 +217,8 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
}
$scope.limit = $scope.providedHostPatterns;
KindChange({ scope: $scope, form: form, reset: false });
$scope.verbosity = $scope.adhoc_verbosity_options[$scope.verbosity_field.default];
$("#forks-number").spinner("value", $scope.forks_field.default);
};
}

View File

@ -82,14 +82,15 @@ export default
}
},
become_enabled: {
label: 'Enable Become for Credential',
label: 'Enable Privilege Escalation',
type: 'checkbox',
editRequired: false
// awPopOver: '<p>If checked, user will be become the user ' +
// 'specified by the credential.</p>',
// dataPlacement: 'right',
// dataTitle: 'Enable Become for Credential',
// dataContainer: 'body'
addRequired: false,
editRequird: false,
column: 2,
awPopOver: "<p>If enabled, run this playbook as an administrator. This is the equivalent of passing the<code> --become</code> option to the <code> ansible</code> command. </p>",
dataPlacement: 'right',
dataTitle: 'Become Privilege Escalation',
dataContainer: "body"
},
verbosity: {
label: 'Verbosity',
@ -104,8 +105,28 @@ export default
'out of the command run that are supported.',
dataTitle: 'Module',
dataPlacement: 'right',
dataContainer: 'body'
}
dataContainer: 'body',
default: 1
},
forks: {
label: 'Forks',
id: 'forks-number',
type: 'number',
integer: true,
min: 0,
spinner: true,
"default": 0,
addRequired: false,
editRequired: false,
'class': "input-small",
column: 1,
awPopOver: '<p>The number of parallel or simultaneous processes to use while executing the command. 0 signifies ' +
'the default value from the <a id="ansible_forks_docs" href=\"http://docs.ansible.com/intro_configuration.html#the-ansible-configuration-file\" ' +
' target=\"_blank\">ansible configuration file</a>.</p>',
dataTitle: 'Forks',
dataPlacement: 'right',
dataContainer: "body"
},
},
buttons: {

View File

@ -176,7 +176,7 @@ export default
'class': "input-small",
column: 1,
awPopOver: '<p>The number of parallel or simultaneous processes to use while executing the playbook. 0 signifies ' +
'the default value from the <a href=\"http://docs.ansible.com/intro_configuration.html#the-ansible-configuration-file\" ' +
'the default value from the <a id="ansible_forks_docs" href=\"http://docs.ansible.com/intro_configuration.html#the-ansible-configuration-file\" ' +
' target=\"_blank\">ansible configuration file</a>.</p>',
dataTitle: 'Forks',
dataPlacement: 'right',

View File

@ -710,9 +710,8 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
if(data.vault_password === "ASK"){
passwords.push("vault_password");
}
scope.$emit(callback, passwords);
}
scope.$emit(callback, passwords);
})
.error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',