This is an automated email from the ASF dual-hosted git repository. mattyb149 pushed a commit to branch analytics-framework in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/analytics-framework by this push: new 60d9ce4 NIFI-6510 - Fix issue displaying estimated time to back pressure in connection summary table when only one of the predictions is known. 60d9ce4 is described below commit 60d9ce427c2b1af9b291d09e19b47de4edeba753 Author: Rob Fellows <rob.fell...@gmail.com> AuthorDate: Fri Sep 6 13:03:45 2019 -0400 NIFI-6510 - Fix issue displaying estimated time to back pressure in connection summary table when only one of the predictions is known. Signed-off-by: Matthew Burgess <mattyb...@apache.org> This closes #3705 --- .../src/main/webapp/js/nf/summary/nf-summary-table.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js index b665bbd..3585356 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js @@ -103,17 +103,26 @@ { label: 'size', percent: percentUseBytes } ]; - var minPrediction = _.minBy(predictions, 'timeToBackPressure'); + // if one of the queues is already at backpressure, return now as the prediction var maxActual = _.maxBy(actualQueuePercents, 'percent'); - if (maxActual.percent >= 100) { // currently experiencing back pressure return 'now (' + maxActual.label + ')'; - } else if (minPrediction.timeToBackPressure < 0) { + } + + // filter out the predictions that are unknown + var knownPredictions = predictions.filter(function(p) { + return p.timeToBackPressure >= 0; + }); + + if (_.isEmpty(knownPredictions)) { // there is not a valid time-to-back-pressure prediction available return 'NA'; } + // there is at least one valid prediction, return the minimum time to back pressure + var minPrediction = _.minBy(knownPredictions, 'timeToBackPressure'); + var formatted = nfCommon.formatPredictedDuration(minPrediction.timeToBackPressure); return nfCommon.escapeHtml(formatted) + ' (' + minPrediction.label + ')'; };