You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by an...@apache.org on 2015/09/03 12:13:04 UTC

ignite git commit: # IGNITE-843 Fixed notes.

Repository: ignite
Updated Branches:
  refs/heads/ignite-843 4b1ff6932 -> 5ec92e820


# IGNITE-843 Fixed notes.


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

Branch: refs/heads/ignite-843
Commit: 5ec92e8202b8f7ec5edeaeb43779706fe0477fb0
Parents: 4b1ff69
Author: Andrey <an...@gridgain.com>
Authored: Thu Sep 3 17:13:41 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Thu Sep 3 17:13:41 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/sql-controller.js   | 80 ++++++++++++--------
 .../src/main/js/public/stylesheets/style.scss   |  6 ++
 .../src/main/js/views/sql/sql.jade              | 20 +++--
 3 files changed, 65 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5ec92e82/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 7325a36..7b3335b 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
@@ -16,8 +16,8 @@
  */
 
 // Controller for SQL notebook screen.
-controlCenterModule.controller('sqlController', ['$scope', '$window','$controller', '$http', '$common',
-    function ($scope, $window, $controller, $http, $common) {
+controlCenterModule.controller('sqlController', ['$scope', '$window','$controller', '$http', '$common', '$confirm',
+    function ($scope, $window, $controller, $http, $common, $confirm) {
     // Initialize the super class and extend it.
     angular.extend(this, $controller('agent-download', {$scope: $scope}));
     $scope.agentGoal = 'execute sql statements';
@@ -39,6 +39,18 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
         {value: 'h', label: 'hours'}
     ];
 
+    $scope.aceInit = function (editor) {
+        editor.$blockScrolling = Infinity;
+
+        var renderer = editor.renderer;
+
+        renderer.setHighlightGutterLine(false);
+        renderer.setShowPrintMargin(false);
+        renderer.setOption('fontSize', '14px');
+
+        editor.setTheme('ace/theme/chrome');
+    };
+
     var loadNotebook = function () {
         $http.post('/notebooks/get', {noteId: $scope.noteId})
             .success(function (notebook) {
@@ -98,25 +110,29 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
     };
 
     $scope.removeNotebook = function () {
-        $http.post('/notebooks/remove', {_id: $scope.notebook._id})
-            .success(function () {
-                var idx = _.findIndex($scope.$root.notebooks, function (item) {
-                    return item._id == $scope.notebook._id;
-                });
-
-                if (idx >= 0) {
-                    $scope.$root.notebooks.splice(idx, 1);
-
-                    if ($scope.$root.notebooks.length > 0)
-                        $window.location = "/sql/" +
-                            $scope.$root.notebooks[Math.min(idx,  $scope.$root.notebooks.length - 1)]._id;
-                    else
-                        $scope.inputNotebookName();
-                }
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
+        $confirm.show('Are you sure you want to remove notebook: "' + $scope.notebook.name + '"?').then(
+            function () {
+                $http.post('/notebooks/remove', {_id: $scope.notebook._id})
+                    .success(function () {
+                        var idx = _.findIndex($scope.$root.notebooks, function (item) {
+                            return item._id == $scope.notebook._id;
+                        });
+
+                        if (idx >= 0) {
+                            $scope.$root.notebooks.splice(idx, 1);
+
+                            if ($scope.$root.notebooks.length > 0)
+                                $window.location = "/sql/" +
+                                    $scope.$root.notebooks[Math.min(idx,  $scope.$root.notebooks.length - 1)]._id;
+                            else
+                                $scope.inputNotebookName();
+                        }
+                    })
+                    .error(function (errMsg) {
+                        $common.showError(errMsg);
+                    });
+            }
+        );
     };
 
     $scope.renameParagraph = function (paragraph, newName) {
@@ -189,18 +205,22 @@ controlCenterModule.controller('sqlController', ['$scope', '$window','$controlle
     };
 
     $scope.removeParagraph = function(paragraph) {
-        var paragraph_idx = _.findIndex($scope.notebook.paragraphs, function (item) {
-            return paragraph == item;
-        });
+        $confirm.show('Are you sure you want to remove paragraph: "' + paragraph.name + '"?').then(
+            function () {
+                var paragraph_idx = _.findIndex($scope.notebook.paragraphs, function (item) {
+                    return paragraph == item;
+                });
 
-        var panel_idx = _.findIndex($scope.notebook.expandedParagraphs, function (item) {
-            return paragraph_idx == item;
-        });
+                var panel_idx = _.findIndex($scope.notebook.expandedParagraphs, function (item) {
+                    return paragraph_idx == item;
+                });
 
-        if (panel_idx >= 0)
-            $scope.notebook.expandedParagraphs.splice(panel_idx, 1);
+                if (panel_idx >= 0)
+                    $scope.notebook.expandedParagraphs.splice(panel_idx, 1);
 
-        $scope.notebook.paragraphs.splice(paragraph_idx, 1);
+                $scope.notebook.paragraphs.splice(paragraph_idx, 1);
+            }
+        );
     };
 
     $http.get('/models/sql.json')

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ec92e82/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 f43acf4..3bf8d22 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
@@ -420,6 +420,12 @@ table tr:hover {
     }
 }
 
+.theme-line .paragraphs {
+    .panel-group .panel + .panel {
+        margin-top: 30px;
+    }
+}
+
 .theme-line .panel-heading {
     padding: 5px 10px;
     margin: 0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/5ec92e82/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 cf4e91a..ac708ff 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
@@ -36,15 +36,13 @@ block container
                         label {{notebook.name}}
                         .btn-group
                             i.btn.btn-default.fa.fa-pencil(ng-click='notebook.edit = true;notebook.edit_name = notebook.name' bs-tooltip data-title='Rename notebook' data-trigger='hover')
-                            i.btn.btn-default.fa.fa-floppy-o(ng-click='saveNotebook()' bs-tooltip data-title='Save notebook' data-trigger='hover')
-                            i.btn.btn-default.fa.fa-remove(ng-click='removeNotebook()' bs-tooltip data-title='Remove notebook' data-trigger='hover')
+                            i.btn.btn-default.fa.fa-paragraph(ng-click='addParagraph()' bs-tooltip data-title='Add new paragraph' data-trigger='hover')
+                            i.btn.btn-default.fa.fa-trash(ng-click='removeNotebook()' bs-tooltip data-title='Remove notebook' data-trigger='hover')
                     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')
-                    .pull-right
-                        i.tipField.fa.fa-plus(ng-click='addParagraph()' bs-tooltip data-title='Add new paragraph' data-trigger='hover')
-                .docs-body(style='margin-top: 20px;')
-                    hr
+                hr
+                .docs-body.paragraphs
                     .panel-group(bs-collapse ng-model='notebook.expandedParagraphs' data-allow-multiple='true' data-start-collapsed='false')
                         .panel.panel-default(ng-repeat='paragraph in notebook.paragraphs')
                             .panel-heading(bs-collapse-toggle)
@@ -70,9 +68,8 @@ block container
                                 .panel-body(ng-show='paragraph.editor')
                                     .row
                                         .col-xs-8.col-sm-9(style='border-right: 1px solid #eee')
-                                            .sql-editor(ui-ace='{ theme: "chrome", mode: "sql",' +
+                                            .sql-editor(ui-ace='{ onLoad: aceInit, theme: "chrome", mode: "sql",' +
                                                 'require: ["ace/ext/language_tools"],' +
-                                                'rendererOptions: {showPrintMargin: false, highlightGutterLine: false, fontSize: 14},' +
                                                 'advanced: {enableSnippets: false, enableBasicAutocompletion: true, enableLiveAutocompletion: true, autoScrollEditorIntoView: true, minLines: 3, maxLines: 15}}'
                                             ng-model='paragraph.query'
                                             ng-class='{"disable": paragraph.status == "RUNNING" || paragraph.status == "PENDING" }')
@@ -90,9 +87,10 @@ block container
                                         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
-                                            button.btn.btn-default.fa.fa-clock-o(ng-class='{"btn-info": paragraph.rate && paragraph.rate.ruined}' title='Refresh rate' bs-popover data-template-url="rate" data-placement='top-right' data-auto-close='1' data-trigger='click') {{rateAsString(paragraph)}}
-                                            label Page Size:&nbsp;
-                                            button.btn.btn-default.base-control(ng-model='paragraph.pageSize' bs-options='item for item in pageSizes' bs-select)
+                                            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.result === "table" && paragraph.rows')
                                     .row
                                         .col-sm-8