Improve loading state in support view

This commit is contained in:
Johannes Zellner
2021-10-19 15:14:52 +02:00
parent c0be926d99
commit f3dcf10ace
2 changed files with 16 additions and 16 deletions

View File

@@ -6,6 +6,7 @@
angular.module('Application').controller('SupportController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); });
$scope.ready = false;
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.apps = Client.getInstalledApps();
@@ -86,28 +87,24 @@ angular.module('Application').controller('SupportController', ['$scope', '$locat
});
};
function getSubscription() {
Client.onReady(function () {
Client.getSubscription(function (error, result) {
if (error && error.statusCode === 412) return; // not yet registered
if (error) return console.error(error);
console.log(result);
$scope.subscription = result;
});
}
Client.onReady(function () {
getSubscription();
Client.getSupportConfig(function (error, supportConfig) {
if (error) return console.error(error);
$scope.supportConfig = supportConfig;
Client.getRemoteSupport(function (error, enabled) {
Client.getSupportConfig(function (error, supportConfig) {
if (error) return console.error(error);
$scope.sshSupportEnabled = enabled;
$scope.supportConfig = supportConfig;
Client.getRemoteSupport(function (error, enabled) {
if (error) return console.error(error);
$scope.sshSupportEnabled = enabled;
$scope.ready = true;
});
});
});
});