Use addon log routes in logviewer

This commit is contained in:
Johannes Zellner
2018-11-26 14:49:50 +01:00
parent ae488312a1
commit 8bd9237951
2 changed files with 22 additions and 6 deletions

View File

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