Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D52FF182D4 for ; Thu, 23 Jul 2015 11:14:13 +0000 (UTC) Received: (qmail 35212 invoked by uid 500); 23 Jul 2015 11:14:10 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 35183 invoked by uid 500); 23 Jul 2015 11:14:10 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 35174 invoked by uid 99); 23 Jul 2015 11:14:10 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2015 11:14:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 4B74ED6F88 for ; Thu, 23 Jul 2015 11:14:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.574 X-Spam-Level: X-Spam-Status: No, score=0.574 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.227, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id UKEmZZmn_pCM for ; Thu, 23 Jul 2015 11:13:55 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 367C421357 for ; Thu, 23 Jul 2015 11:13:54 +0000 (UTC) Received: (qmail 29958 invoked by uid 99); 23 Jul 2015 11:13:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2015 11:13:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5E41FDFC8A; Thu, 23 Jul 2015 11:13:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anovikov@apache.org To: commits@ignite.incubator.apache.org Message-Id: <4c8eeab0f9b14e90a34b1214ee288afd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ignite git commit: #ignite-843 Backport sql from ignite-1121 Date: Thu, 23 Jul 2015 11:13:53 +0000 (UTC) Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 698d7792c -> 07d949994 #ignite-843 Backport sql from ignite-1121 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/07d94999 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/07d94999 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/07d94999 Branch: refs/heads/ignite-843 Commit: 07d9499941d78856397c75ebce28fbb7a48935f4 Parents: 698d779 Author: Andrey Authored: Thu Jul 23 18:14:56 2015 +0700 Committer: Andrey Committed: Thu Jul 23 18:14:56 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/models/sql.json | 5 ++ .../src/main/js/controllers/sql-controller.js | 84 ++++++++++++++++++++ .../src/main/js/views/sql/sql.jade | 84 ++++++++++++++++++++ .../src/main/js/views/templates/tab.jade | 26 ++++++ 4 files changed, 199 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07d94999/modules/web-control-center/src/main/js/controllers/models/sql.json ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/controllers/models/sql.json b/modules/web-control-center/src/main/js/controllers/models/sql.json new file mode 100644 index 0000000..bcb03e0 --- /dev/null +++ b/modules/web-control-center/src/main/js/controllers/models/sql.json @@ -0,0 +1,5 @@ +{ + "screenTip": [ + "Select cache and execute SQL queries." + ] +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07d94999/modules/web-control-center/src/main/js/controllers/sql-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/controllers/sql-controller.js b/modules/web-control-center/src/main/js/controllers/sql-controller.js new file mode 100644 index 0000000..12772c6 --- /dev/null +++ b/modules/web-control-center/src/main/js/controllers/sql-controller.js @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var demoResults = [ + { + id: 256, + firstName: 'Ivan', + lastName: 'Ivanov' + }, + { + id: 384, + firstName: 'Sergey', + lastName: 'Petrov' + }, + { + id: 923, + firstName: 'Andrey', + lastName: 'Sidorov' + } +]; + +var demoCaches = [{_id: '1', name: 'Users', mode: 'LOCAL'}, {_id: '2', name: 'Organizations', mode: 'REPLICATED'}, {_id: '3', name: 'Cities', mode: 'PARTITIONED'}]; + + + +controlCenterModule.controller('sqlController', ['$scope', '$http', '$common', function ($scope, $http, $common) { + $scope.joinTip = $common.joinTip; + + $scope.pageSizes = [50, 100, 200, 400, 800, 1000]; + + $scope.tabs = [ + { + query: "SELECT u.id, u.firstName, u.lastName FROM User u WHERE u.name LIKE 'aaaa'", + cols: Object.keys(demoResults[0]), + page: 1, + hasMore: true, + total: 0, + rows: demoResults + }, + {query: "SELECT * FROM Organization"} + ]; + + $scope.addTab = function() { + console.log('addTab'); + + $scope.tabs.push({query: "SELECT "}); + }; + + $scope.removeTab = function(idx) { + console.log('removeTab'); + + $scope.tabs.splice(idx, 1); + }; + + $scope.modes = [ + {value: 'PARTITIONED', label: 'PARTITIONED'}, + {value: 'REPLICATED', label: 'REPLICATED'}, + {value: 'LOCAL', label: 'LOCAL'} + ]; + + $http.get('/models/sql.json') + .success(function (data) { + $scope.screenTip = data.screenTip; + }) + .error(function (errMsg) { + $common.showError(errMsg); + }); + + $scope.caches = demoCaches; +}]); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07d94999/modules/web-control-center/src/main/js/views/sql/sql.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/views/sql/sql.jade b/modules/web-control-center/src/main/js/views/sql/sql.jade new file mode 100644 index 0000000..6957be1 --- /dev/null +++ b/modules/web-control-center/src/main/js/views/sql/sql.jade @@ -0,0 +1,84 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +extends ../templates/layout + +append scripts + script(src='/sql-controller.js') + + script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/theme-chrome.js') + script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/mode-sql.js') + script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ext-language_tools.js') + +block container + .row + .col-sm-12 + .docs-content + .docs-header + h1 Connect to Ignite and Execute SQL Queries + hr + .docs-body(ng-controller='sqlController') + - var tab = 'tabs[tabs.activeIdx]' + + .block-callout-parent.block-callout-border.margin-bottom-dflt + .block-callout + p(ng-bind-html='joinTip(screenTip)') + .tabs-below(bs-tabs bs-active-pane='tabs.activeIdx' data-template='/tab') + div(ng-repeat='tab in tabs' title='Query' bs-pane) + .row + .col-sm-9(style='border-right: 1px solid #eee') + div(style='height: 200px' ui-ace='{ theme: "chrome", mode: "sql",' + + 'require: ["ace/ext/language_tools"],' + + 'rendererOptions: {showPrintMargin: false, highlightGutterLine: false, fontSize: 14},' + + 'advanced: {enableSnippets: false, enableBasicAutocompletion: true, enableLiveAutocompletion: true}}' ng-model='#{tab}.query') + .col-sm-3 + .links(ng-hide='caches.length == 0' style='margin-top: 0.65em') + lable.labelHeader Caches: + table(st-table='caches') + tbody + tr(ng-repeat='row in caches track by row._id') + td.col-sm-6(ng-class='{active: row._id == #{tab}.selectedItem._id}') + a(ng-click='#{tab}.selectedItem = row') {{$index + 1}}) {{row.name}}, {{row.mode | displayValue:modes:'Cache mode not set'}} + hr(style='margin: 0') + .settings-row + label Page Size:  + button.btn.btn-default.base-control(ng-init='pageSize = pageSizes[0]' ng-model='pageSize' bs-options='item for item in pageSizes' bs-select) + .settings-row + button.btn.btn-primary(ng-click='') Explain + button.btn.btn-primary(ng-click='') Execute + button.btn.btn-primary(ng-click='' disabled) Scan + + div(ng-show='#{tab}.rows.length > 0' style='margin-top: 0.65em') + hr + div + table.table.table-striped.col-sm-12.sql-results(st-table='rows' st-safe-src='#{tab}.rows') + thead + tr(style='border-size: 0') + td(colspan='{{#{tab}.cols.length}}') + .col-sm-8 + lable Page results:  + b {{#{tab}.rows.length}}    + | Page #:  + b {{#{tab}.page}}    + | Total results:  + b {{#{tab}.rows.length + #{tab}.total}} + .col-sm-4 + button.btn.btn-primary.fieldButton(ng-click='') Next page + .input-tip + input.form-control(type='text' st-search='' placeholder='Filter...') + + tr + th(ng-repeat='column in #{tab}.cols' st-sort='{{column}}') {{column}} + tbody + tr(ng-repeat='row in rows') + td(ng-repeat="column in #{tab}.cols") {{row[column]}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07d94999/modules/web-control-center/src/main/js/views/templates/tab.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/src/main/js/views/templates/tab.jade b/modules/web-control-center/src/main/js/views/templates/tab.jade new file mode 100644 index 0000000..518c870 --- /dev/null +++ b/modules/web-control-center/src/main/js/views/templates/tab.jade @@ -0,0 +1,26 @@ +//- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +ul.nav(ng-class='$navClass', role='tablist') + li(role='presentation', ng-repeat='$pane in $panes track by $index', ng-class="[ $isActive($pane, $index) ? $activeClass : '', $pane.disabled ? 'disabled' : '' ]") + a(ng-if='$index == 0' role='tab', data-toggle='tab', ng-click='!$pane.disabled && $setActive($pane.name || $index)', data-index='{{ $index }}', aria-controls='$pane.title') {{$pane.title}} + i.fa.fa-remove(ng-click='removeTab($index)' ng-if='$index > 0' style='margin-left: 5px') + a(ng-if='$index > 0' role='tab', data-toggle='tab', ng-click='!$pane.disabled && $setActive($pane.name || $index)', data-index='{{ $index }}', aria-controls='$pane.title') {{$pane.title}}: {{$index}} + i.fa.fa-remove(ng-click='removeTab($index)' style='margin-left: 5px') + li.pull-right(bs-tooltip data-title='Add new query') + a(role='tab', data-toggle='tab' ng-click='addTab()') + i.fa.fa-plus +.tab-content(ng-transclude)