Host Config Key field and checkbox are on the Job detail page as well. Jobs controller now pulls the values from the related job template -API does not expose the values on /jobs/N.

This commit is contained in:
chouseknecht 2013-06-21 18:03:27 -04:00
parent 8ef9c9ed0b
commit baad4bd7e6
2 changed files with 24 additions and 12 deletions

View File

@ -191,18 +191,29 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Set the playbook lookup
getPlaybooks(scope.project);
// display/hide host callback fields
var dft = (scope['host_config_key']) ? 'true' : 'false';
md5Setup({
scope: scope,
master: master,
check_field: 'allow_callbacks',
default_val: dft
});
$('#forks-slider').slider("option", "value", scope.forks);
$('#forks-slider').slider("disable");
$('input[type="checkbox"]').attr('disabled','disabled');
// Get job template and display/hide host callback fields
Rest.setUrl(scope.template_url);
Rest.get()
.success( function(data, status, headers, config) {
var dft = (data['host_config_key']) ? 'true' : 'false';
scope['host_config_key'] = data['host_config_key'];
md5Setup({
scope: scope,
master: master,
check_field: 'allow_callbacks',
default_val: dft
});
$('input[type="checkbox"]').attr('disabled','disabled');
$('#host_config_key-gen-btn').attr('disabled','disabled');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET status: ' + status });
});
});
// Our job type options
@ -293,11 +304,12 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope.template_url = data.related.job_template;
scope.$emit('jobLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to retrieve job template: ' + $routeParams.id + '. GET status: ' + status });
{ hdr: 'Error!', msg: 'Failed to retrieve job: ' + $routeParams.id + '. GET status: ' + status });
});
// Save changes to the parent

View File

@ -181,7 +181,7 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
html += " \n<button class=\"btn\" ng-click=\"genMD5('" + fld + "')\" " +
"aw-tool-tip=\"Generate " + field.label + "\" data-placement=\"top\" id=\"" + fld + "-gen-btn\"><i class=\"icon-repeat\"></i></button>\n";
html += " \n<button style=\"margin-left: 10px;\" class=\"btn\" ng-click=\"selectAll('" + fld + "')\" " +
"aw-tool-tip=\"Select " + field.label + " for copy\" data-placement=\"top\" id=\"" + fld + "-gen-btn\"><i class=\"icon-copy\"></i></button>\n";
"aw-tool-tip=\"Select " + field.label + " for copy\" data-placement=\"top\" id=\"" + fld + "-copy-btn\"><i class=\"icon-copy\"></i></button>\n";
html += "</div>\n";
}
if (field.ask) {