You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/10/06 13:12:25 UTC
ignite git commit: ignite-843 Sql chart fix.
Repository: ignite
Updated Branches:
refs/heads/ignite-843 7c54c3a72 -> db2c79ed4
ignite-843 Sql chart fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/db2c79ed
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/db2c79ed
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/db2c79ed
Branch: refs/heads/ignite-843
Commit: db2c79ed41f39a085de67ef6cc0ca8d75893afb4
Parents: 7c54c3a
Author: Andrey <an...@gridgain.com>
Authored: Tue Oct 6 18:12:17 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Tue Oct 6 18:12:17 2015 +0700
----------------------------------------------------------------------
.../src/main/js/controllers/sql-controller.js | 152 +++++++++++--------
.../src/main/js/public/stylesheets/style.scss | 67 ++++----
.../src/main/js/views/sql/sql.jade | 28 ++--
3 files changed, 144 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/db2c79ed/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 d336a0f..2e9c0e5 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
@@ -22,13 +22,38 @@ consoleModule.controller('sqlController',
// Initialize the super class and extend it.
angular.extend(this, $controller('agent-download', {$scope: $scope}));
+ $scope.agentGoal = 'execute sql statements';
+ $scope.agentTestDriveOption = '--test-drive-sql';
+
+ $scope.joinTip = $common.joinTip;
+
+ $scope.caches = [];
+
+ $scope.pageSizes = [50, 100, 200, 400, 800, 1000];
+
+ $scope.modes = $common.mkOptions(['PARTITIONED', 'REPLICATED', 'LOCAL']);
+
+ $scope.timeUnit = [
+ {value: 1000, label: 'seconds', short: 's'},
+ {value: 60000, label: 'minutes', short: 'm'},
+ {value: 3600000, label: 'hours', short: 'h'}
+ ];
+
+ $scope.exportDropdown = [{ 'text': 'Export all', 'click': 'exportAll(paragraph)'}];
+
+ $scope.treeOptions = {
+ nodeChildren: 'children',
+ dirSelectable: true,
+ injectClasses: {
+ iExpanded: 'fa fa-minus-square-o',
+ iCollapsed: 'fa fa-plus-square-o'
+ }
+ };
+
var TIME_LINE = 'TIME_LINE';
var chartHistory = [];
- $scope.agentGoal = 'execute sql statements';
- $scope.agentTestDriveOption = '--test-drive-sql';
-
$scope.chartRemoveKeyColumn = function (paragraph, index) {
paragraph.chartKeyCols.splice(index, 1);
@@ -43,8 +68,8 @@ consoleModule.controller('sqlController',
function _chartAcceptableColumn(cols, newCol) {
return _.findIndex(cols, function (col) {
- return col.label == newCol.label;
- }) < 0;
+ return col.label == newCol.label;
+ }) < 0;
}
$scope.chartAcceptKeyColumn = function(paragraph, item) {
@@ -71,31 +96,6 @@ consoleModule.controller('sqlController',
return false;
};
- $scope.joinTip = $common.joinTip;
-
- $scope.caches = [];
-
- $scope.pageSizes = [50, 100, 200, 400, 800, 1000];
-
- $scope.modes = $common.mkOptions(['PARTITIONED', 'REPLICATED', 'LOCAL']);
-
- $scope.timeUnit = [
- {value: 1000, label: 'seconds', short: 's'},
- {value: 60000, label: 'minutes', short: 'm'},
- {value: 3600000, label: 'hours', short: 'h'}
- ];
-
- $scope.exportDropdown = [{ 'text': 'Export all', 'click': 'exportAll(paragraph)'}];
-
- $scope.treeOptions = {
- nodeChildren: 'children',
- dirSelectable: true,
- injectClasses: {
- iExpanded: 'fa fa-minus-square-o',
- iCollapsed: 'fa fa-plus-square-o'
- }
- };
-
var _hideColumn = function (col) {
return !(col.fieldName === '_KEY') && !(col.fieldName == '_VAL');
};
@@ -115,6 +115,10 @@ consoleModule.controller('sqlController',
return this.result != 'table' && this.result != 'none';
};
+ paragraph.queryExecute = function () {
+ return this.queryArgs && this.queryArgs.type == 'QUERY';
+ };
+
paragraph.table = function () {
return this.result == 'table';
};
@@ -297,8 +301,14 @@ consoleModule.controller('sqlController',
paragraph.result = paragraph.result === new_result ? 'none' : new_result;
- if (changed && paragraph.chart())
- _chartApplySettings(paragraph, changed);
+ if (changed) {
+ if (paragraph.chart())
+ _chartApplySettings(paragraph, changed);
+ else
+ setTimeout(function () {
+ paragraph.gridOptions.api.sizeColumnsToFit();
+ });
+ }
};
$scope.resultEq = function(paragraph, result) {
@@ -415,7 +425,7 @@ consoleModule.controller('sqlController',
if (!$common.isDefined(paragraph.chartValCols ))
paragraph.chartValCols = [];
- if (res.meta) {
+ if (res.meta && columnsToFit) {
paragraph.disabledSystemColumns = res.meta.length == 2 &&
res.meta[0].fieldName === '_KEY' && res.meta[1].fieldName === '_VAL';
@@ -434,23 +444,33 @@ consoleModule.controller('sqlController',
delete paragraph.errMsg;
- paragraph.rows = res.rows;
+ if (paragraph.queryArgs.type == "EXPLAIN" && res.rows) {
+ paragraph.rows = [];
+
+ res.rows.forEach(function (row) {
+ (row[0] + '\n ').replace(/\"/g, '').split('\n').forEach(function (line) {
+ paragraph.rows.push([line]);
+ });
+ });
+ }
+ else
+ paragraph.rows = res.rows;
// Add results to history.
- chartHistory.push({tm: new Date(), rows: res.rows});
+ chartHistory.push({tm: new Date(), rows: paragraph.rows});
- if (chartHistory.size > 100)
+ if (chartHistory.length > 100)
chartHistory.shift();
- paragraph.gridOptions.api.setRowData(res.rows);
-
- _showLoading(paragraph, false);
+ paragraph.gridOptions.api.setRowData(paragraph.rows);
if (columnsToFit)
setTimeout(function () {
paragraph.gridOptions.api.sizeColumnsToFit();
});
+ _showLoading(paragraph, false);
+
if (paragraph.result == 'none')
paragraph.result = 'table';
else if (paragraph.chart())
@@ -467,26 +487,16 @@ consoleModule.controller('sqlController',
};
var _showLoading = function (paragraph, enable) {
- if (paragraph.table())
- paragraph.gridOptions.api.showLoading(enable);
+ //if (paragraph.table())
+ // paragraph.gridOptions.api.showLoading(enable);
- paragraph.loading = enable;
+ //paragraph.loading = enable;
};
$scope.execute = function (paragraph) {
_saveNotebook();
- if (paragraph.prevQuery) {
- if (paragraph.prevQuery != paragraph.query) {
- chartHistory = [];
-
- paragraph.prevQuery = paragraph.query;
- }
- }
- else
- paragraph.prevQuery = paragraph.query;
-
- paragraph.queryArgs = { query: paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
+ paragraph.queryArgs = { type: "QUERY", query: paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
_showLoading(paragraph, true);
@@ -512,7 +522,7 @@ consoleModule.controller('sqlController',
_cancelRefresh(paragraph);
- paragraph.queryArgs = {query: 'EXPLAIN ' + paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
+ paragraph.queryArgs = { type: "EXPLAIN", query: 'EXPLAIN ' + paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
_showLoading(paragraph, true);
@@ -532,7 +542,7 @@ consoleModule.controller('sqlController',
_cancelRefresh(paragraph);
- paragraph.queryArgs = { pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
+ paragraph.queryArgs = { type: "SCAN", pageSize: paragraph.pageSize, cacheName: paragraph.cacheName };
_showLoading(paragraph, true);
@@ -750,13 +760,28 @@ consoleModule.controller('sqlController',
var index = 0;
var values = [];
- if (paragraph.chartTimeLineEnabled())
- values = _.map(chartHistory, function (history) {
- return {
- x: history.tm,
- y: _chartNumber(history.rows[0], valCol.value, 0)
+ if (paragraph.chartTimeLineEnabled()) {
+ if (paragraph.charts[0]) {
+ var chartData = _.find(paragraph.charts[0].data, {key: valCol.label});
+
+ if (chartData) {
+ var history = _.last(chartHistory);
+
+ chartData.values.push({
+ x: history.tm,
+ y: _chartNumber(history.rows[0], valCol.value, 0)
+ });
}
- });
+ }
+ else {
+ values = _.map(chartHistory, function (history) {
+ return {
+ x: history.tm,
+ y: _chartNumber(history.rows[0], valCol.value, 0)
+ }
+ });
+ }
+ }
else
values = _.map(paragraph.rows, function (row) {
return {
@@ -916,7 +941,8 @@ consoleModule.controller('sqlController',
y: _yY,
xAxis: {
axisLabel: _chartAxisLabel(paragraph.chartKeyCols, 'X'),
- tickFormat: paragraph.chartTimeLineEnabled() ? _chartTimeTickFormat : _chartWithLabelFormat(data[0].values)
+ tickFormat: paragraph.chartTimeLineEnabled() ? _chartTimeTickFormat : _chartWithLabelFormat(data[0].values),
+ showMaxMin: false
},
yAxis: {
axisLabel: _chartAxisLabel(paragraph.chartValCols, 'Y'),
@@ -932,6 +958,8 @@ consoleModule.controller('sqlController',
paragraph.charts[0].api.update();
})
}
+ else if (paragraph.chartTimeLineEnabled() && paragraph.charts[0])
+ paragraph.charts[0].api.update();
else
paragraph.charts[0].api.updateWithData(data);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db2c79ed/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 4e28527..cbdeca3 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
@@ -225,9 +225,15 @@ ul.navbar-nav, .sidebar-nav {
}
.nav > li {
- > a { color: $navbar-default-link-color }
- > a:hover { color: $link-hover-color }
- > a.active { color: $link-color }
+ > a {
+ color: $navbar-default-link-color
+ }
+ > a:hover {
+ color: $link-hover-color
+ }
+ > a.active {
+ color: $link-color
+ }
}
.theme-line header .navbar-nav a {
@@ -813,7 +819,6 @@ button.form-control {
}
}
-
.theme-line table.sql-results {
margin: 0;
@@ -1405,27 +1410,27 @@ a {
}
.preview-highlight-2 {
- position: absolute;
- background-color: #f0f6ff;
- z-index: 21;
+ position: absolute;
+ background-color: #f0f6ff;
+ z-index: 21;
}
.preview-highlight-3 {
- position: absolute;
- background-color: #e8f2ff;
- z-index: 22;
+ position: absolute;
+ background-color: #e8f2ff;
+ z-index: 22;
}
.preview-highlight-4 {
- position: absolute;
- background-color: #e1eeff;
- z-index: 23;
+ position: absolute;
+ background-color: #e1eeff;
+ z-index: 23;
}
.preview-highlight-5 {
- position: absolute;
- background-color: #DAEAFF;
- z-index: 24;
+ position: absolute;
+ background-color: #DAEAFF;
+ z-index: 24;
}
.preview-highlight-6 {
@@ -1435,27 +1440,27 @@ a {
}
.preview-highlight-7 {
- position: absolute;
- background-color: #CBE1FF;
- z-index: 26;
+ position: absolute;
+ background-color: #CBE1FF;
+ z-index: 26;
}
.preview-highlight-8 {
- position: absolute;
- background-color: #C3DDFF;
- z-index: 27;
+ position: absolute;
+ background-color: #C3DDFF;
+ z-index: 27;
}
.preview-highlight-9 {
- position: absolute;
- background-color: #BCD9FF;
- z-index: 28;
+ position: absolute;
+ background-color: #BCD9FF;
+ z-index: 28;
}
.preview-highlight-10 {
- position: absolute;
- background-color: #B5D5FF;
- z-index: 29;
+ position: absolute;
+ background-color: #B5D5FF;
+ z-index: 29;
}
.preview-panel {
@@ -1621,7 +1626,7 @@ treecontrol.tree-classic {
padding: 0;
}
- li.tree-expanded i.tree-branch-head, li.tree-collapsed i.tree-branch-head {
+ li.tree-expanded i.tree-branch-head, li.tree-collapsed i.tree-branch-head {
background: none;
padding-left: 0;
}
@@ -1648,11 +1653,9 @@ treecontrol.tree-classic {
.ag-cell {
padding: 3px 6px;
- border-right: 1px solid #ccc
+ border-right: 1px solid #ccc;
}
- .ag-cell
-
.ag-pinned-header {
border-bottom: 2px solid $table-border-color;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db2c79ed/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 9cfa03d..fcbaf2b 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
@@ -132,7 +132,7 @@ block container
.sql-error-result(ng-show='paragraph.errMsg') Error: {{paragraph.errMsg}}
.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.
+ .sql-empty-result(ng-show='!paragraph.nonEmpty()') Result set is empty
div(ng-show='paragraph.table() && paragraph.nonEmpty()')
.sql-table-total
label Page #
@@ -146,14 +146,24 @@ block container
span.caret
.sql-table.ag-bootstrap(ag-grid='paragraph.gridOptions')
div(ng-show='paragraph.chart() && paragraph.nonEmpty()')
- .chart-settings-link
- i.fa.fa-chevron-circle-down
- a(ng-show='paragraph.chart' ng-click='$event.stopPropagation()' bs-popover data-template-url='chart-settings' data-placement='bottom' data-auto-close='1' data-trigger='click') Chart settings
- div(ng-repeat='chart in paragraph.charts' ng-hide='paragraph.chartTimeLineEnabled() && !paragraph.timeLineSupported()')
- nvd3(options='chart.options' data='chart.data' api='chart.api')
- .sql-empty-result(ng-show='paragraph.chartTimeLineEnabled() && !paragraph.timeLineSupported()') Pie chart does not supported 'TIME_LINE' column for X-axis.
- div(ng-show='paragraph.chart() && paragraph.nonEmpty() && ')
- div(ng-show='paragraph.queryId')
+ div(ng-show='paragraph.queryExecute()')
+ .sql-empty-result(ng-hide='paragraph.chartColumnsConfigured()') Can't display chart. Need configure axis using 
+ b Chart settings
+ div(ng-show='paragraph.chartColumnsConfigured()')
+ div(ng-show='paragraph.timeLineSupported() || !paragraph.chartTimeLineEnabled()')
+ .chart-settings-link
+ i.fa.fa-chevron-circle-down
+ a(ng-show='paragraph.chart' ng-click='$event.stopPropagation()' bs-popover data-template-url='chart-settings' data-placement='bottom' data-auto-close='1' data-trigger='click') Chart settings
+ div(ng-repeat='chart in paragraph.charts')
+ nvd3(options='chart.options' data='chart.data' api='chart.api')
+ .sql-empty-result(ng-show='!paragraph.timeLineSupported() && paragraph.chartTimeLineEnabled()') Pie chart does not supported 'TIME_LINE' column for X-axis
+ .sql-empty-result(ng-hide='paragraph.queryExecute()')
+ | Charts does not support 
+ b Explain
+ |  and 
+ b Scan
+ |  query
+ div(ng-show='paragraph.queryId && (paragraph.table() || paragraph.chart() && paragraph.queryExecute())')
hr(style='margin-top: 0; margin-bottom: 5px')
i.fa.fa-chevron-circle-right(style='float: right;margin-right: 10px;' ng-click='nextPage(paragraph)')
a(style='float: right; margin-bottom: 5px;margin-right: 5px;' ng-click='nextPage(paragraph)') Next