diff --git a/src/views/app.html b/src/views/app.html index 366735d11..deccd89a7 100644 --- a/src/views/app.html +++ b/src/views/app.html @@ -315,14 +315,14 @@
- +

@@ -579,7 +583,9 @@
- +
@@ -621,7 +627,9 @@
- +
@@ -650,7 +658,9 @@
- +
@@ -663,7 +673,9 @@

This app is running {{ app.manifest.dockerImage }} (Package v{{ app.manifest.version }}) and was last updated {{ app.updateTime | prettyDate }}.


- +
@@ -683,7 +695,9 @@
- + Backups are complete snapshots of the app. You can use app backups to restore or clone this app.
diff --git a/src/views/app.js b/src/views/app.js index d3d8b08a1..8b9ef89b6 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -36,14 +36,11 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $scope.HOST_PORT_MAX = 65535; $scope.ROBOTS_DISABLE_INDEXING_TEMPLATE = '# Disable search engine indexing\n\nUser-agent: *\nDisallow: /'; - $scope.setView = function (view) { + $scope.setView = function (view, skipViewShow) { if ($scope.view === view) return; - // on error only allow uninstall or repair view - if ($scope.app.error && !(view === 'uninstall' || view === 'console')) view = 'repair'; - $route.updateParams({ view: view }); - $scope[view].show(); + if (!skipViewShow) $scope[view].show(); $scope.view = view; }; @@ -1087,18 +1084,16 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $timeout(waitForAppTask.bind(null, callback), 2000); // not yet done } - function switchView() { - // Immediately move to debug view on error - if ($scope.app.error && !($scope.view === 'repair' || $scope.view === 'uninstall' || $scope.view === 'console')) $scope.setView('repair'); - - if (!$scope.view) $scope.setView($routeParams.view || 'display'); // first time - } - Client.onReady(function () { refreshApp(appId, function (error) { if (error) return Client.error(error); - switchView(); + // skipViewShow because we don't have all the values like domains/users to init the view yet + if ($routeParams.view) { // explicit route in url bar + $scope.setView($routeParams.view, true /* skipViewShow */); + } else { // default + $scope.setView($scope.app.error ? 'repair' : 'display', true /* skipViewShow */); + } asyncSeries([ fetchUsers, @@ -1108,7 +1103,9 @@ angular.module('Application').controller('AppController', ['$scope', '$location' ], function (error) { if (error) return Client.error(error); - var refreshTimer = $interval(function () { refreshApp($scope.app.id, switchView); }, 2000); // call with inline function to avoid iteration argument passed see $interval docs + $scope[$scope.view].show(); // initialize now that we have all the values + + var refreshTimer = $interval(function () { refreshApp($scope.app.id); }, 2000); // call with inline function to avoid iteration argument passed see $interval docs $scope.$on('$destroy', function () { $interval.cancel(refreshTimer); });