From d75f118ae116e5c352fdbd02086cafd33dca7e5f Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Tue, 20 Feb 2018 10:28:50 -0500 Subject: [PATCH] NIFI-4894: - Ensuring that any proxy paths are retained when querying for bulletins. This closes #2482 Signed-off-by: Scott Aslan --- .../webapp/js/nf/canvas/nf-canvas-utils.js | 3 ++- .../src/main/webapp/js/nf/nf-common.js | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js index 3dce37e5a2..9347bd4995 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js @@ -251,7 +251,8 @@ var query = function (ids) { var url = new URL(window.location); - var endpoint = url.origin + '/nifi-api/flow/bulletin-board?' + $.param({ + var origin = nfCommon.substringBeforeLast(url.href, '/nifi'); + var endpoint = origin + '/nifi-api/flow/bulletin-board?' + $.param({ sourceId: ids.join('|') }); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js index a1a3fc69d3..f89c4aa427 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js @@ -1022,7 +1022,7 @@ }, /** - * Extracts the contents of the specified str after the strToFind. If the + * Extracts the contents of the specified str after the last strToFind. If the * strToFind is not found or the last part of the str, an empty string is * returned. * @@ -1062,13 +1062,30 @@ }, /** - * Extracts the contents of the specified str before the strToFind. If the + * Extracts the contents of the specified str before the last strToFind. If the * strToFind is not found or the first part of the str, an empty string is * returned. * * @argument {string} str The full string * @argument {string} strToFind The substring to find */ + substringBeforeLast: function (str, strToFind) { + var result = ''; + var indexOfStrToFind = str.lastIndexOf(strToFind); + if (indexOfStrToFind >= 0) { + result = str.substr(0, indexOfStrToFind); + } + return result; + }, + + /** + * Extracts the contents of the specified str before the strToFind. If the + * strToFind is not found or the first path of the str, an empty string is + * returned. + * + * @argument {string} str The full string + * @argument {string} strToFind The substring to find + */ substringBeforeFirst: function (str, strToFind) { var result = ''; var indexOfStrToFind = str.indexOf(strToFind);