ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject ignite git commit: # GG-1223 Fixed table scrolling, remove last notebook.
Date Mon, 07 Sep 2015 05:36:39 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 3025ddcb7 -> 3706cc2e9


# GG-1223 Fixed table scrolling, remove last notebook.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3706cc2e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3706cc2e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3706cc2e

Branch: refs/heads/ignite-843
Commit: 3706cc2e9835b8081c67b55b4885b027a6c83954
Parents: 3025ddc
Author: Andrey <anovikov@gridgain.com>
Authored: Mon Sep 7 12:37:35 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon Sep 7 12:37:35 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/common-module.js    | 41 +++++++++++++
 .../src/main/js/controllers/sql-controller.js   | 15 +++--
 .../stylesheets/_bootstrap-variables.scss       |  2 +-
 .../src/main/js/public/stylesheets/style.scss   | 61 ++++++++++++++++++--
 .../src/main/js/views/sql/notebook-new.jade     |  2 +-
 .../src/main/js/views/sql/sql.jade              | 60 +++++++++----------
 .../src/main/js/views/templates/layout.jade     |  2 +
 7 files changed, 142 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index 99d902f..8ed1060 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -1379,6 +1379,40 @@ controlCenterModule.directive('onClickFocus', function ($focus) {
     };
 });
 
+// FloatThead wrapper for AngularJS.
+controlCenterModule.directive('floatThead', function ($timeout, $log) {
+    // Usage:
+    // Specify float-thead on any table element and optionally pass through a floatThead
options object to initialize the library.
+    // Optionally specify st-safe-src to have the directive watch any objects for changes
and call 'reflow' on floatThead.
+    // You can also manually trigger a reflow by triggering an event on the table element
called 'update', eg: jQuery('.table').trigger('update');
+    return {
+        require: '?stSafeSrc',
+        link: function (scope, element, attrs) {
+            jQuery(element).floatThead(scope.$eval(attrs.floatThead));
+
+            if (attrs.stSafeSrc) {
+                // Set $watch to do a deep watch on the ngModel (collection) by specifying
true as a 3rd parameter
+                scope.$watch(attrs.stSafeSrc, function () {
+                    jQuery(element).floatThead('reflow');
+                }, true);
+            } else {
+                $log.info('floatThead: stSafeSrc not provided!');
+            }
+
+            element.bind('update', function () {
+                $timeout(function() {
+                    jQuery(element).floatThead('reflow');
+                }, 0);
+            });
+
+            element.bind('$destroy', function() {
+                jQuery(element).floatThead('destroy');
+            });
+        },
+        restrict: 'A'
+    };
+});
+
 // Navigation bar controller.
 controlCenterModule.controller('activeLink', [
     '$scope', function ($scope) {
@@ -1520,6 +1554,13 @@ controlCenterModule.controller('notebooks', ['$scope', '$modal', '$window',
'$ht
         _notebookNewModal.$promise.then(_notebookNewModal.show);
     };
 
+    $scope.$root.cancelCreateNotebook = function() {
+        _notebookNewModal.hide();
+
+        if ($scope.$root.notebooks.length == 0)
+            $window.location = '/configuration/clusters';
+    };
+
     $scope.$root.createNewNotebook = function(name) {
         $http.post('/notebooks/new', {name: name})
             .success(function (id) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/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 18021d3..70fdd6e 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
@@ -41,6 +41,13 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
 
     $scope.exportDropdown = [{ 'text': 'Export all', 'click': 'exportAll(paragraph)'}];
 
+    $scope.floatTheadOptions = {
+        useAbsolutePositioning: true,
+        scrollContainer: function($table) {
+            return $table.closest(".sql-table-wrapper");
+        }
+    };
+
     $scope.aceInit = function (editor) {
         editor.setAutoScrollEditorIntoView(true);
         editor.$blockScrolling = Infinity;
@@ -348,7 +355,7 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
             });
     };
 
-    var _export = function(meta, rows) {
+    var _export = function(fileName, meta, rows) {
         var csvContent = "";
 
         if (meta) {
@@ -381,17 +388,17 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
             csvContent += '\n';
         });
 
-        $common.download('application/octet-stream;charset=utf-8', 'export.csv', escape(csvContent));
+        $common.download('application/octet-stream;charset=utf-8', fileName, escape(csvContent));
     };
 
     $scope.exportPage = function(paragraph) {
-        _export(paragraph.meta, paragraph.rows);
+        _export('export.csv', paragraph.meta, paragraph.rows);
     };
 
     $scope.exportAll = function(paragraph) {
         $http.post('/agent/query/getAll', {query: paragraph.query, cacheName: paragraph.cache.name})
             .success(function (item) {
-                _export(item.meta, item.rows);
+                _export('export-all.csv', item.meta, item.rows);
             })
             .error(function (errMsg) {
                 $common.showError(errMsg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/modules/control-center-web/src/main/js/public/stylesheets/_bootstrap-variables.scss
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/public/stylesheets/_bootstrap-variables.scss
b/modules/control-center-web/src/main/js/public/stylesheets/_bootstrap-variables.scss
index 6b87b70..05fb9cc 100644
--- a/modules/control-center-web/src/main/js/public/stylesheets/_bootstrap-variables.scss
+++ b/modules/control-center-web/src/main/js/public/stylesheets/_bootstrap-variables.scss
@@ -291,7 +291,7 @@ $dropdown-caret-color:           #000 !default;
 // Note: These variables are not generated into the Customizer.
 
 $zindex-navbar:            1000 !default;
-$zindex-dropdown:          1000 !default;
+$zindex-dropdown:          1002 !default;
 $zindex-popover:           1060 !default;
 $zindex-tooltip:           1070 !default;
 $zindex-navbar-fixed:      1030 !default;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/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 fb88969..df0633e 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
@@ -421,9 +421,58 @@ table tr:hover {
 }
 
 .theme-line .paragraphs {
+    [class*="col-"] {
+        padding-left: 0 !important;
+        padding-right: 0 !important;
+    }
+
     .panel-group .panel + .panel {
         margin-top: 30px;
     }
+
+    .sql-editor {
+        padding: 5px 0;
+
+        .ace_cursor {
+            opacity: 1;
+        }
+    }
+
+    .sql-table-total {
+        padding: 0 10px;
+
+        label, b {
+            display: inline-block;
+
+            padding-top: 5px;
+
+            height: 27px;
+        }
+
+        .btn-group {
+            margin-right: 0;
+        }
+
+        margin-bottom: 10px;
+    }
+
+    .sql-table-wrapper {
+        overflow: auto;
+        position: relative;
+
+        height: 300px;
+
+        padding: 0;
+    }
+
+    table thead {
+        background-color: white;
+    }
+
+    .sql-empty-result {
+        margin-bottom: 10px;
+        text-align: center;
+    }
 }
 
 .theme-line .panel-heading {
@@ -1146,12 +1195,6 @@ a {
     }
 }
 
-.sql-editor {
-    .ace_cursor {
-        opacity: 1;
-    }
-}
-
 .preview-highlight-1 {
     position: absolute;
     background-color: #f7faff;
@@ -1320,3 +1363,9 @@ a {
 button.dropdown-toggle {
     margin-right: 5px;
 }
+
+//table.floatThead-table {
+//    border-top: none;
+//    border-bottom: none;
+//    background-color: #FFF;
+//}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/sql/notebook-new.jade b/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
index de2e731..805e8d2 100644
--- a/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
+++ b/modules/control-center-web/src/main/js/views/sql/notebook-new.jade
@@ -27,5 +27,5 @@
                         .col-sm-9
                             input.form-control(id='create-notebook' type='text' ng-model='name'
required auto-focus)
             .modal-footer
-                button.btn.btn-default(id='copy-btn-cancel' type='button' ng-click='$hide()')
Cancel
+                button.btn.btn-default(id='copy-btn-cancel' type='button' ng-click='cancelCreateNotebook()')
Cancel
                 button.btn.btn-primary(id='copy-btn-confirm' type='button' ng-disabled='ui.inputForm.$invalid'
ng-click='createNewNotebook(name)') Create

http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/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 f65aed5..8091944 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
@@ -69,8 +69,7 @@ block container
                                     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')
                             .panel-collapse(role='tabpanel' bs-collapse-target)
-                                .panel-body(ng-show='paragraph.editor')
-                                    .row
+                                    .col-sm-12(ng-show='paragraph.editor')
                                         .col-xs-8.col-sm-9(style='border-right: 1px solid
#eee')
                                             .sql-editor(ui-ace='{onLoad: aceInit, theme:
"chrome", mode: "sql", require: ["ace/ext/language_tools"],' +
                                                 'advanced: {enableSnippets: false, enableBasicAutocompletion:
true, enableLiveAutocompletion: true}}'
@@ -84,32 +83,36 @@ block container
                                                         tr(ng-repeat='cache in caches track
by cache.name')
                                                             td.col-sm-6
                                                                 a(ng-class='{active: cache.name
== paragraph.cache.name}' ng-click='paragraph.cache = cache') {{$index + 1}}) {{::cache.name}},
{{::cache.mode}}
-                                    hr(style='margin: 0')
-                                    .settings-row
-                                        button.btn.btn-primary(ng-click='explain(paragraph)'
ng-disabled='!paragraph.query || !paragraph.cache') Explain
-                                        button.btn.btn-primary(ng-click='execute(paragraph)'
ng-disabled='!paragraph.query || !paragraph.cache') Execute
-                                        button.btn.btn-primary(ng-click='scan(paragraph)'
ng-disabled='!paragraph.cache') Scan
-                                        .pull-right
-                                            label Refresh rate:
-                                            button.btn.btn-default.fa.fa-clock-o.tipLabel(ng-class='{"btn-info":
paragraph.rate && paragraph.rate.ruined}' bs-popover data-template-url='rate' data-placement='top-right'
data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
-                                            label.tipLabel Page size:
-                                            button.btn.btn-default.base-control.tipLabel(ng-model='paragraph.pageSize'
bs-options='item for item in pageSizes' bs-select)
-                                .panel-body(ng-show='paragraph.rows && paragraph.result
=== "table" && paragraph.rows')
-                                    .row
-                                        lable Page #:&nbsp;
-                                        b {{paragraph.page}}&nbsp;&nbsp;&nbsp;
-                                        | Results:&nbsp;
-                                        b {{paragraph.rows.length + paragraph.total}}
-                                        button.btn.btn-primary.fieldButton(ng-click='nextPage(paragraph)'
ng-disabled='!paragraph.queryId') Next page
-                                        .btn-group.fieldButton
-                                            button.btn.btn-primary.fieldButton(ng-click='exportPage(paragraph)'
) Export
-                                            button.btn.dropdown-toggle.btn-primary(id='export-item-dropdown'
data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
-                                                span.caret
-                                    .table-responsive
-                                        table.table.table-condensed(st-table='displayedCollection'
st-safe-src='paragraph.rows')
+                                    .col-sm-12
+                                        hr(style='margin: 0')
+                                    .col-sm-12
+                                        .details-row
+                                            button.btn.btn-primary(ng-click='explain(paragraph)'
ng-disabled='!paragraph.query || !paragraph.cache') Explain
+                                            button.btn.btn-primary(ng-click='execute(paragraph)'
ng-disabled='!paragraph.query || !paragraph.cache') Execute
+                                            button.btn.btn-primary(ng-click='scan(paragraph)'
ng-disabled='!paragraph.cache') Scan
+                                            .pull-right
+                                                label Refresh rate:
+                                                button.btn.btn-default.fa.fa-clock-o.tipLabel(ng-class='{"btn-info":
paragraph.rate && paragraph.rate.ruined}' bs-popover data-template-url='rate' data-placement='top-right'
data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
+                                                label.tipLabel Page size:
+                                                button.btn.btn-default.base-control.tipLabel(ng-model='paragraph.pageSize'
bs-options='item for item in pageSizes' bs-select)
+                                div(ng-show='paragraph.rows && paragraph.result ===
"table"')
+                                    .col-sm-12
+                                        .sql-table-total
+                                            label Page #:&nbsp;
+                                            b {{paragraph.page}}&nbsp;&nbsp;&nbsp;
+                                            label Results:&nbsp;
+                                            b {{paragraph.rows.length + paragraph.total}}
+                                            .pull-right
+                                                button.btn.btn-primary(ng-click='nextPage(paragraph)'
ng-disabled='!paragraph.queryId') Next page
+                                                .btn-group
+                                                    button.btn.btn-primary.fieldButton(ng-click='exportPage(paragraph)'
) Export
+                                                    button.btn.btn-primary(id='export-item-dropdown'
data-toggle='dropdown' data-container='body' bs-dropdown='exportDropdown' data-placement='bottom-right')
+                                                        span.caret
+                                    .sql-table-wrapper
+                                        table.table.table-condensed(st-table='displayedCollection'
st-safe-src='paragraph.rows' float-thead='floatTheadOptions')
                                             thead
                                                 tr
-                                                    th(ng-repeat='col in paragraph.meta track
by $index' st-sort='getter' data-ng-bind='col.fieldName' bs-tooltip='columnToolTip(col)')
+                                                    th(ng-repeat='col in paragraph.meta track
by $index' data-ng-bind='col.fieldName' bs-tooltip='columnToolTip(col)')
                                             tbody
                                                 tr(ng-repeat='row in displayedCollection
track by $index')
                                                     td(ng-repeat='val in row track by $index')
{{ val }}
@@ -117,6 +120,5 @@ block container
                                     button.btn.btn-default.chart-btn.fa.fa-cog(bs-popover
data-template-url='chart-settings' data-placement='top-right' data-auto-close='1' data-trigger='click')
                                     div(id='chart-{{paragraph.id}}')
                                         svg
-                                .panel-body(ng-show='!paragraph.rows')
-                                    div(style='text-align: center;')
-                                        label Result set is empty.
+                                .sql-empty-result(ng-show='!paragraph.rows && paragraph.result
!= "none"')
+                                    label Result set is empty.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3706cc2e/modules/control-center-web/src/main/js/views/templates/layout.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/layout.jade b/modules/control-center-web/src/main/js/views/templates/layout.jade
index b2ef894..823b1a6 100644
--- a/modules/control-center-web/src/main/js/views/templates/layout.jade
+++ b/modules/control-center-web/src/main/js/views/templates/layout.jade
@@ -46,6 +46,8 @@ html(ng-app='ignite-web-control-center' ng-init='user = #{JSON.stringify(user)};
             script(src='//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js')
             script(src='//angular-ui.github.io/ui-ace/dist/ui-ace.min.js')
 
+            script(src='////cdnjs.cloudflare.com/ajax/libs/floatthead/1.2.13/jquery.floatThead.min.js')
+
             script(src='/common-module.js')
             script(src='/data-structures.js')
 


Mime
View raw message