From 1d19bd9c06968d85b0331dd0a73e0b4fb2220147 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Tue, 3 Sep 2013 11:04:41 -0400 Subject: [PATCH] Lates UI changes --- awx/ui/static/js/controllers/Projects.js | 15 +++++++++++++++ awx/ui/static/js/forms/Projects.js | 2 +- awx/ui/static/js/helpers/Groups.js | 2 -- awx/ui/static/js/lists/Projects.js | 2 +- awx/ui/static/lib/ansible/form-generator.js | 6 ++++-- awx/ui/static/lib/ansible/utilities.js | 6 ++++-- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index 041fef5500..43aff43245 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -27,6 +27,20 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, var url = (base == 'teams') ? GetBasePath('teams') + $routeParams.team_id + '/projects/' : defaultUrl; SelectionInit({ scope: scope, list: list, url: url, returnToCaller: 1 }); + if (scope.postRefreshRemove) { + scope.postRefereshRemove(); + } + scope.postRefreshRemove = scope.$on('PostRefresh', function() { + for (var i=0; i < scope.projects.length; i++) { + if (scope.projects[i].scm_type == null) { + // override the last_update_failed on manual projects- it should be false so we get a + // green badge. if projet scm_type changed from something to manual, last_update_failed + // will contain status of last update, which is not what we want. + scope.projects[i].last_update_failed = false; + } + } + }); + SearchInit({ scope: scope, set: 'projects', list: list, url: defaultUrl }); PaginateInit({ scope: scope, list: list, url: defaultUrl }); scope.search(list.iterator); @@ -164,6 +178,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam scope.scmChange = function() { // When an scm_type is set, path is not required scope.pathRequired = (scope.scm_type) ? false : true; + scope.scmBranchLabel = (scope.scm_type.value == 'svn') ? 'Revision #' : 'SCM Branch'; } // Cancel diff --git a/awx/ui/static/js/forms/Projects.js b/awx/ui/static/js/forms/Projects.js index fb83885ae6..0c33c92b82 100644 --- a/awx/ui/static/js/forms/Projects.js +++ b/awx/ui/static/js/forms/Projects.js @@ -93,7 +93,7 @@ angular.module('ProjectFormDefinition', []) awRequiredWhen: {variable: "scm_type", init: "true" } }, scm_branch: { - label: 'SCM Branch', + labelBind: "scmBranchLabel", type: 'text', ngShow: "scm_type !== '' && scm_type !== null", addRequired: false, diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index f46afb1ff2..446914f756 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -369,12 +369,10 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' .success( function(data, status, headers, config) { scope.selectedNode = scope.selectedNode.parent().parent(); RefreshTree({ scope: scope }); - Wait('stop'); }) .error( function(data, status, headers, config) { //$('#prompt-modal').modal('hide'); RefreshTree({ scope: scope }); - Wait('stop'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); }); diff --git a/awx/ui/static/js/lists/Projects.js b/awx/ui/static/js/lists/Projects.js index 0c50f1466d..5e05ff04bf 100644 --- a/awx/ui/static/js/lists/Projects.js +++ b/awx/ui/static/js/lists/Projects.js @@ -24,7 +24,7 @@ angular.module('ProjectsListDefinition', []) key: true, label: 'Name', badgeIcon: "\{\{ 'icon-failures-' + project.last_update_failed \}\}", - badgePlacement: 'left' + badgePlacement: 'left', }, description: { label: 'Description' diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 79d26aa518..c6dbcda1f0 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -352,12 +352,14 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += (field.labelNGClass) ? "ng-class=\"" + field.labelNGClass + "\" " : ""; html += "class=\"control-label " + getLabelWidth(); html += (field.labelClass) ? " " + field.labelClass : ""; - html += "\" for=\"" + fld + '">'; + html += "\" "; + html += (field.labelBind) ? "ng-bind=\"" + field.labelBind + "\" " : ""; + html += "for=\"" + fld + '">'; html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : ""; html += (field.icon) ? this.icon(field.icon) : ""; html += field.label + '' + "\n"; html += "
\n"; html += (field.clear || field.genMD5) ? "
\n" : ""; diff --git a/awx/ui/static/lib/ansible/utilities.js b/awx/ui/static/lib/ansible/utilities.js index ed15d90e37..21c214cacb 100644 --- a/awx/ui/static/lib/ansible/utilities.js +++ b/awx/ui/static/lib/ansible/utilities.js @@ -210,12 +210,13 @@ angular.module('Utilities',[]) } }]) - .factory('Wait', [ function() { + .factory('Wait', [ '$rootScope', function($rootScope) { return function(directive) { // Display a spinning icon in the center of the screen to freeze the // UI while waiting on async things to complete (i.e. API calls). // Wait('start' | 'stop'); - if (directive == 'start') { + if (directive == 'start' && !$rootScope.waiting) { + $rootScope.waiting = true; var docw = $(document).width(); var doch = $(document).height(); var spinnyw = $('.spinny').width(); @@ -232,6 +233,7 @@ angular.module('Utilities',[]) }).fadeIn(400); } else { + $rootScope.waiting = false; $('.spinny, .overlay').fadeOut(1000); } }