Add initial logs view

This commit is contained in:
Johannes Zellner
2017-08-07 13:50:45 +02:00
parent 800468fbe6
commit 125b416463
3 changed files with 61 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ app.config(['$routeProvider', function ($routeProvider) {
}).when('/graphs', {
controller: 'GraphsController',
templateUrl: 'views/graphs.html'
}).when('/logs', {
controller: 'LogsController',
templateUrl: 'views/logs.html'
}).when('/certs', {
controller: 'CertsController',
templateUrl: 'views/certs.html'

View File

@@ -0,0 +1,33 @@
<div class="content support">
<br/>
<div>
<div class="text-left">
<h1>Logs</h1>
</div>
</div>
<div class="card card-large">
<div class="grid-item-top">
<div class="row animateMeOpacity">
<div class="col-lg-12">
<h3>Logs</h3>
Select the log to view
<br/>
<br/>
<form name="logsForm">
<div class="form-group">
<select class="form-control" name="type" style="width: 50%;" ng-model="logs.selectedUrl" required>
<option ng-repeat="log in logs.types" ng-value="log.url">{{ log.name }}</option>
</select>
</div>
<a class="btn btn-primary" ng-disabled="!logs.selectedUrl" ng-href="{{logs.selectedUrl}}&format=short&lines=800" target="_self"> Download </a>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Offset the footer -->
<br/><br/>

View File

@@ -0,0 +1,25 @@
'use strict';
angular.module('Application').controller('LogsController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.logs = {
types: null,
selectedUrl: '' // index into types
};
$scope.populateLogTypes = function () {
$scope.logs.types = [
{ name: 'System (All)', url: Client.makeURL('/api/v1/cloudron/logs?units=all') },
{ name: 'Box', url: Client.makeURL('/api/v1/cloudron/logs?units=box') },
{ name: 'Mail', url: Client.makeURL('/api/v1/cloudron/logs?units=mail') }
];
Client.getInstalledApps().forEach(function (app) {
$scope.logs.types.push({ name: app.fqdn, url: Client.makeURL('/api/v1/apps/' + app.id + '/logs') });
});
};
Client.onReady($scope.populateLogTypes);
}]);