implement redirection when there are no more running backups (#92)

This commit is contained in:
ziirish 2015-12-15 10:02:08 +01:00
parent 48afa6a814
commit 6147a568ba
2 changed files with 8 additions and 2 deletions

View file

@ -266,7 +266,7 @@ class Alert(Resource):
message = args['message']
level = args['level'] or 'danger'
flash(args['message'], level)
return {'message': message}, 200
return {'message': message}, 201
@ns.route('/about.json',

View file

@ -59,11 +59,17 @@ app.controller('LiveCtrl', function($scope, $http, $interval) {
$scope.clients = [];
$scope.clients.push(data);
}
if ($scope.clients.length == 0) {
$http.post('{{ url_for("api.alert") }}', {'message': 'No more backup running'});
document.location = '{{ url_for("view.home") }}';
}
})
.error(function(data, status, headers, config) {
// TODO: redirect when there are no running backup
$scope.stopTimer();
errorsHandler(data);
setTimeout(function() {
document.location = '{{ url_for("view.home") }}';
}, 5000);
});
};