diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js index 1ba3780aa2..6bea1ee2d2 100644 --- a/awx/ui/static/js/controllers/Home.js +++ b/awx/ui/static/js/controllers/Home.js @@ -16,7 +16,8 @@ function Home ($routeParams, $rootScope, $location, Wait, ObjectCount, JobStatus ClearScope('home'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. - var scope = $rootScope.$new(); + var element = angular.element(document.getElementById('htmlTemplate')); + var scope = element.scope(); var waitCount = 4; var loadedCount = 0; @@ -31,7 +32,6 @@ function Home ($routeParams, $rootScope, $location, Wait, ObjectCount, JobStatus scope.removeWidgetLoaded = scope.$on('WidgetLoaded', function() { // Once all the widgets report back 'loaded', turn off Wait widget loadedCount++; - console.log('count: ' + loadedCount); if ( loadedCount == waitCount ) { Wait('stop'); } @@ -48,18 +48,24 @@ function Home ($routeParams, $rootScope, $location, Wait, ObjectCount, JobStatus }); scope.showActivity = function() { Stream(); } - scope.refresh = function() { load(); } + + scope.refresh = function() { + Wait('start'); + loadedCount = 0; + Rest.setUrl(GetBasePath('dashboard')); + Rest.get() + .success( function(data, status, headers, config) { + scope.$emit('dashboardReady', data); + }) + .error ( function(data, status, headers, config) { + Wait('stop'); + ProcessErrors(scope, data, status, null, + { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status }); + }) + } + + scope.refresh(); - Rest.setUrl(GetBasePath('dashboard')); - Rest.get() - .success( function(data, status, headers, config) { - scope.$emit('dashboardReady', data); - }) - .error ( function(data, status, headers, config) { - Wait('stop'); - ProcessErrors(scope, data, status, null, - { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status }); - }) } Home.$inject=[ '$routeParams', '$rootScope', '$location', 'Wait', 'ObjectCount', 'JobStatus', 'InventorySyncStatus', diff --git a/awx/ui/static/js/widgets/Stream.js b/awx/ui/static/js/widgets/Stream.js index 78b0cbc142..6dc7c4e3d8 100644 --- a/awx/ui/static/js/widgets/Stream.js +++ b/awx/ui/static/js/widgets/Stream.js @@ -214,9 +214,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti scope['object2_name'] = results.summary_fields.object2.name; } scope['user'] = (results.summary_fields.user) ? results.summary_fields.user.username : 'system'; - scope['changes'] = results['changes']; - //scope['changes'] = (!Empty(results['changes'])) ? JSON.parse(scope.variables) : ''; - //scope['changes'] = JSON.stringify(results['changes'], null, '\t'); + scope['changes'] = JSON.stringify(results['changes'], null, '\t'); scope.formModalAction = function() { $('#form-modal').modal("hide"); } diff --git a/awx/ui/static/partials/home.html b/awx/ui/static/partials/home.html index 189ce1c096..f985574895 100644 --- a/awx/ui/static/partials/home.html +++ b/awx/ui/static/partials/home.html @@ -1,4 +1,5 @@