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 2015/06/29 12:02:17 UTC

[1/2] incubator-ignite git commit: # IGNITE-843 Validation cache and cluster before save.

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-843 bc5bd58c0 -> c7132a9f6


# IGNITE-843 Validation cache and cluster before save.


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

Branch: refs/heads/ignite-843
Commit: 30dfcc60a7e886a4ae8cd8cd5cee169d1fe01568
Parents: 44c1157
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Jun 29 17:02:00 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Jun 29 17:02:00 2015 +0700

----------------------------------------------------------------------
 .../public/javascripts/controllers/caches.js    | 83 +-------------------
 .../public/javascripts/controllers/clusters.js  | 51 ++++++++----
 modules/webconfig/nodejs/routes/clusters.js     |  4 +-
 3 files changed, 41 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30dfcc60/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
index 591b697..006f065 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
@@ -120,88 +120,9 @@ configuratorModule.controller('cachesController', ['$scope', '$alert', '$http',
             $scope.backupItem.space = $scope.spaces[0]._id;
         };
 
-        var notEmpty = function (obj) {
-            for (key in obj) {
-                var p = obj[key];
-
-                if (p) {
-                    var isObj = _.isObject(p);
-                    var isArr = _.isArray(p);
-
-                    if (!isObj && !isArr) {
-                        console.log("    simple key: " + key + ", len = " + p.length);
-                        return true;
-                    }
-
-                    if (isObj) {
-                        if (notEmpty(p)) {
-                            console.log("    not empty obj key: " + key);
-                            return true;
-                        }
-                        else
-                            console.log("    empty obj key: " + key);
-                    }
-
-                    if (isArr) {
-                        if (p.length > 0) {
-                            console.log("    not empty arr key: " + key);
-                            return true;
-                        }
-                        else
-                            console.log("    empty arr key: " + key);
-                    }
-
-                    console.log("    empty key: " + key);
-                }
-                else
-                    console.log("    empty key: " + key);
-            }
-
-            return false;
-        };
-
-        $scope.doCompact = function (obj) {
-            var compacted = {};
-
-            for (var key in obj) {
-                var p = obj[key];
-
-                if (p) {
-                    var isArr = _.isArray(p);
-                    var isObj = _.isObject(p);
-
-                    if (!isArr && !isObj) {
-                        console.log("not empty simple key: " + key);
-                        compacted[key] = p;
-
-                        continue;
-                    }
-
-                    if (isArr && p.length > 0) {
-                        console.log("not empty arr key: " + key);
-                        compacted[key] = p;
-
-                        continue;
-                    }
-
-                    if (isObj && notEmpty(p)) {
-                        console.log("not empty obj key: " + key);
-                        compacted[key] = p;
-
-                        continue;
-                    }
-                }
-                else {
-                    console.log("empty key: " + key);
-                }
-            }
-
-            return compacted;
-        };
-
         // Save cache in db.
         $scope.saveItem = function () {
-            var item = $scope.doCompact($scope.backupItem);
+            var item = $scope.backupItem;
 
             console.log(item);
 
@@ -234,7 +155,7 @@ configuratorModule.controller('cachesController', ['$scope', '$alert', '$http',
                     $scope.selectItem(item);
 
                     $alert({
-                        type: "success",
+                        type: 'success',
                         title: 'Cache "' + item.name + '" saved.',
                         duration: 2,
                         container: '#save-btn'

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30dfcc60/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
index 84ca3d3..ce38381 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-configuratorModule.controller('clustersController', ['$scope', '$alert', '$http', 'commonFunctions', function($scope, $alert, $http, commonFunctions) {
+configuratorModule.controller('clustersController', ['$scope', '$alert', '$http', 'commonFunctions', function ($scope, $alert, $http, commonFunctions) {
         $scope.swapSimpleItems = commonFunctions.swapSimpleItems;
         $scope.joinTip = commonFunctions.joinTip;
         $scope.getModel = commonFunctions.getModel;
@@ -87,7 +87,7 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http'
         $scope.clusters = [];
 
         $http.get('/form-models/clusters.json')
-            .success(function(data) {
+            .success(function (data) {
                 $scope.templateTip = data.templateTip;
 
                 $scope.general = data.general;
@@ -96,7 +96,7 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http'
 
         // When landing on the page, get clusters and show them.
         $http.get('/rest/clusters')
-            .success(function(data) {
+            .success(function (data) {
                 $scope.caches = data.caches;
                 $scope.spaces = data.spaces;
                 $scope.clusters = data.clusters;
@@ -120,26 +120,44 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http'
                 }, true);
             });
 
-        $scope.selectItem = function(item) {
+        $scope.selectItem = function (item) {
             $scope.selectedItem = item;
 
             $scope.backupItem = angular.copy(item);
         };
 
         // Add new cluster.
-        $scope.createItem = function() {
+        $scope.createItem = function () {
             $scope.backupItem = angular.copy($scope.create.template);
 
             $scope.backupItem.space = $scope.spaces[0]._id;
         };
 
         // Save cluster in db.
-        $scope.saveItem = function() {
+        $scope.saveItem = function () {
             var item = $scope.backupItem;
 
+            if (!item.swapSpaceSpi || !item.swapSpaceSpi.kind) {
+                for (var cacheId in item.caches) {
+                    var idx = _.findIndex($scope.caches, function (cache) {
+                        return cache._id == cacheId.value;
+                    });
+
+                    if (idx >= 0) {
+                        var cache = $scope.caches[idx];
+
+                        if (cache.swapEnabled) {
+                            $alert({title: 'Swap space SPI is not configured, but cache "' + cache.label + '" configured to use swap!'});
+
+                            return;
+                        }
+                    }
+                }
+            }
+
             $http.post('/rest/clusters/save', item)
-                .success(function(_id) {
-                    var idx = _.findIndex($scope.clusters, function(cluster) {
+                .success(function (_id) {
+                    var idx = _.findIndex($scope.clusters, function (cluster) {
                         return cluster._id == _id;
                     });
 
@@ -153,19 +171,24 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http'
 
                     $scope.selectItem(item);
 
-                    $alert({type: "success", title: 'Cluster "' + item.name + '" saved.', duration: 2, container: '#save-btn'});
+                    $alert({
+                        type: 'success',
+                        title: 'Cluster "' + item.name + '" saved.',
+                        duration: 2,
+                        container: '#save-btn'
+                    });
                 })
-                .error(function(errorMessage) {
+                .error(function (errorMessage) {
                     $alert({title: errorMessage});
                 });
         };
 
-        $scope.removeItem = function() {
+        $scope.removeItem = function () {
             var _id = $scope.selectedItem._id;
 
             $http.post('/rest/clusters/remove', {_id: _id})
-                .success(function() {
-                    var i = _.findIndex($scope.clusters, function(cluster) {
+                .success(function () {
+                    var i = _.findIndex($scope.clusters, function (cluster) {
                         return cluster._id == _id;
                     });
 
@@ -176,7 +199,7 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http'
                         $scope.backupItem = undefined;
                     }
                 })
-                .error(function(errorMessage) {
+                .error(function (errorMessage) {
                     $alert({title: errorMessage});
                 });
         };

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30dfcc60/modules/webconfig/nodejs/routes/clusters.js
----------------------------------------------------------------------
diff --git a/modules/webconfig/nodejs/routes/clusters.js b/modules/webconfig/nodejs/routes/clusters.js
index 95df8d4..91ac50a 100644
--- a/modules/webconfig/nodejs/routes/clusters.js
+++ b/modules/webconfig/nodejs/routes/clusters.js
@@ -36,7 +36,7 @@ function selectAll(req, res) {
             return value._id;
         });
 
-        db.Cache.find({space: {$in: space_ids}}, '_id name', function (err, caches) {
+        db.Cache.find({space: {$in: space_ids}}, '_id name swapEnabled', function (err, caches) {
             if (err)
                 return res.status(500).send(err);
 
@@ -46,7 +46,7 @@ function selectAll(req, res) {
                     return res.status(500).send(err.message);
 
                 var cachesJson = caches.map(function(cache) {
-                    return {value: cache._id, label: cache.name};
+                    return {value: cache._id, label: cache.name, swapEnabled: cache.swapEnabled};
                 });
 
                 res.json({spaces: spaces, caches: cachesJson, clusters: clusters});


[2/2] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-843' into ignite-843

Posted by ak...@apache.org.
Merge remote-tracking branch 'origin/ignite-843' into ignite-843


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

Branch: refs/heads/ignite-843
Commit: c7132a9f6ae48606167e575d75c2bc75640f8438
Parents: 30dfcc6 bc5bd58
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Jun 29 17:02:15 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Jun 29 17:02:15 2015 +0700

----------------------------------------------------------------------
 .../syntaxHighlighter/shBrushJava.js            | 57 ----------------
 .../javascripts/syntaxHighlighter/shBrushXml.js | 69 --------------------
 .../javascripts/syntaxHighlighter/shCore.js     | 40 ------------
 modules/webconfig/nodejs/views/summary.jade     | 15 ++---
 4 files changed, 7 insertions(+), 174 deletions(-)
----------------------------------------------------------------------