Merge pull request #63 from ansible/fix-dashboard-errors

Do not try to render home template on login/logout
This commit is contained in:
Joe Fiorini 2015-02-06 09:26:47 -05:00
commit 2f9dc2b4ef
7 changed files with 8 additions and 32 deletions

View File

@ -387,12 +387,12 @@ angular.module('Tower', [
}).
when('/login', {
templateUrl: urlPrefix + 'partials/home.html',
templateUrl: urlPrefix + 'partials/blank.html',
controller: 'Authenticate'
}).
when('/logout', {
templateUrl: urlPrefix + 'partials/home.html',
templateUrl: urlPrefix + 'partials/blank.html',
controller: 'Authenticate'
}).

View File

@ -1,5 +1,5 @@
angular.module('DashboardGraphs')
.directive('autoSizeModule', ['$window', '$timeout', function($window, $timeout) {
.directive('autoSizeModule', ['$window', function($window) {
// Adjusts the size of the module so that all modules
// fit into a single a page; assumes there are 2 rows
@ -7,19 +7,8 @@ angular.module('DashboardGraphs')
// by the navbar & the count summaries module
return function(scope, element) {
// We need to trigger a resize on the first call
// to this when the view things load; but we don't want
// to trigger a global window resize for everything that
// has an auto resize, since they'll all pick it up with
// a single call
var triggerResize =
_.throttle(function() {
$($window).resize();
}, 1000);
function adjustSizeInitially() {
adjustSize();
triggerResize();
}
function adjustSize() {
@ -34,17 +23,10 @@ angular.module('DashboardGraphs')
$($window).off('resize', adjustSize);
});
// Wait a second or until dashboardReady triggers,
// whichever comes first. The timeout handles cases
// where dashboardReady never fires.
var dashboardReadyTimeout = $timeout(adjustSizeInitially, 500);
// This makes sure count-container div is loaded
// by controllers/Home.js before we use it
// to determine the available window height
scope.$on('dashboardReady', function() {
$timeout.cancel(dashboardReadyTimeout);
adjustSizeInitially();
});

View File

@ -28,14 +28,7 @@ angular.module('DashboardGraphs').
adjustGraphSize(license_graph, element);
}
angular.element($window).on('resize', function() {
if(!license_graph) {
return;
}
adjustGraphSize(license_graph, element);
});
angular.element($window).on('resize', onResize);
element.on('$destroy', function() {
angular.element($window).off('resize', onResize);

View File

@ -40,7 +40,7 @@ function HostCountGraphData(Rest, getBasePath, processErrors, $q) {
processErrors(null, response.data, response.status, null, { hdr: 'Error!',
msg: errorMessage
});
return response;
throw response;
});
}
};

View File

@ -28,7 +28,7 @@ function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope) {
hdr: 'Error!',
msg: errorMessage
});
return response;
throw response;
});
return pluck('data', result);

View File

@ -0,0 +1 @@
<div></div>

View File

@ -1,5 +1,5 @@
<div class="tab-pane" id="home" ng-if="current_user">
<div class="tab-pane" id="home">
<div ng-cloak id="htmlTemplate" style="padding:10px">
<div id="refresh-row" class="row">
<div class="col-lg-12">