You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by rf...@apache.org on 2020/06/09 19:26:45 UTC

[nifi] branch master updated: NIFI-7514: - Ensuring the group id is always set in the properties table when loading properties. - Using a common approach to getting parameters in nfControllerService. - Code clean up. - Addressing review feedback. - Ensuring the service dialog is closed when navigating to the parameter context dialog.

This is an automated email from the ASF dual-hosted git repository.

rfellows pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new eb2ebef  NIFI-7514: - Ensuring the group id is always set in the properties table when loading properties. - Using a common approach to getting parameters in nfControllerService. - Code clean up. - Addressing review feedback. - Ensuring the service dialog is closed when navigating to the parameter context dialog.
eb2ebef is described below

commit eb2ebefc4682d3f95ba5c9cbb8f604f5331ec79e
Author: Matt Gilman <ma...@gmail.com>
AuthorDate: Mon Jun 8 17:05:24 2020 -0400

    NIFI-7514:
    - Ensuring the group id is always set in the properties table when loading properties.
    - Using a common approach to getting parameters in nfControllerService.
    - Code clean up.
    - Addressing review feedback.
    - Ensuring the service dialog is closed when navigating to the parameter context dialog.
    
    This closes #4322
---
 .../jquery/propertytable/jquery.propertytable.js   | 28 +++++++++++++++-------
 .../webapp/js/nf/canvas/nf-controller-service.js   | 14 ++++++-----
 .../main/webapp/js/nf/canvas/nf-reporting-task.js  |  6 +++--
 .../src/main/webapp/js/nf/nf-processor-details.js  | 10 ++++----
 4 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
index 4acaf94..4b08a31 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
@@ -1246,6 +1246,17 @@
     };
 
     var initPropertiesTable = function (table, options) {
+        // function for closing the dialog
+        var closeDialog = function () {
+            // close the dialog
+            var dialog = table.closest('.dialog');
+            if (dialog.hasClass('modal')) {
+                dialog.modal('hide');
+            } else {
+                dialog.hide();
+            }
+        }
+
         // function for formatting the property name
         var nameFormatter = function (row, cell, value, columnDef, dataContext) {
             var nameWidthOffset = 30;
@@ -1386,7 +1397,7 @@
             }
 
             if (referencesParam && canReadParamContext) {
-                markup += '<div title="Go to parameter" class="goto-to-parameter pointer fa fa-long-arrow-right"></div>';
+                markup += '<div title="Go to parameter" class="go-to-parameter pointer fa fa-long-arrow-right"></div>';
             }
 
             if (options.readOnly !== true) {
@@ -1510,12 +1521,7 @@
                 dataType: 'json'
             }).done(function (controllerServiceEntity) {
                 // close the dialog
-                var dialog = table.closest('.dialog');
-                if (dialog.hasClass('modal')) {
-                    dialog.modal('hide');
-                } else {
-                    dialog.hide();
-                }
+                closeDialog();
 
                 var controllerService = controllerServiceEntity.component;
                 $.Deferred(function (deferred) {
@@ -1616,7 +1622,7 @@
                                 propertyData.updateItem(property.id, updatedItem);
                             });
                     }
-                } else if (target.hasClass('goto-to-parameter')) {
+                } else if (target.hasClass('go-to-parameter')) {
                     var parameterContext;
                     if (_.isFunction(options.getParameterContext)) {
                         parameterContext = options.getParameterContext(groupId);
@@ -1627,6 +1633,9 @@
                             var paramRefsRegex = /#{([a-zA-Z0-9-_. ]+)}/;
                             var result = property.value.match(paramRefsRegex);
                             if (!_.isEmpty(result) && result.length === 2) {
+                                // close the dialog since we are sending the user to the parameter context
+                                closeDialog();
+
                                 var parameterName = result[1];
                                 nfParameterContexts.showParameterContext(parameterContext.id, null, parameterName);
                             }
@@ -2157,7 +2166,8 @@
         },
 
         /**
-         * Sets the current group id.
+         * Sets the current group id. This is used to indicate where inline Controller Services are created
+         * and to obtain the parameter context.
          */
         setGroupId: function (currentGroupId) {
             return this.each(function () {
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 f88c660..4fb41d7 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
@@ -1589,8 +1589,8 @@
         }).promise();
     };
 
-    var getParameterContext = function (groupId, controllerServiceEntity) {
-        if (_.isNil(controllerServiceEntity.parentGroupId)) {
+    var getParameterContext = function (groupId) {
+        if (_.isNil(groupId)) {
             return null;
         }
 
@@ -1598,7 +1598,7 @@
 
         // attempt to identify the parameter context, conditional based on whether
         // the user is configuring the current process group
-        if (_.isNil(groupId) || groupId === nfCanvasUtils.getGroupId()) {
+        if (groupId === nfCanvasUtils.getGroupId()) {
             parameterContext = nfCanvasUtils.getParameterContext();
         } else {
             var parentProcessGroup = nfCanvasUtils.getComponentByType('ProcessGroup').get(groupId);
@@ -1896,7 +1896,7 @@
                         return goToServiceFromProperty(serviceTable);
                     },
                     getParameterContext: function (groupId) {
-                        return getParameterContext(groupId, controllerServiceEntity);
+                        return getParameterContext(groupId);
                     }
                 });
 
@@ -2083,7 +2083,7 @@
                     supportsGoTo: true,
                     readOnly: true,
                     getParameterContext: function (groupId) {
-                        return getParameterContext(groupId, controllerServiceEntity);
+                        return getParameterContext(groupId);
                     }
                 });
 
@@ -2185,7 +2185,9 @@
                 controllerServiceDialog.modal('setButtonModel', buttons);
 
                 // load the property table
-                $('#controller-service-properties').propertytable('loadProperties', controllerService.properties, controllerService.descriptors, controllerServiceHistory.propertyHistory);
+                $('#controller-service-properties')
+                    .propertytable('setGroupId', controllerService.parentGroupId)
+                    .propertytable('loadProperties', controllerService.properties, controllerService.descriptors, controllerServiceHistory.propertyHistory);
 
                 // show the details
                 controllerServiceDialog.modal('show');
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
index 07e59f5..f8b0b1a 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
@@ -601,7 +601,7 @@
 
                 // load the property table
                 $('#reporting-task-properties')
-                    .propertytable('setGroupId', reportingTask.parentGroupId)
+                    .propertytable('setGroupId', null)
                     .propertytable('loadProperties', reportingTask.properties, reportingTask.descriptors, reportingTaskHistory.propertyHistory);
 
                 // show the details
@@ -721,7 +721,9 @@
                 reportingTaskDialog.modal('setButtonModel', buttons).modal('show');
 
                 // load the property table
-                $('#reporting-task-properties').propertytable('loadProperties', reportingTask.properties, reportingTask.descriptors, reportingTaskHistory.propertyHistory);
+                $('#reporting-task-properties')
+                    .propertytable('setGroupId', null)
+                    .propertytable('loadProperties', reportingTask.properties, reportingTask.descriptors, reportingTaskHistory.propertyHistory);
 
                 // show the details
                 reportingTaskDialog.modal('show');
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js
index ec1daf3..93bd080 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js
@@ -174,13 +174,13 @@
             }
 
             // initialize the properties
-            
+
             $('#read-only-processor-properties').propertytable(Object.assign({
                     supportsGoTo: config.supportsGoTo,
                     readOnly: true
-                }, 
+                },
                 //incase of summary window, nfCanvasUtils module wont be loaded
-                nfCanvasUtils && { 
+                nfCanvasUtils && {
                     getParameterContext: function (groupId) {
                         // processors being configured must be in the current group
                         return nfCanvasUtils.getParameterContext();
@@ -289,7 +289,9 @@
                 var selection;
 
                 // load the properties
-                $('#read-only-processor-properties').propertytable('loadProperties', processor.config.properties, processor.config.descriptors, history.propertyHistory);
+                $('#read-only-processor-properties')
+                    .propertytable('setGroupId', processor.parentGroupId)
+                    .propertytable('loadProperties', processor.config.properties, processor.config.descriptors, history.propertyHistory);
 
                 var buttons = [{
                     buttonText: 'Ok',