Fix eventlog display

This commit is contained in:
Girish Ramakrishnan
2018-03-13 21:56:47 -07:00
parent c0f01da1cd
commit 529a668db3
2 changed files with 71 additions and 39 deletions

View File

@@ -335,24 +335,58 @@ app.filter('eventLogDetails', function() {
var errorMessage = data.errorMessage;
switch (eventLog.action) {
case ACTION_ACTIVATE: return '';
case ACTION_APP_CONFIGURE:
case ACTION_APP_INSTALL:
case ACTION_APP_RESTORE:
case ACTION_APP_UNINSTALL: return (data.app ? ('<b>' + data.app.manifest.title + '</b> at <b>' + (data.app.fqdn || data.app.location) + '</b>') : '');
case ACTION_APP_UPDATE: return (data.app ? ('<b>' + data.app.manifest.title + '</b> at <b>' + (data.app.fqdn || data.app.location) + '</b>') : '') + ' to version <b>' + data.toManifest.id + '@' + data.toManifest.version + '</b>';
case ACTION_APP_LOGIN: return 'App ' + data.appId + ' logged in';
case ACTION_BACKUP_START: return 'Backup started';
case ACTION_BACKUP_FINISH: return 'Backup finished' + (errorMessage ? (' error: ' + errorMessage) : '');
case ACTION_BACKUP_CLEANUP: return 'Backup ' + data.backup.id + ' removed';
case ACTION_CERTIFICATE_RENEWAL: return 'Certificate renewal for ' + data.domain + (errorMessage ? ' failed' : ' succeeded');
case ACTION_START: return 'Cloudron started with version ' + data.version;
case ACTION_UPDATE: return 'Updating to version ' + data.boxUpdateInfo.version;
case ACTION_USER_ADD: return data.email + (data.user.username ? ' as <b>' + data.user.username + '</b>' : '');
case ACTION_USER_UPDATE:
case ACTION_USER_REMOVE:
case ACTION_USER_LOGIN: return data.user ? (data.user.email + (data.user.username ? ' as <b>' + data.user.username + '</b>' : '')) : data.userId;
default: return eventLog.action;
case ACTION_ACTIVATE:
return 'Cloudron was activated';
case ACTION_APP_CONFIGURE:
return (data.app ? (data.app.manifest.title + ' was re-configured at ' + (data.app.fqdn || data.app.location)) : '');
case ACTION_APP_INSTALL:
return (data.app ? (data.app.manifest.title + ' was installed at ' + (data.app.fqdn || data.app.location)) : '');
case ACTION_APP_RESTORE:
return (data.app ? (data.app.manifest.title + ' was restored at ' + (data.app.fqdn || data.app.location)) : '');
case ACTION_APP_UNINSTALL:
return (data.app ? (data.app.manifest.title + ' was uninstalled at ' + (data.app.fqdn || data.app.location)) : '');
case ACTION_APP_UPDATE:
return (data.app ? (data.app.manifest.title + ' at ' + (data.app.fqdn || data.app.location)) : '') + ' was updated to version ' + data.toManifest.id + '@' + data.toManifest.version;
case ACTION_APP_LOGIN:
return 'App ' + data.appId + ' logged in';
case ACTION_BACKUP_START:
return 'Backup started';
case ACTION_BACKUP_FINISH:
return 'Backup finished' + (errorMessage ? (' error: ' + errorMessage) : '');
case ACTION_BACKUP_CLEANUP:
return 'Backup ' + data.backup.id + ' removed';
case ACTION_CERTIFICATE_RENEWAL:
return 'Certificate renewal for ' + data.domain + (errorMessage ? ' failed' : ' succeeded');
case ACTION_START:
return 'Cloudron started with version ' + data.version;
case ACTION_UPDATE:
return 'Cloudron was updated to version ' + data.boxUpdateInfo.version;
case ACTION_USER_ADD:
return data.email + (data.user.username ? ' (' + data.user.username + ')' : '') + ' was added';
case ACTION_USER_UPDATE:
return (data.user ? (data.user.email + (data.user.username ? ' (' + data.user.username + ')' : '')) : data.userId) + ' was updated';
case ACTION_USER_REMOVE:
return (data.user ? (data.user.email + (data.user.username ? ' (' + data.user.username + ')' : '')) : data.userId) + ' was removed';
case ACTION_USER_LOGIN:
return (data.user ? (data.user.email + (data.user.username ? ' (' + data.user.username + ')' : '')) : data.userId) + ' logged in';
default: return eventLog.action;
}
};
});
@@ -365,24 +399,24 @@ app.filter('eventLogAction', function() {
var errorMessage = data.errorMessage;
switch (eventLog.action) {
case ACTION_ACTIVATE: return 'Cloudron activated';
case ACTION_APP_CONFIGURE: return 'App configured';
case ACTION_APP_INSTALL: return 'App installed';
case ACTION_APP_RESTORE: return 'App restored';
case ACTION_APP_UNINSTALL: return 'App uninstalled';
case ACTION_APP_UPDATE: return 'App updated';
case ACTION_APP_LOGIN: return 'App login';
case ACTION_BACKUP_START: return 'Backup started';
case ACTION_BACKUP_FINISH: return 'Backup finished';
case ACTION_BACKUP_CLEANUP: return 'Backup removed';
case ACTION_CERTIFICATE_RENEWAL: return 'Certificate renewal';
case ACTION_START: return 'Cloudron started';
case ACTION_UPDATE: return 'Platform updated';
case ACTION_USER_ADD: return 'User added';
case ACTION_USER_LOGIN: return 'User login';
case ACTION_USER_REMOVE: return 'User removed';
case ACTION_USER_UPDATE: return 'User updated';
default: return eventLog.action;
case ACTION_ACTIVATE: return 'Cloudron activated';
case ACTION_APP_CONFIGURE: return 'App configured';
case ACTION_APP_INSTALL: return 'App installed';
case ACTION_APP_RESTORE: return 'App restored';
case ACTION_APP_UNINSTALL: return 'App uninstalled';
case ACTION_APP_UPDATE: return 'App updated';
case ACTION_APP_LOGIN: return 'App login';
case ACTION_BACKUP_START: return 'Backup started';
case ACTION_BACKUP_FINISH: return 'Backup finished';
case ACTION_BACKUP_CLEANUP: return 'Backup removed';
case ACTION_CERTIFICATE_RENEWAL: return 'Certificate renewal';
case ACTION_START: return 'Cloudron started';
case ACTION_UPDATE: return 'Platform updated';
case ACTION_USER_ADD: return 'User added';
case ACTION_USER_LOGIN: return 'User login';
case ACTION_USER_REMOVE: return 'User removed';
case ACTION_USER_UPDATE: return 'User updated';
default: return eventLog.action;
}
};
});

View File

@@ -30,15 +30,13 @@
<thead>
<tr>
<th class="col-md-2">Time</th>
<th class="col-md-2">Event</th>
<th class="col-md-3">Source</th>
<th class="col-md-5">Details</th>
<th class="col-md-7">Details</th>
</tr>
</thead>
<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 | eventLogAction }}</td>
<td>{{ eventLog | eventLogSource }}</td>
<td ng-bind-html="eventLog | eventLogDetails"></td>
</tr>