Repository: nifi
Updated Branches:
  refs/heads/master a181c7b9d -> 3378426f3


NIFI-2581: Keeping context menu and tooltips open when refreshing the canvas.

This closes #899.


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

Branch: refs/heads/master
Commit: 3378426f3520cf66ec0525382a3596ce25915a15
Parents: a181c7b
Author: Matt Gilman <[email protected]>
Authored: Fri Aug 19 10:19:24 2016 -0400
Committer: Pierre Villard <[email protected]>
Committed: Fri Aug 19 19:36:26 2016 +0200

----------------------------------------------------------------------
 .../main/webapp/js/nf/canvas/nf-canvas-utils.js | 28 +++++++-----
 .../src/main/webapp/js/nf/canvas/nf-canvas.js   |  3 --
 .../src/main/webapp/js/nf/canvas/nf-port.js     | 27 +++++++-----
 .../main/webapp/js/nf/canvas/nf-processor.js    | 27 +++++++-----
 .../js/nf/canvas/nf-remote-process-group.js     | 46 ++++++++++++--------
 5 files changed, 79 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/3378426f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
index 1b26f35..09e820e 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js
@@ -476,11 +476,8 @@ nf.CanvasUtils = (function () {
         bulletins: function (selection, d, getTooltipContainer, offset) {
             offset = nf.Common.isDefinedAndNotNull(offset) ? offset : 0;
 
-            // remove any existing tip if necessary
+            // get the tip
             var tip = d3.select('#bulletin-tip-' + d.id);
-            if (!tip.empty()) {
-                tip.remove();
-            }
 
             var hasBulletins = false;
             if (!nf.Common.isEmpty(d.bulletins)) {
@@ -499,17 +496,20 @@ nf.CanvasUtils = (function () {
                 // update the tooltip
                 selection.select('text.bulletin-icon')
                         .each(function () {
-                            // if there are bulletins generate a tooltip
-                            tip = getTooltipContainer().append('div')
+                            // create the tip if necessary
+                            if (tip.empty()) {
+                                tip = getTooltipContainer().append('div')
                                     .attr('id', function () {
                                         return 'bulletin-tip-' + d.id;
                                     })
-                                    .attr('class', 'tooltip nifi-tooltip')
-                                    .html(function () {
-                                        return 
$('<div></div>').append(list).html();
-                                    });
+                                    .attr('class', 'tooltip nifi-tooltip');
+                            }
 
                             // add the tooltip
+                            tip.html(function () {
+                                return $('<div></div>').append(list).html();
+                            });
+
                             nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
                         });
 
@@ -517,6 +517,11 @@ nf.CanvasUtils = (function () {
                 selection.select('text.bulletin-icon').style("visibility", 
"visible");
                 
selection.select('rect.bulletin-background').style("visibility", "visible");
             } else {
+                // clean up if necessary
+                if (!tip.empty()) {
+                    tip.remove();
+                }
+
                 // update the tooltip background
                 selection.select('text.bulletin-icon').style("visibility", 
"hidden");
                 
selection.select('rect.bulletin-background').style("visibility", "hidden");
@@ -1292,6 +1297,9 @@ nf.CanvasUtils = (function () {
          * @param {string} groupId
          */
         enterGroup: function (groupId) {
+            // hide the context menu
+            nf.ContextMenu.hide();
+
             // set the new group id
             nf.Canvas.setGroupId(groupId);
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/3378426f/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-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
index 790d10d..5236e14 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js
@@ -725,9 +725,6 @@ nf.Canvas = (function () {
          */
         reload: function (options) {
             return $.Deferred(function (deferred) {
-                // hide the context menu
-                nf.ContextMenu.hide();
-
                 // issue the requests
                 var processGroupXhr = 
reloadProcessGroup(nf.Canvas.getGroupId(), options);
                 var statusXhr = 
nf.ng.Bridge.injector.get('flowStatusCtrl').reloadFlowStatus();

http://git-wip-us.apache.org/repos/asf/nifi/blob/3378426f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js
index 75aed00..544b12c 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js
@@ -357,20 +357,22 @@ nf.Port = (function () {
                 return img;
             })
             .each(function (d) {
-                // remove the existing tip if necessary
+                // get the tip
                 var tip = d3.select('#run-status-tip-' + d.id);
-                if (!tip.empty()) {
-                    tip.remove();
-                }
 
                 // if there are validation errors generate a tooltip
                 if (d.permissions.canRead && 
!nf.Common.isEmpty(d.component.validationErrors)) {
-                    tip = d3.select('#port-tooltips').append('div')
-                        .attr('id', function () {
-                            return 'run-status-tip-' + d.id;
-                        })
-                        .attr('class', 'tooltip nifi-tooltip')
-                        .html(function () {
+                    // create the tip if necessary
+                    if (tip.empty()) {
+                        tip = d3.select('#port-tooltips').append('div')
+                            .attr('id', function () {
+                                return 'run-status-tip-' + d.id;
+                            })
+                            .attr('class', 'tooltip nifi-tooltip');
+                    }
+
+                    // update the tip
+                    tip.html(function () {
                             var list = 
nf.Common.formatUnorderedList(d.component.validationErrors);
                             if (list === null || list.length === 0) {
                                 return '';
@@ -381,6 +383,11 @@ nf.Port = (function () {
 
                     // add the tooltip
                     nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
+                } else {
+                    // remove if necessary
+                    if (!tip.empty()) {
+                        tip.remove();
+                    }
                 }
             });
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/3378426f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js
index 536f222..d3bbd6e 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js
@@ -608,20 +608,22 @@ nf.Processor = (function () {
                 return img;
             })
             .each(function (d) {
-                // remove the existing tip if necessary
+                // get the tip
                 var tip = d3.select('#run-status-tip-' + d.id);
-                if (!tip.empty()) {
-                    tip.remove();
-                }
 
                 // if there are validation errors generate a tooltip
                 if (d.permissions.canRead && 
!nf.Common.isEmpty(d.component.validationErrors)) {
-                    tip = d3.select('#processor-tooltips').append('div')
-                        .attr('id', function () {
-                            return 'run-status-tip-' + d.id;
-                        })
-                        .attr('class', 'tooltip nifi-tooltip')
-                        .html(function () {
+                    // create the tip if necessary
+                    if (tip.empty()) {
+                        tip = d3.select('#processor-tooltips').append('div')
+                            .attr('id', function () {
+                                return 'run-status-tip-' + d.id;
+                            })
+                            .attr('class', 'tooltip nifi-tooltip');
+                    }
+
+                    // update the tip
+                    tip.html(function () {
                             var list = 
nf.Common.formatUnorderedList(d.component.validationErrors);
                             if (list === null || list.length === 0) {
                                 return '';
@@ -632,6 +634,11 @@ nf.Processor = (function () {
 
                     // add the tooltip
                     nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
+                } else {
+                    // remove the tip if necessary
+                    if (!tip.empty()) {
+                        tip.remove();
+                    }
                 }
             });
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/3378426f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
index fcb452e..f530ba6 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
@@ -520,18 +520,20 @@ nf.RemoteProcessGroup = (function () {
                             return icon;
                         })
                         .each(function (d) {
-                            // remove the existing tip if necessary
+                            // get the tip
                             var tip = d3.select('#transmission-secure-' + 
d.id);
-                            if (!tip.empty()) {
-                                tip.remove();
+
+                            // remove the tip if necessary
+                            if (tip.empty()) {
+                                tip = 
d3.select('#remote-process-group-tooltips').append('div')
+                                    .attr('id', function () {
+                                        return 'transmission-secure-' + d.id;
+                                    })
+                                    .attr('class', 'tooltip nifi-tooltip');
                             }
 
-                            tip = 
d3.select('#remote-process-group-tooltips').append('div')
-                                .attr('id', function () {
-                                    return 'transmission-secure-' + d.id;
-                                })
-                                .attr('class', 'tooltip nifi-tooltip')
-                                .text(function () {
+                            // update the tip
+                            tip.text(function () {
                                     if (d.component.targetSecure === true) {
                                         return 'Site-to-Site is secure.';
                                     } else {
@@ -720,20 +722,22 @@ nf.RemoteProcessGroup = (function () {
                 return d.permissions.canRead && 
!nf.Common.isEmpty(d.component.authorizationIssues);
             })
             .each(function (d) {
-                // remove the existing tip if necessary
+                // get the tip
                 var tip = d3.select('#authorization-issues-' + d.id);
-                if (!tip.empty()) {
-                    tip.remove();
-                }
 
                 // if there are validation errors generate a tooltip
                 if (d.permissions.canRead && 
!nf.Common.isEmpty(d.component.authorizationIssues)) {
-                    tip = 
d3.select('#remote-process-group-tooltips').append('div')
-                        .attr('id', function () {
-                            return 'authorization-issues-' + d.id;
-                        })
-                        .attr('class', 'tooltip nifi-tooltip')
-                        .html(function () {
+                    // create the tip if necessary
+                    if (tip.empty()) {
+                        tip = 
d3.select('#remote-process-group-tooltips').append('div')
+                            .attr('id', function () {
+                                return 'authorization-issues-' + d.id;
+                            })
+                            .attr('class', 'tooltip nifi-tooltip');
+                    }
+
+                    // update the tip
+                    tip.html(function () {
                             var list = 
nf.Common.formatUnorderedList(d.component.authorizationIssues);
                             if (list === null || list.length === 0) {
                                 return '';
@@ -744,6 +748,10 @@ nf.RemoteProcessGroup = (function () {
 
                     // add the tooltip
                     nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
+                } else {
+                    if (!tip.empty()) {
+                        tip.remove();
+                    }
                 }
             });
 

Reply via email to