NIFI-250:
- Addressing cancel action when initiated by pressing escape. Previously it was 
canceling every dialog that was open when it should have only applied to the 
top most.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/985aa134
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/985aa134
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/985aa134

Branch: refs/heads/NIFI-250
Commit: 985aa134c4c5a43b1570b669e0d32c40be28e152
Parents: bf7027c
Author: Matt Gilman <[email protected]>
Authored: Tue Mar 17 09:49:09 2015 -0400
Committer: Matt Gilman <[email protected]>
Committed: Tue Mar 17 09:49:09 2015 -0400

----------------------------------------------------------------------
 .../js/jquery/propertytable/jquery.propertytable.js  | 15 ++++++++++++++-
 .../src/main/webapp/js/nf/canvas/nf-canvas.js        | 13 +++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/985aa134/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
index c08ec53..89bbffd 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
@@ -111,7 +111,6 @@
             if (e.which === $.ui.keyCode.ENTER && !e.shiftKey) {
                 scope.save();
             } else if (e.which === $.ui.keyCode.ESCAPE) {
-                e.preventDefault();
                 scope.cancel();
             }
         };
@@ -887,6 +886,19 @@
                 }
             }
         });
+        propertyGrid.onKeyDown.subscribe(function(e, args) {
+            if (e.which === $.ui.keyCode.ESCAPE) {
+                var editorLock = propertyGrid.getEditorLock();
+                if (editorLock.isActive()) {
+                    editorLock.cancelCurrentEdit();
+                    
+                    // prevents standard cancel logic - standard logic does
+                    // not stop propagation when escape is pressed
+                    e.stopImmediatePropagation();
+                    e.preventDefault();
+                }
+            }
+        });
 
         // wire up the dataview to the grid
         propertyData.onRowCountChanged.subscribe(function (e, args) {
@@ -1142,6 +1154,7 @@
                             if (e.which === $.ui.keyCode.ENTER && !e.shiftKey) 
{
                                 add();
                             } else if (e.which === $.ui.keyCode.ESCAPE) {
+                                e.stopPropagation();
                                 e.preventDefault();
                                 cancel();
                             }

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/985aa134/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
index 747e8b9..626ba34 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
@@ -538,9 +538,18 @@ nf.Canvas = (function () {
             // consider escape, before checking dialogs
             if (!isCtrl && evt.keyCode === 27) {
                 // esc
-                nf.Actions.hideDialogs();
+                var target = $(evt.target);
+                if (target.length) {
+                    if (target.get(0) === $('#canvas-body').get(0)) {
+                        nf.Actions.hideDialogs();
+                    } else {
+                        
target.closest('.cancellable.dialog:visible').modal('hide');
+                    }
+                    
+                    evt.stopPropagation();
+                    evt.preventDefault();
+                }
 
-                evt.preventDefault();
                 return;
             }
             

Reply via email to