Allow deep linking into the app configure views
This commit is contained in:
@@ -34,12 +34,23 @@
|
||||
// });
|
||||
// };
|
||||
|
||||
angular.module('Application').controller('AppController', ['$scope', '$location', '$timeout', '$interval', 'Client', function ($scope, $location, $timeout, $interval, Client) {
|
||||
angular.module('Application').controller('AppController', ['$scope', '$location', '$timeout', '$interval', '$route', '$routeParams', 'Client', function ($scope, $location, $timeout, $interval, $route, $routeParams, Client) {
|
||||
Client.onReady(function () { if (!Client.getUserInfo().admin) $location.path('/'); });
|
||||
|
||||
var appId = $location.path().slice('/app/'.length);
|
||||
// Avoid full reload on path change
|
||||
// https://stackoverflow.com/a/22614334
|
||||
// reloadOnUrl: false in $routeProvider did not work!
|
||||
var lastRoute = $route.current;
|
||||
$scope.$on('$locationChangeSuccess', function (/* event */) {
|
||||
if (lastRoute.$$route.originalPath === $route.current.$$route.originalPath) {
|
||||
$route.current = lastRoute;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.view = 'display';
|
||||
var appId = $routeParams.appId;
|
||||
if (!appId) return $location.path('/apps');
|
||||
|
||||
$scope.view = '';
|
||||
$scope.app = null;
|
||||
$scope.activeTask = null;
|
||||
$scope.appIsRestarting = false;
|
||||
@@ -57,6 +68,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
$scope.setView = function (view) {
|
||||
if ($scope.view === view) return;
|
||||
|
||||
$route.updateParams({ view: view });
|
||||
$scope[view].show();
|
||||
$scope.view = view;
|
||||
};
|
||||
@@ -737,6 +749,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
|
||||
$scope.app = app;
|
||||
|
||||
$scope.setView($routeParams.view || 'display');
|
||||
|
||||
asyncSeries([
|
||||
fetchUsers,
|
||||
fetchGroups,
|
||||
|
||||
Reference in New Issue
Block a user