Merge pull request #2599 from mabashian/stack-jt-checkboxes

Moved job template checkboxes into a group
This commit is contained in:
Michael Abashian 2016-06-24 11:19:44 -04:00 committed by GitHub
commit ac1f3e142f
4 changed files with 51 additions and 25 deletions

View File

@ -225,29 +225,36 @@ export default
text: 'Prompt on launch'
}
},
become_enabled: {
label: 'Enable Privilege Escalation',
type: 'checkbox',
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-playbook</code> command. </p>",
dataPlacement: 'right',
dataTitle: 'Become Privilege Escalation',
dataContainer: "body"
},
allow_callbacks: {
label: 'Allow Provisioning Callbacks',
type: 'checkbox',
addRequired: false,
editRequird: false,
ngChange: "toggleCallback('host_config_key')",
column: 2,
awPopOver: "<p>Enables creation of a provisioning callback URL. Using the URL a host can contact Tower and request a configuration update " +
"using this job template.</p>",
dataPlacement: 'right',
dataTitle: 'Allow Provisioning Callbacks',
dataContainer: "body"
checkbox_group: {
label: 'Options',
type: 'checkbox_group',
fields: [{
name: 'become_enabled',
label: 'Enable Privilege Escalation',
type: 'checkbox',
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-playbook</code> command. </p>",
dataPlacement: 'right',
dataTitle: 'Become Privilege Escalation',
dataContainer: "body",
labelClass: 'stack-inline'
}, {
name: 'allow_callbacks',
label: 'Allow Provisioning Callbacks',
type: 'checkbox',
addRequired: false,
editRequird: false,
ngChange: "toggleCallback('host_config_key')",
column: 2,
awPopOver: "<p>Enables creation of a provisioning callback URL. Using the URL a host can contact Tower and request a configuration update " +
"using this job template.</p>",
dataPlacement: 'right',
dataTitle: 'Allow Provisioning Callbacks',
dataContainer: "body",
labelClass: 'stack-inline'
}]
},
callback_url: {
label: 'Provisioning Callback URL',

View File

@ -110,6 +110,11 @@ angular.module('JobTemplatesHelper', ['Utilities'])
master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
}
if (form.fields[fld].type === 'checkbox_group') {
for(var j=0; j<form.fields[fld].fields.length; j++) {
scope[form.fields[fld].fields[j].name] = data[form.fields[fld].fields[j].name];
}
}
}
Wait('stop');
scope.url = data.url;

View File

@ -482,7 +482,14 @@
if (form.fields[fld].type === 'select' &&
fld !== 'playbook') {
data[fld] = $scope[fld].value;
} else {
}
else if(form.fields[fld].type === 'checkbox_group') {
// Loop across the checkboxes
for(var i=0; i<form.fields[fld].fields.length; i++) {
data[form.fields[fld].fields[i].name] = $scope[form.fields[fld].fields[i].name];
}
}
else {
if (fld !== 'variables' &&
fld !== 'survey') {
data[fld] = $scope[fld];

View File

@ -599,7 +599,14 @@ export default
if (form.fields[fld].type === 'select' &&
fld !== 'playbook') {
data[fld] = $scope[fld].value;
} else {
}
else if(form.fields[fld].type === 'checkbox_group') {
// Loop across the checkboxes
for(var i=0; i<form.fields[fld].fields.length; i++) {
data[form.fields[fld].fields[i].name] = $scope[form.fields[fld].fields[i].name];
}
}
else {
if (fld !== 'variables' &&
fld !== 'survey') {
data[fld] = $scope[fld];