http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java index 5831d6d..738da04 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ConnectionResource.java @@ -29,8 +29,6 @@ import org.apache.nifi.cluster.manager.exception.UnknownNodeException; import org.apache.nifi.cluster.manager.impl.WebClusterManager; import org.apache.nifi.cluster.node.Node; import org.apache.nifi.cluster.protocol.NodeIdentifier; -import org.apache.nifi.controller.queue.SortColumn; -import org.apache.nifi.controller.queue.SortDirection; import org.apache.nifi.stream.io.StreamUtils; import org.apache.nifi.util.NiFiProperties; import org.apache.nifi.web.ConfigurationSnapshot; @@ -1173,6 +1171,11 @@ public class ConnectionResource extends ApplicationResource { ) @PathParam("connection-id") String id) { + // replicate if cluster manager + if (properties.isClusterManager()) { + return clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); + } + // defer to the new endpoint that references /drop-requests in the URI return createDropRequest(httpServletRequest, clientId, id); } @@ -1186,7 +1189,7 @@ public class ConnectionResource extends ApplicationResource { * @return A listRequestEntity */ @POST - @Consumes(MediaType.WILDCARD) + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/{connection-id}/listing-requests") @PreAuthorize("hasRole('ROLE_DFM')") @@ -1213,47 +1216,16 @@ public class ConnectionResource extends ApplicationResource { value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", required = false ) - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @ApiParam( value = "The connection id.", required = true ) - @PathParam("connection-id") String id, - @ApiParam( - value = "The sort column.", - required = false, - defaultValue = "QUEUE_POSITION", - allowableValues = "QUEUE_POSITION, FLOWFILE_UUID, FILENAME, FLOWFILE_SIZE, QUEUED_DURATION, FLOWFILE_AGE, PENALIZATION" - ) - @FormParam("sortColumn") String sortColumn, - @ApiParam( - value = "The sort direction.", - required = false, - defaultValue = "asc", - allowableValues = "asc, desc" - ) - @FormParam("sortOrder") @DefaultValue("asc") String sortOrder) { - - // parse the sort column - final SortColumn column; - if (sortColumn == null) { - column = SortColumn.QUEUE_POSITION; - } else { - try { - column = SortColumn.valueOf(sortColumn); - } catch (final IllegalArgumentException iae) { - throw new IllegalArgumentException(String.format("Sort Column: Value must be one of [%s]", StringUtils.join(SortColumn.values(), ", "))); - } - } - - // normalize the sort order - if (!sortOrder.equalsIgnoreCase("asc") && !sortOrder.equalsIgnoreCase("desc")) { - throw new IllegalArgumentException("The sort order must be 'asc' or 'desc'."); - } + @PathParam("connection-id") String id) { // replicate if cluster manager if (properties.isClusterManager()) { - return clusterManager.applyRequest(HttpMethod.GET, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); + return clusterManager.applyRequest(HttpMethod.POST, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); } // handle expects request (usually from the cluster manager) @@ -1263,13 +1235,6 @@ public class ConnectionResource extends ApplicationResource { return generateContinueResponse().build(); } - final SortDirection direction; - if (sortOrder.equalsIgnoreCase("asc")) { - direction = SortDirection.ASCENDING; - } else { - direction = SortDirection.DESCENDING; - } - // ensure the id is the same across the cluster final String listingRequestId; final ClusterContext clusterContext = ClusterContextThreadLocal.getContext(); @@ -1280,7 +1245,7 @@ public class ConnectionResource extends ApplicationResource { } // submit the listing request - final ListingRequestDTO listingRequest = serviceFacade.createFlowFileListingRequest(groupId, id, listingRequestId, column, direction); + final ListingRequestDTO listingRequest = serviceFacade.createFlowFileListingRequest(groupId, id, listingRequestId); populateRemainingFlowFileListingContent(id, listingRequest); // create the revision @@ -1452,7 +1417,7 @@ public class ConnectionResource extends ApplicationResource { * @return A dropRequestEntity */ @POST - @Consumes(MediaType.WILDCARD) + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Path("/{connection-id}/drop-requests") @PreAuthorize("hasRole('ROLE_DFM')") @@ -1479,7 +1444,7 @@ public class ConnectionResource extends ApplicationResource { value = "If the client id is not specified, new one will be generated. This value (whether specified or generated) is included in the response.", required = false ) - @QueryParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, + @FormParam(CLIENT_ID) @DefaultValue(StringUtils.EMPTY) ClientIdParameter clientId, @ApiParam( value = "The connection id.", required = true @@ -1488,7 +1453,7 @@ public class ConnectionResource extends ApplicationResource { // replicate if cluster manager if (properties.isClusterManager()) { - return clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); + return clusterManager.applyRequest(HttpMethod.POST, getAbsolutePath(), getRequestParameters(true), getHeaders()).getResponse(); } // handle expects request (usually from the cluster manager)
http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java ---------------------------------------------------------------------- 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 6433e9f..6f7a733 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 @@ -378,10 +378,6 @@ public final class DtoFactory { dto.setFailureReason(listingRequest.getFailureReason()); dto.setFinished(isListingRequestComplete(listingRequest.getState())); dto.setMaxResults(listingRequest.getMaxResults()); - dto.setSortColumn(listingRequest.getSortColumn().name()); - dto.setSortDirection(listingRequest.getSortDirection().name()); - dto.setTotalStepCount(listingRequest.getTotalStepCount()); - dto.setCompletedStepCount(listingRequest.getCompletedStepCount()); dto.setPercentCompleted(listingRequest.getCompletionPercentage()); dto.setQueueSize(createQueueSizeDTO(listingRequest.getQueueSize())); http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.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/ConnectionDAO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java index 932cc23..2e1e8fd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/ConnectionDAO.java @@ -16,16 +16,15 @@ */ package org.apache.nifi.web.dao; -import java.util.Set; import org.apache.nifi.connectable.Connection; import org.apache.nifi.controller.queue.DropFlowFileStatus; import org.apache.nifi.controller.queue.ListFlowFileStatus; -import org.apache.nifi.controller.queue.SortColumn; -import org.apache.nifi.controller.queue.SortDirection; import org.apache.nifi.controller.repository.FlowFileRecord; import org.apache.nifi.web.DownloadableContent; import org.apache.nifi.web.api.dto.ConnectionDTO; +import java.util.Set; + public interface ConnectionDAO { /** @@ -118,11 +117,9 @@ public interface ConnectionDAO { * @param groupId group id * @param id connection id * @param listingRequestId listing request id - * @param column sort column - * @param direction sort direction * @return The listing request status */ - ListFlowFileStatus createFlowFileListingRequest(String groupId, String id, String listingRequestId, SortColumn column, SortDirection direction); + ListFlowFileStatus createFlowFileListingRequest(String groupId, String id, String listingRequestId); /** * Verifies the listing can be processed. http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/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 d5fb713..e1faa14 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 @@ -16,18 +16,6 @@ */ package org.apache.nifi.web.dao.impl; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import javax.ws.rs.WebApplicationException; - import org.apache.nifi.admin.service.UserService; import org.apache.nifi.authorization.DownloadAuthorization; import org.apache.nifi.connectable.Connectable; @@ -40,14 +28,12 @@ import org.apache.nifi.controller.exception.ValidationException; import org.apache.nifi.controller.queue.DropFlowFileStatus; import org.apache.nifi.controller.queue.FlowFileQueue; import org.apache.nifi.controller.queue.ListFlowFileStatus; -import org.apache.nifi.controller.queue.SortColumn; -import org.apache.nifi.controller.queue.SortDirection; import org.apache.nifi.controller.repository.ContentNotFoundException; import org.apache.nifi.controller.repository.FlowFileRecord; +import org.apache.nifi.flowfile.FlowFilePrioritizer; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.groups.ProcessGroup; import org.apache.nifi.groups.RemoteProcessGroup; -import org.apache.nifi.flowfile.FlowFilePrioritizer; import org.apache.nifi.processor.Relationship; import org.apache.nifi.remote.RemoteGroupPort; import org.apache.nifi.user.NiFiUser; @@ -64,6 +50,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.AccessDeniedException; +import javax.ws.rs.WebApplicationException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; + public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO { private static final Logger logger = LoggerFactory.getLogger(StandardConnectionDAO.class); @@ -126,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 FlowFile with UUID %s is no longer in the active queue.", flowFileUuid)); } return flowFile; @@ -375,14 +373,14 @@ public class StandardConnectionDAO extends ComponentDAO implements ConnectionDAO } @Override - public ListFlowFileStatus createFlowFileListingRequest(String groupId, String id, String listingRequestId, SortColumn column, SortDirection direction) { + public ListFlowFileStatus createFlowFileListingRequest(String groupId, String id, String listingRequestId) { final Connection connection = locateConnection(groupId, id); final FlowFileQueue queue = connection.getFlowFileQueue(); // ensure we can list verifyList(queue); - return queue.listFlowFiles(listingRequestId, 100, column, direction); + return queue.listFlowFiles(listingRequestId, 100); } @Override @@ -606,7 +604,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 FlowFile with UUID %s is no longer in the active queue.", flowFileUuid)); } // calculate the dn chain http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/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 0d8435a..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 @@ -20,10 +20,16 @@ <div id="queue-listing-header-text"></div> </div> <div id="queue-listing-stats-container"> + <div id="queue-listing-refresh-button" class="pointer" title="Refresh"></div> + <div id="queue-listing-last-refreshed-container"> + Last updated: <span id="queue-listing-last-refreshed"></span> + </div> + <div id="queue-listing-loading-container" class="loading-container"></div> <div id="queue-listing-stats"> Displaying <span id="displayed-flowfiles"></span> of <span id="total-flowfiles-count"></span> (<span id="total-flowfiles-size"></span>) </div> - <div id="queue-listing-loading-container" class="loading-container"></div> + <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/0d7edcb3/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 689ceaf..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 { @@ -41,19 +41,28 @@ } #queue-listing-stats-container { - margin-left: 15px; - margin-top: 30px; + margin-left: 20px; + margin-top: 18px; -webkit-user-select: none; -moz-user-select: none; } -#queue-listing-stats { - font-size: 9px; +#queue-listing-refresh-button { + float: left; + height: 24px; + width: 26px; +} + +#queue-listing-last-refreshed-container { + float: left; + color: #666; + font-weight: normal; + margin-top: 6px; + margin-left: 3px; +} + +#queue-listing-last-refreshed { font-weight: bold; - color: #9f6000; - clear: left; - line-height: normal; - margin-left: 5px; } #queue-listing-loading-container { @@ -65,6 +74,16 @@ margin-left: 3px; } +#queue-listing-stats { + font-size: 9px; + font-weight: bold; + color: #9f6000; + float: right; + line-height: normal; + margin-right: 20px; + margin-top: 6px; +} + /* queue listing table */ #queue-listing-table { @@ -77,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/0d7edcb3/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js index 2f1bbd3..84d3ee3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js @@ -975,7 +975,7 @@ nf.Actions = (function () { }); } else { // nothing was removed - nf.Dialog.showYesNoDialog({ + nf.Dialog.showOkDialog({ dialogContent: 'No FlowFiles were removed.', overlayBackground: false }); http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js index 55df1e9..089ac9e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js @@ -307,7 +307,7 @@ nf.ContextMenu = (function () { * @param {selection} selection */ var canListQueue = function (selection) { - return nf.Common.isDFM() && isConnection(selection) && nf.CanvasUtils.supportsModification(selection); + return nf.Common.isDFM() && isConnection(selection); }; /** http://git-wip-us.apache.org/repos/asf/nifi/blob/0d7edcb3/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 3c33f3a..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 @@ -22,9 +22,6 @@ */ nf.QueueListing = (function () { - var DEFAULT_SORT_COL = 'QUEUE_POSITION'; - var DEFAULT_SORT_ASC = true; - /** * Initializes the listing request status dialog. */ @@ -78,7 +75,7 @@ nf.QueueListing = (function () { var dataUri = $('#flowfile-uri').text() + '/content'; // conditionally include the cluster node id - var clusterNodeId = $('#flowfile-cluster-node-id').text();; + var clusterNodeId = $('#flowfile-cluster-node-id').text(); if (!nf.Common.isBlank(clusterNodeId)) { var parameters = { 'clusterNodeId': clusterNodeId @@ -158,10 +155,8 @@ nf.QueueListing = (function () { * Performs a listing on the specified connection. * * @param connection the connection - * @param sortCol the sort column - * @param sortAsc if sort is asc */ - var performListing = function (connection, sortCol, sortAsc) { + var performListing = function (connection) { var MAX_DELAY = 4; var cancelled = false; var listingRequest = null; @@ -231,6 +226,26 @@ nf.QueueListing = (function () { $('#total-flowfiles-count').text(nf.Common.formatInteger(listingRequest.queueSize.objectCount)); $('#total-flowfiles-size').text(nf.Common.formatDataSize(listingRequest.queueSize.byteCount)); + // 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(); @@ -290,10 +305,6 @@ nf.QueueListing = (function () { $.ajax({ type: 'POST', url: connection.component.uri + '/listing-requests', - data: { - sortColumn: sortCol, - sortOrder: sortAsc ? 'asc' : 'desc' - }, dataType: 'json' }).done(function(response) { // initialize the progress bar value @@ -332,9 +343,15 @@ nf.QueueListing = (function () { } }; + var params = {}; + if (nf.Common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { + params['clusterNodeId'] = flowFileSummary.clusterNodeId; + } + $.ajax({ type: 'GET', url: flowFileSummary.uri, + data: params, dataType: 'json' }).done(function(response) { var flowFile = response.flowFile; @@ -352,12 +369,12 @@ nf.QueueListing = (function () { $('#flowfile-penalized').text(flowFile.penalized === true ? 'Yes' : 'No'); // conditionally show the cluster node identifier - if (nf.Common.isDefinedAndNotNull(flowFile.clusterNodeId)) { + if (nf.Common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { // save the cluster node id - $('#flowfile-cluster-node-id').text(flowFile.clusterNodeId); + $('#flowfile-cluster-node-id').text(flowFileSummary.clusterNodeId); // render the cluster node address - formatFlowFileDetail('Node Address', flowFile.clusterNodeAddress); + formatFlowFileDetail('Node Address', flowFileSummary.clusterNodeAddress); } if (nf.Common.isDefinedAndNotNull(flowFile.contentClaimContainer)) { @@ -423,6 +440,12 @@ nf.QueueListing = (function () { resetTableSize(); }); + // define mouse over event for the refresh button + nf.Common.addHoverEffect('#queue-listing-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () { + var connection = $('#queue-listing-table').data('connection'); + performListing(connection); + }); + // define a custom formatter for showing more processor details var moreDetailsFormatter = function (row, cell, value, columnDef, dataContext) { return '<img src="images/iconDetails.png" title="View Details" class="pointer show-flowfile-details" style="margin-top: 5px; float: left;"/>'; @@ -452,13 +475,13 @@ nf.QueueListing = (function () { // initialize the queue listing table var queueListingColumns = [ {id: 'moreDetails', field: 'moreDetails', name: ' ', sortable: false, resizable: false, formatter: moreDetailsFormatter, width: 50, maxWidth: 50}, - {id: 'QUEUE_POSITION', name: 'Position', field: 'position', sortable: true, resizable: false, width: 75, maxWidth: 75}, - {id: 'FLOWFILE_UUID', name: 'UUID', field: 'uuid', sortable: true, resizable: true}, - {id: 'FILENAME', name: 'Filename', field: 'filename', sortable: true, resizable: true}, - {id: 'FLOWFILE_SIZE', name: 'File Size', field: 'size', sortable: true, resizable: true, defaultSortAsc: false, formatter: dataSizeFormatter}, - {id: 'QUEUED_DURATION', name: 'Queued Duration', field: 'queuedDuration', sortable: true, resizable: true, formatter: durationFormatter}, - {id: 'FLOWFILE_AGE', name: 'Lineage Duration', field: 'lineageDuration', sortable: true, resizable: true, formatter: durationFormatter}, - {id: 'PENALIZATION', name: 'Penalized', field: 'penalized', sortable: true, resizable: false, width: 100, maxWidth: 100, formatter: penalizedFormatter} + {id: 'position', name: 'Position', field: 'position', sortable: false, resizable: false, width: 75, maxWidth: 75}, + {id: 'uuid', name: 'UUID', field: 'uuid', sortable: false, resizable: true}, + {id: 'filename', name: 'Filename', field: 'filename', sortable: false, resizable: true}, + {id: 'size', name: 'File Size', field: 'size', sortable: false, resizable: true, defaultSortAsc: false, formatter: dataSizeFormatter}, + {id: 'queuedDuration', name: 'Queued Duration', field: 'queuedDuration', sortable: false, resizable: true, formatter: durationFormatter}, + {id: 'lineageDuration', name: 'Lineage Duration', field: 'lineageDuration', sortable: false, resizable: true, formatter: durationFormatter}, + {id: 'penalized', name: 'Penalized', field: 'penalized', sortable: false, resizable: false, width: 100, maxWidth: 100, formatter: penalizedFormatter} ]; // conditionally show the cluster node identifier @@ -484,10 +507,6 @@ nf.QueueListing = (function () { var queueListingGrid = new Slick.Grid('#queue-listing-table', queueListingData, queueListingColumns, queueListingOptions); queueListingGrid.setSelectionModel(new Slick.RowSelectionModel()); queueListingGrid.registerPlugin(new Slick.AutoTooltips()); - queueListingGrid.onSort.subscribe(function (e, args) { - var connection = $('#queue-listing-table').data('connection'); - performListing(connection, args.sortCol.id, args.sortAsc); - }); // configure a click listener queueListingGrid.onClick.subscribe(function (e, args) { @@ -530,11 +549,8 @@ nf.QueueListing = (function () { * @param {object} The connection */ listQueue: function (connection) { - var queueListingGrid = $('#queue-listing-table').data('gridInstance'); - queueListingGrid.setSortColumn(DEFAULT_SORT_COL, DEFAULT_SORT_ASC); - // perform the initial listing - performListing(connection, DEFAULT_SORT_COL, DEFAULT_SORT_ASC).done(function () { + performListing(connection).done(function () { // update the connection name var connectionName = nf.CanvasUtils.formatConnectionName(connection.component); if (connectionName === '') { @@ -547,6 +563,7 @@ nf.QueueListing = (function () { $('#queue-listing-table').removeData('connection'); // clear the table + var queueListingGrid = $('#queue-listing-table').data('gridInstance'); var queueListingData = queueListingGrid.getData(); // clear the flowfiles
