ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: # GG-843 Added cache metadata popover.
Date Fri, 18 Sep 2015 06:03:20 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 dc3d175bb -> a9375fab9


# GG-843 Added cache metadata popover.


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

Branch: refs/heads/ignite-843
Commit: a9375fab99b0aa76bb48b36a79dcd0846434ef98
Parents: dc3d175
Author: Andrey <anovikov@gridgain.com>
Authored: Fri Sep 18 13:03:13 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Fri Sep 18 13:03:13 2015 +0700

----------------------------------------------------------------------
 .../agent/testdrive/AgentSqlTestDrive.java      | 10 ++-
 .../main/js/controllers/models/clusters.json    | 29 +++++++++
 .../src/main/js/controllers/sql-controller.js   | 56 +++++++++--------
 modules/control-center-web/src/main/js/db.js    |  3 +-
 .../src/main/js/public/stylesheets/style.scss   | 36 +++++++++++
 .../src/main/js/routes/agent.js                 | 66 +++++++++++++++++---
 .../main/js/routes/generator/generator-java.js  |  3 +-
 .../main/js/routes/generator/generator-xml.js   |  1 +
 .../src/main/js/views/sql/cache-metadata.jade   | 18 ++----
 .../src/main/js/views/sql/sql.jade              |  6 +-
 10 files changed, 175 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentSqlTestDrive.java
----------------------------------------------------------------------
diff --git a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentSqlTestDrive.java
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentSqlTestDrive.java
index 7b3dd80..34dcc46 100644
--- a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentSqlTestDrive.java
+++ b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/testdrive/AgentSqlTestDrive.java
@@ -161,17 +161,23 @@ public class AgentSqlTestDrive {
         ascFlds = new LinkedHashMap<>();
 
         ascFlds.put("employeeId", int.class);
-        ascFlds.put("salary", Double.class);
 
         type.setAscendingFields(ascFlds);
 
+        // Desc fields for EMPLOYEE.
+        Map<String, Class<?>> descFlds = new LinkedHashMap<>();
+
+        descFlds.put("salary", Double.class);
+
+        type.setDescendingFields(descFlds);
+
         // Groups for EMPLOYEE.
         Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>>
grps = new LinkedHashMap<>();
 
         LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>> grpItems
= new LinkedHashMap<>();
 
         grpItems.put("firstName", new IgniteBiTuple<Class<?>, Boolean>(String.class,
false));
-        grpItems.put("lastName", new IgniteBiTuple<Class<?>, Boolean>(String.class,
false));
+        grpItems.put("lastName", new IgniteBiTuple<Class<?>, Boolean>(String.class,
true));
 
         grps.put("EMP_NAMES", grpItems);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/controllers/models/clusters.json
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/models/clusters.json b/modules/control-center-web/src/main/js/controllers/models/clusters.json
index 75139cd..3db757a 100644
--- a/modules/control-center-web/src/main/js/controllers/models/clusters.json
+++ b/modules/control-center-web/src/main/js/controllers/models/clusters.json
@@ -143,6 +143,35 @@
                     "If provided address is non-loopback then multicast socket is bound to
this interface.",
                     "If local address is not set or is any local address then IP finder creates
multicast sockets for all found non-loopback addresses."
                   ]
+                },
+                {
+                  "label": "Addresses",
+                  "type": "table-simple",
+                  "path": "discovery.Multicast",
+                  "model": "addresses",
+                  "reordering": true,
+                  "ipaddress": true,
+                  "placeholder": "IP address:port",
+                  "focusId": "IpAddress",
+                  "addTip": "Add new address.",
+                  "removeTip": "Remove address.",
+                  "tableTip": [
+                    "Addresses may be represented as follows:",
+                    "<ul>",
+                    "  <li>IP address (e.g. 127.0.0.1, 9.9.9.9, etc);</li>",
+                    "  <li>IP address and port (e.g. 127.0.0.1:47500, 9.9.9.9:47501,
etc);</li>",
+                    "  <li>IP address and port range (e.g. 127.0.0.1:47500..47510,
9.9.9.9:47501..47504, etc);</li>",
+                    "  <li>Hostname (e.g. host1.com, host2, etc);</li>",
+                    "  <li>Hostname and port (e.g. host1.com:47500, host2:47502, etc).</li>",
+                    "  <li>Hostname and port range (e.g. host1.com:47500..47510, host2:47502..47508,
etc).</li>",
+                    "</ul>",
+                    "If port is 0 or not provided then default port will be used (depends
on discovery SPI configuration).",
+                    "If port range is provided (e.g. host:port1..port2) the following should
be considered:",
+                    "<ul>",
+                    "  <li>port1 < port2 should be true;</li>",
+                    "  <li>Both port1 and port2 should be greater than 0.</li>",
+                    "</ul>"
+                  ]
                 }
               ]
             },

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/controllers/sql-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/sql-controller.js b/modules/control-center-web/src/main/js/controllers/sql-controller.js
index 2f1f5d9..a9494ee 100644
--- a/modules/control-center-web/src/main/js/controllers/sql-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/sql-controller.js
@@ -16,8 +16,8 @@
  */
 
 // Controller for SQL notebook screen.
-controlCenterModule.controller('sqlController', ['$scope', '$window','$controller', '$http',
'$timeout', '$common', '$confirm', '$interval',
-    function ($scope, $window, $controller, $http, $timeout, $common, $confirm, $interval)
{
+controlCenterModule.controller('sqlController', ['$scope', '$window','$controller', '$http',
'$timeout', '$common', '$confirm', '$interval', '$popover', '$loading',
+    function ($scope, $window, $controller, $http, $timeout, $common, $confirm, $interval,
$popover, $loading) {
     // Initialize the super class and extend it.
     angular.extend(this, $controller('agent-download', {$scope: $scope}));
     $scope.agentGoal = 'execute sql statements';
@@ -49,16 +49,10 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
 
     $scope.treeOptions = {
         nodeChildren: "children",
-        dirSelectable: false,
+        dirSelectable: true,
         injectClasses: {
-            ul: "a1",
-            li: "a2",
-            liSelected: "a7",
-            iExpanded: "a3",
-            iCollapsed: "a4",
-            iLeaf: "a5",
-            label: "a6",
-            labelSelected: "a8"
+            iExpanded: "fa fa-minus-square-o",
+            iCollapsed: "fa fa-plus-square-o"
         }
     };
 
@@ -66,7 +60,7 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
         return !(col.fieldName === "_KEY") && !(col.fieldName == "_VAL");
     };
 
-    var _allColumn = function (col) {
+    var _allColumn = function () {
         return true;
     };
 
@@ -255,23 +249,12 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
     };
 
     $http.post('/agent/topology')
-        .success(function (nodes) {
-            $scope.caches = [];
-
-            var caches = _.sortBy(nodes[0].caches, 'name');
-
-            caches.map(function (cache) {
-                $scope.caches.push({
-                    "name" : cache.name,
-                    meta: [
-                        {"name" : cache.name, "age" : "33", "children" : []}
-                    ]
-                });
+        .success(function (caches) {
+            _.sortBy(caches, 'name').map(function (cache) {
+                $scope.caches.push(cache);
             })
         })
         .error(function (err, status) {
-            $scope.caches = [];
-
             if (status == 503)
                 $scope.showDownloadAgent();
             else
@@ -716,4 +699,25 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
         return $scope.actionAvailable(paragraph, needQuery) ? undefined
             : 'To ' + action + ' query select cache' + (needQuery ? ' and input query' :
'');
     };
+
+    $scope.dblclickMetadata = function (node) {
+        console.log(node);
+    };
+
+    $scope.tryLoadMetadata = function (cache) {
+        if (!cache.metadata) {
+            $loading.start('loadingCacheMetadata');
+
+            $http.post('/agent/cache/metadata', {cacheName: cache.name})
+                .success(function (metadata) {
+                    cache.metadata = metadata;
+                })
+                .error(function (errMsg) {
+                    $common.showError(errMsg);
+                })
+                .finally(function() {
+                    $loading.finish('loadingCacheMetadata');
+                });
+        }
+    }
 }]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/db.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/db.js b/modules/control-center-web/src/main/js/db.js
index 99408c2..2372390 100644
--- a/modules/control-center-web/src/main/js/db.js
+++ b/modules/control-center-web/src/main/js/db.js
@@ -233,7 +233,8 @@ var ClusterSchema = new Schema({
             multicastPort: Number,
             responseWaitTime: Number,
             addressRequestAttempts: Number,
-            localAddress: String
+            localAddress: String,
+            addresses: [String]
         },
         S3: {
             bucketName: String

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/public/stylesheets/style.scss b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
index 497b0a2..fdbaa82 100644
--- a/modules/control-center-web/src/main/js/public/stylesheets/style.scss
+++ b/modules/control-center-web/src/main/js/public/stylesheets/style.scss
@@ -463,6 +463,10 @@ button.form-control {
             opacity: 1;
         }
 
+        .ace_hidden-cursors {
+            opacity: 1;
+        }
+
         .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell {
             padding-right: 5px;
         }
@@ -926,6 +930,22 @@ button.form-control {
     }
 }
 
+.theme-line .popover.cache-metadata {
+    @extend .popover.settings;
+
+    min-width: 305px;
+
+    > .popover-content {
+        overflow: scroll;
+
+        min-height: 400px;
+        max-height: 400px;
+
+        min-width: 300px;
+        max-width: 300px;
+    }
+}
+
 .theme-line .popover.validation-error {
     max-width: 400px;
     color: $brand-primary;
@@ -1471,3 +1491,19 @@ button.dropdown-toggle {
     background-color: white;
     border-radius: 8px;
 }
+
+treecontrol.tree-classic {
+    > ul > li {
+        padding: 0;
+    }
+
+    li.tree-expanded i.tree-branch-head,  li.tree-collapsed i.tree-branch-head {
+        background: none;
+        padding-left: 0;
+    }
+
+    li .tree-selected {
+        background-color: white;
+        font-weight: normal;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/routes/agent.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/routes/agent.js b/modules/control-center-web/src/main/js/routes/agent.js
index eb586e8..471f53b 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -34,6 +34,10 @@ function _client(req, res) {
     return client;
 }
 
+function _compact(className) {
+    return className.replace('java.lang.', '').replace('java.util.', '').replace('java.sql.',
'');
+}
+
 /* Get grid topology. */
 router.get('/download', function (req, res) {
     res.render('templates/agent-download');
@@ -45,13 +49,13 @@ router.post('/topology', function (req, res) {
 
     if (client) {
         client.ignite().cluster().then(function (clusters) {
-            res.json(clusters.map(function (cluster) {
-                var caches = Object.keys(cluster._caches).map(function (key) {
+            var caches = clusters.map(function (cluster) {
+                return Object.keys(cluster._caches).map(function (key) {
                     return {name: key, mode: cluster._caches[key]}
                 });
+            });
 
-                return {nodeId: cluster._nodeId, caches: caches};
-            }));
+            res.json(_.uniq(_.flatten(caches)));
         }, function (err) {
             res.status(500).send(err);
         });
@@ -143,10 +147,58 @@ router.post('/cache/metadata', function (req, res) {
     var client = _client(req, res);
 
     if (client) {
-        var cache = client.ignite().cache(req.body.cacheName);
+        client.ignite().cache(req.body.cacheName).metadata().then(function (meta) {
+            var tables = meta.types.map(function (typeName) {
+                var fields = meta.fields[typeName];
+
+                var showSystem = fields.length == 2 && fields["_KEY"] &&
fields["_VAL"];
+
+                var columns = [];
+
+                for (var fieldName in fields)
+                    if (showSystem || fieldName != "_KEY" && fieldName != "_VAL")
{
+                        var fieldType = _compact(fields[fieldName]);
+
+                        columns.push({
+                            id: typeName + '.' + fieldName,
+                            name: fieldName + ' [' + fieldType + ']',
+                            type: fieldType
+                        });
+                    }
+
+                var indexes = [];
+
+                for (var index of meta.indexes[typeName]) {
+                    fields = [];
+
+                    for (var field of index.fields) {
+                        var order = index.descendings.indexOf(field) < 0 ? 'ASC' : 'DESC';
+
+                        fields.push({
+                            id: typeName + '.' + index.name + '.' + field,
+                            name: field + ' ['+ order  +']',
+                            order: index.descendings.indexOf(field) < 0,
+                            unique: index.unique
+                        });
+                    }
+
+                    if (fields.length > 0)
+                        indexes.push({
+                            id: typeName + '.' + index.name,
+                            name: index.name,
+                            children: fields
+                        });
+                }
+
+                columns = _.sortBy(columns, 'name');
+
+                if (indexes.length > 0)
+                    columns = columns.concat({id: typeName + '.indexes', name: 'Indexes',
children: indexes });
+
+                return {id: typeName, name: typeName, children: columns };
+            });
 
-        cache.metadata().then(function (metadata) {
-            res.json(metadata);
+            res.json(tables);
         }, function (err) {
             res.status(500).send(err);
         });

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/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 d384014..066f479 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
@@ -367,7 +367,8 @@ $generatorJava.clusterGeneral = function (cluster, clientNearCfg, res)
{
                         multicastPort: null,
                         responseWaitTime: null,
                         addressRequestAttempts: null,
-                        localAddress: null
+                        localAddress: null,
+                        addresses: {type: 'list'}
                     }, true);
 
                 break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/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 0e2833e..c45849f 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
@@ -217,6 +217,7 @@ $generatorXml.clusterGeneral = function (cluster, res) {
                     $generatorXml.property(res, d.Multicast, 'responseWaitTime');
                     $generatorXml.property(res, d.Multicast, 'addressRequestAttempts');
                     $generatorXml.property(res, d.Multicast, 'localAddress');
+                    $generatorXml.listProperty(res, d.Multicast, 'addresses');
                 }
 
                 res.endBlock('</bean>');

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/views/sql/cache-metadata.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/cache-metadata.jade b/modules/control-center-web/src/main/js/views/sql/cache-metadata.jade
index 5bbf45e..3cd5866 100644
--- a/modules/control-center-web/src/main/js/views/sql/cache-metadata.jade
+++ b/modules/control-center-web/src/main/js/views/sql/cache-metadata.jade
@@ -11,18 +11,10 @@
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-.popover.settings(tabindex='-1' style='width: 400px')
+.popover.cache-metadata(tabindex='-1' dw-loading='loadingCacheMetadata' dw-loading-options='{text:
""}' ng-init='tryLoadMetadata(cache)')
     .arrow
-    h3.popover-title(style='color: black') Refresh rate
-    button.close(id='paragraph-rate-close' type='button' ng-click='$hide()') &times;
+    h3.popover-title(style='color: black') Cache metadata
+    button.close(id='cache-metadata-close' type='button' ng-click='$hide()') &times;
     .popover-content
-        treecontrol.tree-classic(tree-model='cache.meta' options='treeOptions' selected-node='node1')
employee: {{node.name}} age {{node.age}})
-        //form(name='popoverForm')
-        //    .form-group(style='margin: 0; padding: 5px')
-        //        .col-sm-4(style='padding: 0')
-        //            input.form-control(id='paragraph-rate' ng-init='value = paragraph.rate.value'
ng-model='value' type='number' required auto-focus)
-        //        .col-sm-8(style='padding-left: 5px; padding-right: 0')
-        //            button.form-control(id='paragraph-unit' ng-init='unit = paragraph.rate.unit'
ng-model='unit' required placeholder='Time unit' bs-select bs-options='item.value as item.label
for item in timeUnit' tabindex='0')
-        //    .form-actions(style='margin-top: 30px; padding: 5px')
-        //        button.btn.btn-primary(id='paragraph-rate-start' ng-disabled='popoverForm.$invalid'
type='button' ng-click='startRefresh(paragraph, value, unit); $hide()') Start
-        //        button.btn.btn-primary.btn-default(id='paragraph-rate-stop' type='button'
ng-click='stopRefresh(paragraph); $hide()') Stop
+        treecontrol.tree-classic(tree-model='cache.metadata' options='treeOptions')
+            a(ng-dblclick='dblclickMetadata(node)') {{node.name}}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a9375fab/modules/control-center-web/src/main/js/views/sql/sql.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/sql.jade b/modules/control-center-web/src/main/js/views/sql/sql.jade
index 292eb1b..860abcb 100644
--- a/modules/control-center-web/src/main/js/views/sql/sql.jade
+++ b/modules/control-center-web/src/main/js/views/sql/sql.jade
@@ -87,9 +87,9 @@ block container
                                                 tbody
                                                     tr(ng-repeat='cache in displayedCaches
track by cache.name')
                                                         td(style='width: 100%')
-                                                            a(ng-class='{active: cache.name
== paragraph.cache.name}' ng-click='paragraph.cache = cache') {{$index + 1}}) {{::cache.name}}
-                                                        //td(style='width: 15px')
-                                                        //    i.fa.fa-info-circle(bs-popover
data-template-url='cache-metadata' data-placement='left' data-auto-close='1' data-trigger='click')
+                                                            a(ng-class='{active: cache.name
== paragraph.cache.name}' ng-click='paragraph.cache = cache') {{$index + 1}}) {{cache.name}}
+                                                        td(style='width: 15px')
+                                                            i.fa.fa-info-circle(bs-popover
data-template-url='cache-metadata', data-placement='left', data-trigger='click')
                                         .empty-caches(ng-show='displayedCaches.length ==
0 && caches.length != 0')
                                             label Wrong caches filter
                                         .empty-caches(ng-show='caches.length == 0')


Mime
View raw message