From 26f5c496d1d5345d4ab7e9f7a7af523e70101f44 Mon Sep 17 00:00:00 2001 From: Scott Aslan Date: Mon, 15 Aug 2016 17:04:28 -0400 Subject: [PATCH] NIFI-2534 Fix JS error when stopping a process group This closes #867. Signed-off-by: Bryan Bende --- .../js/nf/canvas/nf-policy-management.js | 10 +++++++- .../webapp/js/nf/canvas/nf-process-group.js | 24 ++++++++++++------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js index a0d5fb15bc..1a373155d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js @@ -948,10 +948,18 @@ nf.PolicyManagement = (function () { resetPolicy(); loadPolicy(); } + + nf.Canvas.reload({ + 'transition': true + }); }).fail(function (xhr, status, error) { - nf.Common.handleAjaxError(xhr, status, error) + nf.Common.handleAjaxError(xhr, status, error); resetPolicy(); loadPolicy(); + + nf.Canvas.reload({ + 'transition': true + }); }); } else { nf.Dialog.showOkDialog({ diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js index 69dc1a604c..7908d7bd09 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js @@ -1082,19 +1082,25 @@ nf.ProcessGroup = (function () { /** * Reloads the process group state from the server and refreshes the UI. - * If the process group is currently unknown, this function just returns. + * If the process group is currently unknown, this function reloads the canvas. * * @param {object} processGroup The process group to reload */ reload: function (processGroup) { - if (processGroupMap.has(processGroup.id)) { - var processGroupEntity = processGroupMap.get(processGroup.id); - return $.ajax({ - type: 'GET', - url: processGroupEntity.uri, - dataType: 'json' - }).done(function (response) { - nf.ProcessGroup.set(response); + if(nf.Common.isDefinedAndNotNull(processGroup)) { + if (processGroupMap.has(processGroup.id)) { + var processGroupEntity = processGroupMap.get(processGroup.id); + return $.ajax({ + type: 'GET', + url: processGroupEntity.uri, + dataType: 'json' + }).done(function (response) { + nf.ProcessGroup.set(response); + }); + } + } else { + nf.Canvas.reload({ + 'transition': true }); } },