mirror of
https://github.com/ansible/awx.git
synced 2026-04-05 01:59:25 -02:30
added become and verbosity support to adhoc UI
This commit is contained in:
@@ -23,7 +23,8 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
|
|||||||
generator = GenerateForm,
|
generator = GenerateForm,
|
||||||
form = AdhocForm,
|
form = AdhocForm,
|
||||||
master = {},
|
master = {},
|
||||||
id = $routeParams.inventory_id;
|
id = $routeParams.inventory_id,
|
||||||
|
choicesReadyCount = 0;
|
||||||
|
|
||||||
// inject the adhoc command form
|
// inject the adhoc command form
|
||||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||||
@@ -63,10 +64,10 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
|
|||||||
$scope.providedHostPatterns = $scope.limit;
|
$scope.providedHostPatterns = $scope.limit;
|
||||||
delete $rootScope.hostPatterns;
|
delete $rootScope.hostPatterns;
|
||||||
|
|
||||||
if ($scope.removeChoicesReady) {
|
if ($scope.removeLookUpInitialize) {
|
||||||
$scope.removeChoicesReady();
|
$scope.removeLookUpInitialize();
|
||||||
}
|
}
|
||||||
$scope.removeChoicesReady = $scope.$on('choicesReadyAdhoc', function () {
|
$scope.removeLookUpInitialize = $scope.$on('lookUpInitialize', function () {
|
||||||
LookUpInit({
|
LookUpInit({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
form: form,
|
form: form,
|
||||||
@@ -79,6 +80,17 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
|
|||||||
Wait('stop'); // END: form population
|
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
|
// setup Machine Credential lookup
|
||||||
GetChoices({
|
GetChoices({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -88,6 +100,15 @@ export function AdhocCtrl($scope, $rootScope, $location, $routeParams,
|
|||||||
callback: 'choicesReadyAdhoc'
|
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
|
// launch the job with the provided form data
|
||||||
$scope.launchJob = function () {
|
$scope.launchJob = function () {
|
||||||
var fld, data={}, html;
|
var fld, data={}, html;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ export default
|
|||||||
sourceModel: 'credential',
|
sourceModel: 'credential',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
ngClick: 'lookUpCredential()',
|
ngClick: 'lookUpCredential()',
|
||||||
|
class: 'squeeze',
|
||||||
awPopOver: '<p>Select the credential you want to use when ' +
|
awPopOver: '<p>Select the credential you want to use when ' +
|
||||||
'accessing the remote hosts to run the command. ' +
|
'accessing the remote hosts to run the command. ' +
|
||||||
'Choose the credential containing ' +
|
'Choose the credential containing ' +
|
||||||
@@ -79,6 +80,30 @@ export default
|
|||||||
variable: 'credRequired',
|
variable: 'credRequired',
|
||||||
init: 'false'
|
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'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user