diff --git a/src/js/client.js b/src/js/client.js index 9d60cb890..180710279 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -732,6 +732,15 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N }); }; + Client.prototype.getEvent = function (eventId, callback) { + get('/api/v1/cloudron/eventlog/' + eventId, {}, function (error, data, status) { + if (error) return callback(error); + if (status !== 200) return callback(new ClientError(status, data)); + + callback(null, data.event); + }); + }; + Client.prototype.getEventLogs = function (actions, search, page, perPage, callback) { var config = { params: { diff --git a/src/views/notifications.html b/src/views/notifications.html index 2726172ef..32b7db92e 100644 --- a/src/views/notifications.html +++ b/src/views/notifications.html @@ -23,11 +23,12 @@ {{ notification.title }} {{ notification.creationTime | prettyDate }} -
+

{{ notification.message }}
- - +
+

+
{{ notification.event.data | json }}
diff --git a/src/views/notifications.js b/src/views/notifications.js index 538f1f9ac..9dd3dca6f 100644 --- a/src/views/notifications.js +++ b/src/views/notifications.js @@ -17,9 +17,8 @@ angular.module('Application').controller('NotificationsController', ['$scope', ' Client.getNotifications($scope.notifications.all ? null : false, 1, 20, function (error, result) { if (error) return console.error(error); - result.forEach(function (r) { - r.isCollapsed = r.acknowledged; - }); + // collapse by default + result.forEach(function (r) { r.isCollapsed = true; }); $scope.notifications.notifications = result; @@ -69,6 +68,18 @@ angular.module('Application').controller('NotificationsController', ['$scope', ' } }; + $scope.notificationExpanding = function (notification) { + notification.busyLoadEvent = true; + + Client.getEvent(notification.eventId, function (error, result) { + notification.busyLoadEvent = false; + + if (error) return console.error(error); + + notification.event = result; + }); + }; + Client.onReady(function () { $scope.notifications.refresh(); });