# IGNITE-843 Sql console: initial commit.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/43e51ed7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/43e51ed7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/43e51ed7 Branch: refs/heads/ignite-843 Commit: 43e51ed70c36e416c5b6824f6d7b2c65d17e2d1a Parents: f53eaef Author: sevdokimov <sergey.evdoki...@jetbrains.com> Authored: Thu Jul 9 19:43:59 2015 +0300 Committer: sevdokimov <sergey.evdoki...@jetbrains.com> Committed: Thu Jul 9 19:49:04 2015 +0300 ---------------------------------------------------------------------- modules/web-control-center/nodejs/app.js | 2 + .../controllers/cache-viewer-controller.js | 36 +++++++++++++ .../nodejs/public/stylesheets/sql-console.css | 31 +++++++++++ modules/web-control-center/nodejs/routes/sql.js | 26 +++++++++ .../nodejs/views/includes/header.jade | 6 +-- .../nodejs/views/sql/sql.jade | 43 +++++++++++++++ .../nodejs/views/templates/headers.jade | 55 ++++++++++++++++++++ .../nodejs/views/templates/layout-fluid.jade | 22 ++++++++ .../nodejs/views/templates/layout.jade | 45 ++-------------- 9 files changed, 223 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/app.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/app.js b/modules/web-control-center/nodejs/app.js index 0086d10..a3efe2f 100644 --- a/modules/web-control-center/nodejs/app.js +++ b/modules/web-control-center/nodejs/app.js @@ -32,6 +32,7 @@ var persistencesRouter = require('./routes/persistences'); var summary = require('./routes/summary'); var adminRouter = require('./routes/admin'); var profileRouter = require('./routes/profile'); +var sqlRouter = require('./routes/sql'); var uiUtils = require('./helpers/ui-utils'); @@ -132,6 +133,7 @@ app.use('/configuration/clusters', clustersRouter); app.use('/configuration/caches', cachesRouter); app.use('/configuration/persistences', persistencesRouter); app.use('/configuration/summary', summary); +app.use('/sql', sqlRouter); // Catch 404 and forward to error handler. app.use(function (req, res, next) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js b/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js new file mode 100644 index 0000000..4bac759 --- /dev/null +++ b/modules/web-control-center/nodejs/controllers/cache-viewer-controller.js @@ -0,0 +1,36 @@ +/* + * 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. + */ + +controlCenterModule.controller('cacheViewerController', ['$scope', '$alert', '$http', 'commonFunctions', function ($scope, $alert, $http, commonFunctions) { + + + var sqlEditor = ace.edit('querySql'); + + sqlEditor.setOptions({ + highlightActiveLine: false, + showPrintMargin: false, + showGutter: true, + theme: "ace/theme/chrome", + mode: "ace/mode/sql", + fontSize: 14 + }); + + sqlEditor.setValue("select u.id from User u where u.name like 'aaaa';"); + + sqlEditor.selection.clearSelection() + +}]); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/public/stylesheets/sql-console.css ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/public/stylesheets/sql-console.css b/modules/web-control-center/nodejs/public/stylesheets/sql-console.css new file mode 100644 index 0000000..a81c31f --- /dev/null +++ b/modules/web-control-center/nodejs/public/stylesheets/sql-console.css @@ -0,0 +1,31 @@ +#queryTable { + width: 100%; +} + +#queryTable tr { + cursor: default; +} + +#queryTable tr { + vertical-align: top; +} + +#querySql { + height: 150px; + + border: 1px solid #aaa; +} + +#querySqlContainer { + margin: 0 10px; +} + +#queryResult { + width: 100%; + + margin-top: 10px; + + padding: 5px; + + +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/routes/sql.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/routes/sql.js b/modules/web-control-center/nodejs/routes/sql.js new file mode 100644 index 0000000..ea3465c --- /dev/null +++ b/modules/web-control-center/nodejs/routes/sql.js @@ -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. + */ + +var router = require('express').Router(); +var db = require('../db'); +var uiUtils = require('../helpers/ui-utils'); + +router.get('/', function(req, res) { + res.render('sql/sql'); +}); + +module.exports = router; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/views/includes/header.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/views/includes/header.jade b/modules/web-control-center/nodejs/views/includes/header.jade index 1be7acc..2cd5811 100644 --- a/modules/web-control-center/nodejs/views/includes/header.jade +++ b/modules/web-control-center/nodejs/views/includes/header.jade @@ -24,8 +24,8 @@ header.header(id='header') a(ng-class="{active: isActive('/configuration')}" href='/configuration/clusters') Configuration li(ng-if='loggedInUser && loggedInUser.admin') a(ng-class="{active: isActive('/admin')}" href='/admin') Administration - //li - // a(ng-class="{active: isActive('/sql')}" href='/sql') SQL + li + a(ng-class="{active: isActive('/sql')}" href='/sql') SQL ul.nav.navbar-nav.pull-right li(ng-show='loggedInUser') a.dropdown-toggle(data-toggle='dropdown' aria-expanded='true' bs-dropdown data-template='user-dropdown' data-placement='bottom-right') {{loggedInUser.username}} @@ -42,4 +42,4 @@ header.header(id='header') div(class='viewedUser' ng-show='viewedUser') You're working as strong {{viewedUser.username}} a(href='/admin/become') - span(class="glyphicon glyphicon-remove" title='Unlogin') \ No newline at end of file + span(class="glyphicon glyphicon-remove" title='Unlogin') http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/views/sql/sql.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/views/sql/sql.jade b/modules/web-control-center/nodejs/views/sql/sql.jade new file mode 100644 index 0000000..134eb10 --- /dev/null +++ b/modules/web-control-center/nodejs/views/sql/sql.jade @@ -0,0 +1,43 @@ + +//- + 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-fluid + +append scripts + script(src='/cache-viewer-controller.js') + script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace.js') + +append css + link(rel='stylesheet', href='/stylesheets/sql-console.css') + +block container + div(ng-controller='cacheViewerController') + h3 Sql console + + table#queryTable(cellpadding=0, cellspacing=0, ng-init='queryType = "sql"') + tr + td + | Query type: + + + td(width='99%') + #querySqlContainer + #querySql + + + td + | Default cache + + #queryResult + | Some result http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/views/templates/headers.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/views/templates/headers.jade b/modules/web-control-center/nodejs/views/templates/headers.jade new file mode 100644 index 0000000..c70f9d1 --- /dev/null +++ b/modules/web-control-center/nodejs/views/templates/headers.jade @@ -0,0 +1,55 @@ +//- + 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. + +doctype html +html(ng-app='ignite-web-control-center', ng-init='loggedInUser = #{JSON.stringify(filterUser(user))}; viewedUser = #{JSON.stringify(viewedUser)}') + head + title= title + + block css + // Bootstrap + link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css') + + // Font Awesome Icons + link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css') + + // Font + link(rel='stylesheet', href='//fonts.googleapis.com/css?family=Roboto+Slab:700:serif|Roboto+Slab:400:serif') + + link(rel='stylesheet', href='/stylesheets/style.css') + + block scripts + script(src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js') + + script(src='//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js') + + script(src='//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js') + script(src='//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-sanitize.js') + script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.2.2/angular-strap.js') + script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.2.2/angular-strap.tpl.min.js') + + script(src='https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.0.3/smart-table.js') + + script(src='/common-module.js') + script(src='/data-structures.js') + + body.theme-line.body-overlap + .wrapper + include ../includes/header + + block main-container + + include ../includes/footer http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/views/templates/layout-fluid.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/views/templates/layout-fluid.jade b/modules/web-control-center/nodejs/views/templates/layout-fluid.jade new file mode 100644 index 0000000..66670cb --- /dev/null +++ b/modules/web-control-center/nodejs/views/templates/layout-fluid.jade @@ -0,0 +1,22 @@ +//- + 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 headers + +block main-container + .container-fluid.body-container + .main-content + block container http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/43e51ed7/modules/web-control-center/nodejs/views/templates/layout.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/views/templates/layout.jade b/modules/web-control-center/nodejs/views/templates/layout.jade index 6ce3c46..17f8da1 100644 --- a/modules/web-control-center/nodejs/views/templates/layout.jade +++ b/modules/web-control-center/nodejs/views/templates/layout.jade @@ -14,44 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. -doctype html -html(ng-app='ignite-web-control-center', ng-init='loggedInUser = #{JSON.stringify(filterUser(user))}; viewedUser = #{JSON.stringify(viewedUser)}') - head - title= title +extends headers - block css - // Bootstrap - link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css') - - // Font Awesome Icons - link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css') - - // Font - link(rel='stylesheet', href='//fonts.googleapis.com/css?family=Roboto+Slab:700:serif|Roboto+Slab:400:serif') - - link(rel='stylesheet', href='/stylesheets/style.css') - - block scripts - script(src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js') - - script(src='//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js') - - script(src='//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js') - script(src='//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-sanitize.js') - script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.2.2/angular-strap.js') - script(src='//cdnjs.cloudflare.com/ajax/libs/angular-strap/2.2.2/angular-strap.tpl.min.js') - - script(src='https://cdnjs.cloudflare.com/ajax/libs/angular-smart-table/2.0.3/smart-table.js') - - script(src='/common-module.js') - script(src='/data-structures.js') - - body.theme-line.body-overlap - .wrapper - include ../includes/header - - .container.body-container - .main-content - block container - - include ../includes/footer +block main-container + .container.body-container + .main-content + block container