Show error when logs are gone

This commit is contained in:
Johannes Zellner
2023-05-15 17:49:34 +02:00
parent b5641cc445
commit af63dbb31d
4 changed files with 20 additions and 11 deletions

View File

@@ -1407,7 +1407,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
Client.prototype.getTaskLogs = function (taskId, follow, lines, callback) {
if (follow) {
var eventSource = new EventSource(client.apiOrigin + '/api/v1/tasks/' + taskId + '/logstream?lines=' + lines + '&access_token=' + token);
callback(null, eventSource);
eventSource.onerror = callback;
eventSource.onopen = function () { callback(null, eventSource); };
} else {
get('/api/v1/services/' + taskId + '/logs?lines=' + lines, null, function (error, data, status) {
if (error) return callback(error);
@@ -1544,7 +1545,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
Client.prototype.getPlatformLogs = function (unit, follow, lines, callback) {
if (follow) {
var eventSource = new EventSource(client.apiOrigin + '/api/v1/cloudron/logstream/' + unit + '?lines=' + lines + '&access_token=' + token);
callback(null, eventSource);
eventSource.onerror = callback;
eventSource.onopen = function () { callback(null, eventSource); };
} else {
get('/api/v1/cloudron/logs/' + unit + '?lines=' + lines, null, function (error, data, status) {
if (error) return callback(error);
@@ -1558,7 +1560,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
Client.prototype.getServiceLogs = function (serviceName, follow, lines, callback) {
if (follow) {
var eventSource = new EventSource(client.apiOrigin + '/api/v1/services/' + serviceName + '/logstream?lines=' + lines + '&access_token=' + token);
callback(null, eventSource);
eventSource.onerror = callback;
eventSource.onopen = function () { callback(null, eventSource); };
} else {
get('/api/v1/services/' + serviceName + '/logs?lines=' + lines, null, function (error, data, status) {
if (error) return callback(error);
@@ -1588,7 +1591,8 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
Client.prototype.getAppLogs = function (appId, follow, lines, callback) {
if (follow) {
var eventSource = new EventSource(client.apiOrigin + '/api/v1/apps/' + appId + '/logstream?lines=' + lines + '&access_token=' + token);
callback(null, eventSource);
eventSource.onerror = callback;
eventSource.onopen = function () { callback(null, eventSource); };
} else {
get('/api/v1/apps/' + appId + '/logs', null, function (error, data, status) {
if (error) return callback(error);