Repository: ignite
Updated Branches:
  refs/heads/master 53a58bcea -> 2b6e556aa


IGNITE-9070 Web Console: Fixed issue with notifications from Admin panel.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2b6e556a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2b6e556a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2b6e556a

Branch: refs/heads/master
Commit: 2b6e556aa7938529186e09745c81b8db4c3ea8ff
Parents: 53a58bc
Author: Alexey Kuznetsov <akuznet...@apache.org>
Authored: Wed Jul 25 00:27:30 2018 +0700
Committer: Alexey Kuznetsov <akuznet...@apache.org>
Committed: Wed Jul 25 00:27:30 2018 +0700

----------------------------------------------------------------------
 modules/web-console/backend/middlewares/api.js                  | 5 +++++
 modules/web-console/backend/routes/admin.js                     | 4 ++--
 modules/web-console/backend/services/notifications.js           | 4 +---
 .../frontend/app/components/user-notifications/service.js       | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2b6e556a/modules/web-console/backend/middlewares/api.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/middlewares/api.js 
b/modules/web-console/backend/middlewares/api.js
index 464471b..9fe9373 100644
--- a/modules/web-console/backend/middlewares/api.js
+++ b/modules/web-console/backend/middlewares/api.js
@@ -39,11 +39,16 @@ module.exports.factory = () => {
 
                 res.status(err.httpCode || err.code || 500).send(err.message);
             },
+
             ok(data) {
                 if (_.isNil(data))
                     return res.sendStatus(404);
 
                 res.status(200).json(data);
+            },
+
+            done() {
+                res.status(200).send({res: true});
             }
         };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b6e556a/modules/web-console/backend/routes/admin.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/routes/admin.js 
b/modules/web-console/backend/routes/admin.js
index 2c34cdb..4a38723 100644
--- a/modules/web-console/backend/routes/admin.js
+++ b/modules/web-console/backend/routes/admin.js
@@ -79,10 +79,10 @@ module.exports.factory = function(settings, mongo, 
spacesService, mailsService,
                 .catch(res.api.error);
         });
 
-        // Revert to your identity.
+        // Update notifications.
         router.put('/notifications', (req, res) => {
             notificationsService.merge(req.user._id, req.body.message, 
req.body.isShown)
-                .then(res.api.ok)
+                .then(res.api.done)
                 .catch(res.api.error);
         });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b6e556a/modules/web-console/backend/services/notifications.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/services/notifications.js 
b/modules/web-console/backend/services/notifications.js
index af70aee..4dacf51 100644
--- a/modules/web-console/backend/services/notifications.js
+++ b/modules/web-console/backend/services/notifications.js
@@ -42,9 +42,7 @@ module.exports.factory = (mongo, browsersHnd) => {
          */
         static merge(owner, message, isShown = false, date = new Date()) {
             return mongo.Notifications.create({owner, message, date, isShown})
-                .then(({message, date, isShown}) => {
-                    browsersHnd.updateNotification({message, date, isShown});
-                });
+                .then(({message, date, isShown}) => 
browsersHnd.updateNotification({message, date, isShown}));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b6e556a/modules/web-console/frontend/app/components/user-notifications/service.js
----------------------------------------------------------------------
diff --git 
a/modules/web-console/frontend/app/components/user-notifications/service.js 
b/modules/web-console/frontend/app/components/user-notifications/service.js
index 15e96f8..d008482 100644
--- a/modules/web-console/frontend/app/components/user-notifications/service.js
+++ b/modules/web-console/frontend/app/components/user-notifications/service.js
@@ -61,7 +61,7 @@ export default class UserNotificationsService {
             .finally(modalHide)
             .then(({ message, isShown }) => {
                 this.$http.put('/api/v1/admin/notifications', { message, 
isShown })
-                    .catch((err) => this.Messages.showError(err));
+                    .catch(this.Messages.showError);
             });
     }
 }

Reply via email to