Fix error state handling
Do not disable views in error state. Many actions like display work just fine. Also, people want to restore etc but all this is disabled.
This commit is contained in:
+11
-14
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user