You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sc...@apache.org on 2019/09/05 18:07:22 UTC

[nifi] 02/12: NIFI-6506 - Fix syntax/style issues. Apply same logic for disabled state when converting prop to param.

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

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

commit f3a04521c2cb37c1bc03a0c458e90889b43a9878
Author: Rob Fellows <ro...@gmail.com>
AuthorDate: Tue Sep 3 08:54:29 2019 -0400

    NIFI-6506 - Fix syntax/style issues. Apply same logic for disabled state when converting prop to param.
---
 .../webapp/js/nf/canvas/nf-parameter-contexts.js   | 32 +++++++++++++++-------
 1 file changed, 22 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-parameter-contexts.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
index ec617aa..e3eac2c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js
@@ -823,11 +823,11 @@
         }
 
         return {
-            name,
-            value,
-            description,
+            name: name,
+            value: value,
+            description: description,
             sensitive: isSensitive,
-            isEmptyStringSet
+            isEmptyStringSet: isEmptyStringSet
         }
     };
 
@@ -1850,7 +1850,21 @@
         initParameterTable();
     };
 
-    var openAddParameterDialog = function ({ onApply, onCancel }) {
+    /**
+     * Opens the Add Parameter Dialog.
+     * @param {Object} callbacks object with callbacks for handling the cancel and apply button functionality:
+     *
+     * @example
+     * openAddParameterDialog({
+     *     onApply: function () {
+     *         // handle the apply button being clicked
+     *     },
+     *     onCancel: function() {
+     *         // handle the cancel button being clicked
+     *     }
+     * });
+     */
+    var openAddParameterDialog = function (callbacks) {
         $('#parameter-dialog')
             .modal('setHeaderText', 'Add Parameter')
             .modal('setButtonModel', [{
@@ -1862,21 +1876,19 @@
                 },
                 disabled: function () {
                     var parameterName = $('#parameter-name').val();
-                    var parameterValue = $('#parameter-value-field').val();
-                    var isEmptyString = $('#parameter-dialog').find('.nf-checkbox').hasClass('checkbox-checked');
                     var isUpdatingParameterContext = $('#parameter-context-updating-status').hasClass('show-status');
 
                     if (isUpdatingParameterContext) {
                         return true;
                     }
 
-                    if ((parameterName !== '' && parameterValue !== '') || (parameterName !== '' && isEmptyString)) {
+                    if (parameterName !== '') {
                         return false;
                     }
                     return true;
                 },
                 handler: {
-                    click: onApply
+                    click: callbacks.onApply
                 }
             }, {
                 buttonText: 'Cancel',
@@ -1886,7 +1898,7 @@
                     text: '#004849'
                 },
                 handler: {
-                    click: onCancel
+                    click: callbacks.onCancel
                 }
             }])
             .modal('show');