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: WIP charts.
Date Fri, 04 Sep 2015 09:05:13 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 e7bce0923 -> 3459261c8


IGNITE-843: WIP charts.


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

Branch: refs/heads/ignite-843
Commit: 3459261c844d6139f353801afa0a92689c60704d
Parents: e7bce09
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Fri Sep 4 16:05:43 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Fri Sep 4 16:05:43 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 54 +++++++++++---------
 .../src/main/js/views/sql/sql.jade              |  8 +--
 2 files changed, 33 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3459261c/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 a484d02..2171d92 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
@@ -54,6 +54,8 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
         editor.setTheme('ace/theme/chrome');
     };
 
+    var paragraphId = 0;
+
     var loadNotebook = function () {
         $http.post('/notebooks/get', {noteId: $scope.noteId})
             .success(function (notebook) {
@@ -61,6 +63,10 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
 
                 $scope.notebook_name = notebook.name;
 
+                _.forEach(notebook.paragraphs, function (paragraph) {
+                    paragraph.id = paragraphId++;
+                });
+
                 if (!notebook.paragraphs || notebook.paragraphs.length == 0)
                     $scope.addParagraph();
             })
@@ -91,8 +97,6 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
                     }
 
                     $scope.notebook.edit = false;
-
-                    $common.showInfo("Notebook successfully renamed.");
                 })
                 .error(function (errMsg) {
                     $common.showError(errMsg);
@@ -104,9 +108,6 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
 
     $scope.saveNotebook = function () {
         $http.post('/notebooks/save', $scope.notebook)
-            .success(function () {
-                $common.showInfo("Notebook successfully saved.");
-            })
             .error(function (errMsg) {
                 $common.showError(errMsg);
             });
@@ -157,15 +158,13 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
             paragraph.edit = false
     };
 
-    var id = 0;
-
     $scope.addParagraph = function () {
         if (!$scope.notebook.paragraphs)
             $scope.notebook.paragraphs = [];
 
         var sz = $scope.notebook.paragraphs.length;
 
-        var paragraph = {id: id++, name: 'Query' + (sz ==0 ? '' : sz), editor: true, query:
'', pageSize: $scope.pageSizes[0], result: 'none'};
+        var paragraph = {id: paragraphId++, name: 'Query' + (sz ==0 ? '' : sz), editor: true,
query: '', pageSize: $scope.pageSizes[0], result: 'none'};
 
         if ($scope.caches && $scope.caches.length > 0)
             paragraph.cache = $scope.caches[0];
@@ -180,28 +179,31 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
     $scope.setResult = function (paragraph, new_result) {
         paragraph.result = paragraph.result === new_result ? 'none' : new_result;
 
-        switch (new_result) {
-            case 'table':
-                break;
+        if (paragraph.rows && paragraph.rows.length > 0) {
+            switch (new_result) {
+                case 'table':
+                case 'none':
+                    break;
 
-            case 'bar':
-                _barChart(paragraph);
-                break;
+                case 'bar':
+                    _barChart(paragraph);
+                    break;
 
-            case 'pie':
-                _pieChart(paragraph);
-                break;
+                case 'pie':
+                    _pieChart(paragraph);
+                    break;
 
-            case 'line':
-                _lineChart(paragraph);
-                break;
+                case 'line':
+                    _lineChart(paragraph);
+                    break;
 
-            case 'area':
-                _areaChart(paragraph);
-                break;
+                case 'area':
+                    _areaChart(paragraph);
+                    break;
 
-            default:
-                $common.showError('Unknown chart: ' + kind);
+                default:
+                    $common.showError('Unknown result: ' + new_result);
+            }
         }
     };
 
@@ -264,6 +266,8 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
     };
 
     var _processQueryResult = function (item) {
+        $scope.saveNotebook();
+
         return function (res) {
             item.meta = [];
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3459261c/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 d35ce86..93c637e 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
@@ -94,7 +94,7 @@ block container
                                             button.btn.btn-default.fa.fa-clock-o.tipLabel(ng-class='{"btn-info":
paragraph.rate && paragraph.rate.ruined}' bs-popover data-template-url="rate" data-placement='top-right'
data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
                                             label.tipLabel Page size:
                                             button.btn.btn-default.base-control.tipLabel(ng-model='paragraph.pageSize'
bs-options='item for item in pageSizes' bs-select)
-                                .panel-body(ng-show='paragraph.result === "table" &&
paragraph.rows')
+                                .panel-body(ng-show='paragraph.rows && paragraph.result
=== "table" && paragraph.rows')
                                     .row
                                         .col-sm-8
                                             lable Page #:&nbsp;
@@ -111,9 +111,9 @@ block container
                                             tbody
                                                 tr(ng-repeat='row in displayedCollection
track by $index')
                                                     td(ng-repeat='val in row track by $index')
{{ val }}
-                                .panel-body(ng-show='paragraph.result != "table" &&
paragraph.result != "none"')
+                                .panel-body(ng-show='paragraph.rows && paragraph.result
!= "table" && paragraph.result != "none"')
                                     div(id='chart-{{paragraph.id}}')
                                         svg
-                                .panel-body(ng-show='paragraph.result === "table" &&
!paragraph.rows')
+                                .panel-body(ng-show='!paragraph.rows')
                                     div(style='text-align: center;')
-                                        label ResultSet is empty.
+                                        label Result set is empty.


Mime
View raw message