IGNITE-843 Fixed UI and XML/java generation.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/30597605 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/30597605 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/30597605 Branch: refs/heads/ignite-1121 Commit: 305976051ae0ecd2828048b5cb98c2e7c16a8f10 Parents: 86fb3d7 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Thu Jul 30 16:22:57 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Thu Jul 30 16:22:57 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/common-module.js | 18 ++++++------ .../src/main/js/controllers/models/caches.json | 2 ++ .../main/js/controllers/models/metadata.json | 12 ++++---- .../src/main/js/routes/generator/java.js | 29 ++++++++++++-------- .../src/main/js/routes/generator/xml.js | 27 +++++++++++------- .../src/main/js/views/configuration/caches.jade | 2 +- 6 files changed, 53 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30597605/modules/control-center-web/src/main/js/controllers/common-module.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js index df2ff19..492f643 100644 --- a/modules/control-center-web/src/main/js/controllers/common-module.js +++ b/modules/control-center-web/src/main/js/controllers/common-module.js @@ -377,11 +377,11 @@ controlCenterModule.directive('match', function ($parse) { }); // Directive to bind ENTER key press with some user action. -controlCenterModule.directive('ngEnter', function() { - return function(scope, element, attrs) { - element.bind('keydown keypress', function(event) { +controlCenterModule.directive('ngEnter', function () { + return function (scope, element, attrs) { + element.bind('keydown keypress', function (event) { if (event.which === 13) { - scope.$apply(function() { + scope.$apply(function () { scope.$eval(attrs.ngEnter); }); @@ -392,11 +392,11 @@ controlCenterModule.directive('ngEnter', function() { }); // Directive to bind ESC key press with some user action. -controlCenterModule.directive('ngEscape', function() { - return function(scope, element, attrs) { - element.bind('keydown keyup', function(event) { +controlCenterModule.directive('ngEscape', function () { + return function (scope, element, attrs) { + element.bind('keydown keyup', function (event) { if (event.which === 27) { - scope.$apply(function() { + scope.$apply(function () { scope.$eval(attrs.ngEscape); }); @@ -430,7 +430,7 @@ controlCenterModule.directive('eventFocus', function (focus) { // Removes bound events in the element itself when the scope is destroyed scope.$on('$destroy', function () { - element.off(attr.eventFocus); + elem.off(attr.eventFocus); }); }; }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30597605/modules/control-center-web/src/main/js/controllers/models/caches.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/caches.json b/modules/control-center-web/src/main/js/controllers/models/caches.json index 932eecc..1cc0ae5 100644 --- a/modules/control-center-web/src/main/js/controllers/models/caches.json +++ b/modules/control-center-web/src/main/js/controllers/models/caches.json @@ -416,6 +416,7 @@ }, { "label": "Rebalance", + "hide": "backupItem.mode == 'LOCAL'", "tip": [ "Cache rebalance settings." ], @@ -495,6 +496,7 @@ }, { "label": "Server near cache", + "hide": "backupItem.mode != 'PARTITIONED'", "tip": [ "Near cache settings.", "Near cache is a small local cache that stores most recently or most frequently accessed data.", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30597605/modules/control-center-web/src/main/js/controllers/models/metadata.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/controllers/models/metadata.json b/modules/control-center-web/src/main/js/controllers/models/metadata.json index a9b60de..86efe0b 100644 --- a/modules/control-center-web/src/main/js/controllers/models/metadata.json +++ b/modules/control-center-web/src/main/js/controllers/models/metadata.json @@ -93,7 +93,7 @@ "model": "keyFields", "keyName": "name", "valueName": "className", - "hide": "backupItem.kind != 'both' && backupItem.kind == 'query'", + "hide": "backupItem.kind == 'query'", "addTip": "Add key field.", "removeTip": "Remove key field.", "tip": [ @@ -119,7 +119,7 @@ "model": "queryFields", "keyName": "name", "valueName": "className", - "hide": "backupItem.kind != 'both' && backupItem.kind != 'query'", + "hide": "backupItem.kind == 'store'", "focusNewItemId": "newQryField", "focusCurItemId": "curQryField", "addTip": "Add field to query.", @@ -134,7 +134,7 @@ "model": "ascendingFields", "keyName": "name", "valueName": "className", - "hide": "backupItem.kind != 'both' && backupItem.kind != 'query'", + "hide": "backupItem.kind == 'store'", "focusNewItemId": "newAscField", "focusCurItemId": "curAscField", "addTip": "Add field to index in ascending order.", @@ -149,7 +149,7 @@ "model": "descendingFields", "keyName": "name", "valueName": "className", - "hide": "backupItem.kind != 'both' && backupItem.kind != 'query'", + "hide": "backupItem.kind == 'store'", "focusNewItemId": "newDescField", "focusCurItemId": "curDescField", "addTip": "Add field to index in descending order.", @@ -162,7 +162,7 @@ "label": "Text fields", "type": "table-simple", "model": "textFields", - "hide": "backupItem.kind != 'both' && backupItem.kind != 'query'", + "hide": "backupItem.kind == 'store'", "placeholder": "Field name", "focusNewItemId": "newTextField", "focusCurItemId": "curTextField", @@ -179,7 +179,7 @@ "label": "Groups", "type": "queryGroups", "model": "groups", - "hide": "backupItem.kind != 'both' && backupItem.kind != 'query'", + "hide": "backupItem.kind == 'store'", "addTip": "Add new group.", "removeTip": "Remove group.", "addItemTip": "Add new field to group.", http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30597605/modules/control-center-web/src/main/js/routes/generator/java.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/routes/generator/java.js b/modules/control-center-web/src/main/js/routes/generator/java.js index d017901..573418d 100644 --- a/modules/control-center-web/src/main/js/routes/generator/java.js +++ b/modules/control-center-web/src/main/js/routes/generator/java.js @@ -472,10 +472,13 @@ function addCacheConfiguration(res, cache, varName) { addProperty(res, varName, cache, 'name'); - addProperty(res, varName, cache, 'mode', 'CacheMode', 'cacheMode'); + var cacheMode = addProperty(res, varName, cache, 'mode', 'CacheMode', 'cacheMode'); addProperty(res, varName, cache, 'atomicityMode', 'CacheAtomicityMode'); - addProperty(res, varName, cache, 'backups'); + + if (cacheMode == 'PARTITIONED') + addProperty(res, varName, cache, 'backups'); + addProperty(res, varName, cache, 'startSize'); addProperty(res, varName, cache, 'readFromBackup'); @@ -490,7 +493,7 @@ function addCacheConfiguration(res, cache, varName) { addEvictionPolicy(res, varName, cache.evictionPolicy, 'evictionPolicy'); - if (cache.nearCacheEnabled) { + if (cacheMode == 'PARTITIONED' && cache.nearCacheEnabled) { res.needEmptyLine = true; res.importClass('org.apache.ignite.configuration.NearCacheConfiguration'); @@ -530,15 +533,17 @@ function addCacheConfiguration(res, cache, varName) { res.needEmptyLine = true; - addProperty(res, varName, cache, 'rebalanceMode', 'CacheRebalanceMode'); - addProperty(res, varName, cache, 'rebalanceThreadPoolSize'); - addProperty(res, varName, cache, 'rebalanceBatchSize'); - addProperty(res, varName, cache, 'rebalanceOrder'); - addProperty(res, varName, cache, 'rebalanceDelay'); - addProperty(res, varName, cache, 'rebalanceTimeout'); - addProperty(res, varName, cache, 'rebalanceThrottle'); + if (cacheMode != 'LOCAL') { + addProperty(res, varName, cache, 'rebalanceMode', 'CacheRebalanceMode'); + addProperty(res, varName, cache, 'rebalanceThreadPoolSize'); + addProperty(res, varName, cache, 'rebalanceBatchSize'); + addProperty(res, varName, cache, 'rebalanceOrder'); + addProperty(res, varName, cache, 'rebalanceDelay'); + addProperty(res, varName, cache, 'rebalanceTimeout'); + addProperty(res, varName, cache, 'rebalanceThrottle'); - res.needEmptyLine = true; + res.needEmptyLine = true; + } if (cache.cacheStoreFactory && cache.cacheStoreFactory.kind) { var storeFactory = cache.cacheStoreFactory[cache.cacheStoreFactory.kind]; @@ -716,6 +721,8 @@ function addProperty(res, varName, obj, propName, enumType, setterName) { res.line(varName + '.' + getSetterName(setterName ? setterName : propName) + '(' + toJavaCode(val, enumType) + ');'); } + + return val; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30597605/modules/control-center-web/src/main/js/routes/generator/xml.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/routes/generator/xml.js b/modules/control-center-web/src/main/js/routes/generator/xml.js index 271d79c..d6bc1c3 100644 --- a/modules/control-center-web/src/main/js/routes/generator/xml.js +++ b/modules/control-center-web/src/main/js/routes/generator/xml.js @@ -457,10 +457,13 @@ function generateCacheConfiguration(res, cacheCfg) { res.needEmptyLine = true; - addProperty(res, cacheCfg, 'mode', 'cacheMode'); + var cacheMode = addProperty(res, cacheCfg, 'mode', 'cacheMode'); addProperty(res, cacheCfg, 'atomicityMode'); - addProperty(res, cacheCfg, 'backups'); + + if (cacheMode == 'PARTITIONED') + addProperty(res, cacheCfg, 'backups'); + addProperty(res, cacheCfg, 'startSize'); addProperty(res, cacheCfg, 'readFromBackup'); @@ -518,15 +521,17 @@ function generateCacheConfiguration(res, cacheCfg) { res.needEmptyLine = true; - addProperty(res, cacheCfg, 'rebalanceMode'); - addProperty(res, cacheCfg, 'rebalanceThreadPoolSize'); - addProperty(res, cacheCfg, 'rebalanceBatchSize'); - addProperty(res, cacheCfg, 'rebalanceOrder'); - addProperty(res, cacheCfg, 'rebalanceDelay'); - addProperty(res, cacheCfg, 'rebalanceTimeout'); - addProperty(res, cacheCfg, 'rebalanceThrottle'); + if (cacheMode != 'LOCAL') { + addProperty(res, cacheCfg, 'rebalanceMode'); + addProperty(res, cacheCfg, 'rebalanceThreadPoolSize'); + addProperty(res, cacheCfg, 'rebalanceBatchSize'); + addProperty(res, cacheCfg, 'rebalanceOrder'); + addProperty(res, cacheCfg, 'rebalanceDelay'); + addProperty(res, cacheCfg, 'rebalanceTimeout'); + addProperty(res, cacheCfg, 'rebalanceThrottle'); - res.needEmptyLine = true; + res.needEmptyLine = true; + } if (cacheCfg.cacheStoreFactory && cacheCfg.cacheStoreFactory.kind) { var storeFactory = cacheCfg.cacheStoreFactory[cacheCfg.cacheStoreFactory.kind]; @@ -636,6 +641,8 @@ function addProperty(res, obj, propName, setterName) { if (generatorUtils.isDefined(val)) addElement(res, 'property', 'name', setterName ? setterName : propName, 'value', escapeAttr(val)); + + return val; } function addBeanWithProperties(res, bean, beanPropName, beanClass, props, createBeanAlthoughNoProps) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/30597605/modules/control-center-web/src/main/js/views/configuration/caches.jade ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/views/configuration/caches.jade b/modules/control-center-web/src/main/js/views/configuration/caches.jade index 15d8f40..2cddbce 100644 --- a/modules/control-center-web/src/main/js/views/configuration/caches.jade +++ b/modules/control-center-web/src/main/js/views/configuration/caches.jade @@ -55,7 +55,7 @@ block content a(bs-collapse-toggle='0' ng-click='expanded = !expanded;') {{expanded ? 'Hide advanced settings...' : 'Show advanced settings...'}} .panel-collapse(bs-collapse-target) .span(bs-collapse data-start-collapsed='true' data-allow-multiple='true') - .panel.panel-default(ng-repeat='group in advanced') + .panel.panel-default(ng-repeat='group in advanced' ng-hide='{{group.hide}}') .panel-heading h3 a(bs-collapse-toggle) {{group.label}}