changing $routeChangeStart to $stateChangeStart

This commit is contained in:
Jared Tabor
2015-12-18 14:47:51 -08:00
parent 690d485616
commit f61bfa21da

View File

@@ -1017,58 +1017,58 @@ var tower = angular.module('Tower', [
},2000); },2000);
}); });
// $rootScope.$on("$routeChangeStart", function (event, next, prev) { $rootScope.$on("$stateChangeStart", function (event, next, nextParams, prev) {
// // this line removes the query params attached to a route // this line removes the query params attached to a route
// if(prev && prev.$$route && if(prev && prev.$$route &&
// prev.$$route.name === 'systemTracking'){ prev.$$route.name === 'systemTracking'){
// $location.replace($location.search('').$$url); $location.replace($location.search('').$$url);
// } }
//
// // Before navigating away from current tab, make sure the primary view is visible // Before navigating away from current tab, make sure the primary view is visible
// if ($('#stream-container').is(':visible')) { if ($('#stream-container').is(':visible')) {
// HideStream(); HideStream();
// } }
//
// // remove any lingering intervals // remove any lingering intervals
// if ($rootScope.jobDetailInterval) { if ($rootScope.jobDetailInterval) {
// window.clearInterval($rootScope.jobDetailInterval); window.clearInterval($rootScope.jobDetailInterval);
// } }
// if ($rootScope.jobStdOutInterval) { if ($rootScope.jobStdOutInterval) {
// window.clearInterval($rootScope.jobStdOutInterval); window.clearInterval($rootScope.jobStdOutInterval);
// } }
//
// // On each navigation request, check that the user is logged in // On each navigation request, check that the user is logged in
// if (!/^\/(login|logout)/.test($location.path())) { if (!/^\/(login|logout)/.test($location.path())) {
// // capture most recent URL, excluding login/logout // capture most recent URL, excluding login/logout
// $rootScope.lastPath = $location.path(); $rootScope.lastPath = $location.path();
// $rootScope.enteredPath = $location.path(); $rootScope.enteredPath = $location.path();
// $cookieStore.put('lastPath', $location.path()); $cookieStore.put('lastPath', $location.path());
// } }
//
// if (Authorization.isUserLoggedIn() === false) { if (Authorization.isUserLoggedIn() === false) {
// if (next.templateUrl !== (urlPrefix + 'login/loginBackDrop.partial.html')) { if (next.templateUrl !== (urlPrefix + 'login/loginBackDrop.partial.html')) {
// $location.path('/login'); $location.path('/login');
// } }
// } else if ($rootScope && $rootScope.sessionTimer && $rootScope.sessionTimer.isExpired()) { } else if ($rootScope && $rootScope.sessionTimer && $rootScope.sessionTimer.isExpired()) {
// // gets here on timeout // gets here on timeout
// if (next.templateUrl !== (urlPrefix + 'login/loginBackDrop.partial.html')) { if (next.templateUrl !== (urlPrefix + 'login/loginBackDrop.partial.html')) {
// $rootScope.sessionTimer.expireSession('idle'); $rootScope.sessionTimer.expireSession('idle');
// if (sock&& sock.socket && sock.socket.socket) { if (sock&& sock.socket && sock.socket.socket) {
// sock.socket.socket.disconnect(); sock.socket.socket.disconnect();
// } }
// $location.path('/login'); $location.path('/login');
// } }
// } else { } else {
// if ($rootScope.current_user === undefined || $rootScope.current_user === null) { if ($rootScope.current_user === undefined || $rootScope.current_user === null) {
// Authorization.restoreUserInfo(); //user must have hit browser refresh Authorization.restoreUserInfo(); //user must have hit browser refresh
// } }
// if (next && next.$$route && (!/^\/(login|logout)/.test(next.$$route.originalPath))) { if (next && next.$$route && (!/^\/(login|logout)/.test(next.$$route.originalPath))) {
// // if not headed to /login or /logout, then check the license // if not headed to /login or /logout, then check the license
// CheckLicense.test(); CheckLicense.test();
// } }
// } }
// activateTab(); activateTab();
// }); });
if (!Authorization.getToken() || !Authorization.isUserLoggedIn()) { if (!Authorization.getToken() || !Authorization.isUserLoggedIn()) {
// User not authenticated, redirect to login page // User not authenticated, redirect to login page