Improve app related eventlog display

This commit is contained in:
Johannes Zellner
2018-03-02 10:49:46 +01:00
parent 576f6eafbb
commit 1fc7efef0d

View File

@@ -311,28 +311,54 @@ app.filter('eventLogDetails', function() {
var data = eventLog.data;
var errorMessage = data.errorMessage;
function shortenId(id) {
return id.slice(0, 8) + '...';
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) : ('id: ' + data.filename));
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 'User ' + data.email + ' added with id ' + data.userId;
case ACTION_USER_LOGIN: return 'User ' + data.userId + ' logged in';
case ACTION_USER_REMOVE: return 'User ' + data.userId + ' removed';
case ACTION_USER_UPDATE: return 'User ' + data.userId + ' updated';
default: return eventLog.action;
}
};
});
app.filter('eventLogAction', function() {
// NOTE: if you change this, the CLI tool (cloudron machine eventlog) probably needs fixing as well
return function(eventLog) {
var source = eventLog.source;
var data = eventLog.data;
var errorMessage = data.errorMessage;
switch (eventLog.action) {
case ACTION_ACTIVATE: return 'Cloudron activated';
case ACTION_APP_CONFIGURE: return 'App ' + shortenId(data.appId) + ' was configured';
case ACTION_APP_INSTALL: return 'App ' + data.manifest.id + '@' + data.manifest.version + ' installed at ' + data.location + '.' + data.domain + ' with id ' + shortenId(data.appId);
case ACTION_APP_RESTORE: return 'App ' + shortenId(data.appId) + ' restored';
case ACTION_APP_UNINSTALL: return 'App ' + shortenId(data.appId) + ' uninstalled';
case ACTION_APP_UPDATE: return 'App ' + shortenId(data.appId) + ' updated to version ' + data.toManifest.id + '@' + data.toManifest.version;
case ACTION_APP_LOGIN: return 'App ' + shortenId(data.appId) + ' logged in';
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 logged in';
case ACTION_BACKUP_START: return 'Backup started';
case ACTION_BACKUP_FINISH: return 'Backup finished. ' + (errorMessage ? ('error: ' + errorMessage) : ('id: ' + data.filename));
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 'User ' + data.email + ' added with id ' + data.userId;
case ACTION_USER_LOGIN: return 'User ' + data.userId + ' logged in';
case ACTION_USER_REMOVE: return 'User ' + data.userId + ' removed';
case ACTION_USER_UPDATE: return 'User ' + data.userId + ' updated';
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 startup';
case ACTION_UPDATE: return 'Platform update';
case ACTION_USER_ADD: return 'User added';
case ACTION_USER_LOGIN: return 'User logged in';
case ACTION_USER_REMOVE: return 'User removed';
case ACTION_USER_UPDATE: return 'User updated';
default: return eventLog.action;
}
};