From 567605cc59d5ca89bda4cd20a84041efcdb809e1 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Thu, 26 Sep 2013 15:55:47 -0400 Subject: [PATCH] Latest UI changes --- awx/ui/static/js/controllers/Home.js | 29 ++++++++++++++++--------- awx/ui/static/js/widgets/ObjectCount.js | 1 + 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/awx/ui/static/js/controllers/Home.js b/awx/ui/static/js/controllers/Home.js index 3d3e142cd8..ae9ffdf623 100644 --- a/awx/ui/static/js/controllers/Home.js +++ b/awx/ui/static/js/controllers/Home.js @@ -12,18 +12,27 @@ function Home ($routeParams, $scope, $rootScope, $location, Wait, ObjectCount, ClearScope) { - //ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior - //scope. - if (!$routeParams['login']) { - Wait('start'); - } - - ObjectCount({ target: 'container1' }); + ClearScope('home'); //Garbage collection. Don't leave behind any listeners/watchers from the prior + //scope. - if (!$routeParams['login']) { - Wait('stop'); - } + var waitCount = 1; + var loadedCount = 0; + if (!$routeParams['login']) { + // If we're not logging in, start the Wait widget. Otherwise, it's already running. + Wait('start'); + } + + ObjectCount({ target: 'container1' }); + + $rootScope.$on('WidgetLoaded', function() { + // Once all the widget report back 'loaded', turn off Wait widget + console.log('got here!'); + loadedCount++; + if ( loadedCount == waitCount ) { + Wait('stop'); + } + }); } Home.$inject=[ '$routeParams', '$scope', '$rootScope', '$location', 'Wait', 'ObjectCount', 'ClearScope']; \ No newline at end of file diff --git a/awx/ui/static/js/widgets/ObjectCount.js b/awx/ui/static/js/widgets/ObjectCount.js index 16689b6473..6cd55f52ce 100644 --- a/awx/ui/static/js/widgets/ObjectCount.js +++ b/awx/ui/static/js/widgets/ObjectCount.js @@ -83,6 +83,7 @@ angular.module('ObjectCountWidget', ['RestServices', 'Utilities']) //scope = element.scope(); // Set scope specific to the element we're compiling, avoids circular reference // From here use 'scope' to manipulate the form, as the form is not in '$scope' $compile(element)(scope); + $rootScope.$emit('WidgetLoaded'); } });