NIFI-250:
- Only recording previously configured controller service when attempting to 
change a controller service.
- Only polling schedulable components when stopping. No need to poll during 
start requests.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/2949beb6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/2949beb6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/2949beb6

Branch: refs/heads/NIFI-250
Commit: 2949beb6f57a7af469257a27adffa9397e234d7b
Parents: 0b77160
Author: Matt Gilman <[email protected]>
Authored: Mon Mar 30 13:20:55 2015 -0400
Committer: Matt Gilman <[email protected]>
Committed: Mon Mar 30 13:20:55 2015 -0400

----------------------------------------------------------------------
 .../js/nf/canvas/nf-controller-service.js       | 27 +++++++++++---------
 1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/2949beb6/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
----------------------------------------------------------------------
diff --git 
a/nifi/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/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
index 1698b94..1a1de6e 100644
--- 
a/nifi/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/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
@@ -599,13 +599,14 @@ nf.ControllerService = (function () {
                         var referencingService = 
controllerServiceData.getItemById(controllerServiceId);
                         
polling.push(stopReferencingSchedulableComponents(referencingService, 
pollCondition));
                     });
+                    
+                    // wait until polling has finished
+                    $.when.apply(window, polling).done(function () {
+                        deferred.resolve();
+                    }).fail(function() {
+                        deferred.reject();
+                    });
                 }
-                
-                $.when.apply(window, polling).done(function () {
-                    deferred.resolve();
-                }).fail(function() {
-                    deferred.reject();
-                });
             }).fail(function() {
                 deferred.reject();
             });
@@ -780,7 +781,6 @@ nf.ControllerService = (function () {
             nf.Client.setRevision(response.revision);
         }).fail(nf.Common.handleAjaxError);
         
-        // need to wait until finished ENALBING or DISABLING?
         // wait unil the polling of each service finished
         return $.Deferred(function(deferred) {
             updated.done(function(response) {
@@ -1396,10 +1396,11 @@ nf.ControllerService = (function () {
                                 if (validateDetails(updatedControllerService)) 
{
                                     var previouslyReferencedServiceIds = [];
                                     
$.each(identifyReferencedServiceDescriptors(controllerService), function (_, 
descriptor) {
-                                        // if we are attempting to update a 
controller service reference
-                                        if 
(!nf.Common.isUndefined(updatedControllerService.controllerService.properties[descriptor.name])
 &&
-                                                
!nf.Common.isNull(controllerService.properties[descriptor.name])) {
+                                        var modifyingService = 
!nf.Common.isUndefined(updatedControllerService.controllerService.properties) 
&& 
!nf.Common.isUndefined(updatedControllerService.controllerService.properties[descriptor.name]);
+                                        var isCurrentlyConfigured = 
nf.Common.isDefinedAndNotNull(controllerService.properties[descriptor.name]);
                                         
+                                        // if we are attempting to update a 
controller service reference
+                                        if (modifyingService && 
isCurrentlyConfigured) {
                                             // record the current value if set
                                             
previouslyReferencedServiceIds.push(controllerService.properties[descriptor.name]);
                                         }
@@ -1483,9 +1484,11 @@ nf.ControllerService = (function () {
                                             if 
(validateDetails(updatedControllerService)) {
                                                 var 
previouslyReferencedServiceIds = [];
                                                 
$.each(identifyReferencedServiceDescriptors(controllerService), function (_, 
descriptor) {
+                                                    var modifyingService = 
!nf.Common.isUndefined(updatedControllerService.controllerService.properties) 
&& 
!nf.Common.isUndefined(updatedControllerService.controllerService.properties[descriptor.name]);
+                                                    var isCurrentlyConfigured 
= nf.Common.isDefinedAndNotNull(controllerService.properties[descriptor.name]);
+
                                                     // if we are attempting to 
update a controller service reference
-                                                    if 
(!nf.Common.isUndefined(updatedControllerService.controllerService.properties[descriptor.name])
 &&
-                                                            
!nf.Common.isNull(controllerService.properties[descriptor.name])) {
+                                                    if (modifyingService && 
isCurrentlyConfigured) {
                                                         
                                                         // record the current 
value if set
                                                         
previouslyReferencedServiceIds.push(controllerService.properties[descriptor.name]);

Reply via email to