Repository: ignite Updated Branches: refs/heads/ignite-2.3 9358a8853 -> c4acf5441
IGNITE-6287 Web Console: Improved DDL support: added checkbox "Use selected cache as default schema name". (cherry picked from commit a45677c) Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c4acf544 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c4acf544 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c4acf544 Branch: refs/heads/ignite-2.3 Commit: c4acf54413a0e8cb9cedcb7201084f29ee554ee7 Parents: 9358a88 Author: Vasiliy Sisko <vsi...@gridgain.com> Authored: Mon Oct 9 19:23:23 2017 +0700 Committer: Alexey Kuznetsov <akuznet...@apache.org> Committed: Mon Oct 9 19:27:02 2017 +0700 ---------------------------------------------------------------------- .../ignite/internal/visor/query/VisorQueryTask.java | 15 +-------------- modules/web-console/backend/app/mongo.js | 1 + .../frontend/app/modules/sql/sql.controller.js | 14 +++++++++++++- .../frontend/public/stylesheets/style.scss | 8 ++++++++ modules/web-console/frontend/views/sql/sql.tpl.pug | 10 ++++++++++ 5 files changed, 33 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c4acf544/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java index a3668c8..933bacc 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java @@ -99,20 +99,7 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTaskArg, VisorEit if (c == null) throw new SQLException("Fail to execute query. Cache not found: " + cacheName); - try { - qryCursor = c.withKeepBinary().query(qry); - } - catch (CacheException e) { - // Work around for DDL without explicit schema name. - if (X.hasCause(e, IgniteSQLException.class) - && e.getMessage().contains("can only be executed on PUBLIC schema")) { - qry.setSchema("PUBLIC"); - - qryCursor = c.withKeepBinary().query(qry); - } - else - throw e; - } + qryCursor = c.withKeepBinary().query(qry); } VisorQueryCursor<List<?>> cur = new VisorQueryCursor<>(qryCursor); http://git-wip-us.apache.org/repos/asf/ignite/blob/c4acf544/modules/web-console/backend/app/mongo.js ---------------------------------------------------------------------- diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js index ecc833f..a07f979 100644 --- a/modules/web-console/backend/app/mongo.js +++ b/modules/web-console/backend/app/mongo.js @@ -1036,6 +1036,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose maxPages: Number, hideSystemColumns: Boolean, cacheName: String, + useAsDefaultSchema: Boolean, chartsOptions: {barChart: {stacked: Boolean}, areaChart: {style: String}}, rate: { value: Number, http://git-wip-us.apache.org/repos/asf/ignite/blob/c4acf544/modules/web-console/frontend/app/modules/sql/sql.controller.js ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js index 8011b0f..a3fc0ca 100644 --- a/modules/web-console/frontend/app/modules/sql/sql.controller.js +++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js @@ -32,6 +32,8 @@ const ENFORCE_JOIN_SINCE = [['1.7.9', '1.8.0'], ['1.8.4', '1.9.0'], '1.9.1']; const LAZY_QUERY_SINCE = [['2.1.4-p1', '2.2.0'], '2.2.1']; +const DDL_SINCE = [['2.1.6', '2.2.0'], '2.3.0']; + const _fullColName = (col) => { const res = []; @@ -56,6 +58,7 @@ class Paragraph { self.qryType = paragraph.qryType || 'query'; self.maxPages = 0; self.filter = ''; + self.useAsDefaultSchema = false; _.assign(this, paragraph); @@ -1381,6 +1384,15 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', return false; }; + $scope.ddlAvailable = (paragraph) => { + const cache = _.find($scope.caches, {name: paragraph.cacheName}); + + if (cache) + return !!_.find(cache.nodes, (node) => Version.since(node.version, ...DDL_SINCE)); + + return false; + }; + $scope.execute = (paragraph, local = false) => { const nonCollocatedJoins = !!paragraph.nonCollocatedJoins; const enforceJoinOrder = !!paragraph.enforceJoinOrder; @@ -1399,7 +1411,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', .then(() => { const args = paragraph.queryArgs = { type: 'QUERY', - cacheName: paragraph.cacheName, + cacheName: ($scope.ddlAvailable(paragraph) && !paragraph.useAsDefaultSchema) ? null : paragraph.cacheName, query: paragraph.query, pageSize: paragraph.pageSize, maxPages: paragraph.maxPages, http://git-wip-us.apache.org/repos/asf/ignite/blob/c4acf544/modules/web-console/frontend/public/stylesheets/style.scss ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss index eeb3a55..b259f1d 100644 --- a/modules/web-console/frontend/public/stylesheets/style.scss +++ b/modules/web-console/frontend/public/stylesheets/style.scss @@ -304,6 +304,14 @@ body > .wrapper > ui-view { } } +.use-cache { + display: flex; + + input[type="checkbox"] { + width: 20px; + } +} + .group-section { margin-top: 20px; } http://git-wip-us.apache.org/repos/asf/ignite/blob/c4acf544/modules/web-console/frontend/views/sql/sql.tpl.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug index 724c53c..7ee966d 100644 --- a/modules/web-console/frontend/views/sql/sql.tpl.pug +++ b/modules/web-console/frontend/views/sql/sql.tpl.pug @@ -240,6 +240,16 @@ mixin paragraph-query td(style='width: 100%') input.labelField(id='cache_{{ [paragraph.id, $index].join("_") }}' type='radio' value='{{cache.name}}' ng-model='paragraph.cacheName') label(for='cache_{{ [paragraph.id, $index].join("_") }} ' ng-bind-html='cache.label') + .settings-row + .row(ng-if='ddlAvailable(paragraph)') + label.tipLabel.use-cache(bs-tooltip data-placement='bottom' + data-title= + 'Use selected cache as default schema name.<br/>\ + This will allow to execute query on specified cache without specify schema name.<br/>\ + <b>NOTE:</b> In future version of Ignite this feature will be removed.' + data-trigger='hover') + input(type='checkbox' ng-model='paragraph.useAsDefaultSchema') + span Use selected cache as default schema name .empty-caches(ng-show='displayedCaches.length == 0 && caches.length != 0') label Wrong caches filter .empty-caches(ng-show='caches.length == 0')