ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843: WIP Preview highlight on input.
Date Tue, 01 Sep 2015 10:02:59 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 f7e0b3f91 -> b01166575


IGNITE-843: WIP Preview highlight on input.


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

Branch: refs/heads/ignite-843
Commit: b0116657571c0af6abab59743ca9e14c75bcf615
Parents: f7e0b3f
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Tue Sep 1 17:03:09 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Tue Sep 1 17:03:09 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    |  1 +
 .../main/js/controllers/clusters-controller.js  |  9 +---
 .../src/main/js/controllers/common-module.js    | 49 ++++++++++++++++++--
 .../main/js/controllers/metadata-controller.js  |  1 +
 .../src/main/js/views/includes/controls.jade    |  4 +-
 5 files changed, 51 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b0116657/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index 0debcfa..69b108d 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -48,6 +48,7 @@ controlCenterModule.controller('cachesController', [
             $scope.tablePairSaveVisible = $table.tablePairSaveVisible;
 
             $scope.previewInit = $preview.previewInit;
+            $scope.previewChanged = $preview.previewChanged;
 
             $scope.formChanged = $common.formChanged;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0116657/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 03aa3d2..7d40463 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -43,14 +43,7 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
         $scope.tableSimpleDownVisible = $table.tableSimpleDownVisible;
 
         $scope.previewInit = $preview.previewInit;
-
-        $scope.aceChanged = function (editor) {
-            console.log('aceChanged');
-
-            var edt = editor[1];
-
-            edt.navigateFileStart();
-        };
+        $scope.previewChanged = $preview.previewChanged;
 
         $scope.formChanged = $common.formChanged;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0116657/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 5e4d2da..48cf24b 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
@@ -994,9 +994,51 @@ controlCenterModule.service('$table', ['$common', '$focus', function
($common, $
     }
 }]);
 
-
 // Preview support service.
-controlCenterModule.service('$preview', [function () {
+controlCenterModule.service('$preview', [function ($timeout) {
+    var Range = require('ace/range').Range;
+
+    var previewPrevContent = [];
+
+    function previewChanged (ace) {
+        var content = ace[0];
+
+        if (content.action == 'remove')
+            previewPrevContent = content.lines;
+        else {
+            var previewNewContent = content.lines;
+
+            var start = -1;
+            var end = -1;
+            var prevLen = previewPrevContent.length;
+            var newLen = previewNewContent.length;
+
+            for (var i = 0; i < newLen || i < prevLen; i++) {
+                if (previewNewContent[i] != previewPrevContent[i]) {
+                    if (start < 0)
+                        start = i;
+                    else {
+                        end = i;
+                        break;
+                    }
+                }
+            }
+
+            if (start >= 0) {
+                if (end < 0)
+                    end = start + 1;
+
+                var editor = ace[1];
+
+                editor.selection.setSelectionRange(new Range(start, 0, end, 0), false);
+
+                $timeout(function() {
+                    editor.clearSelection();
+                }, 3000);
+            }
+        }
+    }
+
     return {
         previewInit: function (editor) {
             editor.setReadOnly(true);
@@ -1011,7 +1053,8 @@ controlCenterModule.service('$preview', [function () {
             renderer.setOption('fontSize', '10px');
 
             editor.setTheme('ace/theme/chrome');
-        }
+        },
+        previewChanged: previewChanged
     }
 }]);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0116657/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 6e8e554..173d3b0 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -56,6 +56,7 @@ controlCenterModule.controller('metadataController', [
             $scope.tablePairSaveVisible = $table.tablePairSaveVisible;
 
             $scope.previewInit = $preview.previewInit;
+            $scope.previewChanged = $preview.previewChanged;
 
             $scope.formChanged = $common.formChanged;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b0116657/modules/control-center-web/src/main/js/views/includes/controls.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/includes/controls.jade b/modules/control-center-web/src/main/js/views/includes/controls.jade
index 58c125d..bc349e1 100644
--- a/modules/control-center-web/src/main/js/views/includes/controls.jade
+++ b/modules/control-center-web/src/main/js/views/includes/controls.jade
@@ -466,8 +466,8 @@ mixin preview(preview, id)
         .preview-legend(ng-show='!preview[#{preview}].allDefaults')
             a(ng-class='{active: !#{previewState}}' ng-click='#{previewState} = false') XML&nbsp;
             a(ng-class='{active: #{previewState}}' ng-click='#{previewState} = true') Java
-        .preview-content(ng-if='!preview[#{preview}].allDefaults && !#{previewState}'
id='#{id}' ui-ace='{onLoad: previewInit, onChange: aceChanged, mode: "xml"}' ng-model='preview[#{preview}].xml'
min-height='{{::group.minHeight}}')
-        .preview-content(ng-if='!preview[#{preview}].allDefaults && #{previewState}'
id='#{id}' ui-ace='{onLoad: previewInit, onChange: aceChanged, mode: "java"}' ng-model='preview[#{preview}].java'
min-height='{{::group.minHeight}}')
+        .preview-content(ng-if='!preview[#{preview}].allDefaults && !#{previewState}'
id='#{id}' ui-ace='{onLoad: previewInit, onChange: previewChanged, mode: "xml"}' ng-model='preview[#{preview}].xml'
min-height='{{::group.minHeight}}')
+        .preview-content(ng-if='!preview[#{preview}].allDefaults && #{previewState}'
id='#{id}' ui-ace='{onLoad: previewInit, onChange: previewChanged, mode: "java"}' ng-model='preview[#{preview}].java'
min-height='{{::group.minHeight}}')
         .preview-content-empty(ng-if='preview[#{preview}].allDefaults' id='#{id}')
             label All Defaults
 


Mime
View raw message