diff --git a/src/js/index.js b/src/js/index.js index 9c13885c8..296d42c7a 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -338,6 +338,7 @@ app.filter('postInstallMessage', function () { var ACTION_ACTIVATE = 'cloudron.activate'; var ACTION_PROVISION = 'cloudron.provision'; var ACTION_RESTORE = 'cloudron.restore'; +var ACTION_APP_CLONE = 'app.clone'; var ACTION_APP_CONFIGURE = 'app.configure'; var ACTION_APP_INSTALL = 'app.install'; var ACTION_APP_RESTORE = 'app.restore'; @@ -346,7 +347,8 @@ var ACTION_APP_UPDATE = 'app.update'; var ACTION_APP_LOGIN = 'app.login'; var ACTION_BACKUP_FINISH = 'backup.finish'; var ACTION_BACKUP_START = 'backup.start'; -var ACTION_BACKUP_CLEANUP = 'backup.cleanup'; +var ACTION_BACKUP_CLEANUP_START = 'backup.cleanup.start'; +var ACTION_BACKUP_CLEANUP_FINISH = 'backup.cleanup.finish'; var ACTION_CERTIFICATE_NEW = 'certificate.new'; var ACTION_CERTIFICATE_RENEWAL = 'certificate.renew'; var ACTION_DOMAIN_ADD = 'domain.add'; @@ -391,6 +393,7 @@ app.filter('eventLogDetails', function() { var source = eventLog.source; var data = eventLog.data; var errorMessage = data.errorMessage; + var details; switch (eventLog.action) { case ACTION_ACTIVATE: @@ -403,19 +406,32 @@ app.filter('eventLogDetails', function() { return 'Cloudron was restored from backup ' + data.backupId; case ACTION_APP_CONFIGURE: - return (data.app ? (data.app.manifest.title + ' was re-configured at ' + (data.app.fqdn || data.app.location)) : ''); + if (!data.app) return ''; + return 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)) : ''); + if (!data.app) return ''; + return data.app.manifest.title + ' was installed at ' + (data.app.fqdn || data.app.location) + ' with version ' + data.app.manifest.version; case ACTION_APP_RESTORE: - return (data.app ? (data.app.manifest.title + ' was restored at ' + (data.app.fqdn || data.app.location)) : ''); + if (!data.app) return ''; + details = data.app.manifest.title + ' was restored at ' + (data.app.fqdn || data.app.location); + // older versions (<3.5) did not have these fields + if (data.fromManifest) details += ' from version ' + data.app.manifest.version; + if (data.toManifest) details += ' to version' + data.toManifest.version; + if (data.backupId) details += ' from backup ' + data.backupInfo.id; + return details; case ACTION_APP_UNINSTALL: - return (data.app ? (data.app.manifest.title + ' was uninstalled at ' + (data.app.fqdn || data.app.location)) : ''); + if (!data.app) return ''; + return data.app.manifest.title + ' was uninstalled at ' + (data.app.fqdn || data.app.location) + ' with version ' + data.app.manifest.version; 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; + if (!data.app) return ''; + return data.app.manifest.title + ' at ' + (data.app.fqdn || data.app.location) + ' was updated from version ' + data.fromManifest.version + ' to version ' + data.toManifest.version; + + case ACTION_APP_CLONE: + return data.newApp.manifest.title + ' at ' + (data.newApp.fqdn || data.newApp.location) + ' was cloned from ' + (data.oldApp.fqdn || data.oldApp.location) + ' from backup ' + data.backupId + ' with version ' + data.oldApp.manifest.version; case ACTION_APP_LOGIN: return 'App ' + data.appId + ' logged in'; @@ -426,8 +442,11 @@ app.filter('eventLogDetails', function() { case ACTION_BACKUP_FINISH: return 'Backup finished' + (errorMessage ? (' error: ' + errorMessage) : ''); - case ACTION_BACKUP_CLEANUP: - return 'Backup ' + data.backup.id + ' removed'; + case ACTION_BACKUP_CLEANUP_START: + return 'Backup cleaner started'; + + case ACTION_BACKUP_CLEANUP_FINISH: + return 'Backup cleaner removed ' + data.removedBoxBackups.length + ' backups'; case ACTION_CERTIFICATE_NEW: return 'Certificate install for ' + data.domain + (errorMessage ? ' failed' : ' succeeded'); @@ -489,12 +508,7 @@ app.filter('eventLogDetails', function() { }); 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_RESTORE: return 'Cloudron restored'; @@ -505,10 +519,13 @@ app.filter('eventLogAction', function() { case ACTION_APP_RESTORE: return 'App restored'; case ACTION_APP_UNINSTALL: return 'App uninstalled'; case ACTION_APP_UPDATE: return 'App updated'; + case ACTION_APP_CLONE: return 'App cloned'; 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_BACKUP_CLEANUP_START: return 'Backup cleaner started'; + case ACTION_BACKUP_CLEANUP_FINISH: return 'Backup cleaner finished'; + case ACTION_CERTIFICATE_NEW: return 'Certificated installed'; case ACTION_CERTIFICATE_RENEWAL: return 'Certificate renewal'; case ACTION_DOMAIN_ADD: return 'Domain added'; case ACTION_DOMAIN_UPDATE: return 'Domain updated'; @@ -520,7 +537,7 @@ app.filter('eventLogAction', function() { case ACTION_MAIL_LIST_ADD: return 'Mail list added'; case ACTION_MAIL_LIST_REMOVE: return 'Mail list removed'; case ACTION_START: return 'Cloudron started'; - case ACTION_UPDATE: return 'Platform updated'; + case ACTION_UPDATE: return 'Cloudron updated'; case ACTION_USER_ADD: return 'User added'; case ACTION_USER_LOGIN: return 'User login'; case ACTION_USER_REMOVE: return 'User removed';