diff --git a/src/views/account.html b/src/views/account.html index 827bf3554..85e8d4da6 100644 --- a/src/views/account.html +++ b/src/views/account.html @@ -285,6 +285,39 @@
+
+

Notifications

+
+ +
+
+
+
+ + + + + + + + + + + + + +
Title
+ {{ notification.title }} +
+
+
+
+
+ +
+

API Tokens

diff --git a/src/views/account.js b/src/views/account.js index 431801074..1dcb1d964 100644 --- a/src/views/account.js +++ b/src/views/account.js @@ -12,6 +12,7 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client $scope.activeClients = []; $scope.webadminClient = {}; $scope.apiClient = {}; + $scope.notifications = []; $scope.twoFactorAuthentication = { busy: false, @@ -381,6 +382,23 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client }); } + function refreshNotifications() { + Client.getNotifications(false, 1, 100, function (error, result) { + if (error) return console.error(error); + + $scope.notifications = result; + }); + } + + $scope.notificationClicked = function (notification) { + Client.ackNotification(notification.id, function (error) { + if (error) return console.error(error); + + if (notification.action) window.location = notification.action; + else refreshNotifications(); + }); + }; + Client.onReady(function () { Client.getOAuthClients(function (error, activeClients) { if (error) return console.error(error); @@ -397,6 +415,8 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client $scope.activeTokenCount += $scope.webadminClient ? $scope.webadminClient.activeTokens.length : 0; }); }); + + refreshNotifications(); }); // setup all the dialog focus handling