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
4 changed files with 51 additions and 25 deletions

View File

@@ -225,7 +225,11 @@ export default
text: 'Prompt on launch' text: 'Prompt on launch'
} }
}, },
become_enabled: { checkbox_group: {
label: 'Options',
type: 'checkbox_group',
fields: [{
name: 'become_enabled',
label: 'Enable Privilege Escalation', label: 'Enable Privilege Escalation',
type: 'checkbox', type: 'checkbox',
addRequired: false, addRequired: false,
@@ -234,9 +238,10 @@ export default
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>", 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', dataPlacement: 'right',
dataTitle: 'Become Privilege Escalation', dataTitle: 'Become Privilege Escalation',
dataContainer: "body" dataContainer: "body",
}, labelClass: 'stack-inline'
allow_callbacks: { }, {
name: 'allow_callbacks',
label: 'Allow Provisioning Callbacks', label: 'Allow Provisioning Callbacks',
type: 'checkbox', type: 'checkbox',
addRequired: false, addRequired: false,
@@ -247,7 +252,9 @@ export default
"using this job template.</p>", "using this job template.</p>",
dataPlacement: 'right', dataPlacement: 'right',
dataTitle: 'Allow Provisioning Callbacks', dataTitle: 'Allow Provisioning Callbacks',
dataContainer: "body" dataContainer: "body",
labelClass: 'stack-inline'
}]
}, },
callback_url: { callback_url: {
label: 'Provisioning 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] = master[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField] =
scope[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'); Wait('stop');
scope.url = data.url; scope.url = data.url;

View File

@@ -482,7 +482,14 @@
if (form.fields[fld].type === 'select' && if (form.fields[fld].type === 'select' &&
fld !== 'playbook') { fld !== 'playbook') {
data[fld] = $scope[fld].value; 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' && if (fld !== 'variables' &&
fld !== 'survey') { fld !== 'survey') {
data[fld] = $scope[fld]; data[fld] = $scope[fld];

View File

@@ -599,7 +599,14 @@ export default
if (form.fields[fld].type === 'select' && if (form.fields[fld].type === 'select' &&
fld !== 'playbook') { fld !== 'playbook') {
data[fld] = $scope[fld].value; 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' && if (fld !== 'variables' &&
fld !== 'survey') { fld !== 'survey') {
data[fld] = $scope[fld]; data[fld] = $scope[fld];