ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: ignite-843 Fixed sql result load.
Date Mon, 28 Sep 2015 03:37:47 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 749bec1b6 -> a218a5594


ignite-843 Fixed sql result load.


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

Branch: refs/heads/ignite-843
Commit: a218a5594c34035e35fbb8f873b5d5f6e65048ca
Parents: 749bec1
Author: Andrey <anovikov@gridgain.com>
Authored: Mon Sep 28 10:38:07 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon Sep 28 10:38:07 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 54 +++++++++++++++-----
 .../src/main/js/views/sql/sql.jade              |  9 ++--
 2 files changed, 45 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a218a559/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 58e534a..cf93268 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
@@ -89,7 +89,7 @@ consoleModule.controller('sqlController',
 
     $scope.treeOptions = {
         nodeChildren: 'children',
-        dirSelectable: false,
+        dirSelectable: true,
         injectClasses: {
             iExpanded: 'fa fa-minus-square-o',
             iCollapsed: 'fa fa-plus-square-o'
@@ -115,6 +115,10 @@ consoleModule.controller('sqlController',
             return this.result != 'table' && this.result != 'none';
         };
 
+        paragraph.table = function () {
+            return this.result == 'table';
+        };
+
         paragraph.chartColumnsConfigured = function () {
             return !$common.isEmptyArray(this.chartKeyCols) && !$common.isEmptyArray(this.chartValCols);
         };
@@ -125,9 +129,7 @@ consoleModule.controller('sqlController',
 
         Object.defineProperty(paragraph, 'gridOptions', { value: {
             enableColResize: true,
-            columnDefs: [
-                {headerName: 'Test', valueGetter: 'data[0]'}
-            ],
+            columnDefs: [],
             rowData: null
         }});
     }
@@ -432,10 +434,10 @@ consoleModule.controller('sqlController',
             if (chartHistory.size > 100)
                 chartHistory.shift();
 
-            paragraph.gridOptions.api.showLoading(false);
-
             paragraph.gridOptions.api.setRowData(res.rows);
 
+            _showLoading(paragraph, false);
+
             setTimeout(function () {
                 paragraph.gridOptions.api.sizeColumnsToFit();
             });
@@ -455,6 +457,13 @@ consoleModule.controller('sqlController',
             });
     };
 
+    var _showLoading = function (paragraph, enable) {
+        if (paragraph.table())
+            paragraph.gridOptions.api.showLoading(enable);
+
+        paragraph.loading = enable;
+    };
+
     $scope.execute = function (paragraph) {
         _saveNotebook();
 
@@ -470,7 +479,7 @@ consoleModule.controller('sqlController',
 
         paragraph.queryArgs = { query: paragraph.query, pageSize: paragraph.pageSize, cacheName:
paragraph.cacheName };
 
-        paragraph.gridOptions.api.showLoading(true);
+        _showLoading(paragraph, true);
 
         $http.post('/agent/query', paragraph.queryArgs)
             .success(function (res) {
@@ -481,6 +490,8 @@ consoleModule.controller('sqlController',
             .error(function (errMsg) {
                 paragraph.errMsg = errMsg;
 
+                _showLoading(paragraph, false);
+
                 $scope.stopRefresh(paragraph);
             });
 
@@ -492,12 +503,14 @@ consoleModule.controller('sqlController',
 
         _cancelRefresh(paragraph);
 
-        paragraph.gridOptions.api.showLoading(true);
+        _showLoading(paragraph, true);
 
         $http.post('/agent/query', {query: 'EXPLAIN ' + paragraph.query, pageSize: paragraph.pageSize,
cacheName: paragraph.cacheName})
             .success(_processQueryResult(paragraph))
             .error(function (errMsg) {
                 paragraph.errMsg = errMsg;
+
+                _showLoading(paragraph, false);
             });
 
         paragraph.ace.focus();
@@ -508,19 +521,23 @@ consoleModule.controller('sqlController',
 
         _cancelRefresh(paragraph);
 
-        paragraph.gridOptions.api.showLoading(true);
+        _showLoading(paragraph, true);
 
         $http.post('/agent/scan', {pageSize: paragraph.pageSize, cacheName: paragraph.cacheName})
             .success(_processQueryResult(paragraph))
             .error(function (errMsg) {
                 paragraph.errMsg = errMsg;
+
+                _showLoading(paragraph, false);
             });
 
         paragraph.ace.focus();
     };
 
     $scope.nextPage = function(item) {
-        $http.post('/agent/query/fetch', {queryId: item.queryId, pageSize: item.pageSize,
cacheName: item.cacheName})
+        _showLoading(true);
+
+        $http.post('/agent/query/fetch', {queryId: item.queryId, pageSize: item.pageSize,
cacheName: item.queryArgs.cacheName})
             .success(function (res) {
                 item.page++;
 
@@ -528,11 +545,17 @@ consoleModule.controller('sqlController',
 
                 item.rows = res.rows;
 
+                item.gridOptions.api.setRowData(res.rows);
+
+                _showLoading(paragraph, false);
+
                 if (res.last)
                     delete item.queryId;
             })
             .error(function (errMsg) {
                 paragraph.errMsg = errMsg;
+
+                _showLoading(paragraph, false);
             });
     };
 
@@ -926,12 +949,17 @@ consoleModule.controller('sqlController',
     }
 
     $scope.actionAvailable = function (paragraph, needQuery) {
-        return $scope.caches.length > 0 && paragraph.cacheName && (!needQuery
|| paragraph.query);
+        return $scope.caches.length > 0 && paragraph.cacheName && (!needQuery
|| paragraph.query) && !paragraph.loading;
     };
 
     $scope.actionTooltip = function (paragraph, action, needQuery) {
-        return $scope.actionAvailable(paragraph, needQuery) ? undefined
-            : 'To ' + action + ' query select cache' + (needQuery ? ' and input query' :
'');
+        if ($scope.actionAvailable(paragraph, needQuery))
+            return;
+
+        if (paragraph.loading)
+            return 'Wating for server response';
+
+        return 'To ' + action + ' query select cache' + (needQuery ? ' and input query' :
'');
     };
 
     $scope.clickableMetadata = function (node) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/a218a559/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 d14eade..1ce2056 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
@@ -97,8 +97,7 @@ block container
                                     .col-xs-8.col-sm-9(style='border-right: 1px solid #eee')
                                         .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" }')
+                                        ng-model='paragraph.query')
                                     .col-xs-4.col-sm-3
                                         div(ng-show='caches.length > 0' style='padding:
5px 10px' st-table='displayedCaches' st-safe-src='caches')
                                             lable.labelField.labelFormField Caches:
@@ -134,15 +133,15 @@ block container
                                 .col-sm-12(ng-show='!paragraph.errMsg && paragraph.result
!= "none"')
                                     hr(style='margin-top: 0; margin-bottom: 10px')
                                     .sql-empty-result(ng-show='!paragraph.nonEmpty()') Result
set is empty.
-                                    div(ng-show='paragraph.result === "table" &&
paragraph.nonEmpty()')
+                                    div(ng-show='paragraph.table() && paragraph.nonEmpty()')
                                         .sql-table-total
                                             label Page #&nbsp;
                                             b {{paragraph.page}}&nbsp;&nbsp;&nbsp;
                                             label Results so far:&nbsp;
                                             b {{paragraph.rows.length + paragraph.total}}
                                             .pull-right
-                                                .btn-group
-                                                    button.btn.btn-primary.fieldButton(ng-click='exportPage(paragraph)'
) Export
+                                                .btn-group(ng-disabled='paragraph.loading')
+                                                    button.btn.btn-primary.fieldButton(ng-click='exportPage(paragraph)'
bs-tooltip data-title='{{actionTooltip(paragraph, "export", false)}}') Export
                                                     button.btn.btn-primary(id='export-item-dropdown'
data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
                                                         span.caret
                                         .sql-table.ag-bootstrap(ag-grid='paragraph.gridOptions')


Mime
View raw message