turcsanyip commented on a change in pull request #4425: URL: https://github.com/apache/nifi/pull/4425#discussion_r466938361
########## File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/DropAllFlowfilesRequestEndpointMerger.java ########## @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.cluster.coordination.http.endpoints; + +import java.net.URI; +import java.util.regex.Pattern; + +public class DropAllFlowfilesRequestEndpointMerger extends DropRequestEndpointMerger { Review comment: Type: FlowFiles ########## File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js ########## @@ -1270,6 +1270,184 @@ }); }, + emptyAllQueues: function (selection) { + // prompt the user before emptying the queue + nfDialog.showYesNoDialog({ + headerText: 'Empty All Queues', + dialogContent: 'Are you sure you want to empty all queues in this Process Group? All FlowFiles from all connections waiting at the time of the request will be removed.', + noText: 'Cancel', + yesText: 'Empty All', + yesHandler: function () { + var processGroupId; + if (selection.empty()) { + processGroupId = nfCanvasUtils.getGroupId(); + } else { + processGroupId = selection.datum().id; + } + + var MAX_DELAY = 4; + var cancelled = false; + var dropRequest = null; + var dropRequestTimer = null; + + // updates the progress bar + var updateProgress = function (percentComplete) { + // remove existing labels + var progressBar = $('#drop-request-percent-complete'); + progressBar.find('div.progress-label').remove(); + progressBar.find('md-progress-linear').remove(); + + // update the progress bar + var label = $('<div class="progress-label"></div>').text(percentComplete + '%'); + (nfNgBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + percentComplete + '" class="md-hue-2" md-mode="determinate" aria-label="Drop request percent complete"></md-progress-linear>'))(nfNgBridge.rootScope)).appendTo(progressBar); + progressBar.append(label); + }; + + // update the button model of the drop request status dialog + $('#drop-request-status-dialog').modal('setButtonModel', [{ + buttonText: 'Stop', + color: { + base: '#728E9B', + hover: '#004849', + text: '#ffffff' + }, + handler: { + click: function () { + cancelled = true; + + // we are waiting for the next poll attempt + if (dropRequestTimer !== null) { + // cancel it + clearTimeout(dropRequestTimer); + + // cancel the drop request + completeDropRequest(); + } + } + } + }]); + + // completes the drop request by removing it and showing how many flowfiles were deleted + var completeDropRequest = function () { + nfCanvasUtils.reload(); + + // clean up as appropriate + if (nfCommon.isDefinedAndNotNull(dropRequest)) { + $.ajax({ + type: 'DELETE', + url: dropRequest.uri, + dataType: 'json' + }).done(function (response) { + // report the results of this drop request + dropRequest = response.dropRequest; + + // build the results + var droppedTokens = dropRequest.dropped.split(/ \/ /); + var results = $('<div></div>'); + $('<span class="label"></span>').text(droppedTokens[0]).appendTo(results); + $('<span></span>').text(' FlowFiles (' + droppedTokens[1] + ')').appendTo(results); + + // if the request did not complete, include the original + if (dropRequest.percentCompleted < 100) { + var originalTokens = dropRequest.original.split(/ \/ /); + $('<span class="label"></span>').text(' out of ' + originalTokens[0]).appendTo(results); + $('<span></span>').text(' (' + originalTokens[1] + ')').appendTo(results); + } + $('<span></span>').text(' were removed from the queue.').appendTo(results); Review comment: Type: "... from the queues." ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
