Repository: ignite Updated Branches: refs/heads/ignite-843 301b8b4c0 -> 812db6816
# IGNITE-843 Change active cache selection on sql Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e1e8f836 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e1e8f836 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e1e8f836 Branch: refs/heads/ignite-843 Commit: e1e8f836c6b74a4e6b9726011cd5dc6fde941600 Parents: d6cacf2 Author: Andrey <anovi...@gridgain.com> Authored: Wed Sep 23 14:43:54 2015 +0700 Committer: Andrey <anovi...@gridgain.com> Committed: Wed Sep 23 14:43:54 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/controllers/sql-controller.js | 20 +++++++++++-------- .../src/main/js/public/stylesheets/style.scss | 9 +++++++-- .../src/main/js/views/sql/sql.jade | 21 ++++++++++---------- 3 files changed, 29 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/e1e8f836/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 7c57a9e..d6b56d1 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 @@ -253,9 +253,13 @@ controlCenterModule.controller('sqlController', $http.post('/agent/topology') .success(function (caches) { - _.sortBy(caches, 'name').map(function (cache) { - $scope.caches.push(cache); - }) + $scope.caches = _.sortBy(caches, 'name'); + + if ($scope.caches.length > 0) + _.forEach($scope.notebook.paragraphs, function (paragraph) { + if (!paragraph.cacheName || !_.find($scope.caches, {name: paragraph.cacheName})) + paragraph.cacheName = $scope.caches[0].name; + }); }) .error(function (err, status) { if (status == 503) @@ -349,7 +353,7 @@ controlCenterModule.controller('sqlController', $scope.execute = function (paragraph) { _saveNotebook(); - paragraph.queryArgs = { query: paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cache.name }; + paragraph.queryArgs = { query: paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName }; $http.post('/agent/query', paragraph.queryArgs) .success(function (res) { @@ -369,7 +373,7 @@ controlCenterModule.controller('sqlController', _cancelRefresh(paragraph); - $http.post('/agent/query', {query: 'EXPLAIN ' + paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cache.name}) + $http.post('/agent/query', {query: 'EXPLAIN ' + paragraph.query, pageSize: paragraph.pageSize, cacheName: paragraph.cacheName}) .success(_processQueryResult(paragraph)) .error(function (errMsg) { paragraph.errMsg = errMsg; @@ -381,7 +385,7 @@ controlCenterModule.controller('sqlController', _cancelRefresh(paragraph); - $http.post('/agent/scan', {pageSize: paragraph.pageSize, cacheName: paragraph.cache.name}) + $http.post('/agent/scan', {pageSize: paragraph.pageSize, cacheName: paragraph.cacheName}) .success(_processQueryResult(paragraph)) .error(function (errMsg) { paragraph.errMsg = errMsg; @@ -389,7 +393,7 @@ controlCenterModule.controller('sqlController', }; $scope.nextPage = function(item) { - $http.post('/agent/query/fetch', {queryId: item.queryId, pageSize: item.pageSize, cacheName: item.cache.name}) + $http.post('/agent/query/fetch', {queryId: item.queryId, pageSize: item.pageSize, cacheName: item.cacheName}) .success(function (res) { item.page++; @@ -446,7 +450,7 @@ controlCenterModule.controller('sqlController', }; $scope.exportAll = function(paragraph) { - $http.post('/agent/query/getAll', {query: paragraph.query, cacheName: paragraph.cache.name}) + $http.post('/agent/query/getAll', {query: paragraph.query, cacheName: paragraph.cacheName}) .success(function (item) { _export(paragraph.name + '-all.csv', item.meta, item.rows); }) http://git-wip-us.apache.org/repos/asf/ignite/blob/e1e8f836/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 f6daddb..9da3904 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 @@ -395,11 +395,11 @@ button, a.btn { margin-right: 0; } - .btn + .btn { + button.btn + .btn { margin-left: 0; } - > .btn-primary:not(.dropdown-toggle) { + > button.btn-primary:not(.dropdown-toggle) { border-right-color: black; } } @@ -623,6 +623,11 @@ button.form-control { font-weight: normal; } + input[type="radio"] { + margin-left: 1px; + margin-right: 5px; + } + tbody { border-left: 10px solid transparent; } http://git-wip-us.apache.org/repos/asf/ignite/blob/e1e8f836/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 74c4dd5..5763412 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 @@ -39,11 +39,11 @@ block container h1.col-sm-6(ng-hide='notebook.edit') label {{notebook.name}} .btn-group - +btn-toolbar('fa-pencil', 'notebook.edit = true;notebook.edit_name = notebook.name', 'Rename notebook') + +btn-toolbar('fa-pencil', 'notebook.edit = true;notebook.editName = notebook.name', 'Rename notebook') +btn-toolbar('fa-trash', 'removeNotebook()', 'Remove notebook') h1.col-sm-6(ng-show='notebook.edit') - input.sql-name-input(ng-model='notebook.edit_name' required on-enter='renameNotebook(notebook.edit_name)' on-escape='notebook.edit = false;') - i.tipLabel.fa.fa-floppy-o(ng-show='notebook.edit_name' ng-click='renameNotebook(notebook.edit_name)' bs-tooltip data-title='Save notebook name' data-trigger='hover') + input.sql-name-input(ng-model='notebook.editName' required on-enter='renameNotebook(notebook.editName)' on-escape='notebook.edit = false;') + i.tipLabel.fa.fa-floppy-o(ng-show='notebook.editName' ng-click='renameNotebook(notebook.editName)' bs-tooltip data-title='Save notebook name' data-trigger='hover') .pull-right +btn-toolbar('fa-plus', 'addParagraph()', 'Add new query') hr @@ -55,10 +55,10 @@ block container a {{paragraph.name}} .btn-group(ng-hide='notebook.paragraphs.length > 1') - +btn-toolbar('fa-pencil', 'paragraph.edit = true; paragraph.edit_name = paragraph.name; $event.stopPropagation();', 'Rename paragraph') + +btn-toolbar('fa-pencil', 'paragraph.edit = true; paragraph.editName = paragraph.name; $event.stopPropagation();', 'Rename paragraph') .btn-group(ng-show='notebook.paragraphs.length > 1' ng-click='$event.stopPropagation();') - +btn-toolbar('fa-pencil', 'paragraph.edit = true; paragraph.edit_name = paragraph.name;', 'Rename paragraph') + +btn-toolbar('fa-pencil', 'paragraph.edit = true; paragraph.editName = paragraph.name;', 'Rename paragraph') +btn-toolbar('fa-remove', 'removeParagraph(paragraph)', 'Remove paragraph') .pull-right @@ -69,8 +69,8 @@ block container +btn-toolbar-data('fa-line-chart', 'line', 'Show line chart.<br/>By default first column - X values, second column - Y values.<br/>In case of one column it will be treated as Y values.') +btn-toolbar-data('fa-area-chart', 'area', 'Show area chart.<br/>By default first column - X values, second column - Y values.<br/>In case of one column it will be treated as Y values.') div(ng-show='paragraph.edit') - input.sql-name-input(ng-model='paragraph.edit_name' required ng-click='$event.stopPropagation();' on-enter='renameParagraph(paragraph, paragraph.edit_name)' on-escape='paragraph.edit = false') - i.tipLabel.fa.fa-floppy-o(ng-show='paragraph.edit_name' ng-click='renameParagraph(paragraph, paragraph.edit_name); $event.stopPropagation();' bs-tooltip data-title='Save paragraph name' data-trigger='hover') + input.sql-name-input(ng-model='paragraph.editName' required ng-click='$event.stopPropagation();' on-enter='renameParagraph(paragraph, paragraph.editName)' on-escape='paragraph.edit = false') + i.tipLabel.fa.fa-floppy-o(ng-show='paragraph.editName' ng-click='renameParagraph(paragraph, paragraph.editName); $event.stopPropagation();' bs-tooltip data-title='Save paragraph name' data-trigger='hover') .panel-collapse(role='tabpanel' bs-collapse-target) .col-sm-12(ng-show='paragraph.editor') .col-xs-8.col-sm-9(style='border-right: 1px solid #eee') @@ -84,12 +84,11 @@ block container .input-tip input.form-control(type='text' st-search placeholder='Filter caches...') table.links - tbody.scrollable-y(style='max-height: 19em;display:block;') + tbody.scrollable-y(style='max-height: 19em;display:block;' ng-model='paragraph.cacheName' bs-radio-group) tr(ng-repeat='cache in displayedCaches track by cache.name') td(style='width: 100%') - a(ng-class='{active: cache.name == paragraph.cache.name}' ng-click='paragraph.cache = cache') {{$index + 1}}) {{cache.name}} - td(style='width: 15px') - i.fa.fa-info-circle(bs-popover data-template-url='cache-metadata', data-placement='left', data-trigger='click') + input.labelField(type='radio' value='{{cache.name}}') + a(bs-popover data-template-url='cache-metadata', data-placement='auto', data-trigger='click') {{cache.name}} .empty-caches(ng-show='displayedCaches.length == 0 && caches.length != 0') label Wrong caches filter .empty-caches(ng-show='caches.length == 0')