You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/02/16 16:14:44 UTC

[27/50] ignite git commit: IGNITE-843 WIP rework server side to promises.

IGNITE-843 WIP rework server side to promises.


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

Branch: refs/heads/ignite-843-rc3
Commit: 3fc013ae481df5df795f35bd5d3e017f310afdf6
Parents: ba69d63
Author: AKuznetsov <ak...@gridgain.com>
Authored: Tue Feb 16 07:57:26 2016 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Tue Feb 16 07:57:26 2016 +0700

----------------------------------------------------------------------
 modules/control-center-web/src/main/js/serve/mongo.js     | 10 ++++++++++
 .../control-center-web/src/main/js/serve/routes/caches.js |  4 ++--
 .../src/main/js/serve/routes/clusters.js                  |  4 ++--
 .../src/main/js/serve/routes/domains.js                   |  6 +++---
 .../control-center-web/src/main/js/serve/routes/igfs.js   |  4 ++--
 5 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3fc013ae/modules/control-center-web/src/main/js/serve/mongo.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/mongo.js b/modules/control-center-web/src/main/js/serve/mongo.js
index 83d3b67..5dc1209 100644
--- a/modules/control-center-web/src/main/js/serve/mongo.js
+++ b/modules/control-center-web/src/main/js/serve/mongo.js
@@ -544,6 +544,16 @@ module.exports.factory = function(deepPopulatePlugin, passportMongo, settings, p
         return result.Space.find({owner: userId}).exec();
     };
 
+    /**
+     * Extract IDs from user spaces.
+     *
+     * @param spaces Array of user spaces.
+     * @returns {Array} of spaces ID.
+     */
+    result.spacesIds = function(spaces) {
+        return spaces.map((value) => value._id);
+    };
+
     // Registering the routes of all plugin modules
     for (const name in pluginMongo) {
         if (pluginMongo.hasOwnProperty(name))

http://git-wip-us.apache.org/repos/asf/ignite/blob/3fc013ae/modules/control-center-web/src/main/js/serve/routes/caches.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/caches.js b/modules/control-center-web/src/main/js/serve/routes/caches.js
index 77c3943..581b5f7 100644
--- a/modules/control-center-web/src/main/js/serve/routes/caches.js
+++ b/modules/control-center-web/src/main/js/serve/routes/caches.js
@@ -42,7 +42,7 @@ module.exports.factory = function(_, express, mongo) {
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
                     result.spaces = spaces;
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cluster.find({space: {$in: result.spacesIds}}).sort('name').exec();
                 })
@@ -123,7 +123,7 @@ module.exports.factory = function(_, express, mongo) {
 
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cluster.update({space: {$in: spacesIds}}, {caches: []}, {multi: true});
                 })

http://git-wip-us.apache.org/repos/asf/ignite/blob/3fc013ae/modules/control-center-web/src/main/js/serve/routes/clusters.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/clusters.js b/modules/control-center-web/src/main/js/serve/routes/clusters.js
index 468e912..c4260db 100644
--- a/modules/control-center-web/src/main/js/serve/routes/clusters.js
+++ b/modules/control-center-web/src/main/js/serve/routes/clusters.js
@@ -41,7 +41,7 @@ module.exports.factory = function(_, express, mongo) {
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
                     result.spaces = spaces;
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cache.find({space: {$in: spacesIds}}).sort('name').exec();
                 })
@@ -125,7 +125,7 @@ module.exports.factory = function(_, express, mongo) {
             // Get owned space and all accessed space.
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cluster.remove({space: {$in: spacesIds}});
                 })

http://git-wip-us.apache.org/repos/asf/ignite/blob/3fc013ae/modules/control-center-web/src/main/js/serve/routes/domains.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/domains.js b/modules/control-center-web/src/main/js/serve/routes/domains.js
index 922fff2..3dc2116 100644
--- a/modules/control-center-web/src/main/js/serve/routes/domains.js
+++ b/modules/control-center-web/src/main/js/serve/routes/domains.js
@@ -41,7 +41,7 @@ module.exports.factory = function(_, express, async, mongo) {
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
                     result.spaces = spaces;
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cluster.find({space: {$in: spacesIds}}, '_id name').sort('name').exec();
                 })
@@ -198,7 +198,7 @@ module.exports.factory = function(_, express, async, mongo) {
 
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cache.update({space: {$in: spacesIds}}, {domains: []}, {multi: true}).exec();
                 })
@@ -217,7 +217,7 @@ module.exports.factory = function(_, express, async, mongo) {
 
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.DomainModel.remove({$and: [{space: {$in: spacesIds}}, {demo: true}]});
                 })

http://git-wip-us.apache.org/repos/asf/ignite/blob/3fc013ae/modules/control-center-web/src/main/js/serve/routes/igfs.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/igfs.js b/modules/control-center-web/src/main/js/serve/routes/igfs.js
index 1df089e..39cc978 100644
--- a/modules/control-center-web/src/main/js/serve/routes/igfs.js
+++ b/modules/control-center-web/src/main/js/serve/routes/igfs.js
@@ -42,7 +42,7 @@ module.exports.factory = function(_, express, mongo) {
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
                     result.spaces = spaces;
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Cluster.find({space: {$in: spacesIds}}, '_id name').sort('name').exec();
                 })
@@ -114,7 +114,7 @@ module.exports.factory = function(_, express, mongo) {
             // Get owned space and all accessed space.
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
-                    spacesIds = spaces.map((value) => value._id);
+                    spacesIds = mongo.spacesIds(spaces);
 
                     return mongo.Igfs.remove({space: {$in: spacesIds}});
                 })