scottyaslan commented on a change in pull request #4969:
URL: https://github.com/apache/nifi/pull/4969#discussion_r606008307



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
##########
@@ -498,293 +525,261 @@
         var referencingControllerServices = [];
         var unauthorizedReferencingComponents = [];
 
-        // clear the referencing components from the previous selection
-        resetUsage();
-
-        var parameterReferencingComponentsContainer = 
$('#parameter-referencing-components-container');
-
-        // referencing component will be undefined when a new parameter is 
added
-        if (nfCommon.isUndefined(referencingComponents)) {
-            // set to pending
-            $('<div class="referencing-component-container"><span 
class="unset">Pending 
Apply</span></div>').appendTo(parameterReferencingComponentsContainer);
-        } else {
-            var referencingComponentsForBulletinRetrieval = [];
+        var spinner = $('#parameter-context-usage 
.referencing-components-loading');
 
-            // bin the referencing components according to their type
-            $.each(referencingComponents, function (_, 
referencingComponentEntity) {
-                if (referencingComponentEntity.permissions.canRead === true && 
referencingComponentEntity.permissions.canWrite === true) {
-                    
referencingComponentsForBulletinRetrieval.push(referencingComponentEntity.id);
+        var loadingDeferred = $.Deferred(function (deferred) {
+            spinner.addClass('ajax-loading');
+            deferred.resolve();
+        });
+        loadingDeferred.then(function () {

Review comment:
       I think you can remove this `then` if you call `resetUsage();` above.

##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
##########
@@ -498,293 +525,261 @@
         var referencingControllerServices = [];
         var unauthorizedReferencingComponents = [];
 
-        // clear the referencing components from the previous selection
-        resetUsage();
-
-        var parameterReferencingComponentsContainer = 
$('#parameter-referencing-components-container');
-
-        // referencing component will be undefined when a new parameter is 
added
-        if (nfCommon.isUndefined(referencingComponents)) {
-            // set to pending
-            $('<div class="referencing-component-container"><span 
class="unset">Pending 
Apply</span></div>').appendTo(parameterReferencingComponentsContainer);
-        } else {
-            var referencingComponentsForBulletinRetrieval = [];
+        var spinner = $('#parameter-context-usage 
.referencing-components-loading');
 
-            // bin the referencing components according to their type
-            $.each(referencingComponents, function (_, 
referencingComponentEntity) {
-                if (referencingComponentEntity.permissions.canRead === true && 
referencingComponentEntity.permissions.canWrite === true) {
-                    
referencingComponentsForBulletinRetrieval.push(referencingComponentEntity.id);
+        var loadingDeferred = $.Deferred(function (deferred) {
+            spinner.addClass('ajax-loading');
+            deferred.resolve();

Review comment:
       ```suggestion
               resetUsage();
               deferred.resolve();
   ```

##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js
##########
@@ -820,170 +846,141 @@
         var affectedControllerServices = [];
         var unauthorizedAffectedComponents = [];
 
-        // clear the affected components from the previous selection
-        var processorContainer = $('#variable-registry-affected-processors');
-        nfCommon.cleanUpTooltips(processorContainer, 
'div.referencing-component-state');
-        nfCommon.cleanUpTooltips(processorContainer, 
'div.referencing-component-bulletins');
-        processorContainer.empty();
-
-        var controllerServiceContainer = 
$('#variable-registry-affected-controller-services');
-        nfCommon.cleanUpTooltips(controllerServiceContainer, 
'div.referencing-component-state');
-        nfCommon.cleanUpTooltips(controllerServiceContainer, 
'div.referencing-component-bulletins');
-        controllerServiceContainer.empty();
-
-        var unauthorizedComponentsContainer = 
$('#variable-registry-affected-unauthorized-components').empty();
+        var spinner = $('#variable-registry-dialog 
.referencing-components-loading');
 
-        // affected component will be undefined when a new variable is added
-        if (nfCommon.isUndefined(affectedComponents)) {
-            $('<li class="affected-component-container"><span 
class="unset">Pending Apply</span></li>').appendTo(processorContainer);
-            $('<li class="affected-component-container"><span 
class="unset">Pending Apply</span></li>').appendTo(controllerServiceContainer);
-            $('<li class="affected-component-container"><span 
class="unset">Pending 
Apply</span></li>').appendTo(unauthorizedComponentsContainer);
-        } else {
-            var referencingComponentsForBulletinRetrieval = [];
-
-            // bin the affected components according to their type
-            $.each(affectedComponents, function (_, affectedComponentEntity) {
-                if (affectedComponentEntity.permissions.canRead === true && 
affectedComponentEntity.permissions.canWrite === true) {
-                    
referencingComponentsForBulletinRetrieval.push(affectedComponentEntity.id);
+        var loadingDeferred = $.Deferred(function (deferred) {
+            spinner.addClass('ajax-loading');
+            deferred.resolve();
+        });
 
-                    if (affectedComponentEntity.component.referenceType === 
'PROCESSOR') {
-                        affectedProcessors.push(affectedComponentEntity);
+        var processorContainer = $('#variable-registry-affected-processors');
+        var controllerServiceContainer = 
$('#variable-registry-affected-controller-services');
+        var unauthorizedComponentsContainer = 
$('#variable-registry-affected-unauthorized-components');
+        loadingDeferred.then(function() {
+            // clear the affected components from the previous selection

Review comment:
       I think we want to clear out the old 'Referencing Components' as soon as 
we `spinner.addClass('ajax-loading');` on line 852




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to