ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: IGNITE-843 Refactor serve to es6.
Date Tue, 16 Feb 2016 08:44:03 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843-rc2 4d75119c4 -> 28f33ca99


IGNITE-843 Refactor serve to es6.


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

Branch: refs/heads/ignite-843-rc2
Commit: 28f33ca99519e4980081e05354892b0afc41eaff
Parents: 4d75119
Author: Andrey <anovikov@gridgain.com>
Authored: Tue Feb 16 15:44:14 2016 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Tue Feb 16 15:44:14 2016 +0700

----------------------------------------------------------------------
 modules/control-center-web/src/main/js/serve.js |  2 +-
 .../src/main/js/serve/routes/caches.js          |  4 ++--
 .../src/main/js/serve/routes/clusters.js        |  4 ++--
 .../src/main/js/serve/routes/domains.js         | 22 +++++++++++++-------
 .../src/main/js/serve/routes/igfs.js            |  4 ++--
 .../src/main/js/serve/routes/notebooks.js       |  2 +-
 6 files changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/28f33ca9/modules/control-center-web/src/main/js/serve.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve.js b/modules/control-center-web/src/main/js/serve.js
index a962539..59ea9e8 100644
--- a/modules/control-center-web/src/main/js/serve.js
+++ b/modules/control-center-web/src/main/js/serve.js
@@ -80,7 +80,7 @@ Promise.all([fireUp('settings'), fireUp('app'), fireUp('agent')])
         server.on('listening', _onListening.bind(null, server.address()));
 
         // Create HTTPS server if needed.
-        if (settings.serverSSLOptions) {
+        if (settings.server.SSLOptions) {
             const httpsServer = https.createServer(settings.server.SSLOptions, app);
 
             const httpsPort = settings.server.SSLOptions.port;

http://git-wip-us.apache.org/repos/asf/ignite/blob/28f33ca9/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 aa57c4e..aed7f10 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
@@ -110,7 +110,7 @@ module.exports.factory = function(_, express, mongo) {
 
             mongo.Cluster.update({caches: {$in: [cacheId]}}, {$pull: {caches: cacheId}},
{multi: true}).exec()
                 .then(() => mongo.DomainModel.update({caches: {$in: [cacheId]}}, {$pull:
{caches: cacheId}}, {multi: true}).exec())
-                .then(() => mongo.Cache.remove(params))
+                .then(() => mongo.Cache.remove(params).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });
@@ -128,7 +128,7 @@ module.exports.factory = function(_, express, mongo) {
                     return mongo.Cluster.update({space: {$in: spacesIds}}, {caches: []},
{multi: true}).exec();
                 })
                 .then(() => mongo.DomainModel.update({space: {$in: spacesIds}}, {caches:
[]}, {multi: true}).exec())
-                .then(() => mongo.Cache.remove({space: {$in: spacesIds}}))
+                .then(() => mongo.Cache.remove({space: {$in: spacesIds}}).exec())
                 .catch((err) => mongo.handleError(res, err));
         });
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/28f33ca9/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 fd936a1..b6af923 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
@@ -122,7 +122,7 @@ module.exports.factory = function(_, express, mongo) {
 
             mongo.Cache.update({clusters: {$in: [clusterId]}}, {$pull: {clusters: clusterId}},
{multi: true}).exec()
                 .then(() => mongo.Igfs.update({clusters: {$in: [clusterId]}}, {$pull:
{clusters: clusterId}}, {multi: true}).exec())
-                .then(() => mongo.Cluster.remove(params))
+                .then(() => mongo.Cluster.remove(params).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });
@@ -141,7 +141,7 @@ module.exports.factory = function(_, express, mongo) {
                     return mongo.Cache.update({space: {$in: spacesIds}}, {clusters: []},
{multi: true}).exec();
                 })
                 .then(() => mongo.Igfs.update({space: {$in: spacesIds}}, {clusters: []},
{multi: true}).exec())
-                .then(() => mongo.Cluster.remove({space: {$in: spacesIds}}))
+                .then(() => mongo.Cluster.remove({space: {$in: spacesIds}}).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });

http://git-wip-us.apache.org/repos/asf/ignite/blob/28f33ca9/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 1b3d1d1..b0df059 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
@@ -24,7 +24,7 @@ module.exports = {
     inject: ['require(lodash)', 'require(express)', 'mongo']
 };
 
-module.exports.factory = function(_, express, mongo) {
+module.exports.factory = function (_, express, mongo) {
     return new Promise((factoryResolve) => {
         const router = new express.Router();
 
@@ -181,7 +181,7 @@ module.exports.factory = function(_, express, mongo) {
 
             mongo.DomainModel.findOne(params).exec()
                 .then((domain) => mongo.Cache.update({_id: {$in: domain.caches}}, {$pull:
{domain: domainId}}, {multi: true}).exec())
-                .then(() => mongo.DomainModel.remove(params))
+                .then(() => mongo.DomainModel.remove(params).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });
@@ -207,17 +207,25 @@ module.exports.factory = function(_, express, mongo) {
          * Remove all generated demo domain models and caches.
          */
         router.post('/remove/demo', (req, res) => {
-            let spacesIds = [];
+            let spaceIds = [];
+            let domainIds = [];
+            let cacheIds = [];
 
             // TODO IGNITE-843 also remove from links: Cache -> DomainModel ; DomainModel
-> Cache; Cluster -> Cache.
 
             mongo.spaces(req.currentUserId())
                 .then((spaces) => {
-                    spacesIds = mongo.spacesIds(spaces);
-
-                    return mongo.DomainModel.remove({$and: [{space: {$in: spacesIds}}, {demo:
true}]});
+                    spaceIds = mongo.spacesIds(spaces)
                 })
-                .then(() => mongo.Cache.remove({$and: [{space: {$in: spacesIds}}, {demo:
true}]}))
+                .then(() => mongo.DomainModel.find({$and: [{space: {$in: spaceIds}}, {demo:
true}]}).lean().exec())
+                .then((domains) => domainIds = _.map(domains, (domain) => domain._id))
+                .then(() => mongo.Cache.update({domains: {$in: domainIds}}, {$pull: {domains:
{$in: domainIds}}}, {multi: true}).exec())
+                .then(() => mongo.DomainModel.remove({_id: {$in: domainIds}}).exec())
+                .then(() => mongo.Cache.find({$and: [{space: {$in: spaceIds}}, {demo:
true}]}).lean().exec())
+                .then((caches) => cacheIds = _.map(caches, (cache) => cache._id))
+                .then(() => mongo.Cluster.update({caches: {$in: cacheIds}}, {$pull: {caches:
{$in: cacheIds}}}, {multi: true}).exec())
+                .then(() => mongo.DomainModel.update({$and: [{caches: {$in: cacheIds}},
{demo: false}]}, {$pull: {$in: {caches: cacheIds}}}, {multi: true}).exec())
+                .then(() => mongo.Cache.remove({$and: [{space: {$in: spaceIds}}, {demo:
true}]}).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });

http://git-wip-us.apache.org/repos/asf/ignite/blob/28f33ca9/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 144a577..1eacc72 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
@@ -100,7 +100,7 @@ module.exports.factory = function(_, express, mongo) {
             const igfsId = params._id;
 
             mongo.Cluster.update({igfss: {$in: [igfsId]}}, {$pull: {igfss: igfsId}}, {multi:
true}).exec()
-                .then(mongo.Igfs.remove(params))
+                .then(mongo.Igfs.remove(params).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });
@@ -118,7 +118,7 @@ module.exports.factory = function(_, express, mongo) {
 
                     return mongo.Cluster.update({space: {$in: spacesIds}}, {igfss: []}, {multi:
true}).exec();
                 })
-                .then(() => mongo.Igfs.remove({space: {$in: spacesIds}}))
+                .then(() => mongo.Igfs.remove({space: {$in: spacesIds}}).exec())
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });

http://git-wip-us.apache.org/repos/asf/ignite/blob/28f33ca9/modules/control-center-web/src/main/js/serve/routes/notebooks.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/serve/routes/notebooks.js b/modules/control-center-web/src/main/js/serve/routes/notebooks.js
index 67dbaf7..8e79ec1 100644
--- a/modules/control-center-web/src/main/js/serve/routes/notebooks.js
+++ b/modules/control-center-web/src/main/js/serve/routes/notebooks.js
@@ -90,7 +90,7 @@ module.exports.factory = function(express, mongo) {
          * @param res Response.
          */
         router.post('/remove', (req, res) => {
-            mongo.Notebook.remove(req.body)
+            mongo.Notebook.remove(req.body).exec()
                 .then(() => res.sendStatus(200))
                 .catch((err) => mongo.handleError(res, err));
         });


Mime
View raw message