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 03:46:43 UTC
incubator-ignite git commit: IGNITE-843: WIP on compacting object.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-843 e048a7fc6 -> 5e9777c60
IGNITE-843: WIP on compacting object.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/5e9777c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/5e9777c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/5e9777c6
Branch: refs/heads/ignite-843
Commit: 5e9777c60e6dddd8e4ec8a64efb52da99e466eba
Parents: e048a7f
Author: AKuznetsov <ak...@gridgain.com>
Authored: Mon Jun 29 08:46:38 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Mon Jun 29 08:46:38 2015 +0700
----------------------------------------------------------------------
.../public/javascripts/controllers/caches.js | 90 +++++++++++++++++++-
.../public/javascripts/controllers/clusters.js | 2 +-
2 files changed, 89 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e9777c6/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 9815887..488abff 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/caches.js
@@ -122,9 +122,90 @@ 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.backupItem;
+ var item = $scope.doCompact($scope.backupItem);
+
+ console.log(item);
if (item.cacheStoreFactory && !item.readThrough && !item.writeThrough) {
$alert({position: 'top', title: 'Store is configured but read/write through are not enabled!'});
@@ -154,7 +235,12 @@ configuratorModule.controller('cachesController', ['$scope', '$alert', '$http',
$scope.selectItem(item);
- $alert({type: "success", title: 'Cache saved.', duration: 2, container: '#save-btn'});
+ $alert({
+ type: "success",
+ title: 'Cache "' + item.name + '" saved.',
+ duration: 2,
+ container: '#save-btn'
+ });
})
.error(function (errorMessage) {
$alert({title: errorMessage});
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5e9777c6/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 75de767..de17b42 100644
--- a/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
+++ b/modules/webconfig/nodejs/public/javascripts/controllers/clusters.js
@@ -155,7 +155,7 @@ configuratorModule.controller('clustersController', ['$scope', '$alert', '$http'
$scope.selectItem(item);
- $alert({type: "success", title: 'Cluster saved.', duration: 2, container: '#save-btn'});
+ $alert({type: "success", title: 'Cluster "' + item.name + '" saved.', duration: 2, container: '#save-btn'});
})
.error(function(errorMessage) {
$alert({title: errorMessage});