Display server logs

This commit is contained in:
jendib 2013-08-03 21:51:15 +02:00
parent c0e7e34373
commit f5871e89e2
8 changed files with 60 additions and 1 deletions

View File

@ -1,3 +1,2 @@
- Display logs (client)
- Tag stats (client/server) - Tag stats (client/server)
- Users administration (client) - Users administration (client)

View File

@ -175,6 +175,14 @@ public class FileResource extends BaseResource {
ValidationUtil.validateRequired(documentId, "id"); ValidationUtil.validateRequired(documentId, "id");
ValidationUtil.validateRequired(idList, "order"); ValidationUtil.validateRequired(idList, "order");
// Get the document
DocumentDao documentDao = new DocumentDao();
try {
documentDao.getDocument(documentId, principal.getId());
} catch (NoResultException e) {
throw new ClientException("DocumentNotFound", MessageFormat.format("Document not found: {0}", documentId));
}
// Reorder files // Reorder files
FileDao fileDao = new FileDao(); FileDao fileDao = new FileDao();
for (File file : fileDao.getByDocumentId(documentId)) { for (File file : fileDao.getByDocumentId(documentId)) {

View File

@ -41,6 +41,7 @@
<script src="js/controller/SettingsDefault.js" type="text/javascript"></script> <script src="js/controller/SettingsDefault.js" type="text/javascript"></script>
<script src="js/controller/SettingsAccount.js" type="text/javascript"></script> <script src="js/controller/SettingsAccount.js" type="text/javascript"></script>
<script src="js/controller/SettingsSession.js" type="text/javascript"></script> <script src="js/controller/SettingsSession.js" type="text/javascript"></script>
<script src="js/controller/SettingsLog.js" type="text/javascript"></script>
<script src="js/service/User.js" type="text/javascript"></script> <script src="js/service/User.js" type="text/javascript"></script>
<script src="js/service/Tag.js" type="text/javascript"></script> <script src="js/service/Tag.js" type="text/javascript"></script>
<script src="js/filter/Newline.js" type="text/javascript"></script> <script src="js/filter/Newline.js" type="text/javascript"></script>

View File

@ -66,6 +66,15 @@ var App = angular.module('docs', ['ui.state', 'ui.bootstrap', 'ui.route', 'ui.ke
} }
} }
}) })
.state('settings.log', {
url: '/log',
views: {
'settings': {
templateUrl: 'partial/settings.log.html',
controller: 'SettingsLog'
}
}
})
.state('document', { .state('document', {
url: '/document', url: '/document',
abstract: true, abstract: true,

View File

@ -0,0 +1,12 @@
'use strict';
/**
* Settings logs controller.
*/
App.controller('SettingsLog', function($scope, Restangular) {
Restangular.one('app/log').get({
limit: 100
}).then(function(data) {
$scope.logs = data.logs;
});
});

View File

@ -5,6 +5,9 @@
<li class="nav-header">Personal settings</li> <li class="nav-header">Personal settings</li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/account"><a href="#/settings/account">User account</a></li> <li ng-class="{active: $uiRoute}" ui-route="/settings/account"><a href="#/settings/account">User account</a></li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/session"><a href="#/settings/session">Opened sessions</a></li> <li ng-class="{active: $uiRoute}" ui-route="/settings/session"><a href="#/settings/session">Opened sessions</a></li>
<li class="nav-header">General settings</li>
<li ng-class="{active: $uiRoute}" ui-route="/settings/log"><a href="#/settings/log">Server logs</a></li>
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,18 @@
<h1>Server <small>logs</small></h1>
<table class="table table-striped table-hover table-logs">
<thead>
<tr>
<th>Date</th>
<th>Tag</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in logs"
ng-class="{ info: log.level == 'INFO' || log.level == 'DEBUG', warn: log.level == 'WARN', error: log.level == 'ERROR' || log.level == 'FATAL' }">
<td>{{ log.date | date: 'yyyy-MM-dd HH:mm' }}</td>
<td>{{ log.tag }}</td>
<td>{{ log.message }}</td>
</tr>
</tbody>
</table>

View File

@ -10,6 +10,15 @@
} }
} }
// Logs list
.table-logs {
tbody tr td {
&:first-child {
white-space: nowrap;
}
}
}
// File thumbnails // File thumbnails
.thumbnail-file { .thumbnail-file {
cursor: pointer; cursor: pointer;