ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [50/50] ignite git commit: IGNITE-843 Optimize server side.
Date Tue, 16 Feb 2016 15:15:07 GMT
IGNITE-843 Optimize server side.


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

Branch: refs/heads/ignite-843-rc3
Commit: ddf268ca01a67422a44b03f78a9f7a985f99435d
Parents: f06c195
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Tue Feb 16 22:06:02 2016 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Tue Feb 16 22:06:02 2016 +0700

----------------------------------------------------------------------
 .../src/main/js/serve/routes/clusters.js               | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ddf268ca/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 bca0735..aae7e42 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
@@ -37,6 +37,7 @@ module.exports.factory = function(_, express, mongo) {
         router.post('/list', (req, res) => {
             const result = {};
             let spacesIds = [];
+            let domains = {};
 
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
@@ -45,16 +46,18 @@ module.exports.factory = function(_, express, mongo) {
 
                     return mongo.DomainModel.find({space: {$in: spacesIds}}).sort('valueType').lean().exec();
                 })
-                .then((domains) => {
-                    result.domains = domains;
+                .then((_domains) => {
+                    domains = _domains.reduce((map, obj) => {
+                        map[obj._id] = obj;
+
+                        return map;
+                    }, {});
 
                     return mongo.Cache.find({space: {$in: spacesIds}}).sort('name').lean().exec();
                 })
                 .then((caches) => {
                     _.forEach(caches, (cache) => {
-                        cache.domains = _.map(cache.domains, (domainId) => {
-                            return _.find(result.domains, {_id: domainId});
-                        });
+                        cache.domains = _.map(cache.domains, (domainId) => domains[domainId]);
                     });
 
                     result.caches = caches;


Mime
View raw message