From 4b09ba4c8373184e04650c54575164256adc3a0f Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Tue, 24 Sep 2013 03:42:23 +0000 Subject: [PATCH] AC-466. Fixed issue with refresh timer randomly quitting. Fixed project authorization checkbox. --- awx/ui/static/js/app.js | 1 + awx/ui/static/js/controllers/Credentials.js | 2 ++ awx/ui/static/js/controllers/Inventories.js | 3 +- awx/ui/static/js/controllers/JobTemplates.js | 2 ++ awx/ui/static/js/controllers/Jobs.js | 1 + awx/ui/static/js/controllers/Organizations.js | 2 ++ awx/ui/static/js/controllers/Permissions.js | 2 ++ awx/ui/static/js/controllers/Projects.js | 6 +++- awx/ui/static/js/controllers/Teams.js | 2 ++ awx/ui/static/js/controllers/Users.js | 2 ++ awx/ui/static/lib/ansible/form-generator.js | 34 +++++++------------ 11 files changed, 34 insertions(+), 23 deletions(-) diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 72ab526156..bf11eb7130 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -260,6 +260,7 @@ angular.module('ansible', [ if ($rootScope.timer) { clearInterval($rootScope.timer); + $rootScope.timer = null; } // Make the correct tab active diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index 0485778c1f..233e9b77dd 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -107,6 +107,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa // Save scope.formSave = function() { + generator.clearApiErrors(); Rest.setUrl(defaultUrl); var data = {} for (var fld in form.fields) { @@ -252,6 +253,7 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); Rest.setUrl(defaultUrl + id + '/'); var data = {} for (var fld in form.fields) { diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 9e24b7da36..a356afb37e 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -130,7 +130,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa // Save scope.formSave = function() { - + generator.clearApiErrors(); try { // Make sure we have valid variable data if (scope.inventoryParseType == 'json') { @@ -257,6 +257,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP $location.path('/inventories'); }); scope.formSave = function() { + generator.clearApiErrors(); SaveInventory({ scope: scope }); } diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index f722d5e605..5dfe81e328 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -197,6 +197,7 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP // Save scope.formSave = function() { + generator.clearApiErrors(); var data = {} try { // Make sure we have valid variable data @@ -467,6 +468,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); var data = {} try { // Make sure we have valid variable data diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 4ab6a78299..81b533291d 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -397,6 +397,7 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); Rest.setUrl(defaultUrl + $routeParams.id + '/'); var data = {} for (var fld in form.fields) { diff --git a/awx/ui/static/js/controllers/Organizations.js b/awx/ui/static/js/controllers/Organizations.js index 10e85a2bbd..460c0e0e63 100644 --- a/awx/ui/static/js/controllers/Organizations.js +++ b/awx/ui/static/js/controllers/Organizations.js @@ -91,6 +91,7 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route // Save scope.formSave = function() { + form.clearApiErrors();s var url = GetBasePath(base); url += (base != 'organizations') ? $routeParams['project_id'] + '/organizations/' : ''; Rest.setUrl(url); @@ -182,6 +183,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); var params = {}; for (var fld in form.fields) { params[fld] = scope[fld]; diff --git a/awx/ui/static/js/controllers/Permissions.js b/awx/ui/static/js/controllers/Permissions.js index 785eeb6765..2a081cfb7e 100644 --- a/awx/ui/static/js/controllers/Permissions.js +++ b/awx/ui/static/js/controllers/Permissions.js @@ -109,6 +109,7 @@ function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routePa // Save scope.formSave = function() { + generator.clearApiErrors(); if (scope.PermissionAddAllowed) { var data = {}; for (var fld in form.fields) { @@ -245,6 +246,7 @@ function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeP // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); var data = {} for (var fld in form.fields) { data[fld] = scope[fld]; diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index eb4a952423..6b09db4f8d 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -198,6 +198,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam // Save scope.formSave = function() { + generator.clearApiErrors(); var data = {}; for (var fld in form.fields) { if (form.fields[fld].type == 'checkbox_group') { @@ -333,7 +334,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara scope.project_local_paths = opts; scope.base_dir = 'You do not have access to view this property'; } - scope.auth_required = (scope.scm_type && (scope.scm_username || scope.scm_key_unlock)) ? true : false; + scope.auth_required = (scope.scm_type && (scope.scm_username || scope.scm_password || scope.scm_key_data)) ? true : false; master.auth_required = scope.auth_required; }); @@ -377,6 +378,8 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara } master['scm_type'] = scope['scm_type']; + master['auth_required'] = scope['auth_required']; + scope.scmBranchLabel = (scope.scm_type && scope.scm_type.value && scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; setAskCheckboxes(); @@ -393,6 +396,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); $rootScope.flashMessage = null; var params = {}; for (var fld in form.fields) { diff --git a/awx/ui/static/js/controllers/Teams.js b/awx/ui/static/js/controllers/Teams.js index 450ce7f05c..9138146d5e 100644 --- a/awx/ui/static/js/controllers/Teams.js +++ b/awx/ui/static/js/controllers/Teams.js @@ -119,6 +119,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save scope.formSave = function() { + generator.clearApiErrors(); Rest.setUrl(defaultUrl); var data = {} for (var fld in form.fields) { @@ -228,6 +229,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); $rootScope.flashMessage = null; Rest.setUrl(defaultUrl + $routeParams.team_id +'/'); var data = {} diff --git a/awx/ui/static/js/controllers/Users.js b/awx/ui/static/js/controllers/Users.js index c71f666047..79dd2d8794 100644 --- a/awx/ui/static/js/controllers/Users.js +++ b/awx/ui/static/js/controllers/Users.js @@ -120,6 +120,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save scope.formSave = function() { + generator.clearApiErrors(); if (scope.organization !== undefined && scope.organization !== null && scope.organization !== '') { Rest.setUrl(defaultUrl + scope.organization + '/users/'); var data = {} @@ -250,6 +251,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { + generator.clearApiErrors(); $rootScope.flashMessage = null; Rest.setUrl(defaultUrl + id + '/'); var data = {} diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 299d084670..42f54baf77 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -141,7 +141,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) } if (!this.scope.$$phase) { this.scope.$digest(); - } + } return this.scope; }, @@ -160,7 +160,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) reset: function() { // The form field values cannot be reset with jQuery. Each field is tied to a model, so to clear the field - // value, you have clear the model. + // value, you have to clear the model. this.scope[this.form.name + '_form'].$setPristine(); for (var fld in this.form.fields) { if (this.form.fields[fld].type == 'checkbox_group') { @@ -284,27 +284,19 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) return html; }, - /*button: function(btn, topOrBottom) { - // pass in a button object and get back an html string containing - // a