Fixed issue with selected users based on user.id rathr than set index. Fixed dataLoad callback not being destroyed after controller routine exits.

This commit is contained in:
Chris Houseknecht
2013-05-06 22:18:44 -04:00
parent ccb732bd69
commit ced96a1bb3
8 changed files with 60 additions and 52 deletions

View File

@@ -12,7 +12,7 @@
function HostsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
Alert, HostList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit,
ReturnToCaller, ClearScope)
ReturnToCaller, ClearScope, ProcessErrors)
{
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -65,7 +65,7 @@ function HostsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
}
HostsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'HostList', 'GenerateList',
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope' ];
'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors' ];
function HostsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, HostForm,
@@ -150,8 +150,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
LookUpInventoryInit({ scope: scope });
// After form data loads, load related sets and lookups
scope.$on('dataLoaded', function() {
scope.$on('hostLoaded', function() {
Rest.setUrl(scope['inventory_url']);
Rest.get()
.success( function(data, status, headers, config) {
@@ -162,11 +161,9 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to retrieve: ' + scope.inventory_url + '. GET status: ' + status });
});
for (var set in relatedSets) {
scope.search(relatedSets[set].iterator);
}
});
// Retrieve detail record and prepopulate the form
@@ -190,7 +187,7 @@ function HostsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope['inventory_url'] = data.related.inventory;
scope.$emit('dataLoaded');
scope.$emit('hostLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,