Repository: nifi Updated Branches: refs/heads/NIFI-108 bbe819811 -> f3385a853
NIFI-108: - Removing Delete FlowFile button. - Ensuring sort flags are being passed correctly. - Setting column widths. - Also including the cluster node address in the flowfile summaries. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/f3385a85 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/f3385a85 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/f3385a85 Branch: refs/heads/NIFI-108 Commit: f3385a8533d2a4ecdc440aa117c2d274ae16ecf3 Parents: bbe8198 Author: Matt Gilman <[email protected]> Authored: Fri Dec 18 08:39:16 2015 -0500 Committer: Matt Gilman <[email protected]> Committed: Fri Dec 18 08:39:16 2015 -0500 ---------------------------------------------------------------------- .../nifi/web/api/dto/FlowFileSummaryDTO.java | 17 +++++- .../cluster/manager/impl/WebClusterManager.java | 7 ++- .../apache/nifi/web/api/ConnectionResource.java | 57 -------------------- .../webapp/js/nf/canvas/nf-queue-listing.js | 49 ++++++----------- 4 files changed, 37 insertions(+), 93 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/f3385a85/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java index e787e41..e9bf9c5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/FlowFileSummaryDTO.java @@ -30,7 +30,8 @@ public class FlowFileSummaryDTO { private Long lineageDuration; private Boolean isPenalized; - private String clusterNodeId; + private String clusterNodeId; // include when clustered + private String clusterNodeAddress; // include when clustered /** * @return the FlowFile uri @@ -157,4 +158,18 @@ public class FlowFileSummaryDTO { public void setClusterNodeId(String clusterNodeId) { this.clusterNodeId = clusterNodeId; } + + /** + * @return label for the node where this FlowFile resides + */ + @ApiModelProperty( + value = "The label for the node where this FlowFile resides." + ) + public String getClusterNodeAddress() { + return clusterNodeAddress; + } + + public void setClusterNodeAddress(String clusterNodeAddress) { + this.clusterNodeAddress = clusterNodeAddress; + } } http://git-wip-us.apache.org/repos/asf/nifi/blob/f3385a85/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java index 3282318..f01b1a5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/impl/WebClusterManager.java @@ -2869,6 +2869,9 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C int numStepsTotal = 0; boolean finished = true; for (final Map.Entry<NodeIdentifier, ListingRequestDTO> entry : listingRequestMap.entrySet()) { + final NodeIdentifier nodeIdentifier = entry.getKey(); + final String nodeAddress = nodeIdentifier.getApiAddress() + ":" + nodeIdentifier.getApiPort(); + final ListingRequestDTO nodeRequest = entry.getValue(); numStepsCompleted += nodeRequest.getCompletedStepCount(); @@ -2889,7 +2892,9 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C } for (final FlowFileSummaryDTO summaryDTO : nodeRequest.getFlowFileSummaries()) { - summaryDTO.setClusterNodeId(entry.getKey().getId()); + summaryDTO.setClusterNodeId(nodeIdentifier.getId()); + summaryDTO.setClusterNodeAddress(nodeAddress); + flowFileSummaries.add(summaryDTO); // Keep the set from growing beyond our max http://git-wip-us.apache.org/repos/asf/nifi/blob/f3385a85/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 4b5193f..9da3d77 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 @@ -1027,63 +1027,6 @@ public class ConnectionResource extends ApplicationResource { return generateOkResponse(entity).build(); } - @DELETE - @Consumes(MediaType.WILDCARD) - @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) - @Path("/{connection-id}/flowfiles/{flowfile-uuid}") - @PreAuthorize("hasRole('ROLE_DFM')") - public Response deleteFlowFile( - @Context HttpServletRequest httpServletRequest, - @ApiParam( - 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, - @ApiParam( - value = "The connection id.", - required = true - ) - @PathParam("connection-id") String connectionId, - @ApiParam( - value = "The flowfile uuid.", - required = true - ) - @PathParam("flowfile-uuid") String flowFileUuid, - @ApiParam( - value = "The id of the node where the content exists if clustered.", - required = false - ) - @QueryParam("clusterNodeId") String clusterNodeId) { - - // replicate if cluster manager - if (properties.isClusterManager()) { - // determine where this request should be sent - if (clusterNodeId == null) { - throw new IllegalArgumentException("The id of the node in the cluster is required."); - } else { - // get the target node and ensure it exists - final Node targetNode = clusterManager.getNode(clusterNodeId); - if (targetNode == null) { - throw new UnknownNodeException("The specified cluster node does not exist."); - } - - final Set<NodeIdentifier> targetNodes = new HashSet<>(); - targetNodes.add(targetNode.getNodeId()); - - // replicate the request to the specific node - return clusterManager.applyRequest(HttpMethod.DELETE, getAbsolutePath(), getRequestParameters(true), getHeaders(), targetNodes).getResponse(); - } - } - - // handle expects request (usually from the cluster manager) - final String expects = httpServletRequest.getHeader(WebClusterManager.NCM_EXPECTS_HTTP_HEADER); - if (expects != null) { - return generateContinueResponse().build(); - } - - return null; - } - /** * Gets the content for the specified flowfile in the specified connection. * http://git-wip-us.apache.org/repos/asf/nifi/blob/f3385a85/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 5336b89..76bea54 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 @@ -195,7 +195,7 @@ nf.QueueListing = (function () { }); } } - }); + }).fail(nf.Common.handleAjaxError); } else { // close the dialog $('#listing-request-status-dialog').modal('hide'); @@ -234,7 +234,7 @@ nf.QueueListing = (function () { }).done(function(response) { listingRequest = response.listingRequest; processListingRequest(nextDelay); - }).fail(completeListingRequest); + }).fail(completeListingRequest).fail(nf.Common.handleAjaxError); }; // issue the request to list the flow files @@ -242,8 +242,8 @@ nf.QueueListing = (function () { type: 'POST', url: connection.component.uri + '/listing-requests', data: { - sortCol: sortCol, - sortDir: sortAsc ? 'asc' : 'desc' + sortColumn: sortCol, + sortOrder: sortAsc ? 'asc' : 'desc' }, dataType: 'json' }).done(function(response) { @@ -256,7 +256,7 @@ nf.QueueListing = (function () { // process the drop request listingRequest = response.listingRequest; processListingRequest(1); - }).fail(completeListingRequest); + }).fail(completeListingRequest).fail(nf.Common.handleAjaxError); }; /** @@ -278,24 +278,6 @@ nf.QueueListing = (function () { }; /** - * Deletes the specified flowfile. - * - * @param flowFileSummary the flowfile summary - */ - var deleteFlowfile = function (flowFileSummary) { - $.ajax({ - type: 'DELETE', - url: flowFileSummary.uri, - dataType: 'json' - }).done(function(response) { - // get the table and update the row accordingly - var queueListingGrid = $('#queue-listing-table').data('gridInstance'); - var queueListingData = queueListingGrid.getData(); - queueListingData.deleteItem(flowFileSummary.uuid); - }).fail(nf.Common.handleAjaxError); - }; - - /** * Resets the table size. */ var resetTableSize = function () { @@ -330,24 +312,23 @@ nf.QueueListing = (function () { return nf.Common.formatDuration(value); } - // function for formatting the actions column - var actionFormatter = function (row, cell, value, columnDef, dataContext) { - return '<img src="images/iconDelete.png" title="Delete FlowFile" class="pointer delete-flowfile" style="margin-top: 2px;"/>'; - }; - // initialize the queue listing table - var flowFileListingColumns = [ - {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreDetailsFormatter, sortable: true, width: 50, maxWidth: 50}, - {id: 'QUEUE_POSITION', name: 'Position', field: 'position', sortable: true, resizable: true}, + 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: formatDuration}, {id: 'FLOWFILE_AGE', name: 'Lineage Duration', field: 'lineageDuration', sortable: true, resizable: true, formatter: formatDuration}, - {id: 'PENALIZATION', name: 'Penalized', field: 'penalized', sortable: true, resizable: true}, - {id: 'actions', name: ' ', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100} + {id: 'PENALIZATION', name: 'Penalized', field: 'penalized', sortable: true, resizable: false, width: 100, maxWidth: 100} ]; + // conditionally show the cluster node identifier + if (nf.Canvas.isClustered()) { + queueListingColumns.push({id: 'clusterNodeAddress', name: 'Node', field: 'clusterNodeAddress', sortable: false, resizable: true}); + } + var queueListingOptions = { forceFitColumns: true, enableTextSelectionOnCells: true, @@ -363,7 +344,7 @@ nf.QueueListing = (function () { queueListingData.setItems([]); // initialize the grid - var queueListingGrid = new Slick.Grid('#queue-listing-table', queueListingData, flowFileListingColumns, queueListingOptions); + var queueListingGrid = new Slick.Grid('#queue-listing-table', queueListingData, queueListingColumns, queueListingOptions); queueListingGrid.setSelectionModel(new Slick.RowSelectionModel()); queueListingGrid.registerPlugin(new Slick.AutoTooltips()); queueListingGrid.setSortColumn(DEFAULT_SORT_COL, DEFAULT_SORT_ASC);
