Repository: ignite Updated Branches: refs/heads/master b3f912ffe -> 9d61a42e4
IGNITE-8235 Web Console: Implement execution of selected part of SQL query. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9d61a42e Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d61a42e Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d61a42e Branch: refs/heads/master Commit: 9d61a42e4e468d6e622e39369fc852af4fa36ee7 Parents: b3f912f Author: Alexander Kalinin <[email protected]> Authored: Thu Apr 26 15:37:07 2018 +0700 Committer: Alexey Kuznetsov <[email protected]> Committed: Thu Apr 26 15:37:07 2018 +0700 ---------------------------------------------------------------------- .../components/queries-notebook/controller.js | 13 ++++++++----- .../components/queries-notebook/template.tpl.pug | 2 +- .../frontend/app/modules/ace.module.js | 18 ++++++++++++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/9d61a42e/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js index fa7460f..859d1f7 100644 --- a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js +++ b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/controller.js @@ -1477,8 +1477,9 @@ export class NotebookCtrl { $scope.queryAvailable(paragraph) && _chooseNode(paragraph.cacheName, local) .then((nid) => { - Notebook.save($scope.notebook) - .catch(Messages.showError); + // If we are executing only selected part of query then Notebook shouldn't be saved. + if (!paragraph.partialQuery) + Notebook.save($scope.notebook).catch(Messages.showError); paragraph.localQueryMode = local; paragraph.prevQuery = paragraph.queryArgs ? paragraph.queryArgs.query : paragraph.query; @@ -1487,10 +1488,12 @@ export class NotebookCtrl { return _closeOldQuery(paragraph) .then(() => { + const query = paragraph.partialQuery || paragraph.query; + const args = paragraph.queryArgs = { type: 'QUERY', cacheName: $scope.cacheNameForSql(paragraph), - query: paragraph.query, + query, pageSize: paragraph.pageSize, maxPages: paragraph.maxPages, nonCollocatedJoins, @@ -1499,10 +1502,10 @@ export class NotebookCtrl { lazy }; - const qry = args.maxPages ? addLimit(args.query, args.pageSize * args.maxPages) : paragraph.query; - ActivitiesData.post({ action: '/queries/execute' }); + const qry = args.maxPages ? addLimit(args.query, args.pageSize * args.maxPages) : query; + return agentMgr.querySql(nid, args.cacheName, qry, nonCollocatedJoins, enforceJoinOrder, false, local, args.pageSize, lazy); }) .then((res) => { http://git-wip-us.apache.org/repos/asf/ignite/blob/9d61a42e/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug index a163125..96c704d 100644 --- a/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug +++ b/modules/web-console/frontend/app/components/page-queries/components/queries-notebook/template.tpl.pug @@ -309,7 +309,7 @@ mixin paragraph-query .col-xs-8.col-sm-9(style='border-right: 1px solid #eee') .sql-editor(ignite-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-model='paragraph.query' on-selection-change='paragraph.partialQuery = $event') .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: http://git-wip-us.apache.org/repos/asf/ignite/blob/9d61a42e/modules/web-console/frontend/app/modules/ace.module.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/ace.module.js b/modules/web-console/frontend/app/modules/ace.module.js index 6a6e70a..44e51ca 100644 --- a/modules/web-console/frontend/app/modules/ace.module.js +++ b/modules/web-console/frontend/app/modules/ace.module.js @@ -134,8 +134,12 @@ angular return { restrict: 'EA', - require: ['?ngModel', '?^form'], - link: (scope, elm, attrs, [ngModel, form]) => { + require: ['?ngModel', '?^form', 'igniteAce'], + bindToController: { + onSelectionChange: '&?' + }, + controller() {}, + link: (scope, elm, attrs, [ngModel, form, igniteAce]) => { /** * Corresponds the igniteAceConfig ACE configuration. * @@ -165,6 +169,8 @@ angular */ const session = acee.getSession(); + const selection = session.getSelection(); + /** * Reference to a change listener created by the listener factory. * @@ -223,6 +229,14 @@ angular ngModel.$render = () => session.setValue(ngModel.$viewValue); acee.on('change', () => ngModel.$setViewValue(acee.getValue())); + + selection.on('changeSelection', () => { + if (igniteAce.onSelectionChange) { + const aceSelection = selection.isEmpty() ? null : acee.session.getTextRange(acee.getSelectionRange()); + + igniteAce.onSelectionChange({$event: aceSelection}); + } + }); } // Listen for option updates.
