mosermw commented on code in PR #9967:
URL: https://github.com/apache/nifi/pull/9967#discussion_r2426874797


##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java:
##########
@@ -2821,6 +2846,18 @@ private void flattenProcessGroups(final 
VersionedProcessGroup group, final Map<S
        }
    }
 
+   private ComponentDifferenceDTO createBundleDifference(final FlowDifference 
difference) {
+       VersionedComponent component = difference.getComponentB();
+
+       final ComponentDifferenceDTO dto = new ComponentDifferenceDTO();
+       dto.setComponentType(component.getComponentType().toString());
+       // bundle difference could apply to many components, but use the 
Process Group identifier as
+       // the Component Identifier here so that many similar component 
differences can be easily deduped
+       dto.setComponentId(component.getGroupIdentifier());

Review Comment:
   This quite nicely dedupes only similar component differences.  As an 
example, if your Versioned Process Group contains 20 processors from 
nifi-standard-nar and 1 processor from nifi-jolt-nar, then once you make any 
non-environmental change, you would see 1 difference in the nifi-jolt-nar 
version and only 1 difference in the nifi-standard-nar version.  I didn't think 
showing 21 differences with 20 being the same would be desirable.



##########
nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java:
##########
@@ -73,6 +73,10 @@ public static boolean isEnvironmentalChange(final 
FlowDifference difference, fin
             || isLogFileSuffixChange(difference);
     }
 
+    public static boolean isBundleChange(final FlowDifference difference) {

Review Comment:
   Ah, I meant to call the new isBundleChange method from the 
isEnvironmentalChange method above.  This would follow the pattern of the other 
methods called by isEnvironmentalChange.



##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java:
##########
@@ -2792,12 +2800,19 @@ public Set<ComponentDifferenceDTO> 
createComponentDifferenceDtosForLocalModifica
 
            final ComponentDifferenceDTO componentDiff = 
createComponentDifference(difference);
            final List<DifferenceDTO> differences = 
differencesByComponent.computeIfAbsent(componentDiff, key -> new ArrayList<>());
-
-           final DifferenceDTO dto = new DifferenceDTO();
-           
dto.setDifferenceType(difference.getDifferenceType().getDescription());
-           dto.setDifference(difference.getDescription());
-
-           differences.add(dto);
+           differences.add(createDifferenceDto(difference));
+       }
+
+       if (!differencesByComponent.isEmpty()) {
+           // differences were found, so now let's add back in any 
BUNDLE_CHANGED differences
+           // since they were initially filtered out as an 
environment-specific change

Review Comment:
   Bundle changes are still considered to be an environmental change, 
**_unless_** another local change has been made.  I didn't want bundle 
differences to be the only reason a Versioned Process Group would appear as 
locally changed, because a NiFi upgrade could potentially cause all Versioned 
PGs to appear locally changed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to