AC-657 Fixed order of operations for prompting user to approve delete, starting spinner, sending request to API, stoping spinner and refreshing page. The key is starting the spinner using the modal.on.hidden.bs.modal to start the spinner and then not stopping it until inside postrefresh event. Applied the fix to all controllers and tested.

This commit is contained in:
Chris Houseknecht
2013-11-20 06:06:13 +00:00
parent 4bc15a4392
commit 0127680805
8 changed files with 65 additions and 42 deletions
+7 -5
View File
@@ -33,6 +33,10 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
scope.removePostRefresh();
}
scope.removePostRefresh = scope.$on('PostRefresh', function() {
// Cleanup after a delete
Wait('stop');
$('#prompt-modal').off();
list.fields.kind.searchOptions = scope.credential_kind_options;
// Translate the kind value
@@ -88,20 +92,18 @@ function CredentialsList ($scope, $rootScope, $location, $log, $routeParams, Res
scope.deleteCredential = function(id, name) {
var action = function() {
Wait('start');
$('#prompt-modal').on('hidden.bs.modal', function(){ Wait('start'); });
$('#prompt-modal').modal('hide');
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 });
{ hdr: 'Error!', msg: 'Call to ' + url + ' failed. DELETE returned status: ' + status });
});
};