Try to fetch the cloudron status to offer a way to reload

This commit is contained in:
Johannes Zellner
2016-01-19 11:20:32 +01:00
parent 19f404e092
commit eb6a09c2bd

View File

@@ -33,6 +33,7 @@
app.controller('Controller', ['$scope', '$http', function ($scope, $http) {
$scope.webServerOriginLink = '/';
$scope.errorMessage = '';
$scope.statusOk = false;
// try to fetch at least config.json to get appstore url
$http.get('/config.json').success(function(data, status) {
@@ -43,6 +44,15 @@
else console.error(status, data);
});
// try to fetch the cloudron status
$http.get('/api/v1/cloudron/status').success(function(data, status) {
if (status !== 200 || typeof data !== 'object') return console.error(status, data);
$scope.statusOk = true;
}).error(function (data, status) {
console.error(status, data);
$scope.statusOk = false;
});
var search = window.location.search.slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
$scope.errorCode = search.errorCode || 0;
@@ -62,7 +72,8 @@
<div ng-show="errorCode == 0">
<h3> <i class="fa fa-frown-o fa-fw text-danger"></i> Something has gone wrong </h3>
Please check your cloudron status <a href="{{ webServerOriginLink }}">here</a>.
<span ng-hide="statusOk">Please check your cloudron status <a href="{{ webServerOriginLink }}">here</a>.</span>
<span ng-show="statusOk">Please try again reloading the page <a href="/">here</a>.</span>
</div>
<div ng-show="errorCode == 1">