add activity view
This commit is contained in:
35
webadmin/src/views/activity.html
Normal file
35
webadmin/src/views/activity.html
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<h1>Activity Log</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="card card-block" style="max-width: 100%">
|
||||
<table class="table table-striped table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-1">Time</th>
|
||||
<th class="col-md-1">Action</th>
|
||||
<th class="col-md-1">Source</th>
|
||||
<th class="col-md-5">Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="eventLog in eventLogs">
|
||||
<td>{{ eventLog.creationTime | prettyDate }}</td>
|
||||
<th scope="row">{{ eventLog.action }}</td>
|
||||
<td>{{ eventLog.source.username }} ({{ eventLog.source.ip }})</td>
|
||||
<td>{{ eventLog.details }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
23
webadmin/src/views/activity.js
Normal file
23
webadmin/src/views/activity.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('Application').controller('ActivityController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
|
||||
$scope.config = Client.getConfig();
|
||||
|
||||
$scope.eventLogs = [ ];
|
||||
|
||||
function fetchEventLogs() {
|
||||
Client.getEventLogs(1, 20, function (error, eventLogs) {
|
||||
if (error) return console.error(error);
|
||||
|
||||
$scope.eventLogs = eventLogs;
|
||||
$scope.eventLogs.forEach(function (e) {
|
||||
e.details = Object.keys(e.data).map(function (k) { return k + ':' + e.data[k]; }).join(' ');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Client.onReady(function () {
|
||||
fetchEventLogs();
|
||||
});
|
||||
|
||||
}]);
|
||||
Reference in New Issue
Block a user