ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [2/2] ignite git commit: IGNITE-843 WIP on preview java.
Date Wed, 26 Aug 2015 07:37:38 GMT
IGNITE-843 WIP on preview java.


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

Branch: refs/heads/ignite-843
Commit: b63961ae50c29ddef46cf1d92b9a1bee31e2eb25
Parents: f6e8920
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Aug 26 14:38:00 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Aug 26 14:38:00 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/clusters-controller.js  |  37 ++++---
 .../src/main/js/controllers/common-module.js    |   3 +-
 .../main/js/routes/generator/generator-java.js  | 108 ++++++++++++-------
 .../main/js/routes/generator/generator-xml.js   |   2 +-
 .../main/js/views/configuration/sidebar.jade    |   1 +
 .../src/main/js/views/includes/controls.jade    |  11 +-
 6 files changed, 110 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b63961ae/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 c1ef33d..7ed6b95 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
@@ -201,18 +201,31 @@ controlCenterModule.controller('clustersController', ['$scope', '$http',
'$timeo
                             return memo;
                         }, []);
 
-                        $scope.preview.general = $generatorXml.clusterCaches(clusterCaches,
$generatorXml.clusterGeneral(val)).join('');
-                        $scope.preview.atomics = $generatorXml.clusterAtomics(val).join('');
-                        $scope.preview.communication = $generatorXml.clusterCommunication(val).join('');
-                        $scope.preview.deployment = $generatorXml.clusterDeployment(val).join('');
-                        $scope.preview.events = $generatorXml.clusterEvents(val).join('');
-                        $scope.preview.marshaller = $generatorXml.clusterMarshaller(val).join('');
-                        $scope.preview.metrics = $generatorXml.clusterMetrics(val).join('');
-                        $scope.preview.p2p = $generatorXml.clusterP2p(val).join('');
-                        $scope.preview.swap = $generatorXml.clusterSwap(val).join('');
-                        $scope.preview.time = $generatorXml.clusterTime(val).join('');
-                        $scope.preview.pools = $generatorXml.clusterPools(val).join('');
-                        $scope.preview.transactions = $generatorXml.clusterTransactions(val).join('');
+                        $scope.preview.generalXml = $generatorXml.clusterCaches(clusterCaches,
$generatorXml.clusterGeneral(val)).join('');
+                        $scope.preview.atomicsXml = $generatorXml.clusterAtomics(val).join('');
+                        $scope.preview.communicationXml = $generatorXml.clusterCommunication(val).join('');
+                        $scope.preview.deploymentXml = $generatorXml.clusterDeployment(val).join('');
+                        $scope.preview.eventsXml = $generatorXml.clusterEvents(val).join('');
+                        $scope.preview.marshallerXml = $generatorXml.clusterMarshaller(val).join('');
+                        $scope.preview.metricsXml = $generatorXml.clusterMetrics(val).join('');
+                        $scope.preview.p2pXml = $generatorXml.clusterP2p(val).join('');
+                        $scope.preview.swapXml = $generatorXml.clusterSwap(val).join('');
+                        $scope.preview.timeXml = $generatorXml.clusterTime(val).join('');
+                        $scope.preview.poolsXml = $generatorXml.clusterPools(val).join('');
+                        $scope.preview.transactionsXml = $generatorXml.clusterTransactions(val).join('');
+
+                        $scope.preview.generalJava = $generatorJava.clusterCaches(clusterCaches,
$generatorJava.clusterGeneral(val)).join('');
+                        $scope.preview.atomicsJava = $generatorJava.clusterAtomics(val).join('');
+                        $scope.preview.communicationJava = $generatorJava.clusterCommunication(val).join('');
+                        //$scope.preview.deploymentJava = $generatorJava.clusterDeployment(val).join('');
+                        //$scope.preview.eventsJava = $generatorJava.clusterEvents(val).join('');
+                        //$scope.preview.marshallerJava = $generatorJava.clusterMarshaller(val).join('');
+                        //$scope.preview.metricsJava = $generatorJava.clusterMetrics(val).join('');
+                        //$scope.preview.p2pJava = $generatorJava.clusterP2p(val).join('');
+                        //$scope.preview.swapJava = $generatorJava.clusterSwap(val).join('');
+                        //$scope.preview.timeJava = $generatorJava.clusterTime(val).join('');
+                        //$scope.preview.poolsJava = $generatorJava.clusterPools(val).join('');
+                        //$scope.preview.transactionsJava = $generatorJava.clusterTransactions(val).join('');
                     }
                 }, true);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b63961ae/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 a983ebf..4413612 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
@@ -661,9 +661,8 @@ controlCenterModule.service('$common', [
                         resizePreview(el);
                     });
 
-                    observer.observe($('#' + el.id + '-left')[0], {
+                    observer.observe(el, {
                         childList: true,
-                        attributes: true,
                         subtree: true
                     });
                 });

http://git-wip-us.apache.org/repos/asf/ignite/blob/b63961ae/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 21a0389..07e1140 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
@@ -582,36 +582,10 @@ function _addBeanWithProperties(res, varName, bean, beanPropName, beanVarName,
b
 
 $generatorJava = {};
 
-/**
- * Function to generate java code for cluster configuration.
- *
- * @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.
- */
-$generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration) {
-    var res = $generatorCommon.builder();
-
-    res.datasourceBeans = [];
-
-    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() {');
-    }
-
-    _declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
-    res.line();
-
-    if (clientNearConfiguration) {
-        res.line('cfg.setClientMode(true);');
-        res.line();
-    }
+// Generate cluster general group.
+$generatorJava.clusterGeneral = function (cluster, res) {
+    if (!res)
+        res = $generatorCommon.builder();
 
     if (cluster.discovery) {
         var d = cluster.discovery;
@@ -713,6 +687,73 @@ $generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration)
         res.needEmptyLine = true;
     }
 
+    return res;
+};
+
+// Generate atomics group.
+$generatorJava.clusterAtomics = function (cluster, res) {
+    if (!res)
+        res = $generatorCommon.builder();
+
+    var atomicCfg = $generatorCommon.ATOMIC_CONFIGURATION;
+
+    _addBeanWithProperties(res, 'cfg', cluster.atomicConfiguration, 'atomicConfiguration',
'atomicCfg',
+        atomicCfg.className, atomicCfg.fields);
+
+    res.needEmptyLine = true;
+
+    return res;
+};
+
+// Generate communication group.
+$generatorJava.clusterCommunication = function (cluster, res) {
+    if (!res)
+        res = $generatorCommon.builder();
+
+    return res;
+};
+
+// Generate cluster caches.
+$generatorJava.clusterCaches = function (cluster, res) {
+    if (!res)
+        res = $generatorCommon.builder();
+
+    return res;
+};
+
+/**
+ * Function to generate java code for cluster configuration.
+ *
+ * @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.
+ */
+$generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration) {
+    var res = $generatorCommon.builder();
+
+    res.datasourceBeans = [];
+
+    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() {');
+    }
+
+    _declareVariable(res, true, 'cfg', 'org.apache.ignite.configuration.IgniteConfiguration');
+    res.line();
+
+    if (clientNearConfiguration) {
+        res.line('cfg.setClientMode(true);');
+        res.line();
+    }
+
+    $generatorJava.clusterGeneral(cluster, res);
+
     var caches = cluster.caches;
 
     if (caches && caches.length > 0) {
@@ -748,12 +789,7 @@ $generatorJava.cluster = function (cluster, javaClass, clientNearConfiguration)
         res.needEmptyLine = true;
     }
 
-    var atomicCfg = $generatorCommon.ATOMIC_CONFIGURATION;
-
-    _addBeanWithProperties(res, 'cfg', cluster.atomicConfiguration, 'atomicConfiguration',
'atomicCfg',
-        atomicCfg.className, atomicCfg.fields);
-
-    res.needEmptyLine = true;
+    $generatorJava.clusterAtomics(cluster, res);
 
     _addProperty(res, 'cfg', cluster, 'networkTimeout');
     _addProperty(res, 'cfg', cluster, 'networkSendRetryDelay');

http://git-wip-us.apache.org/repos/asf/ignite/blob/b63961ae/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 8380a38..c970701 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
@@ -261,7 +261,7 @@ function _addCacheTypeMetadataGroups(res, meta) {
 $generatorXml = {};
 
 // Generate discovery.
-$generatorXml.clusterGeneral = function (cluster, caches, res) {
+$generatorXml.clusterGeneral = function (cluster, res) {
     if (!res)
         res = $generatorCommon.builder();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b63961ae/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade b/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
index 0bc393f..48f0341 100644
--- a/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
+++ b/modules/control-center-web/src/main/js/views/configuration/sidebar.jade
@@ -21,6 +21,7 @@ append scripts
     script(src='/data-structures.js')
     script(src='/generator-common.js')
     script(src='/generator-xml.js')
+    script(src='/generator-java.js')
 
 mixin sidebar-item(ref, num, txt)
     li

http://git-wip-us.apache.org/repos/asf/ignite/blob/b63961ae/modules/control-center-web/src/main/js/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade
index 3c48c07..0c03175 100644
--- a/modules/control-center-web/src/main/js/views/includes/controls.jade
+++ b/modules/control-center-web/src/main/js/views/includes/controls.jade
@@ -462,5 +462,14 @@ mixin advanced-options-bottom
         a(ng-click='toggleExpanded()') {{ui.expanded ? 'Hide advanced settings...' : 'Show
advanced settings...'}}
 
 mixin preview(previewModel, id)
+    -var previewModelXml = previewModel + 'Xml'
+    -var previewModelJava = previewModel + 'Java'
+    -var previewModelState = previewModel + 'State'
+
     .panel-details(style='margin-left: 20px; padding: 0 3px')
-        .ace-preview(id='#{id}' ui-ace='{onLoad: previewInit, mode: "xml"}' ng-model='preview[#{previewModel}]')
+        div(style='padding: 5px; position: absolute; z-index: 9999; right: 0')
+            button(ng-click='#{previewModelState} = !#{previewModelState}')
+                img(ng-if='#{previewModelState}' src="/images/xml.png" width="16px" height="16px")
+                img(ng-if='!#{previewModelState}' src="/images/java.png" width="16px" height="16px")
+        .ace-preview(ng-if='!#{previewModelState}' id='#{id}' ui-ace='{onLoad: previewInit,
mode: "xml"}' ng-model='preview[#{previewModel} + "Xml"]')
+        .ace-preview(ng-if='#{previewModelState}' id='#{id}' ui-ace='{onLoad: previewInit,
mode: "java"}' ng-model='preview[#{previewModel} + "Java"]')


Mime
View raw message