From ce7688d2529685470d2508c0ffb7996c59eea033 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Sun, 17 Nov 2013 06:37:34 +0000 Subject: [PATCH] Added 'working' spinner to all save/delete/select actions. This is to compensate for places where activity log is slowing down the API. AC-646 changes Rackspace credentials to show API Key in place of password. Fixed a bug on machine credential that caused username to not be passed to the API when adding and editing. --- awx/ui/static/js/controllers/Credentials.js | 13 +++++++--- awx/ui/static/js/controllers/Inventories.js | 14 +++++++--- awx/ui/static/js/controllers/JobTemplates.js | 23 +++++++++++----- awx/ui/static/js/controllers/Organizations.js | 20 +++++++++++--- awx/ui/static/js/controllers/Permissions.js | 24 ++++++++++++----- awx/ui/static/js/controllers/Projects.js | 21 ++++++++++----- awx/ui/static/js/controllers/Teams.js | 25 ++++++++++++------ awx/ui/static/js/controllers/Users.js | 26 +++++++++++++------ awx/ui/static/js/forms/Credentials.js | 17 +++++++++--- awx/ui/static/js/helpers/Credentials.js | 15 ++++++++--- awx/ui/static/js/helpers/Groups.js | 16 +++++++++--- awx/ui/static/js/helpers/Hosts.js | 18 ++++++++++--- awx/ui/static/js/helpers/JobSubmission.js | 9 +++++-- awx/ui/static/js/helpers/Selection.js | 7 +++-- awx/ui/static/js/helpers/inventory.js | 9 +++++-- awx/ui/static/js/widgets/Stream.js | 3 ++- 16 files changed, 194 insertions(+), 66 deletions(-) diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index f120a59cdc..b4b9c2d976 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -12,7 +12,7 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, CredentialList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, - ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices) + ClearScope, ProcessErrors, GetBasePath, SelectionInit, GetChoices, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -86,14 +86,17 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res scope.deleteCredential = function(id, name) { var action = function() { + Wait('start'); var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -109,7 +112,7 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res CredentialsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'CredentialList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', - 'GetBasePath', 'SelectionInit', 'GetChoices']; + 'GetBasePath', 'SelectionInit', 'GetChoices', 'Wait' ]; function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, CredentialForm, @@ -360,14 +363,16 @@ function CredentialsEdit ($scope, $rootScope, $compile, $location, $log, $routeP master['secret_key'] = scope['secret_key']; break; case 'ssh': - scope['ssh_username'] = data.username; scope['ssh_password'] = data.password; - master['ssh_username'] = scope['ssh_username']; master['ssh_password'] = scope['ssh_password']; break; case 'scm': scope['scm_key_unlock'] = data['ssh_key_unlock']; break; + case 'rax': + scope['api_key'] = data['password']; + master['api_key'] = scope['api_key']; + break; } scope.$emit('credentialLoaded'); diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 55fba75cec..49f441dd03 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -150,6 +150,7 @@ function InventoriesList ($scope, $rootScope, $location, $log, $routeParams, Res scope.deleteInventory = function(id, name) { var action = function() { + Wait('start'); var url = defaultUrl + id + '/'; $('#prompt-modal').modal('hide'); Wait('start'); @@ -207,7 +208,7 @@ InventoriesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$route function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, OrganizationList, SearchInit, PaginateInit, LookUpInit, GetBasePath, - ParseTypeChange) + ParseTypeChange, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -239,6 +240,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa // Save scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); try { // Make sure we have valid variable data if (scope.inventoryParseType == 'json') { @@ -273,23 +275,28 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa Rest.setUrl(data.related.variable_data); Rest.put(json_data) .success( function(data, status, headers, config) { + Wait('stop'); $location.path('/inventories/' + inventory_id + '/groups'); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add inventory varaibles. PUT returned status: ' + status }); }); } else { + Wait('stop'); $location.path('/inventories/' + inventory_id + '/groups'); } }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new inventory. Post returned status: ' + status }); }); } catch(err) { + Wait('stop'); Alert("Error", "Error parsing inventory variables. Parser returned: " + err); } @@ -304,13 +311,14 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa InventoriesAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'InventoryForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', - 'OrganizationList', 'SearchInit', 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange']; + 'OrganizationList', 'SearchInit', 'PaginateInit', 'LookUpInit', 'GetBasePath', 'ParseTypeChange', 'Wait']; function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, InventoryForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt, OrganizationList, - GetBasePath, LoadInventory, ParseTypeChange, EditInventory, SaveInventory, PostLoadInventory) + GetBasePath, LoadInventory, ParseTypeChange, EditInventory, SaveInventory, PostLoadInventory + ) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. diff --git a/awx/ui/static/js/controllers/JobTemplates.js b/awx/ui/static/js/controllers/JobTemplates.js index 653401672b..7dfaf36bc6 100644 --- a/awx/ui/static/js/controllers/JobTemplates.js +++ b/awx/ui/static/js/controllers/JobTemplates.js @@ -13,7 +13,7 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobTemplateList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, PromptPasswords, JobTemplateForm, CredentialList, - LookUpInit, SubmitJob) + LookUpInit, SubmitJob, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -49,14 +49,17 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re scope.deleteJobTemplate = function(id, name) { var action = function() { + Wait('start'); var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -77,13 +80,13 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re JobTemplatesList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobTemplateList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors','GetBasePath', 'PromptPasswords', 'JobTemplateForm', 'CredentialList', 'LookUpInit', - 'SubmitJob' + 'SubmitJob', 'Wait' ]; function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GetBasePath, InventoryList, CredentialList, ProjectList, LookUpInit, - md5Setup, ParseTypeChange) + md5Setup, ParseTypeChange, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -224,6 +227,7 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP // Save scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); var data = {} try { // Make sure we have valid variable data @@ -258,16 +262,19 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP Rest.setUrl(defaultUrl); Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; (base == 'job_templates') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new job template. POST returned status: ' + status }); }); } catch(err) { + Wait('stop'); Alert("Error", "Error parsing extra variables. Parser returned: " + err); } }; @@ -286,14 +293,14 @@ function JobTemplatesAdd ($scope, $rootScope, $compile, $location, $log, $routeP JobTemplatesAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'JobTemplateForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit', - 'md5Setup', 'ParseTypeChange' ]; + 'md5Setup', 'ParseTypeChange', 'Wait']; function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, JobTemplateForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, InventoryList, CredentialList, ProjectList, LookUpInit, PromptPasswords, GetBasePath, md5Setup, ParseTypeChange, - JobStatusToolTip, FormatDate) + JobStatusToolTip, FormatDate, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -530,6 +537,7 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route // Save changes to the parent scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); var data = {} try { // Make sure we have valid variable data @@ -564,16 +572,19 @@ function JobTemplatesEdit ($scope, $rootScope, $compile, $location, $log, $route Rest.setUrl(defaultUrl + id + '/'); Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; (base == 'job_templates') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update job template. PUT returned status: ' + status }); }); } catch(err) { + Wait('stop'); Alert("Error", "Error parsing extra variables. Parser returned: " + err); } }; @@ -631,5 +642,5 @@ JobTemplatesEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$ 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'InventoryList', 'CredentialList', 'ProjectList', 'LookUpInit', 'PromptPasswords', 'GetBasePath', 'md5Setup', 'ParseTypeChange', - 'JobStatusToolTip', 'FormatDate' + 'JobStatusToolTip', 'FormatDate', 'Wait' ]; diff --git a/awx/ui/static/js/controllers/Organizations.js b/awx/ui/static/js/controllers/Organizations.js index a64cfc4b61..743311cc8f 100644 --- a/awx/ui/static/js/controllers/Organizations.js +++ b/awx/ui/static/js/controllers/Organizations.js @@ -49,14 +49,17 @@ function OrganizationsList ($routeParams, $scope, $rootScope, $location, $log, R scope.deleteOrganization = function(id, name) { var action = function() { + Wait('start'); var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -77,7 +80,7 @@ OrganizationsList.$inject=[ '$routeParams', '$scope', '$rootScope', '$location', function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope, GetBasePath, - ReturnToCaller) + ReturnToCaller, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -94,12 +97,14 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route // Save scope.formSave = function() { form.clearApiErrors(); + Wait('start'); var url = GetBasePath(base); url += (base != 'organizations') ? $routeParams['project_id'] + '/organizations/' : ''; Rest.setUrl(url); Rest.post({ name: $scope.name, description: $scope.description }) .success( function(data, status, headers, config) { + Wait('stop'); if (base == 'organizations') { $rootScope.flashMessage = "New organization successfully created!"; $location.path('/organizations/' + data.id); @@ -109,6 +114,7 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route } }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, OrganizationForm, { hdr: 'Error!', msg: 'Failed to add new organization. Post returned status: ' + status }); }); @@ -123,12 +129,12 @@ function OrganizationsAdd ($scope, $rootScope, $compile, $location, $log, $route OrganizationsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath', - 'ReturnToCaller' ]; + 'ReturnToCaller', 'Wait']; function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, OrganizationForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, - RelatedPaginateInit, Prompt, ClearScope, GetBasePath) + RelatedPaginateInit, Prompt, ClearScope, GetBasePath, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -186,6 +192,7 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout // Save changes to the parent scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); var params = {}; for (var fld in form.fields) { params[fld] = scope[fld]; @@ -193,10 +200,12 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout Rest.setUrl(defaultUrl + id + '/'); Rest.put(params) .success( function(data, status, headers, config) { + Wait('stop'); master = params; $rootScope.flashMessage = "Your changes were successfully saved!"; }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, OrganizationForm, { hdr: 'Error!', msg: 'Failed to update organization: ' + id + '. PUT status: ' + status }); }); @@ -228,14 +237,17 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout $rootScope.flashMessage = null; var action = function() { + Wait('start'); var url = defaultUrl + $routeParams.organization_id + '/' + set + '/'; Rest.setUrl(url); Rest.post({ id: itm_id, disassociate: 1 }) .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(form.related[set].iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. POST returned status: ' + status }); @@ -252,4 +264,4 @@ function OrganizationsEdit ($scope, $rootScope, $compile, $location, $log, $rout OrganizationsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'OrganizationForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', - 'RelatedPaginateInit', 'Prompt', 'ClearScope', 'GetBasePath']; + 'RelatedPaginateInit', 'Prompt', 'ClearScope', 'GetBasePath', 'Wait']; diff --git a/awx/ui/static/js/controllers/Permissions.js b/awx/ui/static/js/controllers/Permissions.js index 2a081cfb7e..78f3453e72 100644 --- a/awx/ui/static/js/controllers/Permissions.js +++ b/awx/ui/static/js/controllers/Permissions.js @@ -1,7 +1,7 @@ function PermissionsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, PermissionList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, - ClearScope, ProcessErrors, GetBasePath, CheckAccess) + ClearScope, ProcessErrors, GetBasePath, CheckAccess, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -35,14 +35,17 @@ function PermissionsList ($scope, $rootScope, $location, $log, $routeParams, Res scope.deletePermission = function(id, name) { var action = function() { + Wait('start'); var url = GetBasePath('base') + 'permissions/' + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -60,13 +63,14 @@ function PermissionsList ($scope, $rootScope, $location, $log, $routeParams, Res PermissionsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'PermissionList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', - 'ClearScope', 'ProcessErrors', 'GetBasePath', 'CheckAccess' + 'ClearScope', 'ProcessErrors', 'GetBasePath', 'CheckAccess', 'Wait' ]; function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, PermissionsForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope, - GetBasePath, ReturnToCaller, InventoryList, ProjectList, LookUpInit, CheckAccess) + GetBasePath, ReturnToCaller, InventoryList, ProjectList, LookUpInit, CheckAccess, + Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -110,6 +114,7 @@ function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routePa // Save scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); if (scope.PermissionAddAllowed) { var data = {}; for (var fld in form.fields) { @@ -119,9 +124,11 @@ function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routePa Rest.setUrl(url); Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, PermissionsForm, { hdr: 'Error!', msg: 'Failed to create new permission. Post returned status: ' + status }); }); @@ -153,13 +160,14 @@ function PermissionsAdd ($scope, $rootScope, $compile, $location, $log, $routePa PermissionsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'PermissionsForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath', - 'ReturnToCaller', 'InventoryList', 'ProjectList', 'LookUpInit', 'CheckAccess' + 'ReturnToCaller', 'InventoryList', 'ProjectList', 'LookUpInit', 'CheckAccess', 'Wait' ]; function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, PermissionsForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, - ClearScope, Prompt, GetBasePath, InventoryList, ProjectList, LookUpInit, CheckAccess) + ClearScope, Prompt, GetBasePath, InventoryList, ProjectList, LookUpInit, CheckAccess, + Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -247,6 +255,7 @@ function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeP // Save changes to the parent scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); var data = {} for (var fld in form.fields) { data[fld] = scope[fld]; @@ -254,9 +263,11 @@ function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeP Rest.setUrl(defaultUrl); Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update Permission: ' + $routeParams.id + '. PUT status: ' + status }); }); @@ -286,6 +297,7 @@ function PermissionsEdit ($scope, $rootScope, $compile, $location, $log, $routeP PermissionsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'PermissionsForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', - 'ClearScope', 'Prompt', 'GetBasePath', 'InventoryList', 'ProjectList', 'LookUpInit', 'CheckAccess' + 'ClearScope', 'Prompt', 'GetBasePath', 'InventoryList', 'ProjectList', 'LookUpInit', 'CheckAccess', + 'Wait' ]; diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index fa13092afe..3b610d4a3e 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -13,7 +13,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit, ProjectUpdate, ProjectStatus, - FormatDate, Refresh) + FormatDate, Refresh, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -112,14 +112,17 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, scope.deleteProject = function(id, name) { var action = function() { + Wait('start'); var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -225,13 +228,13 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', - 'GetBasePath', 'SelectionInit', 'ProjectUpdate', 'ProjectStatus', 'FormatDate', 'Refresh' ]; + 'GetBasePath', 'SelectionInit', 'ProjectUpdate', 'ProjectStatus', 'FormatDate', 'Refresh', 'Wait' ]; function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ClearScope, GetBasePath, ReturnToCaller, GetProjectPath, LookUpInit, OrganizationList, - CredentialList, GetChoices, DebugForm) + CredentialList, GetChoices, DebugForm, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -291,6 +294,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam // Save scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); var data = {}; for (var fld in form.fields) { if (form.fields[fld].type == 'checkbox_group') { @@ -322,6 +326,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam Rest.setUrl(url); Rest.post(org) .success( function(data, status, headers, config) { + Wait('stop'); $rootScope.flashMessage = "New project successfully created!"; (base == 'projects') ? ReturnToCaller() : ReturnToCaller(1); }) @@ -331,6 +336,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam }); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, ProjectsForm, { hdr: 'Error!', msg: 'Failed to create new project. POST returned status: ' + status }); }); @@ -357,14 +363,14 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam ProjectsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'ProjectsForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ClearScope', 'GetBasePath', 'ReturnToCaller', 'GetProjectPath', 'LookUpInit', 'OrganizationList', 'CredentialList', 'GetChoices', - 'DebugForm' + 'DebugForm', 'Wait' ]; function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, Prompt, ClearScope, GetBasePath, ReturnToCaller, GetProjectPath, - Authorization, CredentialList, LookUpInit, GetChoices, Empty, DebugForm) + Authorization, CredentialList, LookUpInit, GetChoices, Empty, DebugForm, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -499,6 +505,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara // Save changes to the parent scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); $rootScope.flashMessage = null; var params = {}; for (var fld in form.fields) { @@ -525,9 +532,11 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara Rest.setUrl(defaultUrl); Rest.put(params) .success( function(data, status, headers, config) { + Wait('stop'); ReturnToCaller(); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update project: ' + id + '. PUT status: ' + status }); }); @@ -591,5 +600,5 @@ ProjectsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log' 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'Prompt', 'ClearScope', 'GetBasePath', 'ReturnToCaller', 'GetProjectPath', 'Authorization', 'CredentialList', 'LookUpInit', 'GetChoices', 'Empty', - 'DebugForm' + 'DebugForm', 'Wait' ]; diff --git a/awx/ui/static/js/controllers/Teams.js b/awx/ui/static/js/controllers/Teams.js index b5e66cfe7f..9d5279f145 100644 --- a/awx/ui/static/js/controllers/Teams.js +++ b/awx/ui/static/js/controllers/Teams.js @@ -12,7 +12,7 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, TeamList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, - ClearScope, ProcessErrors, SetTeamListeners, GetBasePath, SelectionInit) + ClearScope, ProcessErrors, SetTeamListeners, GetBasePath, SelectionInit, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -56,14 +56,17 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale scope.deleteTeam = function(id, name) { var action = function() { + Wait('start'); var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -90,12 +93,12 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale TeamsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'TeamList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', - 'SetTeamListeners', 'GetBasePath', 'SelectionInit']; + 'SetTeamListeners', 'GetBasePath', 'SelectionInit', 'Wait']; -function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm, - GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, - GenerateList, OrganizationList, SearchInit, PaginateInit, GetBasePath, LookUpInit) +function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm, GenerateForm, + Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, GenerateList, + OrganizationList, SearchInit, PaginateInit, GetBasePath, LookUpInit, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -120,6 +123,7 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); Rest.setUrl(defaultUrl); var data = {} for (var fld in form.fields) { @@ -127,10 +131,12 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, } Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); $rootScope.flashMessage = "New team successfully created!"; $location.path('/teams/' + data.id); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new team. Post returned status: ' + status }); }); @@ -145,13 +151,13 @@ function TeamsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamsAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GenerateList', - 'OrganizationList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'LookUpInit' ]; + 'OrganizationList', 'SearchInit', 'PaginateInit', 'GetBasePath', 'LookUpInit', 'Wait']; function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, RelatedPaginateInit, ReturnToCaller, ClearScope, LookUpInit, Prompt, - GetBasePath, CheckAccess, OrganizationList) + GetBasePath, CheckAccess, OrganizationList, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -230,6 +236,7 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); $rootScope.flashMessage = null; Rest.setUrl(defaultUrl + $routeParams.team_id +'/'); var data = {} @@ -238,10 +245,12 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, } Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; (base == 'teams') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update team: ' + $routeParams.team_id + '. PUT status: ' + status }); }); @@ -335,6 +344,6 @@ function TeamsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, TeamsEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'TeamForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'LookUpInit', 'Prompt', - 'GetBasePath', 'CheckAccess', 'OrganizationList' + 'GetBasePath', 'CheckAccess', 'OrganizationList', 'Wait' ]; diff --git a/awx/ui/static/js/controllers/Users.js b/awx/ui/static/js/controllers/Users.js index 79dd2d8794..a0e73ce685 100644 --- a/awx/ui/static/js/controllers/Users.js +++ b/awx/ui/static/js/controllers/Users.js @@ -10,9 +10,9 @@ 'use strict'; -function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest, - Alert, UserList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, - ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, SelectionInit) +function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, UserList, + GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, + ClearScope, ProcessErrors, GetBasePath, SelectionInit, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -47,14 +47,17 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest, scope.deleteUser = function(id, name) { var action = function() { + Wait('start') var url = defaultUrl + id + '/'; Rest.setUrl(url); Rest.destroy() .success( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); scope.search(list.iterator); }) .error( function(data, status, headers, config) { + Wait('stop'); $('#prompt-modal').modal('hide'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status }); @@ -70,12 +73,12 @@ function UsersList ($scope, $rootScope, $location, $log, $routeParams, Rest, UsersList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'UserList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', - 'GetBasePath', 'SelectionInit']; + 'GetBasePath', 'SelectionInit', 'Wait' ]; function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope, - GetBasePath, LookUpInit, OrganizationList, ResetForm) + GetBasePath, LookUpInit, OrganizationList, ResetForm, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -121,6 +124,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); if (scope.organization !== undefined && scope.organization !== null && scope.organization !== '') { Rest.setUrl(defaultUrl + scope.organization + '/users/'); var data = {} @@ -138,6 +142,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; if (base == 'users') { $rootScope.flashMessage = 'New user successfully created!'; @@ -148,6 +153,7 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, } }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new user. POST returned status: ' + status }); }); @@ -174,12 +180,13 @@ function UsersAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, UsersAdd.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope', 'GetBasePath', - 'LookUpInit', 'OrganizationList', 'ResetForm' ]; + 'LookUpInit', 'OrganizationList', 'ResetForm', 'Wait' ]; function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, UserForm, GenerateForm, Rest, Alert, ProcessErrors, LoadBreadCrumbs, RelatedSearchInit, - RelatedPaginateInit, ReturnToCaller, ClearScope, GetBasePath, Prompt, CheckAccess, ResetForm) + RelatedPaginateInit, ReturnToCaller, ClearScope, GetBasePath, Prompt, CheckAccess, + ResetForm, Wait) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -252,6 +259,7 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, // Save changes to the parent scope.formSave = function() { generator.clearApiErrors(); + Wait('start'); $rootScope.flashMessage = null; Rest.setUrl(defaultUrl + id + '/'); var data = {} @@ -269,10 +277,12 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; (base == 'users') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update users: ' + $routeParams.id + '. PUT status: ' + status }); }); @@ -425,5 +435,5 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, UsersEdit.$inject = [ '$scope', '$rootScope', '$compile', '$location', '$log', '$routeParams', 'UserForm', 'GenerateForm', 'Rest', 'Alert', 'ProcessErrors', 'LoadBreadCrumbs', 'RelatedSearchInit', 'RelatedPaginateInit', 'ReturnToCaller', 'ClearScope', 'GetBasePath', 'Prompt', 'CheckAccess', - 'ResetForm' ]; + 'ResetForm', 'Wait' ]; diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index 90f018cebd..495a557e17 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -114,11 +114,22 @@ angular.module('CredentialFormDefinition', []) awRequiredWhen: {variable: 'rackspace_required', init: false }, autocomplete: false }, + "api_key": { + label: 'API Key', + type: 'password', + ngShow: "kind.value == 'rax'", + awRequiredWhen: { variable: "rackspace_required", init: false }, + autocomplete: false, + ask: false, + clear: false, + apiField: 'passwowrd' + }, "password": { label: 'Password', type: 'password', - ngShow: "kind.value == 'rax' || kind.value == 'scm'", - awRequiredWhen: {variable: 'rackspace_required', init: false }, + ngShow: "kind.value == 'scm'", + addRequired: false, + editRequired: false, ngChange: "clearPWConfirm('password_confirm')", ask: false, clear: false, @@ -128,7 +139,7 @@ angular.module('CredentialFormDefinition', []) "password_confirm": { label: 'Confirm Password', type: 'password', - ngShow: "kind.value == 'rax' || kind.value == 'scm'", + ngShow: "kind.value == 'scm'", addRequired: false, editRequired: false, awPassMatch: true, diff --git a/awx/ui/static/js/helpers/Credentials.js b/awx/ui/static/js/helpers/Credentials.js index b021981dfc..1f33533f3b 100644 --- a/awx/ui/static/js/helpers/Credentials.js +++ b/awx/ui/static/js/helpers/Credentials.js @@ -44,6 +44,7 @@ angular.module('CredentialsHelper', ['Utilities']) if (reset) { scope['access_key'] = null; scope['secret_key'] = null; + scope['api_key'] = null; scope['username'] = null; scope['password'] = null; scope['password_confirm'] = null; @@ -94,14 +95,16 @@ angular.module('CredentialsHelper', ['Utilities']) }]) - .factory('FormSave', ['$location', 'Rest', 'ProcessErrors', 'Empty', 'GetBasePath', 'CredentialForm', 'ReturnToCaller', - function($location, Rest, ProcessErrors, Empty, GetBasePath, CredentialForm, ReturnToCaller) { + .factory('FormSave', ['$location', 'Rest', 'ProcessErrors', 'Empty', 'GetBasePath', 'CredentialForm', 'ReturnToCaller', 'Wait', + function($location, Rest, ProcessErrors, Empty, GetBasePath, CredentialForm, ReturnToCaller, Wait) { return function(params) { var scope = params.scope; var mode = params.mode; // add or edit var form = CredentialForm; var data = {} + Wait('start'); + for (var fld in form.fields) { if (fld !== 'access_key' && fld !== 'secret_key' && fld !== 'ssh_username' && fld !== 'ssh_password') { @@ -127,7 +130,6 @@ angular.module('CredentialsHelper', ['Utilities']) switch (data['kind']) { case 'ssh': - data['username'] = scope['ssh_username']; data['password'] = scope['ssh_password']; break; case 'aws': @@ -137,6 +139,9 @@ angular.module('CredentialsHelper', ['Utilities']) case 'scm': data['ssh_key_unlock'] = scope['scm_key_unlock']; break; + case 'rax': + data['password'] = scope['api_key']; + break; } if (Empty(data.team) && Empty(data.user)) { @@ -150,10 +155,12 @@ angular.module('CredentialsHelper', ['Utilities']) Rest.setUrl(url); Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; (base == 'credentials') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to create new Credential. POST status: ' + status }); }); @@ -163,10 +170,12 @@ angular.module('CredentialsHelper', ['Utilities']) Rest.setUrl(url); Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); var base = $location.path().replace(/^\//,'').split('/')[0]; (base == 'credentials') ? ReturnToCaller() : ReturnToCaller(1); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update Credential. PUT status: ' + status }); }); diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 56ba78810f..3c43b6555f 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -564,9 +564,9 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' }]) .factory('GroupsAdd', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm', - 'Prompt', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'GroupsEdit', 'BuildTree', 'ClickNode', + 'Prompt', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'GroupsEdit', 'BuildTree', 'ClickNode', 'Wait', function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors, - GetBasePath, ParseTypeChange, GroupsEdit, BuildTree, ClickNode) { + GetBasePath, ParseTypeChange, GroupsEdit, BuildTree, ClickNode, Wait) { return function(params) { var inventory_id = params.inventory_id; @@ -603,6 +603,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' // Save scope.formModalAction = function() { + Wait('start'); try { scope.formModalActionDisabled = true; @@ -638,6 +639,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' Rest.setUrl(defaultUrl); Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); groupCreated = true; scope.formModalActionDisabled = false; scope.showGroupHelp = false; //get rid of the Hint @@ -653,12 +655,14 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' }); }) .error( function(data, status, headers, config) { + Wait('stop'); scope.formModalActionDisabled = false; ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new group. POST returned status: ' + status }); }); } catch(err) { + Wait('stop'); scope.formModalActionDisabled = false; Alert("Error", "Error parsing group variables. Parser returned: " + err); } @@ -675,10 +679,10 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' .factory('GroupsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'GroupForm', 'GenerateForm', 'Prompt', 'ProcessErrors', 'GetBasePath', 'SetNodeName', 'ParseTypeChange', 'GetSourceTypeOptions', 'InventoryUpdate', - 'GetUpdateIntervalOptions', 'ClickNode', 'LookUpInit', 'CredentialList', 'Empty', + 'GetUpdateIntervalOptions', 'ClickNode', 'LookUpInit', 'CredentialList', 'Empty', 'Wait', function($rootScope, $location, $log, $routeParams, Rest, Alert, GroupForm, GenerateForm, Prompt, ProcessErrors, GetBasePath, SetNodeName, ParseTypeChange, GetSourceTypeOptions, InventoryUpdate, GetUpdateIntervalOptions, ClickNode, - LookUpInit, CredentialList, Empty) { + LookUpInit, CredentialList, Empty, Wait) { return function(params) { var group_id = params.group_id; @@ -942,6 +946,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' // Save changes to the parent scope.formSave = function() { + Wait('start'); try { var refreshHosts = false; @@ -967,6 +972,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' Rest.setUrl(defaultUrl); Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); if (scope.variables) { //update group variables Rest.setUrl(scope.variable_url); @@ -979,11 +985,13 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', ' scope.$emit('formSaveSuccess', data.id); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update group: ' + group_id + '. PUT status: ' + status }); }); } catch(err) { + Wait('stop'); Alert("Error", "Error parsing group variables. Parser returned: " + err); } }; diff --git a/awx/ui/static/js/helpers/Hosts.js b/awx/ui/static/js/helpers/Hosts.js index bf1d246e20..31b6056eba 100644 --- a/awx/ui/static/js/helpers/Hosts.js +++ b/awx/ui/static/js/helpers/Hosts.js @@ -161,9 +161,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H .factory('HostsAdd', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm', - 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', + 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors, - GetBasePath, HostsReload, ParseTypeChange) { + GetBasePath, HostsReload, ParseTypeChange, Wait) { return function(params) { var inventory_id = params.inventory_id; @@ -202,6 +202,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H // Save scope.formModalAction = function() { + Wait('start'); + function finished() { $('#form-modal').modal('hide'); scope.$emit('hostsReload'); @@ -245,15 +247,18 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H Rest.setUrl(defaultUrl); Rest.post(data) .success( function(data, status, headers, config) { + Wait('stop'); finished(); }) .error( function(data, status, headers, config) { + Wait('stop'); scope.formModalActionDisabled = false; ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to add new host. POST returned status: ' + status }); }); } catch(err) { + Wait('stop'); scope.formModalActionDisabled = false; Alert("Error", "Error parsing host variables. Parser returned: " + err); } @@ -270,9 +275,9 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H .factory('HostsEdit', ['$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostForm', 'GenerateForm', - 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', + 'Prompt', 'ProcessErrors', 'GetBasePath', 'HostsReload', 'ParseTypeChange', 'Wait', function($rootScope, $location, $log, $routeParams, Rest, Alert, HostForm, GenerateForm, Prompt, ProcessErrors, - GetBasePath, HostsReload, ParseTypeChange) { + GetBasePath, HostsReload, ParseTypeChange, Wait) { return function(params) { var host_id = params.host_id; @@ -366,6 +371,8 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H // Save changes to the parent scope.formModalAction = function() { + Wait('start'); + function finished() { $('#form-modal').modal('hide'); if (hostsReload) { @@ -406,14 +413,17 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', 'H Rest.setUrl(defaultUrl); Rest.put(data) .success( function(data, status, headers, config) { + Wait('stop'); finished(); }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update host: ' + host_id + '. PUT returned status: ' + status }); }); } catch(err) { + Wait('stop'); Alert("Error", "Error parsing host variables. Parser returned: " + err); } }; diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index f997706292..a64c242f28 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -8,8 +8,9 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential 'LookUpHelper', 'ProjectFormDefinition', 'JobSubmissionHelper', 'GroupFormDefinition', 'GroupsHelper' ]) .factory('PromptPasswords', ['CredentialForm', 'JobTemplateForm', 'GroupForm', 'ProjectsForm', '$compile', 'Rest', '$location', 'ProcessErrors', - 'GetBasePath', 'Alert', 'Empty', - function(CredentialForm, JobTemplateForm, ProjectsForm, GroupForm, $compile, Rest, $location, ProcessErrors, GetBasePath, Alert, Empty) { + 'GetBasePath', 'Alert', 'Empty', 'Wait', + function(CredentialForm, JobTemplateForm, ProjectsForm, GroupForm, $compile, Rest, $location, ProcessErrors, GetBasePath, Alert, Empty, + Wait) { return function(params) { var scope = params.scope; @@ -65,6 +66,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential scope.startJob = function() { $('#password-modal').modal('hide'); + Wait('start'); var pswd = {}; var value_supplied = false; $('.password-field').each(function(index) { @@ -77,17 +79,20 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential Rest.setUrl(start_url); Rest.post(pswd) .success( function(data, status, headers, config) { + Wait('stop'); scope.$emit('UpdateSubmitted','started'); if (form.name == 'credential') { navigate(false); } }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'POST to ' + start_url + ' failed with status: ' + status }); }); } else { + Wait('stop'); Alert('No Passwords', 'Required password(s) not provided. The request was not submitted.', 'alert-info'); if (form.name == 'credential') { // No passwords provided, so we can't start the job. Rather than leave the job in a 'new' diff --git a/awx/ui/static/js/helpers/Selection.js b/awx/ui/static/js/helpers/Selection.js index 4fd1b66f4b..92367f2375 100644 --- a/awx/ui/static/js/helpers/Selection.js +++ b/awx/ui/static/js/helpers/Selection.js @@ -12,8 +12,8 @@ angular.module('SelectionHelper', ['Utilities', 'RestServices']) - .factory('SelectionInit', [ 'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', - function(Rest, Alert, ProcessErrors, ReturnToCaller) { + .factory('SelectionInit', [ 'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'Wait', + function(Rest, Alert, ProcessErrors, ReturnToCaller, Wait) { return function(params) { var scope = params.scope; // current scope @@ -74,6 +74,8 @@ angular.module('SelectionHelper', ['Utilities', 'RestServices']) scope.queue = []; scope.formModalActionDisabled = true; + Wait('start'); + function finished() { scope.selected = []; if (returnToCaller !== undefined) { @@ -92,6 +94,7 @@ angular.module('SelectionHelper', ['Utilities', 'RestServices']) // We call the API for each selected item. We need to hang out until all the api // calls are finished. if (scope.queue.length == scope.selected.length) { + Wait('stop'); var errors = 0; for (var i=0; i < scope.queue.length; i++) { if (scope.queue[i].result == 'error') { diff --git a/awx/ui/static/js/helpers/inventory.js b/awx/ui/static/js/helpers/inventory.js index 0cf040a43e..b0df8c0e2c 100644 --- a/awx/ui/static/js/helpers/inventory.js +++ b/awx/ui/static/js/helpers/inventory.js @@ -106,9 +106,9 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi }]) .factory('SaveInventory', ['InventoryForm', 'Rest', 'Alert', 'ProcessErrors', 'LookUpInit', 'OrganizationList', - 'GetBasePath', 'ParseTypeChange', 'LoadInventory', + 'GetBasePath', 'ParseTypeChange', 'LoadInventory', 'Wait', function(InventoryForm, Rest, Alert, ProcessErrors, LookUpInit, OrganizationList, GetBasePath, ParseTypeChange, - LoadInventory) { + LoadInventory, Wait) { return function(params) { // Save inventory property modifications @@ -116,6 +116,8 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi var scope = params.scope; var form = InventoryForm; var defaultUrl=GetBasePath('inventory'); + + Wait('start'); try { // Make sure we have valid variable data @@ -150,6 +152,7 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi Rest.setUrl(data.related.variable_data); Rest.put(json_data) .success( function(data, status, headers, config) { + Wait('stop'); scope.$emit('inventorySaved'); }) .error( function(data, status, headers, config) { @@ -162,11 +165,13 @@ angular.module('InventoryHelper', [ 'RestServices', 'Utilities', 'OrganizationLi } }) .error( function(data, status, headers, config) { + Wait('stop'); ProcessErrors(scope, data, status, form, { hdr: 'Error!', msg: 'Failed to update inventory. POST returned status: ' + status }); }); } catch(err) { + Wait('stop'); Alert("Error", "Error parsing inventory variables. Parser returned: " + err); } } diff --git a/awx/ui/static/js/widgets/Stream.js b/awx/ui/static/js/widgets/Stream.js index f3fd56ec3f..498fef4a3b 100644 --- a/awx/ui/static/js/widgets/Stream.js +++ b/awx/ui/static/js/widgets/Stream.js @@ -195,6 +195,8 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti // Add a container for the stream widget $('#tab-content-container').append('
'); + + ShowStream(); // Generate the list var scope = view.inject(list, { @@ -257,7 +259,6 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti } scope['activities'][i].description = BuildDescription(scope['activities'][i]); } - ShowStream(); }); // Initialize search and paginate pieces and load data