You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/11/30 18:02:59 UTC

[GitHub] [nifi] mcgilman commented on a change in pull request #5559: NIFI-9336 - Show icon for property values with leading or trailing whitespace

mcgilman commented on a change in pull request #5559:
URL: https://github.com/apache/nifi/pull/5559#discussion_r759531704



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
##########
@@ -1763,13 +1771,26 @@
                 var propertyHistory = history[property];
 
                 // format the tooltip
-                var tooltip = nfCommon.formatPropertyTooltip(propertyDescriptor, propertyHistory);
+                var propertyTooltip = nfCommon.formatPropertyTooltip(propertyDescriptor, propertyHistory);
 
-                if (nfCommon.isDefinedAndNotNull(tooltip)) {
+                if (nfCommon.isDefinedAndNotNull(propertyTooltip)) {
                     infoIcon.qtip($.extend({},
                         nfCommon.config.tooltipConfig,
                         {
-                            content: tooltip
+                            content: propertyTooltip
+                        }));
+                }
+            }
+
+            var whitespaceIcon = $(this).find('div.fa-info');
+            if (whitespaceIcon.length && !whitespaceIcon.data('qtip')) {
+                var whitespaceTooltip = nfCommon.formatWhitespaceTooltip();
+
+                if (nfCommon.isDefinedAndNotNull(whitespaceTooltip)) {
+                    whitespaceIcon.qtip($.extend({},

Review comment:
       Tooltips from qtip should be manually cleaned up to avoid a dom leak. If you open up DevTools and show one of these new tooltips, close the configuration dialog, open the configuration dialog, and show another one of these new tooltips you can see at the bottom of the dom elements we continually add new qtip content.
   
   In this case, you can clean up by updating the `clear` function to also clean up `div.fa-info`.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
##########
@@ -996,6 +996,30 @@
             }
         },
 
+        /**
+         * Returns a tooltip for leading and/or trailing whitespace.
+         *
+         * @returns {string}
+         */
+        formatWhitespaceTooltip: function () {
+            return nfCommon.escapeHtml('The specified value contains leading and/or trailing whitespace character(s). ' +
+                'This could produce unexpected results if it was not intentional.');
+
+        },
+
+        /**
+         * Checks the specified value for leading and/or trailing whitespace.
+         *
+         * @argument {string} value     The value to check
+         */
+        hasWhitespace : function (value) {
+            if (!value) {
+                return false;
+            }
+            var leadOrTrailWhitespaceRegex = /^[ \s]+|[ \s]+$/;

Review comment:
       If a property value only contains whitespace, this regex will hit. Only whitespace would be considered a normal occurrence as we support delimiters for example. I think this logic needs to be updated to only trigger when the value contains leading or trailing whitespace but not only whitespace.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org