diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 1878c2d9b9..f722d5e605 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -297,6 +297,9 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route scope.playbook_options = []; for (var i=0; i < data.length; i++) { scope.playbook_options.push(data[i]); + if (data[i] == scope.playbook) { + scope['job_templates_form']['playbook'].$setValidity('required',true); + } } if (!scope.$$phase) { scope.$digest(); @@ -514,7 +517,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route scope[fld] = master[fld]; } scope.parseType = 'yaml'; - //$('#forks-slider').slider("option", "value", scope.forks); + $('#forks-slider').slider("option", "value", scope.forks); }; // Related set: Add button diff --git a/awx/ui/static/js/forms/JobTemplates.js b/awx/ui/static/js/forms/JobTemplates.js index d55bf78492..b5e0c3363b 100644 --- a/awx/ui/static/js/forms/JobTemplates.js +++ b/awx/ui/static/js/forms/JobTemplates.js @@ -85,10 +85,10 @@ angular.module('JobTemplateFormDefinition', []) forks: { label: 'Forks', id: 'forks-number', - type: 'text', - /*integer: true, + type: 'number', + integer: true, min: 0, - spinner: true,*/ + spinner: true, "default": '0', addRequired: false, editRequired: false, diff --git a/awx/ui/static/lib/ansible/Utilities.js b/awx/ui/static/lib/ansible/Utilities.js index 5578719d80..28887d6a0a 100644 --- a/awx/ui/static/lib/ansible/Utilities.js +++ b/awx/ui/static/lib/ansible/Utilities.js @@ -266,4 +266,27 @@ angular.module('Utilities',[]) $('.spinny, .overlay').fadeOut(1000); } } - }]); + }]) + + /* DeugForm(form_name) + * + * Use to log the $pristine and $invalid properties of each form element. Helpful when form + * buttons fail to enable/disable properly. + * + */ + .factory('DebugForm', [ function() { + return function(form_name) { + $('form[name="' + form_name + '"]').find('select, input, button, textarea').each(function(index){ + var name = $(this).attr('name'); + if (name) { + if (scope['job_templates_form'][name]) { + console.log(name + ' pristine: ' + scope['job_templates_form'][name].$pristine); + console.log(name + ' invalid: ' + scope['job_templates_form'][name].$invalid); + } + } + }); + } + }]); + + +