ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Preview tweaks and summaty page fixes.
Date Mon, 31 Aug 2015 03:10:06 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 331950c75 -> 2ff720f99


IGNITE-843 Preview tweaks and summaty page fixes.


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

Branch: refs/heads/ignite-843
Commit: 2ff720f99b504e3bd36f9a8c30b5ae0fd12a42b4
Parents: 331950c
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Mon Aug 31 10:10:32 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Mon Aug 31 10:10:32 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/clusters-controller.js  |   6 +-
 .../main/js/controllers/summary-controller.js   |   7 +
 .../js/routes/generator/generator-common.js     |   7 +-
 .../main/js/routes/generator/generator-java.js  | 102 +++++++-------
 .../main/js/routes/generator/generator-xml.js   | 138 ++++++++++---------
 5 files changed, 135 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2ff720f9/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 14c99ff..67e5895 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
@@ -212,12 +212,12 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
                     if (val) {
                         sessionStorage.clusterBackupItem = angular.toJson(val);
 
-                        var clusterCaches = _.reduce($scope.caches, function(memo, cache){
+                        var clusterCaches = _.reduce($scope.caches, function(caches, cache){
                             if (_.contains(val.caches, cache.value)) {
-                                memo.push(cache.cache);
+                                caches.push(cache.cache);
                             }
 
-                            return memo;
+                            return caches;
                         }, []);
 
                         $scope.preview.general.xml = $generatorXml.clusterCaches(clusterCaches,
$generatorXml.clusterGeneral(val)).join('');

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ff720f9/modules/control-center-web/src/main/js/controllers/summary-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/summary-controller.js b/modules/control-center-web/src/main/js/controllers/summary-controller.js
index 7e545a9..256534a 100644
--- a/modules/control-center-web/src/main/js/controllers/summary-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/summary-controller.js
@@ -126,6 +126,13 @@ controlCenterModule.controller('summaryController', ['$scope', '$http',
'$common
         $scope.clusters = data.clusters;
 
         if ($scope.clusters.length > 0) {
+            // Populate clusters with caches.
+            _.forEach($scope.clusters, function (cluster) {
+                cluster.caches = _.filter(data.caches, function (cache) {
+                    return _.contains(cluster.caches, cache._id);
+                });
+            });
+
             var restoredId = sessionStorage.summarySelectedId;
 
             var selectIdx = 0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ff720f9/modules/control-center-web/src/main/js/routes/generator/generator-common.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-common.js b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
index d177c08..220ef9e 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-common.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-common.js
@@ -108,14 +108,11 @@ $generatorCommon.builder = function () {
 
     res.emptyLineIfNeeded = function () {
         if (this.needEmptyLine) {
-            this.line();
+            this.push('\n');
+            this.lineStart = true;
 
             this.needEmptyLine = false;
-
-            return true;
         }
-
-        return false;
     };
 
     res.imports = {};

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ff720f9/modules/control-center-web/src/main/js/routes/generator/generator-java.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-java.js b/modules/control-center-web/src/main/js/routes/generator/generator-java.js
index fe5864e..610f7a5 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-java.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-java.js
@@ -103,6 +103,8 @@ $generatorJava.needNewVariable = function (res, varName) {
  * @param varFullGenericType2 Optional full class name of second generic.
  */
 $generatorJava.declareVariable = function (res, varNew, varName, varFullType, varFullActualType,
varFullGenericType1, varFullGenericType2) {
+    res.emptyLineIfNeeded();
+
     var varType = res.importClass(varFullType);
 
     if (varFullActualType && varFullGenericType1) {
@@ -116,6 +118,8 @@ $generatorJava.declareVariable = function (res, varNew, varName, varFullType,
va
     }
     else
         res.line((varNew ? (varType + ' ') : '') + varName + ' = new ' + varType + '();');
+
+    res.needEmptyLine = true;
 };
 
 /**
@@ -186,6 +190,8 @@ $generatorJava.multiparamProperty = function (res, varName, obj, propName,
type,
     var val = obj[propName];
 
     if (val && val.length > 0) {
+        res.emptyLineIfNeeded();
+
         res.append(varName + '.' + $generatorJava.setterName(setterName ? setterName : propName)
+ '(');
 
         for (var i = 0; i < val.length; i++) {
@@ -201,9 +207,7 @@ $generatorJava.multiparamProperty = function (res, varName, obj, propName,
type,
 
 $generatorJava.beanProperty = function (res, varName, bean, beanPropName, beanVarName, beanClass,
props, createBeanAlthoughNoProps) {
     if (bean && $commonUtils.hasProperty(bean, props)) {
-        if (!res.emptyLineIfNeeded()) {
-            res.line();
-        }
+        res.emptyLineIfNeeded();
 
         var clsName = res.importClass(beanClass);
 
@@ -289,19 +293,28 @@ $generatorJava.beanProperty = function (res, varName, bean, beanPropName,
beanVa
  */
 $generatorJava.evictionPolicy = function (res, varName, evictionPolicy, propertyName) {
     if (evictionPolicy && evictionPolicy.kind) {
-        var e = $generatorCommon.EVICTION_POLICIES[evictionPolicy.kind];
+        var evictionPolicyDesc = $generatorCommon.EVICTION_POLICIES[evictionPolicy.kind];
 
         var obj = evictionPolicy[evictionPolicy.kind.toUpperCase()];
 
-        $generatorJava.beanProperty(res, varName, obj, propertyName, propertyName, e.className,
e.fields, true);
+        $generatorJava.beanProperty(res, varName, obj, propertyName, propertyName,
+            evictionPolicyDesc.className, evictionPolicyDesc.fields, true);
     }
 };
 
 // Generate cluster general group.
-$generatorJava.clusterGeneral = function (cluster, res) {
+$generatorJava.clusterGeneral = function (cluster, clientNearCfg, res) {
     if (!res)
         res = $generatorCommon.builder();
 
+    $generatorJava.declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
+
+    if (clientNearCfg) {
+        res.line('cfg.setClientMode(true);');
+
+        res.needEmptyLine = true;
+    }
+
     if (cluster.discovery) {
         var d = cluster.discovery;
 
@@ -383,8 +396,6 @@ $generatorJava.clusterGeneral = function (cluster, res) {
                 break;
 
             case 'Jdbc':
-                res.line();
-
                 if (d.Jdbc) {
                     $generatorJava.declareVariable(res, true, 'ipFinder', 'org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder');
 
@@ -656,8 +667,6 @@ $generatorJava.cacheGeneral = function (cache, varName, res) {
     if (cache.cacheMode == 'PARTITIONED')
         $generatorJava.property(res, varName, cache, 'backups');
 
-    res.needEmptyLine = true;
-
     $generatorJava.property(res, varName, cache, 'readFromBackup');
     $generatorJava.property(res, varName, cache, 'copyOnRead');
     $generatorJava.property(res, varName, cache, 'invalidate');
@@ -1114,64 +1123,57 @@ $generatorJava.clusterCaches = function (caches, res) {
  *
  * @param cluster Cluster to process.
  * @param javaClass If 'true' then generate factory class otherwise generate code snippet.
- * @param clientNearConfiguration Near cache configuration for client node.
+ * @param clientNearCfg Near cache configuration for client node.
  */
-$generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration) {
+$generatorJava.cluster = function (cluster, javaClass, clientNearCfg) {
     var res = $generatorCommon.builder();
 
-    if (javaClass) {
-        res.line('/**');
-        res.line(' * ' + $generatorCommon.mainComment());
-        res.line(' */');
-        res.startBlock('public class ConfigurationFactory {');
-        res.line('/**');
-        res.line(' * Configure grid.');
-        res.line(' */');
-        res.startBlock('public IgniteConfiguration createConfiguration() {');
-    }
-
-    $generatorJava.declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
-
-    res.line();
-
-    if (clientNearConfiguration) {
-        res.line('cfg.setClientMode(true);');
-        res.line();
-    }
+    if (cluster) {
+        if (javaClass) {
+            res.line('/**');
+            res.line(' * ' + $generatorCommon.mainComment());
+            res.line(' */');
+            res.startBlock('public class ConfigurationFactory {');
+            res.line('/**');
+            res.line(' * Configure grid.');
+            res.line(' */');
+            res.startBlock('public IgniteConfiguration createConfiguration() {');
+        }
 
-    $generatorJava.clusterGeneral(cluster, res);
+        $generatorJava.clusterGeneral(cluster, clientNearCfg, res);
 
-    $generatorJava.clusterAtomics(cluster, res);
+        $generatorJava.clusterAtomics(cluster, res);
 
-    $generatorJava.clusterCommunication(cluster, res);
+        $generatorJava.clusterCommunication(cluster, res);
 
-    $generatorJava.clusterDeployment(cluster, res);
+        $generatorJava.clusterDeployment(cluster, res);
 
-    $generatorJava.clusterEvents(cluster, res);
+        $generatorJava.clusterEvents(cluster, res);
 
-    $generatorJava.clusterMarshaller(cluster, res);
+        $generatorJava.clusterMarshaller(cluster, res);
 
-    $generatorJava.clusterMetrics(cluster, res);
+        $generatorJava.clusterMetrics(cluster, res);
 
-    $generatorJava.clusterP2p(cluster, res);
+        $generatorJava.clusterP2p(cluster, res);
 
-    $generatorJava.clusterSwap(cluster, res);
+        $generatorJava.clusterSwap(cluster, res);
 
-    $generatorJava.clusterTime(cluster, res);
+        $generatorJava.clusterTime(cluster, res);
 
-    $generatorJava.clusterPools(cluster, res);
+        $generatorJava.clusterPools(cluster, res);
 
-    $generatorJava.clusterTransactions(cluster, res);
+        $generatorJava.clusterTransactions(cluster, res);
 
-    $generatorJava.clusterCaches(cluster.caches, res);
+        $generatorJava.clusterCaches(cluster.caches, res);
 
-    if (javaClass) {
-        res.line();
-        res.line('return cfg;');
-        res.endBlock('}');
-        res.endBlock('}');
+        if (javaClass) {
+            res.line();
+            res.line('return cfg;');
+            res.endBlock('}');
+            res.endBlock('}');
 
-        return res.generateImports() + '\n\n' + res.join('')
+            return res.generateImports() + '\n\n' + res.join('')
+        }
     }
 
     return res.join('');

http://git-wip-us.apache.org/repos/asf/ignite/blob/2ff720f9/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
index 9be534c..b8ace49 100644
--- a/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
+++ b/modules/control-center-web/src/main/js/routes/generator/generator-xml.js
@@ -962,101 +962,105 @@ $generatorXml.clusterCaches = function(caches, res) {
 
 // Generate cluster config.
 $generatorXml.cluster = function (cluster, clientNearCfg) {
-    var res = $generatorCommon.builder();
+    if (cluster) {
+        var res = $generatorCommon.builder();
 
-    res.deep = 1;
+        res.deep = 1;
 
-    if (clientNearCfg) {
-        res.startBlock('<bean id="nearCacheBean" class="org.apache.ignite.configuration.NearCacheConfiguration">');
+        if (clientNearCfg) {
+            res.startBlock('<bean id="nearCacheBean" class="org.apache.ignite.configuration.NearCacheConfiguration">');
 
-        if (clientNearCfg.nearStartSize)
-            $generatorXml.property(res, clientNearCfg, 'nearStartSize');
+            if (clientNearCfg.nearStartSize)
+                $generatorXml.property(res, clientNearCfg, 'nearStartSize');
 
-        if (clientNearCfg.nearEvictionPolicy && clientNearCfg.nearEvictionPolicy.kind)
-            $generatorXml.evictionPolicy(res, clientNearCfg.nearEvictionPolicy, 'nearEvictionPolicy');
+            if (clientNearCfg.nearEvictionPolicy && clientNearCfg.nearEvictionPolicy.kind)
+                $generatorXml.evictionPolicy(res, clientNearCfg.nearEvictionPolicy, 'nearEvictionPolicy');
 
-        res.endBlock('</bean>');
+            res.endBlock('</bean>');
 
-        res.line();
-    }
+            res.line();
+        }
 
-    // Generate Ignite Configuration.
-    res.startBlock('<bean class="org.apache.ignite.configuration.IgniteConfiguration">');
+        // Generate Ignite Configuration.
+        res.startBlock('<bean class="org.apache.ignite.configuration.IgniteConfiguration">');
 
-    if (clientNearCfg) {
-        res.line('<property name="clientMode" value="true" />');
+        if (clientNearCfg) {
+            res.line('<property name="clientMode" value="true" />');
 
-        res.line();
-    }
+            res.line();
+        }
 
-    $generatorXml.clusterGeneral(cluster, res);
+        $generatorXml.clusterGeneral(cluster, res);
 
-    $generatorXml.clusterAtomics(cluster, res);
+        $generatorXml.clusterAtomics(cluster, res);
 
-    $generatorXml.clusterCommunication(cluster, res);
+        $generatorXml.clusterCommunication(cluster, res);
 
-    $generatorXml.clusterDeployment(cluster, res);
+        $generatorXml.clusterDeployment(cluster, res);
 
-    $generatorXml.clusterEvents(cluster, res);
+        $generatorXml.clusterEvents(cluster, res);
 
-    $generatorXml.clusterMarshaller(cluster, res);
+        $generatorXml.clusterMarshaller(cluster, res);
 
-    $generatorXml.clusterMetrics(cluster, res);
+        $generatorXml.clusterMetrics(cluster, res);
 
-    $generatorXml.clusterP2p(cluster, res);
+        $generatorXml.clusterP2p(cluster, res);
 
-    $generatorXml.clusterSwap(cluster, res);
+        $generatorXml.clusterSwap(cluster, res);
 
-    $generatorXml.clusterTime(cluster, res);
+        $generatorXml.clusterTime(cluster, res);
 
-    $generatorXml.clusterPools(cluster, res);
+        $generatorXml.clusterPools(cluster, res);
 
-    $generatorXml.clusterTransactions(cluster, res);
+        $generatorXml.clusterTransactions(cluster, res);
 
-    $generatorXml.clusterCaches(cluster.caches, res);
+        $generatorXml.clusterCaches(cluster.caches, res);
 
-    res.endBlock('</bean>');
+        res.endBlock('</bean>');
 
-    // Build final XML:
-    // 1. Add header.
-    var xml = '<?xml version="1.0" encoding="UTF-8"?>\n\n';
-
-    xml += '<!-- ' + $generatorCommon.mainComment() + ' -->\n';
-    xml += '<beans xmlns="http://www.springframework.org/schema/beans"\n';
-    xml += '       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n';
-    xml += '       xmlns:util="http://www.springframework.org/schema/util"\n';
-    xml += '       xsi:schemaLocation="http://www.springframework.org/schema/beans\n';
-    xml += '                           http://www.springframework.org/schema/beans/spring-beans.xsd\n';
-    xml += '                           http://www.springframework.org/schema/util\n';
-    xml += '                           http://www.springframework.org/schema/util/spring-util.xsd">\n';
-
-    // 2. Add external property file and all data sources.
-    if (res.datasources.length > 0) {
-        xml += '    <!-- Load external properties file. -->\n';
-        xml += '    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\n';
-        xml += '        <property name="location" value="classpath:secret.properties"/>\n';
-        xml += '    </bean>\n\n';
-
-        xml += '    <!-- Data source beans will be initialized from external properties
file. -->\n';
-
-        _.forEach(res.datasources, function (item) {
-            var beanId = item.dataSourceBean;
-
-            xml += '    <bean id= "' + beanId + '" class="' + item.className + '">\n';
-            xml += '        <property name="URL" value="${' + beanId + '.jdbc.url}" />\n';
-            xml += '        <property name="user" value="${' + beanId + '.jdbc.username}"
/>\n';
-            xml += '        <property name="password" value="${' + beanId + '.jdbc.password}"
/>\n';
+        // Build final XML:
+        // 1. Add header.
+        var xml = '<?xml version="1.0" encoding="UTF-8"?>\n\n';
+
+        xml += '<!-- ' + $generatorCommon.mainComment() + ' -->\n';
+        xml += '<beans xmlns="http://www.springframework.org/schema/beans"\n';
+        xml += '       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n';
+        xml += '       xmlns:util="http://www.springframework.org/schema/util"\n';
+        xml += '       xsi:schemaLocation="http://www.springframework.org/schema/beans\n';
+        xml += '                           http://www.springframework.org/schema/beans/spring-beans.xsd\n';
+        xml += '                           http://www.springframework.org/schema/util\n';
+        xml += '                           http://www.springframework.org/schema/util/spring-util.xsd">\n';
+
+        // 2. Add external property file and all data sources.
+        if (res.datasources.length > 0) {
+            xml += '    <!-- Load external properties file. -->\n';
+            xml += '    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\n';
+            xml += '        <property name="location" value="classpath:secret.properties"/>\n';
             xml += '    </bean>\n\n';
-        });
-    }
 
-    // 3. Add main content.
-    xml += res.join('');
+            xml += '    <!-- Data source beans will be initialized from external properties
file. -->\n';
+
+            _.forEach(res.datasources, function (item) {
+                var beanId = item.dataSourceBean;
+
+                xml += '    <bean id= "' + beanId + '" class="' + item.className + '">\n';
+                xml += '        <property name="URL" value="${' + beanId + '.jdbc.url}"
/>\n';
+                xml += '        <property name="user" value="${' + beanId + '.jdbc.username}"
/>\n';
+                xml += '        <property name="password" value="${' + beanId + '.jdbc.password}"
/>\n';
+                xml += '    </bean>\n\n';
+            });
+        }
+
+        // 3. Add main content.
+        xml += res.join('');
 
-    // 4. Add footer.
-    xml += '</beans>\n';
+        // 4. Add footer.
+        xml += '</beans>\n';
+
+        return xml;
+    }
 
-    return xml;
+    return '';
 };
 
 // For server side we should export XML generation entry point.


Mime
View raw message