Prettify eventlog source display

This commit is contained in:
Johannes Zellner
2018-03-02 19:21:24 +01:00
parent 31c414bbe1
commit 91265613a9
2 changed files with 18 additions and 1 deletions

View File

@@ -310,6 +310,23 @@ var ACTION_USER_LOGIN = 'user.login';
var ACTION_USER_REMOVE = 'user.remove';
var ACTION_USER_UPDATE = 'user.update';
app.filter('eventLogSource', function() {
return function(eventLog) {
var source = eventLog.source;
var data = eventLog.data;
var errorMessage = data.errorMessage;
// <span ng-show="eventLog.source.ip || eventLog.source.appId"> ({{ eventLog.source.ip || eventLog.source.appId }}) </span>
var line = source.username || source.userId || source.authType;
if (source.app) line += ' - ' + source.app.fqdn;
else if (source.ip) line += ' - ' + source.ip;
else if (source.appId) line += ' - ' + source.appId;
return line;
};
});
app.filter('eventLogDetails', function() {
// NOTE: if you change this, the CLI tool (cloudron machine eventlog) probably needs fixing as well
return function(eventLog) {

View File

@@ -38,7 +38,7 @@
<tbody ng-repeat="eventLog in eventLogs">
<tr ng-click="showEventLogDetails(eventLog)" class="hand">
<td><span uib-tooltip="{{ eventLog.creationTime | prettyLongDate }}" class="arrow">{{ eventLog.creationTime | prettyDate }}</span></td>
<td>{{ eventLog.source.username || eventLog.source.userId || eventLog.source.authType }} <span ng-show="eventLog.source.ip || eventLog.source.appId"> ({{ eventLog.source.ip || eventLog.source.appId }}) </span> </td>
<td>{{ eventLog | eventLogSource }}</td>
<td>{{ eventLog | eventLogAction }}</td>
<td ng-bind-html="eventLog | eventLogDetails"></td>
</tr>