From deed25656facf6cf88bcd9425a1ddc66cf23d332 Mon Sep 17 00:00:00 2001 From: Scott Aslan Date: Mon, 10 Apr 2017 14:52:53 -0400 Subject: [PATCH] [NIFI-3035] use URLSearchParams .toString() to update URL. This closes #1659 --- .../main/webapp/js/nf/canvas/nf-canvas-utils.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 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 f7ad2ace0e..5fc18d5821 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 @@ -410,27 +410,21 @@ params.set('processGroupId', groupId); params.set('componentIds', selectedComponentIds.sort()); - // create object whose keys are the parameter name and the values are the parameter values - var paramsObject = {}; - params.forEach(function (v, k) { - paramsObject[k] = v; - }); - var url = new URL(window.location); var newUrl = url.origin + url.pathname; if (nfCommon.isDefinedAndNotNull(nfCanvasUtils.getParentGroupId()) || selectedComponentIds.length > 0) { if (!nfCommon.isDefinedAndNotNull(nfCanvasUtils.getParentGroupId())) { // we are in the root group so set processGroupId param value to 'root' alias - paramsObject['processGroupId'] = 'root'; + params.set('processGroupId', 'root'); } - if ((url.origin + url.pathname + '?' + $.param(paramsObject)).length <= nfCanvasUtils.MAX_URL_LENGTH) { - newUrl = url.origin + url.pathname + '?' + $.param(paramsObject); + if ((url.origin + url.pathname + '?' + params.toString()).length <= nfCanvasUtils.MAX_URL_LENGTH) { + newUrl = url.origin + url.pathname + '?' + params.toString(); } else if (nfCommon.isDefinedAndNotNull(nfCanvasUtils.getParentGroupId())) { // silently remove all component ids - paramsObject['componentIds'] = ''; - newUrl = url.origin + url.pathname + '?' + $.param(paramsObject); + params.set('componentIds', ''); + newUrl = url.origin + url.pathname + '?' + params.toString(); } }