ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: IGNITE-843 Added cleanup of deleted cache references in clusters. Added cleanup of deleted metadata references in caches.
Date Sat, 08 Aug 2015 03:19:39 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 deb96fd89 -> 72347f80f


IGNITE-843 Added cleanup of deleted cache references in clusters. Added cleanup of deleted
metadata references in caches.


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

Branch: refs/heads/ignite-843
Commit: 72347f80fab57e8ab9b1eb4143b65fa0be3775e5
Parents: deb96fd
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Sat Aug 8 10:19:28 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Sat Aug 8 10:19:28 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/clusters-controller.js    |  7 +++++++
 .../main/js/controllers/metadata-controller.js    | 17 ++++++++++++++++-
 .../src/main/js/routes/caches.js                  | 18 +++++++++++++++++-
 .../src/main/js/routes/clusters.js                | 12 +++++++++++-
 4 files changed, 51 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72347f80/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 62fab5b..2cdd1ab 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -160,6 +160,13 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$commo
                         });
 
                         if (idx >= 0) {
+                            // Remove deleted caches.
+                            restoredItem.caches = _.filter(restoredItem.caches, function
(cacheId) {
+                                return _.findIndex($scope.caches, function (scopeCache) {
+                                    return scopeCache.value == cacheId;
+                                }) >= 0;
+                            });
+
                             $scope.selectedItem = $scope.clusters[idx];
                             $scope.backupItem = restoredItem;
                         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72347f80/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 15c48a1..ba72b17 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -342,8 +342,23 @@ controlCenterModule.controller('metadataController', [
                                 return metadata._id == restoredItem._id;
                             });
 
-                            if (idx >= 0)
+                            if (idx >= 0) {
+                                // Remove deleted metadata.
+                                restoredItem.queryMetadata = _.filter(restoredItem.queryMetadata,
function (metaId) {
+                                    return _.findIndex($scope.metadatas, function (scopeMeta)
{
+                                            return scopeMeta.value == metaId;
+                                        }) >= 0;
+                                });
+
+                                // Remove deleted metadata.
+                                restoredItem.storeMetadata = _.filter(restoredItem.storeMetadata,
function (metaId) {
+                                    return _.findIndex($scope.metadatas, function (scopeMeta)
{
+                                            return scopeMeta.value == metaId;
+                                        }) >= 0;
+                                });
+
                                 setSelectedAndBackupItem($scope.metadatas[idx], restoredItem);
+                            }
                             else {
                                 sessionStorage.removeItem('metadataBackupItem');
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72347f80/modules/control-center-web/src/main/js/routes/caches.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/caches.js b/modules/control-center-web/src/main/js/routes/caches.js
index 24152af..875f84e 100644
--- a/modules/control-center-web/src/main/js/routes/caches.js
+++ b/modules/control-center-web/src/main/js/routes/caches.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+var _ = require('lodash');
 var router = require('express').Router();
 var db = require('../db');
 
@@ -51,6 +52,21 @@ router.post('/list', function (req, res) {
                 if (err)
                     return res.status(500).send(err.message);
 
+                // Remove deleted metadata.
+                _.forEach(caches, function (cache) {
+                    cache.queryMetadata = _.filter(cache.queryMetadata, function (metaId)
{
+                        return _.findIndex(metadatas, function (meta) {
+                            return meta._id.equals(metaId);
+                        }) >= 0;
+                    });
+
+                    cache.storeMetadata = _.filter(cache.storeMetadata, function (metaId)
{
+                        return _.findIndex(metadatas, function (meta) {
+                            return meta._id.equals(metaId);
+                        }) >= 0;
+                    });
+                });
+
                 var metadatasJson = metadatas.map(function (meta) {
                     return {value: meta._id, label: meta.name, kind: meta.kind};
                 });
@@ -102,4 +118,4 @@ router.post('/remove', function (req, res) {
     })
 });
 
-module.exports = router;
\ No newline at end of file
+module.exports = router;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/72347f80/modules/control-center-web/src/main/js/routes/clusters.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/clusters.js b/modules/control-center-web/src/main/js/routes/clusters.js
index 683630e..5feb185 100644
--- a/modules/control-center-web/src/main/js/routes/clusters.js
+++ b/modules/control-center-web/src/main/js/routes/clusters.js
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+var _ = require('lodash');
 var router = require('express').Router();
 var db = require('../db');
 
@@ -50,6 +51,15 @@ router.post('/list', function (req, res) {
                 if (err)
                     return res.status(500).send(err.message);
 
+                // Remove deleted caches.
+                _.forEach(clusters, function (cluster) {
+                    cluster.caches = _.filter(cluster.caches, function (cacheId) {
+                        return _.findIndex(caches, function (cache) {
+                            return cache._id.equals(cacheId);
+                        }) >= 0;
+                    });
+                });
+
                 var cachesJson = caches.map(function (cache) {
                     return {value: cache._id, label: cache.name, swapEnabled: cache.swapEnabled};
                 });
@@ -101,4 +111,4 @@ router.post('/remove', function (req, res) {
     })
 });
 
-module.exports = router;
\ No newline at end of file
+module.exports = router;


Mime
View raw message