Repository: incubator-nifi
Updated Branches:
  refs/heads/develop 6f1c12f5e -> d27d2e303


NIFI-24:
- Updating the state of the enable/disable button in the toolbar when 
appropriate.

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

Branch: refs/heads/develop
Commit: d27d2e303e8badf24e07259cbc79bfadd0023bbd
Parents: 6f1c12f
Author: Matt Gilman <[email protected]>
Authored: Tue Dec 30 07:43:20 2014 -0500
Committer: Matt Gilman <[email protected]>
Committed: Tue Dec 30 07:43:20 2014 -0500

----------------------------------------------------------------------
 .../main/webapp/js/nf/canvas/nf-canvas-toolbar.js  | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/d27d2e30/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js
----------------------------------------------------------------------
diff --git 
a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js
 
b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js
index 23cb20f..38707d8 100644
--- 
a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js
+++ 
b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js
@@ -148,11 +148,26 @@ nf.CanvasToolbar = (function () {
                 });
 
                 // if there are any colorable components enable the button
-                if (nf.Common.isDefinedAndNotNull(colorableComponents) && 
colorableComponents.size() === 1 && colorableComponents.size() === 
selection.size()) {
+                if (colorableComponents.size() === 1 && 
colorableComponents.size() === selection.size()) {
                     actions['fill'].enable();
                 } else {
                     actions['fill'].disable();
                 }
+                
+                // determine if there are any selected components that support 
enable/disable
+                var supportsEnable = selection.filter(function(d) {
+                    var selected = d3.select(this);
+                    return nf.CanvasUtils.isProcessor(selected) || 
nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected);
+                });
+                
+                // ensure the entire selection supports enable/disable
+                if (!supportsEnable.empty() && supportsEnable.size() === 
selection.size()) {
+                    actions['enable'].enable();
+                    actions['disable'].enable();
+                } else {
+                    actions['enable'].disable();
+                    actions['disable'].disable();
+                }
             }
         }
     };

Reply via email to