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

added become and verbosity support to adhoc UI

This commit is contained in:
John Mitchell 2015-04-14 15:38:35 -04:00
parent ed0f6a7918
commit e4518895cb
2 changed files with 50 additions and 4 deletions

View File

@ -23,7 +23,8 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
generator = GenerateForm,
form = AdhocForm,
master = {},
id = $routeParams.inventory_id;
id = $routeParams.inventory_id,
choicesReadyCount = 0;
// inject the adhoc command form
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
@ -63,10 +64,10 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
$scope.providedHostPatterns = $scope.limit;
delete $rootScope.hostPatterns;
if ($scope.removeChoicesReady) {
$scope.removeChoicesReady();
if ($scope.removeLookUpInitialize) {
$scope.removeLookUpInitialize();
}
$scope.removeChoicesReady = $scope.$on('choicesReadyAdhoc', function () {
$scope.removeLookUpInitialize = $scope.$on('lookUpInitialize', function () {
LookUpInit({
scope: $scope,
form: form,
@ -79,6 +80,17 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
Wait('stop'); // END: form population
});
if ($scope.removeChoicesReady) {
$scope.removeChoicesReady();
}
$scope.removeChoicesReady = $scope.$on('choicesReadyAdhoc', function () {
choicesReadyCount++;
if (choicesReadyCount === 2) {
$scope.$emit('lookUpInitialize');
}
});
// setup Machine Credential lookup
GetChoices({
scope: $scope,
@ -88,6 +100,15 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
callback: 'choicesReadyAdhoc'
});
// setup verbosity options lookup
GetChoices({
scope: $scope,
url: url,
field: 'verbosity',
variable: 'adhoc_verbosity_options',
callback: 'choicesReadyAdhoc'
});
// launch the job with the provided form data
$scope.launchJob = function () {
var fld, data={}, html;

View File

@ -67,6 +67,7 @@ export default
sourceModel: 'credential',
sourceField: 'name',
ngClick: 'lookUpCredential()',
class: 'squeeze',
awPopOver: '<p>Select the credential you want to use when ' +
'accessing the remote hosts to run the command. ' +
'Choose the credential containing ' +
@ -79,6 +80,30 @@ export default
variable: 'credRequired',
init: 'false'
}
},
become_enabled: {
label: 'Enable Become for Credential',
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'
},
verbosity: {
label: 'Verbosity',
excludeModal: true,
type: 'select',
ngOptions: 'verbosity.label for verbosity in ' +
'adhoc_verbosity_options ' +
'track by verbosity.value',
editRequired: true,
awPopOver:'<p>These are the verbosity levels for standard ' +
'out of the command run that are supported.',
dataTitle: 'Module',
dataPlacement: 'right',
dataContainer: 'body'
}
},