Support new platform log routes

This commit is contained in:
Johannes Zellner
2018-06-11 20:10:57 +02:00
parent e3950c2fb0
commit e741ca9216

View File

@@ -608,12 +608,12 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N
}).error(defaultErrorHandler(callback));
};
Client.prototype.getPlatformLogs = function (units, follow, lines, callback) {
Client.prototype.getPlatformLogs = function (unit, follow, lines, callback) {
if (follow) {
var eventSource = new EventSource(client.apiOrigin + '/api/v1/cloudron/logstream?lines=' + lines + '&access_token=' + token + '&units=' + units);
var eventSource = new EventSource(client.apiOrigin + '/api/v1/cloudron/logstream/' + unit + '?lines=' + lines + '&access_token=' + token);
callback(null, eventSource);
} else {
get('/api/v1/cloudron/logs?lines=100&units=' + units).success(function (data, status) {
get('/api/v1/cloudron/logs/' + unit + '?lines=100').success(function (data, status) {
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
callback(null, data);
}).error(defaultErrorHandler(callback));