You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2020/11/03 20:39:16 UTC

[nifi] 06/07: NIFI-1121 Fixed a dependent value check error.

This is an automated email from the ASF dual-hosted git repository.

bbende pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 42c2cda9a21fc1d66040c6b95dcff1164515e2a6
Author: mtien <mt...@gmail.com>
AuthorDate: Thu Oct 29 09:02:15 2020 -0700

    NIFI-1121 Fixed a dependent value check error.
    
    Signed-off-by: Bryan Bende <bb...@apache.org>
---
 .../js/jquery/propertytable/jquery.propertytable.js     | 17 +++++++++++++++--
 .../processors/tests/system/DependOnProperties.java     |  7 +++----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
index e5e1208..4a3b37d 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
@@ -1695,7 +1695,13 @@
 
                                             // Test the dependentValues array against the current value of the property
                                             // If not, then mark the current property hidden attribute is true
-                                            hidden = !dependency.dependentValues.includes(propertyValue);
+                                            if (propertyValue != null) {
+                                                if (dependency.hasOwnProperty("dependentValues")) {
+                                                    hidden = !dependency.dependentValues.includes(propertyValue);
+                                                }
+                                            } else {
+                                                hidden = true;
+                                            }
                                         } else {
                                             hidden = true;
                                         }
@@ -1854,9 +1860,16 @@
                                 if (property.hidden === false) {
                                     // Get the property value by propertyName
                                     var propertyValue = properties[dependency.propertyName];
+
                                     // Test the dependentValues against the current value of the property
                                     // If not, then mark the current property hidden attribute is true
-                                    hidden = !dependency.dependentValues.includes(propertyValue);
+                                    if (propertyValue != null) {
+                                        if (dependency.hasOwnProperty("dependentValues")) {
+                                            hidden = !dependency.dependentValues.includes(propertyValue);
+                                        }
+                                    } else {
+                                        hidden = true;
+                                    }
                                 } else {
                                     hidden = true;
                                 }
diff --git a/nifi-system-tests/nifi-system-test-extensions-bundle/nifi-system-test-extensions/src/main/java/org/apache/nifi/processors/tests/system/DependOnProperties.java b/nifi-system-tests/nifi-system-test-extensions-bundle/nifi-system-test-extensions/src/main/java/org/apache/nifi/processors/tests/system/DependOnProperties.java
index 49c2dbb..50135e7 100644
--- a/nifi-system-tests/nifi-system-test-extensions-bundle/nifi-system-test-extensions/src/main/java/org/apache/nifi/processors/tests/system/DependOnProperties.java
+++ b/nifi-system-tests/nifi-system-test-extensions-bundle/nifi-system-test-extensions/src/main/java/org/apache/nifi/processors/tests/system/DependOnProperties.java
@@ -17,6 +17,8 @@
 
 package org.apache.nifi.processors.tests.system;
 
+import java.util.Arrays;
+import java.util.List;
 import org.apache.nifi.components.AllowableValue;
 import org.apache.nifi.components.PropertyDescriptor;
 import org.apache.nifi.components.PropertyDescriptor.Builder;
@@ -26,9 +28,6 @@ import org.apache.nifi.processor.ProcessSession;
 import org.apache.nifi.processor.exception.ProcessException;
 import org.apache.nifi.processor.util.StandardValidators;
 
-import java.util.Arrays;
-import java.util.List;
-
 import static org.apache.nifi.processor.util.StandardValidators.NON_EMPTY_VALIDATOR;
 
 public class DependOnProperties extends AbstractProcessor {
@@ -74,7 +73,7 @@ public class DependOnProperties extends AbstractProcessor {
     static final PropertyDescriptor REQUIRED_IF_ALWAYS_REQUIRED_IS_BAR_OR_BAZ = new Builder()
         .name("Required If Always Required Is Bar Or Baz")
         .displayName("Required If Always Required Is Bar Or Baz")
-        .description("This property is required if and only if hte 'Always Required' property is set to the value 'bar' or the value 'baz'")
+        .description("This property is required if and only if the 'Always Required' property is set to the value 'bar' or the value 'baz'")
         .required(true)
         .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR)
         .dependsOn(ALWAYS_REQUIRED, BAR, BAZ)