From d6e54f19ee249da45fe8d625cf68ce3d3e61380a Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Fri, 10 Nov 2017 15:58:59 -0500 Subject: [PATCH] NIFI-4436: - Adding the version number to the start version control, commit, and change version dialog. - Showing a loading item in the combo's while querying for the registries, buckets, and flows. - Adding tooltips to display version control information on the canvas. - Adding progress bar dialogs for changing version and reverting local changes. - Updating canvas and breadcrumb according to the version control state. - Updating to use registry name, bucket name, and flow name where appropriate. --- .../dto/VersionedFlowUpdateRequestDTO.java | 10 +- .../apache/nifi/web/api/VersionsResource.java | 82 ++-- .../apache/nifi/web/api/dto/DtoFactory.java | 4 +- .../canvas/import-flow-version-dialog.jsp | 18 + .../WEB-INF/partials/canvas/navigation.jsp | 6 +- .../canvas/save-flow-version-dialog.jsp | 3 +- .../src/main/webapp/css/dialog.css | 31 +- .../nifi-web-ui/src/main/webapp/css/graph.css | 3 +- .../src/main/webapp/css/navigation.css | 13 +- .../nf-ng-breadcrumbs-controller.js | 51 ++ .../directives/nf-ng-breadcrumbs-directive.js | 6 +- .../webapp/js/nf/canvas/nf-flow-version.js | 441 ++++++++++++++---- .../webapp/js/nf/canvas/nf-process-group.js | 131 +++++- .../src/main/webapp/js/nf/nf-common.js | 19 + .../nf-ng-breadcrumbs-directive-view.html | 9 +- 15 files changed, 652 insertions(+), 175 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java index 013b40d14f..cc82af4f36 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/VersionedFlowUpdateRequestDTO.java @@ -32,7 +32,7 @@ public class VersionedFlowUpdateRequestDTO { private Date lastUpdated; private boolean complete = false; private String failureReason; - private int percentComplete; + private int percentCompleted; private String state; private VersionControlInformationDTO versionControlInformation; @@ -110,11 +110,11 @@ public class VersionedFlowUpdateRequestDTO { } @ApiModelProperty(value = "The percentage complete for the request, between 0 and 100", readOnly = true) - public int getPercentComplete() { - return percentComplete; + public int getPercentCompleted() { + return percentCompleted; } - public void setPercentComplete(int percentComplete) { - this.percentComplete = percentComplete; + public void setPercentCompleted(int percentCompleted) { + this.percentCompleted = percentCompleted; } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java index b808ae63ee..f61b399586 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java @@ -17,37 +17,12 @@ package org.apache.nifi.web.api; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; - +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.authorization.Authorizer; import org.apache.nifi.authorization.ProcessGroupAuthorizable; @@ -94,12 +69,35 @@ import org.apache.nifi.web.util.Pause; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import java.util.stream.Collectors; @Path("/versions") @Api(value = "/versions", description = "Endpoint for managing version control for a flow") @@ -776,7 +774,7 @@ public class VersionsResource extends ApplicationResource { updateRequestDto.setRequestId(requestId); updateRequestDto.setUri(generateResourceUri("versions", requestType, requestId)); updateRequestDto.setState(asyncRequest.getState()); - updateRequestDto.setPercentComplete(asyncRequest.getPercentComplete()); + updateRequestDto.setPercentCompleted(asyncRequest.getPercentComplete()); if (updateRequestDto.isComplete()) { final VersionControlInformationEntity vciEntity = serviceFacade.getVersionControlInformation(asyncRequest.getProcessGroupId()); @@ -858,7 +856,7 @@ public class VersionsResource extends ApplicationResource { updateRequestDto.setProcessGroupId(asyncRequest.getProcessGroupId()); updateRequestDto.setRequestId(requestId); updateRequestDto.setUri(generateResourceUri("versions", requestType, requestId)); - updateRequestDto.setPercentComplete(asyncRequest.getPercentComplete()); + updateRequestDto.setPercentCompleted(asyncRequest.getPercentComplete()); updateRequestDto.setState(asyncRequest.getState()); if (updateRequestDto.isComplete()) { @@ -1040,7 +1038,7 @@ public class VersionsResource extends ApplicationResource { updateRequestDto.setProcessGroupId(groupId); updateRequestDto.setRequestId(requestId); updateRequestDto.setUri(generateResourceUri("versions", "update-requests", requestId)); - updateRequestDto.setPercentComplete(request.getPercentComplete()); + updateRequestDto.setPercentCompleted(request.getPercentComplete()); updateRequestDto.setState(request.getState()); final VersionedFlowUpdateRequestEntity updateRequestEntity = new VersionedFlowUpdateRequestEntity(); @@ -1192,7 +1190,7 @@ public class VersionsResource extends ApplicationResource { updateRequestDto.setRequestId(requestId); updateRequestDto.setVersionControlInformation(currentVersion); updateRequestDto.setUri(generateResourceUri("versions", "revert-requests", requestId)); - updateRequestDto.setPercentComplete(100); + updateRequestDto.setPercentCompleted(100); updateRequestDto.setState(request.getState()); final VersionedFlowUpdateRequestEntity updateRequestEntity = new VersionedFlowUpdateRequestEntity(); @@ -1231,6 +1229,8 @@ public class VersionsResource extends ApplicationResource { updateRequestDto.setLastUpdated(request.getLastUpdated()); updateRequestDto.setProcessGroupId(groupId); updateRequestDto.setRequestId(requestId); + updateRequestDto.setState(request.getState()); + updateRequestDto.setPercentCompleted(request.getPercentComplete()); updateRequestDto.setUri(generateResourceUri("versions", "revert-requests", requestId)); final VersionedFlowUpdateRequestEntity updateRequestEntity = new VersionedFlowUpdateRequestEntity(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index 1c1e729130..bd603be8e3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -2230,8 +2230,8 @@ public final class DtoFactory { dto.setFlowName(versionControlInfo.getFlowName()); dto.setFlowDescription(versionControlInfo.getFlowDescription()); dto.setVersion(versionControlInfo.getVersion()); - dto.setCurrent(versionControlInfo.getCurrent().orElse(null)); - dto.setModified(versionControlInfo.getModified().orElse(null)); + dto.setCurrent(versionControlInfo.getCurrent().orElse(true)); + dto.setModified(versionControlInfo.getModified().orElse(false)); return dto; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/import-flow-version-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/import-flow-version-dialog.jsp index 5169c7cdc2..5ea622a6df 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/import-flow-version-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/import-flow-version-dialog.jsp @@ -39,6 +39,24 @@ +
+ + \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/navigation.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/navigation.jsp index 86f4ba3647..4700b8b714 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/navigation.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/navigation.jsp @@ -19,7 +19,11 @@ breadcrumbs="appCtrl.serviceProvider.breadcrumbsCtrl.getBreadcrumbs();" click-func="appCtrl.nf.CanvasUtils.getComponentByType('ProcessGroup').enterGroup" highlight-crumb-id="appCtrl.nf.CanvasUtils.getGroupId();" - separator-func="appCtrl.nf.Common.isDefinedAndNotNull"> + separator-func="appCtrl.nf.Common.isDefinedAndNotNull" + is-tracking="appCtrl.serviceProvider.breadcrumbsCtrl.isTracking" + is-current="appCtrl.serviceProvider.breadcrumbsCtrl.isCurrent" + is-modified="appCtrl.serviceProvider.breadcrumbsCtrl.isModified" + get-version-control-tooltip="appCtrl.serviceProvider.breadcrumbsCtrl.getVersionControlTooltip">