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:14 UTC
[nifi] 04/07: NIFI-1121: Added an additional check for hidden
properties to account for transitive dependent properties. - Added a
'dependent' attribute to determine whether or not to save dependent
property values
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 535cab3167a5c2cd88ef560494628186317bf0d3
Author: mtien <mt...@gmail.com>
AuthorDate: Thu Aug 27 16:35:30 2020 -0700
NIFI-1121: Added an additional check for hidden properties to account for transitive dependent properties.
- Added a 'dependent' attribute to determine whether or not to save dependent property values
Co-authored-by: Scott Aslan <sc...@gmail.com>
Signed-off-by: Bryan Bende <bb...@apache.org>
---
.../apache/nifi/components/PropertyDependency.java | 4 +-
.../apache/nifi/processor/util/bin/BinFiles.java | 3 +-
.../jquery/propertytable/jquery.propertytable.js | 54 ++++++++++++++++------
.../nifi/processors/standard/MergeContent.java | 5 +-
4 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/nifi-api/src/main/java/org/apache/nifi/components/PropertyDependency.java b/nifi-api/src/main/java/org/apache/nifi/components/PropertyDependency.java
index 5c0f9b5..8e09fc0 100644
--- a/nifi-api/src/main/java/org/apache/nifi/components/PropertyDependency.java
+++ b/nifi-api/src/main/java/org/apache/nifi/components/PropertyDependency.java
@@ -75,8 +75,8 @@ public class PropertyDependency {
}
final PropertyDependency that = (PropertyDependency) o;
- return Objects.equals(getPropertyName(), that.getPropertyName()) &&
- Objects.equals(getDependentValues(), that.getDependentValues());
+ return Objects.equals(getPropertyName(), that.getPropertyName())
+ && Objects.equals(getDependentValues(), that.getDependentValues());
}
@Override
diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java
index 4ba4a96..7851654 100644
--- a/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java
+++ b/nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java
@@ -26,7 +26,6 @@ import java.util.Queue;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-
import org.apache.nifi.annotation.lifecycle.OnScheduled;
import org.apache.nifi.annotation.lifecycle.OnStopped;
import org.apache.nifi.components.PropertyDescriptor;
@@ -51,7 +50,7 @@ public abstract class BinFiles extends AbstractSessionFactoryProcessor {
public static final PropertyDescriptor MIN_SIZE = new PropertyDescriptor.Builder()
.name("Minimum Group Size")
- .description("The minimum size of for the bundle")
+ .description("The minimum size for the bundle")
.required(true)
.defaultValue("0 B")
.addValidator(StandardValidators.DATA_SIZE_VALIDATOR)
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 7767508..e5e1208 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
@@ -1674,6 +1674,7 @@
// Get the property descriptor object
var descriptor = descriptors[item.property];
var hidden = false;
+ var dependent = false;
// Check for dependencies
if (descriptor.dependencies.length > 0) {
@@ -1687,12 +1688,17 @@
// Check the row's dependent values against all other row's current values to determine hidden state
$.each(items, function (k, property) {
if (property.property === dependency.propertyName) {
- // Get the current property value to compare with the dependent value
- var propertyValue = property.value;
-
- // 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);
+ dependent = true;
+ if (property.hidden === false) {
+ // Get the current property value to compare with the dependent value
+ var propertyValue = property.value;
+
+ // 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);
+ } else {
+ hidden = true;
+ }
if (hidden) {
// It is sufficient to have found a single instance of not meeting the
// requirement for a dependent value in order to hide a property
@@ -1705,7 +1711,8 @@
propertyData.beginUpdate();
propertyData.updateItem(id, $.extend(item, {
- hidden: hidden
+ hidden: hidden,
+ dependent: dependent
}));
propertyData.endUpdate();
@@ -1826,18 +1833,38 @@
}
var hidden = false;
+ var dependent = false;
// Check for dependencies
if (descriptor.dependencies.length > 0) {
$.each(descriptor.dependencies, function (i, dependency) {
- // 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);
+ // It is sufficient to have found a single instance of not meeting the
+ // requirement for a dependent value in order to hide a property
if (hidden) {
return false;
}
+
+ // Get the rows from the table
+ var items = propertyData.getItems();
+
+ // Get the item's hidden attribute to compare. If item.hidden=true, hidden = true.
+ $.each(items, function (k, property) {
+ if (property.property === dependency.propertyName) {
+ dependent = true;
+ 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);
+ } else {
+ hidden = true;
+ }
+ if (hidden) {
+ return false;
+ }
+ }
+ })
});
}
@@ -1845,6 +1872,7 @@
propertyData.addItem({
id: i++,
hidden: hidden,
+ dependent: dependent,
property: name,
displayName: displayName,
previousValue: value,
@@ -2221,7 +2249,7 @@
var propertyGrid = table.data('gridInstance');
var propertyData = propertyGrid.getData();
$.each(propertyData.getItems(), function () {
- if (this.hidden === true) {
+ if (this.hidden === true && !(this.dependent === true)) {
// hidden properties were removed by the user, clear the value
properties[this.property] = null;
} else if (this.value !== this.previousValue) {
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
index 215822e..13eb119 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
@@ -43,7 +43,6 @@ import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;
-
import org.apache.avro.Schema;
import org.apache.avro.file.CodecFactory;
import org.apache.avro.file.DataFileConstants;
@@ -55,13 +54,13 @@ import org.apache.avro.generic.GenericRecord;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.lang3.StringUtils;
-import org.apache.nifi.annotation.behavior.SystemResourceConsideration;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
import org.apache.nifi.annotation.behavior.ReadsAttribute;
import org.apache.nifi.annotation.behavior.ReadsAttributes;
import org.apache.nifi.annotation.behavior.SideEffectFree;
import org.apache.nifi.annotation.behavior.SystemResource;
+import org.apache.nifi.annotation.behavior.SystemResourceConsideration;
import org.apache.nifi.annotation.behavior.TriggerWhenEmpty;
import org.apache.nifi.annotation.behavior.WritesAttribute;
import org.apache.nifi.annotation.behavior.WritesAttributes;
@@ -284,7 +283,7 @@ public class MergeContent extends BinFiles {
+ "the values of the properties should be used as the content.")
.allowableValues(DELIMITER_STRATEGY_NONE, DELIMITER_STRATEGY_FILENAME, DELIMITER_STRATEGY_TEXT)
.defaultValue(DELIMITER_STRATEGY_NONE.getValue())
- .dependsOn(MERGE_STRATEGY, MERGE_STRATEGY_BIN_PACK)
+ .dependsOn(MERGE_FORMAT, MERGE_FORMAT_CONCAT_VALUE)
.build();
public static final PropertyDescriptor HEADER = new PropertyDescriptor.Builder()
.name("Header File")