ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [1/2] ignite git commit: # GG-843 Added cache metadata popover.
Date Fri, 18 Sep 2015 07:09:12 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 d43f41768 -> ee0fd4354


# 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/064c1bb9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/064c1bb9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/064c1bb9

Branch: refs/heads/ignite-843
Commit: 064c1bb9f42a951da3af2544eca8adeb63e96d67
Parents: a9375fa
Author: Andrey <anovikov@gridgain.com>
Authored: Fri Sep 18 14:08:46 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Fri Sep 18 14:08:46 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 32 ++++++++++++--------
 .../src/main/js/public/stylesheets/style.scss   |  4 +++
 .../src/main/js/routes/agent.js                 | 23 +++++++-------
 .../src/main/js/views/sql/cache-metadata.jade   |  6 +++-
 .../src/main/js/views/sql/sql.jade              |  2 +-
 5 files changed, 42 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/064c1bb9/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 a9494ee..3b057dc 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
@@ -76,19 +76,23 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
         };
     }
 
-    $scope.aceInit = function (editor) {
-        editor.setAutoScrollEditorIntoView(true);
-        editor.$blockScrolling = Infinity;
+    $scope.aceInit = function (paragraph) {
+        return function (editor) {
+            editor.setAutoScrollEditorIntoView(true);
+            editor.$blockScrolling = Infinity;
 
-        var renderer = editor.renderer;
+            var renderer = editor.renderer;
 
-        renderer.setHighlightGutterLine(false);
-        renderer.setShowPrintMargin(false);
-        renderer.setOption('fontSize', '14px');
-        renderer.setOption('minLines', '5');
-        renderer.setOption('maxLines', '15');
+            renderer.setHighlightGutterLine(false);
+            renderer.setShowPrintMargin(false);
+            renderer.setOption('fontSize', '14px');
+            renderer.setOption('minLines', '5');
+            renderer.setOption('maxLines', '15');
 
-        editor.setTheme('ace/theme/chrome');
+            editor.setTheme('ace/theme/chrome');
+
+            paragraph.ace = editor;
+        }
     };
 
     var loadNotebook = function () {
@@ -700,8 +704,12 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
             : 'To ' + action + ' query select cache' + (needQuery ? ' and input query' :
'');
     };
 
-    $scope.dblclickMetadata = function (node) {
-        console.log(node);
+    $scope.clickableMetadata = function (node) {
+        return node.type.slice(0, 5) != 'index';
+    };
+
+    $scope.dblclickMetadata = function (paragraph, node) {
+        paragraph.ace.insert(node.name);
     };
 
     $scope.tryLoadMetadata = function (cache) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/064c1bb9/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 fdbaa82..6f47d2a 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
@@ -944,6 +944,10 @@ button.form-control {
         min-width: 300px;
         max-width: 300px;
     }
+
+    label.clickable {
+        cursor: pointer;
+    }
 }
 
 .theme-line .popover.validation-error {

http://git-wip-us.apache.org/repos/asf/ignite/blob/064c1bb9/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 471f53b..700fb6e 100644
--- a/modules/control-center-web/src/main/js/routes/agent.js
+++ b/modules/control-center-web/src/main/js/routes/agent.js
@@ -157,12 +157,13 @@ router.post('/cache/metadata', function (req, res) {
 
                 for (var fieldName in fields)
                     if (showSystem || fieldName != "_KEY" && fieldName != "_VAL")
{
-                        var fieldType = _compact(fields[fieldName]);
+                        var fieldClass = _compact(fields[fieldName]);
 
                         columns.push({
-                            id: typeName + '.' + fieldName,
-                            name: fieldName + ' [' + fieldType + ']',
-                            type: fieldType
+                            type: 'field',
+                            name: fieldName,
+                            fullName: typeName + '.' + fieldName,
+                            clazz: fieldClass
                         });
                     }
 
@@ -172,11 +173,10 @@ router.post('/cache/metadata', function (req, res) {
                     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  +']',
+                            type: 'index-field',
+                            name: field,
+                            fullName: typeName + '.' + index.name + '.' + field,
                             order: index.descendings.indexOf(field) < 0,
                             unique: index.unique
                         });
@@ -184,8 +184,9 @@ router.post('/cache/metadata', function (req, res) {
 
                     if (fields.length > 0)
                         indexes.push({
-                            id: typeName + '.' + index.name,
+                            type: 'index',
                             name: index.name,
+                            fullName: typeName + '.' + index.name,
                             children: fields
                         });
                 }
@@ -193,9 +194,9 @@ router.post('/cache/metadata', function (req, res) {
                 columns = _.sortBy(columns, 'name');
 
                 if (indexes.length > 0)
-                    columns = columns.concat({id: typeName + '.indexes', name: 'Indexes',
children: indexes });
+                    columns = columns.concat({type: 'indexes', name: 'Indexes', fullName:
typeName + '.indexes', children: indexes });
 
-                return {id: typeName, name: typeName, children: columns };
+                return {type: 'type', name: typeName, fullName: req.body.cacheName + '.'
+typeName,  children: columns };
             });
 
             res.json(tables);

http://git-wip-us.apache.org/repos/asf/ignite/blob/064c1bb9/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 3cd5866..0bfb3c7 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
@@ -17,4 +17,8 @@
     button.close(id='cache-metadata-close' type='button' ng-click='$hide()') &times;
     .popover-content
         treecontrol.tree-classic(tree-model='cache.metadata' options='treeOptions')
-            a(ng-dblclick='dblclickMetadata(node)') {{node.name}}
+            label.clickable(ng-if='node.type == "type"' ng-dblclick='dblclickMetadata(paragraph,
node)') {{node.name}}
+            label.clickable(ng-if='node.type == "field"' ng-dblclick='dblclickMetadata(paragraph,
node)') {{node.name}} [{{node.clazz}}]
+            label(ng-if='node.type == "indexes"') {{node.name}}
+            label(ng-if='node.type == "index"') {{node.name}}
+            label(ng-if='node.type == "index-field"') {{node.name}} [{{node.order ? 'ASC'
: 'DESC'}}]

http://git-wip-us.apache.org/repos/asf/ignite/blob/064c1bb9/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 860abcb..a21fbf0 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
@@ -74,7 +74,7 @@ block container
                             .panel-collapse(role='tabpanel' bs-collapse-target)
                                 .col-sm-12(ng-show='paragraph.editor')
                                     .col-xs-8.col-sm-9(style='border-right: 1px solid #eee')
-                                        .sql-editor(ui-ace='{onLoad: aceInit, theme: "chrome",
mode: "sql", require: ["ace/ext/language_tools"],' +
+                                        .sql-editor(ui-ace='{onLoad: aceInit(paragraph),
theme: "chrome", mode: "sql", require: ["ace/ext/language_tools"],' +
                                             'advanced: {enableSnippets: false, enableBasicAutocompletion:
true, enableLiveAutocompletion: true}}'
                                         ng-model='paragraph.query'
                                         ng-class='{"disable": paragraph.status == "RUNNING"
|| paragraph.status == "PENDING" }')


Mime
View raw message