Set busy indicator to false in refresh callbacks

This commit is contained in:
Girish Ramakrishnan
2019-12-20 19:09:17 -08:00
parent 24d1c2d63a
commit f5fd75f4fa
2 changed files with 42 additions and 35 deletions

View File

@@ -114,13 +114,16 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
function done(error) {
if (error) Client.error(error);
refreshApp($scope.app.id, $scope.display.show);
$scope.displayForm.$setPristine();
$scope.display.success = true;
$timeout(function () {
$scope.display.busy = false;
$scope.display.success = true;
$scope.displayForm.$setPristine();
}, 1000);
refreshApp($scope.app.id, function (error) {
if (error) Client.error(error);
$scope.display.show(); // "refresh" view with latest data
$timeout(function () { $scope.display.busy = false; }, 1000);
});
}
var NOOP = function (next) { return next(); };
@@ -281,10 +284,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
}
if (error) return Client.error(error);
$scope.locationForm.$setPristine();
$scope.location.busy = false;
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id);
$scope.locationForm.$setPristine();
$timeout(function () { $scope.location.busy = false; }, 1000);
});
});
});
}
@@ -390,9 +395,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
if (error) return Client.error(error);
$scope.resources.currentMemoryLimit = $scope.resources.memoryLimit;
$scope.resources.busy = false;
refreshApp($scope.app.id);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () { $scope.resources.busy = false; }, 1000);
});
});
},
@@ -409,9 +417,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
if (error) return Client.error(error);
$scope.resourcesDataDirForm.$setPristine();
$scope.resources.busyDataDir = false;
refreshApp($scope.app.id);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () { $scope.resources.busyDataDir = false; }, 1000);
});
});
}
};
@@ -447,13 +458,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.emailForm.$setPristine();
$scope.email.busy = false;
refreshApp($scope.app.id, function (error) {
if (error) return;
if (error) return Client.error(error);
// when the mailboxName is 'reset', this will fill it up with the default again
$scope.email.mailboxName = $scope.app.mailboxName || '';
$scope.email.mailboxDomain = $scope.domains.filter(function (d) { return d.domain === $scope.app.mailboxDomain; })[0];
$timeout(function () { $scope.email.busy = false; }, 1000);
});
});
}
@@ -663,11 +676,11 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
func($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () {
$scope.console.busyRunState = false;
}, 1000);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id);
$timeout(function () { $scope.console.busyRunState = false; }, 1000);
});
});
}
};
@@ -923,12 +936,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
Client.restartApp($scope.app.id, function (error) {
if (error) return console.error(error);
refreshApp($scope.app.id, function () {
waitForAppTask(function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$scope.repair.restartBusy = false;
});
$timeout(function () { $scope.repair.restartBusy = false; }, 1000);
});
});
},
@@ -941,12 +952,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
Client.debugApp($scope.app.id, true, function (error) {
if (error) return console.error(error);
refreshApp($scope.app.id, function () {
waitForAppTask(function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$scope.repair.pauseBusy = false;
});
$timeout(function () { $scope.repair.pauseBusy = false; }, 1000);
});
});
},
@@ -957,12 +966,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
Client.debugApp($scope.app.id, false, function (error) {
if (error) return console.error(error);
refreshApp($scope.app.id, function () {
waitForAppTask(function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$scope.repair.pauseBusy = false;
});
$timeout(function () { $scope.repair.pauseBusy = false; }, 1000);
});
});
}