From baad4bd7e694b38807872151ac99b037e2eb87bc Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Fri, 21 Jun 2013 18:03:27 -0400 Subject: [PATCH] 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. --- ansibleworks/ui/static/js/controllers/Jobs.js | 34 +++++++++++++------ .../ui/static/lib/ansible/form-generator.js | 2 +- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ansibleworks/ui/static/js/controllers/Jobs.js b/ansibleworks/ui/static/js/controllers/Jobs.js index 7da9a3ba8e..72b6b21f49 100644 --- a/ansibleworks/ui/static/js/controllers/Jobs.js +++ b/ansibleworks/ui/static/js/controllers/Jobs.js @@ -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 diff --git a/ansibleworks/ui/static/lib/ansible/form-generator.js b/ansibleworks/ui/static/lib/ansible/form-generator.js index 2ff38b2821..05618fde87 100644 --- a/ansibleworks/ui/static/lib/ansible/form-generator.js +++ b/ansibleworks/ui/static/lib/ansible/form-generator.js @@ -181,7 +181,7 @@ angular.module('FormGenerator', ['GeneratorHelpers']) html += " \n\n"; html += " \n\n"; + "aw-tool-tip=\"Select " + field.label + " for copy\" data-placement=\"top\" id=\"" + fld + "-copy-btn\">\n"; html += "\n"; } if (field.ask) {