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:40 UTC
[23/50] ignite git commit: IGNITE-843 Fixed remove.
IGNITE-843 Fixed remove.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5bfc4c7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5bfc4c7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5bfc4c7
Branch: refs/heads/ignite-843-rc3
Commit: e5bfc4c7f800e6228270561546212dd14ab1f81c
Parents: ae86c52
Author: Andrey <an...@gridgain.com>
Authored: Mon Feb 15 18:08:27 2016 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Mon Feb 15 18:08:27 2016 +0700
----------------------------------------------------------------------
.../src/main/js/serve/routes/clusters.js | 12 ++----------
.../control-center-web/src/main/js/serve/routes/igfs.js | 3 +--
2 files changed, 3 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5bfc4c7/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 2674975..256de5d 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
@@ -137,18 +137,10 @@ module.exports.factory = function(_, express, mongo) {
* Remove cluster by ._id.
*/
router.post('/remove', (req, res) => {
- const userId = req.currentUserId();
const clusterId = req.body;
- let spacesIds = [];
-
- mongo.Space.find({$or: [{owner: userId}, {usedBy: {$elemMatch: {account: userId}}}]})
- .then((spaces) => {
- spacesIds = spaces.map((value) => value._id);
-
- return mongo.Cache.update({space: {$in: spacesIds}}, {$pull: {clusters: clusterId}}, {multi: true});
- })
- .then(() => mongo.Igfs.update({space: {$in: spacesIds}}, {$pull: {clusters: clusterId}}, {multi: true}))
+ 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(clusterId))
.then(() => res.sendStatus(200))
.catch((err) => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5bfc4c7/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 c9ce238..7508f9a 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
@@ -109,8 +109,7 @@ module.exports.factory = function(_, express, mongo) {
router.post('/remove', (req, res) => {
const igfsId = req.body;
- mongo.Space.find({$or: [{owner: userId}, {usedBy: {$elemMatch: {account: userId}}}]})
- .then((spaces) => mongo.Cluster.update({space: {$in: spacesIds}}, {$pull: {igfss: igfsId}}, {multi: true}))
+ mongo.Cluster.update({igfss: {$in: [igfsId]}}, {$pull: {igfss: igfsId}}, {multi: true}).exec()
.then(mongo.Igfs.remove(igfsId))
.then(() => res.sendStatus(200))
.catch((err) => {