From f2bd9f87ba3ec6c3aca502aaccf7227b58cd3a0b Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Thu, 26 Oct 2017 12:43:02 -0400 Subject: [PATCH] NIFI-4518: - Addressing issues when handling the done callback for controller service references. --- .../src/main/webapp/js/nf/canvas/nf-canvas-utils.js | 8 +++++++- .../src/main/webapp/js/nf/canvas/nf-controller-service.js | 3 +-- 2 files changed, 8 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 f9178e2ec6..68a918aa4a 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 @@ -284,7 +284,13 @@ if (queries.length === 1) { // if there was only one query, return it - return queries[0].fail(nfErrorHandler.handleAjaxError); + return $.Deferred(function (deferred) { + queries[0].done(function (response) { + deferred.resolve(response); + }).fail(function () { + deferred.reject(); + }).fail(nfErrorHandler.handleAjaxError); + }).promise(); } else { // if there were multiple queries, wait for each to complete return $.Deferred(function (deferred) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js index c7d9c435dc..c97c861d18 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js @@ -864,8 +864,7 @@ dataType: 'json' }); - $.when(bulletins, service).done(function (bulletinResult, serviceResult) { - var bulletinResponse = bulletinResult[0]; + $.when(bulletins, service).done(function (bulletinResponse, serviceResult) { var serviceResponse = serviceResult[0]; conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins); }).fail(function (xhr, status, error) {