Fixes for AC-212 & AC-2088

This commit is contained in:
chouseknecht
2013-07-11 17:18:25 -04:00
parent 36e8dcff7c
commit ab6fca64a0
15 changed files with 374 additions and 327 deletions

View File

@@ -250,12 +250,16 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP
try {
// Make sure we have valid variable data
if (scope.parseType == 'json') {
var myjson = JSON.parse(scope.variables); //make sure JSON parses
var json_data = scope.variables;
var json_data = JSON.parse(scope.variables); //make sure JSON parses
}
else {
var json_data = jsyaml.load(scope.variables); //parse yaml
}
// Make sure our JSON is actually an object
if (typeof json_data !== 'object') {
throw "failed to return an object!";
}
for (var fld in form.fields) {
if (form.fields[fld].type == 'select' && fld != 'playbook') {
@@ -479,6 +483,11 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route
var json_data = jsyaml.load(scope.variables); //parse yaml
}
// Make sure our JSON is actually an object
if (typeof json_data !== 'object') {
throw "failed to return an object!";
}
for (var fld in form.fields) {
if (form.fields[fld].type == 'select' && fld != 'playbook') {
data[fld] = scope[fld].value;