bbende commented on code in PR #8670: URL: https://github.com/apache/nifi/pull/8670#discussion_r1619124970
########## nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java: ########## @@ -2104,6 +2203,24 @@ public Response getVersions( return generateOkResponse(versionedFlowSnapshotMetadataSetEntity).build(); } + private static FlowComparisonEntity limitDifferences(final FlowComparisonEntity original, final int offset, final int limit) { + final List<ComponentDifferenceDTO> limited = PaginationHelper.paginateByContainedItems( + original.getComponentDifferences(), offset, limit, ComponentDifferenceDTO::getDifferences, FlowResource::limitDifferences); + final FlowComparisonEntity result = new FlowComparisonEntity(); + result.setComponentDifferences(new HashSet<>(limited)); + return result; + } + + private static ComponentDifferenceDTO limitDifferences(final ComponentDifferenceDTO original, final List<DifferenceDTO> partial) { + final ComponentDifferenceDTO result = new ComponentDifferenceDTO(); + result.setComponentType(original.getComponentType()); + result.setComponentId(original.getComponentId()); + result.setComponentName(original.getComponentName()); + result.setProcessGroupId(original.getProcessGroupId()); + result.setDifferences(partial); + return result; + } Review Comment: Just want to ask whether we think we truly need paging here. Generally most of NiFi's REST APIs don't page anything, and all of the paging is done on the client side. The reason is because the slow part is not sending a large response from server to client, it is the rendering of the whole response on the client. So as long as the client is rendering pages, it usually works totally fine. If we do want paging, then shouldn't the entity being returned contain some paging info? At a minimum I would think we need to return the total rows in the result set, otherwise how can a client know when to page to? ########## nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/FlowResource.java: ########## @@ -2057,6 +2062,100 @@ public Response getDetails( return generateOkResponse(flowDetails).build(); } + @GET + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.APPLICATION_JSON) + @Path("registries/{registry-id}/branches/{branch-id-a}/buckets/{bucket-id-a}/flows/{flow-id-a}/{version-a}/diff/branches/{branch-id-b}/buckets/{bucket-id-b}/flows/{flow-id-b}/{version-b}") Review Comment: Is the intended use case for this to right-click on a process group under version control and be able to choose something like `Compare With` and then choose another version to compare with? is there any other scenario where we want to compare two flow versions? I'm asking because if it is limited to the first scenario I described, we may want to consider a more specific API to the PG, similar to `process-groups/{id}local-changes`, maybe `/process-groups/{id}/diff`. Then it would only need the parameters for the other flow version to compare to, which could be added to the path, or as query params. -- 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-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org