Repository: nifi Updated Branches: refs/heads/NIFI-108-2 642c46d06 -> 47e10dce7
NIFI-108: - Adding a message when the source or destination of a connection is actively running. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/47e10dce Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/47e10dce Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/47e10dce Branch: refs/heads/NIFI-108-2 Commit: 47e10dce76422526b5832bff6504aec53ee9a419 Parents: 642c46d Author: Matt Gilman <[email protected]> Authored: Fri Jan 8 10:55:52 2016 -0500 Committer: Matt Gilman <[email protected]> Committed: Fri Jan 8 10:55:52 2016 -0500 ---------------------------------------------------------------------- .../nifi/web/api/dto/ListingRequestDTO.java | 27 ++++++++++++++ .../nifi/controller/FlowFileSummaries.java | 6 --- .../nifi/web/StandardNiFiServiceFacade.java | 39 ++++++++++++++++++-- .../web/dao/impl/StandardConnectionDAO.java | 2 +- .../WEB-INF/partials/canvas/queue-listing.jsp | 1 + .../src/main/webapp/css/queue-listing.css | 20 +++++++--- .../webapp/js/nf/canvas/nf-queue-listing.js | 17 +++++++++ 7 files changed, 97 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java index e5026d6..7e48c9f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ListingRequestDTO.java @@ -43,6 +43,9 @@ public class ListingRequestDTO { private Integer totalStepCount; private Integer completedStepCount; + private Boolean isSourceRunning; + private Boolean isDestinationRunning; + private String state; private QueueSizeDTO queueSize; @@ -224,4 +227,28 @@ public class ListingRequestDTO { public void setQueueSize(QueueSizeDTO queueSize) { this.queueSize = queueSize; } + + /** + * @return whether the source is running + */ + @ApiModelProperty(value = "Whether the source of the connection is running") + public Boolean getSourceRunning() { + return isSourceRunning; + } + + public void setSourceRunning(Boolean sourceRunning) { + isSourceRunning = sourceRunning; + } + + /** + * @return whether the destination is running + */ + @ApiModelProperty(value = "Whether the destination of the connection is running") + public Boolean getDestinationRunning() { + return isDestinationRunning; + } + + public void setDestinationRunning(Boolean destinationRunning) { + isDestinationRunning = destinationRunning; + } } http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowFileSummaries.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowFileSummaries.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowFileSummaries.java index 7a303e2..d7cea54 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowFileSummaries.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowFileSummaries.java @@ -60,12 +60,6 @@ public class FlowFileSummaries { } } - /** - * Creates a comparator for comparing two FlowFileSummaryDTO objects. The objects must be fully populated in - * @param column - * @param direction - * @return - */ public static Comparator<FlowFileSummaryDTO> createDTOComparator(final SortColumn column, final SortDirection direction) { final Comparator<FlowFileSummaryDTO> comparator = new Comparator<FlowFileSummaryDTO>() { @Override http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java index 8f9402c..142ff08 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java @@ -824,7 +824,18 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { @Override public ListingRequestDTO deleteFlowFileListingRequest(String groupId, String connectionId, String listingRequestId) { - return dtoFactory.createListingRequestDTO(connectionDAO.deleteFlowFileListingRequest(groupId, connectionId, listingRequestId)); + final ListingRequestDTO listRequest = dtoFactory.createListingRequestDTO(connectionDAO.deleteFlowFileListingRequest(groupId, connectionId, listingRequestId)); + + // include whether the source and destination are running + final Connection connection = connectionDAO.getConnection(groupId, connectionId); + if (connection.getSource() != null) { + listRequest.setSourceRunning(connection.getSource().isRunning()); + } + if (connection.getDestination() != null) { + listRequest.setDestinationRunning(connection.getDestination().isRunning()); + } + + return listRequest; } @Override @@ -1085,7 +1096,18 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { @Override public ListingRequestDTO createFlowFileListingRequest(String groupId, String connectionId, String listingRequestId) { - return dtoFactory.createListingRequestDTO(connectionDAO.createFlowFileListingRequest(groupId, connectionId, listingRequestId)); + final ListingRequestDTO listRequest = dtoFactory.createListingRequestDTO(connectionDAO.createFlowFileListingRequest(groupId, connectionId, listingRequestId)); + + // include whether the source and destination are running + final Connection connection = connectionDAO.getConnection(groupId, connectionId); + if (connection.getSource() != null) { + listRequest.setSourceRunning(connection.getSource().isRunning()); + } + if (connection.getDestination() != null) { + listRequest.setDestinationRunning(connection.getDestination().isRunning()); + } + + return listRequest; } @Override @@ -2149,7 +2171,18 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { @Override public ListingRequestDTO getFlowFileListingRequest(String groupId, String connectionId, String listingRequestId) { - return dtoFactory.createListingRequestDTO(connectionDAO.getFlowFileListingRequest(groupId, connectionId, listingRequestId)); + final ListingRequestDTO listRequest = dtoFactory.createListingRequestDTO(connectionDAO.getFlowFileListingRequest(groupId, connectionId, listingRequestId)); + + // include whether the source and destination are running + final Connection connection = connectionDAO.getConnection(groupId, connectionId); + if (connection.getSource() != null) { + listRequest.setSourceRunning(connection.getSource().isRunning()); + } + if (connection.getDestination() != null) { + listRequest.setDestinationRunning(connection.getDestination().isRunning()); + } + + return listRequest; } @Override http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java index c5c6b07..d98b590 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardConnectionDAO.java @@ -124,7 +124,7 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO final FlowFileRecord flowFile = queue.getFlowFile(flowFileUuid); if (flowFile == null) { - throw new ResourceNotFoundException(String.format("Unable to find FlowFile '%s' in Connection '%s'.", flowFileUuid, id)); + throw new ResourceNotFoundException(String.format("The desired FlowFile[uuid=%s] is no longer in the active queue.", flowFileUuid)); } return flowFile; http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/queue-listing.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/queue-listing.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/queue-listing.jsp index ab34d63..b7d4622 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/queue-listing.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/queue-listing.jsp @@ -31,4 +31,5 @@ <div class="clear"></div> </div> <div id="queue-listing-table"></div> + <div id="queue-listing-message" class="hidden"></div> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css index 73d1868..49c0525 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css @@ -21,10 +21,10 @@ #queue-listing-container { position: absolute; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; + top: 0; + bottom: 0; + left: 0; + right: 0; } #queue-listing-header-container { @@ -81,7 +81,7 @@ float: right; line-height: normal; margin-right: 20px; - margin-top: 9px; + margin-top: 6px; } /* queue listing table */ @@ -96,6 +96,16 @@ overflow: hidden; } +/* queue listing table */ + +#queue-listing-message { + position: absolute; + left: 20px; + bottom: 20px; + color: #f00; + font-size: 10px; +} + /* flowfile details */ #flowfile-details-dialog { http://git-wip-us.apache.org/repos/asf/nifi/blob/47e10dce/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js index eeb2dd2..c131432 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js @@ -229,6 +229,23 @@ nf.QueueListing = (function () { // update the last updated time $('#queue-listing-last-refreshed').text(listingRequest.lastUpdated); + // show a message for the queue listing if necessary + var queueListingTable = $('#queue-listing-table'); + var queueListingMessage = $('#queue-listing-message'); + if (listingRequest.sourceRunning === true || listingRequest.destinationRunning === true) { + if (listingRequest.souceRunning === true && listingRequest.destinationRunning === true) { + queueListingMessage.text('The source and destination of this queue are currently running. This listing may no longer be accurate.').show(); + } else if (listingRequest.sourceRunning === true) { + queueListingMessage.text('The source of this queue is currently running. This listing may no longer be accurate.').show(); + } else if (listingRequest.destinationRunning === true) { + queueListingMessage.text('The destination of this queue is currently running. This listing may no longer be accurate.').show(); + } + queueListingTable.css('bottom', '35px'); + } else { + queueListingMessage.text('').hide(); + queueListingTable.css('bottom', '20px'); + } + // get the grid to load the data var queueListingGrid = $('#queue-listing-table').data('gridInstance'); var queueListingData = queueListingGrid.getData();
