1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-28 02:25:27 +03:00

Merge pull request #5693 from ryanpetrello/ad_hoc_extra_vars

add ui support for specifying extra vars for ad-hoc commands
This commit is contained in:
Ryan Petrello 2017-03-13 11:39:02 -04:00 committed by GitHub
commit c13242305f
2 changed files with 28 additions and 4 deletions

View File

@ -12,7 +12,7 @@
function adhocController($q, $scope, $location, $stateParams, function adhocController($q, $scope, $location, $stateParams,
$state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm, $state, CheckPasswords, PromptForPasswords, CreateLaunchDialog, CreateSelect2, adhocForm,
GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices, GenerateForm, Rest, ProcessErrors, ClearScope, GetBasePath, GetChoices,
KindChange, CredentialList, Empty, Wait) { KindChange, CredentialList, ParseTypeChange, Empty, Wait) {
ClearScope(); ClearScope();
@ -162,6 +162,12 @@ function adhocController($q, $scope, $location, $stateParams,
privateFn.initializeForm(id, urls, hostPattern); privateFn.initializeForm(id, urls, hostPattern);
// init codemirror
$scope.extra_vars = '---';
$scope.parseType = 'yaml';
$scope.envParseType = 'yaml';
ParseTypeChange({ scope: $scope, field_id: 'adhoc_extra_vars' , variable: "extra_vars"});
$scope.formCancel = function(){ $scope.formCancel = function(){
$state.go('inventoryManage'); $state.go('inventoryManage');
}; };
@ -199,6 +205,7 @@ function adhocController($q, $scope, $location, $stateParams,
"module_args": "", "module_args": "",
"forks": 0, "forks": 0,
"verbosity": 0, "verbosity": 0,
"extra_vars": "",
"privilege_escalation": "" "privilege_escalation": ""
}; };
@ -297,5 +304,5 @@ function adhocController($q, $scope, $location, $stateParams,
export default ['$q', '$scope', '$location', '$stateParams', export default ['$q', '$scope', '$location', '$stateParams',
'$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2', '$state', 'CheckPasswords', 'PromptForPasswords', 'CreateLaunchDialog', 'CreateSelect2',
'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath', 'adhocForm', 'GenerateForm', 'Rest', 'ProcessErrors', 'ClearScope', 'GetBasePath',
'GetChoices', 'KindChange', 'CredentialList', 'Empty', 'Wait', 'GetChoices', 'KindChange', 'CredentialList', 'ParseTypeChange', 'Empty', 'Wait',
adhocController]; adhocController];

View File

@ -10,7 +10,7 @@
* @description This form is for executing an adhoc command * @description This form is for executing an adhoc command
*/ */
export default function() { export default ['i18n', function(i18n) {
return { return {
addTitle: 'EXECUTE COMMAND', addTitle: 'EXECUTE COMMAND',
name: 'adhoc', name: 'adhoc',
@ -121,6 +121,23 @@ export default function() {
dataPlacement: 'right', dataPlacement: 'right',
dataContainer: "body" dataContainer: "body"
}, },
extra_vars: {
label: i18n._('Extra Variables'),
type: 'textarea',
class: 'Form-textAreaLabel Form-formGroup--fullWidth',
rows: 6,
"default": "---",
column: 2,
awPopOver: "<p>" + i18n.sprintf(i18n._("Pass extra command line variables. This is the %s or %s command line parameter " +
"for %s. Provide key/value pairs using either YAML or JSON."), '<code>-e</code>', '<code>--extra-vars</code>', '<code>ansible</code>') + "</p>" +
"JSON:<br />\n" +
"<blockquote>{<br />&emsp;\"somevar\": \"somevalue\",<br />&emsp;\"password\": \"magic\"<br /> }</blockquote>\n" +
"YAML:<br />\n" +
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n",
dataTitle: i18n._('Extra Variables'),
dataPlacement: 'right',
dataContainer: "body"
}
}, },
buttons: { buttons: {
reset: { reset: {
@ -139,4 +156,4 @@ export default function() {
related: {} related: {}
}; };
} }];