ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [45/47] ignite git commit: IGNITE-5734 Web Console: Fixed transition.
Date Tue, 01 Aug 2017 09:26:28 GMT
IGNITE-5734 Web Console: Fixed transition.


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

Branch: refs/heads/master
Commit: 4d323f374670af277a4c37ee91fe49273bd95d91
Parents: 0376c48
Author: Andrey Novikov <anovikov@gridgain.com>
Authored: Tue Aug 1 14:27:49 2017 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Tue Aug 1 14:27:49 2017 +0700

----------------------------------------------------------------------
 modules/web-console/backend/middlewares/api.js  | 38 +++++++++++---------
 .../frontend/app/modules/user/user.module.js    |  2 +-
 2 files changed, 22 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4d323f37/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 9c6395e..2c4c1bd 100644
--- a/modules/web-console/backend/middlewares/api.js
+++ b/modules/web-console/backend/middlewares/api.js
@@ -21,24 +21,28 @@
 
 module.exports = {
     implements: 'middlewares:api',
-    factory: () => {
-        return (req, res, next) => {
-            res.api = {
-                error(err) {
-                    // TODO: removed code from error
-                    res.status(err.httpCode || err.code || 500).send(err.message);
-                },
-                ok(data) {
-                    res.status(200).json(data);
-                },
-                serverError(err) {
-                    err.httpCode = 500;
+    inject: ['require("mongodb-core")']
+};
+
+module.exports.factory = (mongodb) => {
+    return (req, res, next) => {
+        res.api = {
+            error(err) {
+                if (err instanceof mongodb.MongoError)
+                    res.status(500).send(err.message);
 
-                    res.api.error(err);
-                }
-            };
+                res.status(err.httpCode || err.code || 500).send(err.message);
+            },
+            ok(data) {
+                res.status(200).json(data);
+            },
+            serverError(err) {
+                err.httpCode = 500;
 
-            next();
+                res.api.error(err);
+            }
         };
-    }
+
+        next();
+    };
 };

http://git-wip-us.apache.org/repos/asf/ignite/blob/4d323f37/modules/web-console/frontend/app/modules/user/user.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/user.module.js b/modules/web-console/frontend/app/modules/user/user.module.js
index cac8943..5cd8bc5 100644
--- a/modules/web-console/frontend/app/modules/user/user.module.js
+++ b/modules/web-console/frontend/app/modules/user/user.module.js
@@ -35,7 +35,7 @@ angular.module('ignite-console.user', [
 
                 const stateName = $injector.get('$uiRouterGlobals').current.name;
 
-                if (stateName !== 'signin')
+                if (!_.includes(['', 'signin'], stateName))
                     $injector.get('$state').go('signin');
             }
 


Mime
View raw message