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

@@ -32,7 +32,11 @@ app.controller('LogsController', ['$scope', '$timeout', '$location', 'Client', f
function showLogs() {
if (!$scope.selected) return;
var func = $scope.selected.type === 'platform' ? Client.getPlatformLogs : Client.getAppLogs;
var func;
if ($scope.selected.type === 'platform') func = Client.getPlatformLogs;
else if ($scope.selected.type === 'addon') func = Client.getAddonLogs;
else func = Client.getAppLogs;
func($scope.selected.value, true, $scope.lines, function handleLogs(error, result) {
if (error) return console.error(error);
@@ -66,11 +70,11 @@ app.controller('LogsController', ['$scope', '$timeout', '$location', 'Client', f
{ name: 'Box', type: 'platform', value: 'box', url: Client.makeURL('/api/v1/cloudron/logs/box') },
{ name: 'Mail', type: 'platform', value: 'mail', url: Client.makeURL('/api/v1/cloudron/logs/mail') },
{ name: 'Backup', type: 'platform', value: 'backup', url: Client.makeURL('/api/v1/cloudron/logs/backup') },
{ name: 'MongoDB', type: 'platform', value: 'mongodb', url: Client.makeURL('/api/v1/addons/mongodb/logs') },
{ name: 'MySQL', type: 'platform', value: 'mysql', url: Client.makeURL('/api/v1/addons/mysql/logs') },
{ name: 'PostgreSQL', type: 'platform', value: 'postgresql', url: Client.makeURL('/api/v1/addons/postgresql/logs') },
{ name: 'Email', type: 'platform', value: 'email', url: Client.makeURL('/api/v1/addons/email/logs') },
{ name: 'Docker', type: 'platform', value: 'docker', url: Client.makeURL('/api/v1/addons/docker/logs') }
{ name: 'MongoDB', type: 'addon', value: 'mongodb', url: Client.makeURL('/api/v1/addons/mongodb/logs') },
{ name: 'MySQL', type: 'addon', value: 'mysql', url: Client.makeURL('/api/v1/addons/mysql/logs') },
{ name: 'PostgreSQL', type: 'addon', value: 'postgresql', url: Client.makeURL('/api/v1/addons/postgresql/logs') },
{ name: 'Email', type: 'addon', value: 'email', url: Client.makeURL('/api/v1/addons/email/logs') },
{ name: 'Docker', type: 'addon', value: 'docker', url: Client.makeURL('/api/v1/addons/docker/logs') }
];
$scope.selected = BUILT_IN_LOGS.find(function (e) { return e.value === id; });