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 2017/08/16 15:57:19 UTC

[2/2] nifi git commit: NIFI-3780 - Should be able to specify Service...

NIFI-3780 - Should be able to specify Service...

...name when I create a new Controller Service within a Processor/Service configuration dialog

Changed CS name default's behavior according to PR feedback.

Signed-off-by: Scott Aslan <sc...@gmail.com>

This closes #2081


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

Branch: refs/heads/master
Commit: 02c05bc2037ca2e4ee1850a8cb765d85a4f3b8a3
Parents: 79300de
Author: yuri1969 <19...@gmail.com>
Authored: Tue Aug 15 20:50:51 2017 +0200
Committer: Scott Aslan <sc...@gmail.com>
Committed: Wed Aug 16 11:56:23 2017 -0400

----------------------------------------------------------------------
 .../src/main/webapp/css/controller-service.css  |  2 +-
 .../propertytable/jquery.propertytable.js       | 24 ++++++++++++++------
 .../src/main/webapp/js/nf/nf-common.js          | 11 ++++++++-
 3 files changed, 28 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/02c05bc2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service.css
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service.css
index 88e6caa..49b7376 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service.css
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service.css
@@ -228,7 +228,7 @@ div.disable-referencing-components, div.enable-referencing-components {
     New inline controller service dialog
 */
 
-div.new-inline-controller-service-requirement, div.new-inline-controller-service-combo, div.new-inline-controller-service-bundle, div.new-inline-controller-service-tags, div.new-inline-controller-service-description {
+div.new-inline-controller-service-requirement, div.new-inline-controller-service-combo, input.new-inline-controller-service-name, div.new-inline-controller-service-bundle, div.new-inline-controller-service-tags {
     margin-bottom: 15px;
 }
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/02c05bc2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
----------------------------------------------------------------------
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 be96271..d1006ab 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
@@ -997,6 +997,12 @@
                                 '</div>' +
                             '</div>' +
                             '<div>' +
+                                '<div class="setting-name">Controller Service Name</div>' +
+                                '<div class="setting-field">' +
+                                    '<input type="text" class="new-inline-controller-service-name"/>' +
+                                '</div>' +
+                            '</div>' +
+                            '<div>' +
                                 '<div class="setting-name">Bundle</div>' +
                                 '<div class="setting-field">' +
                                     '<div class="new-inline-controller-service-bundle"></div>' +
@@ -1014,22 +1020,16 @@
                                     '<div class="new-inline-controller-service-description"></div>' +
                                 '</div>' +
                             '</div>' +
-                            '<div>' +
-                                '<div class="setting-name">Controller Service Name</div>' +
-                                '<div class="setting-field">' +
-                                    '<input type="text" class="new-inline-controller-service-name"/>' +
-                                '</div>' +
-                            '</div>' +
                         '</div>' +
                     '</div>';
 
                 var newControllerServiceDialog = $(newControllerServiceDialogMarkup).appendTo(configurationOptions.dialogContainer);
                 var newControllerServiceRequirement = newControllerServiceDialog.find('div.new-inline-controller-service-requirement');
                 var newControllerServiceCombo = newControllerServiceDialog.find('div.new-inline-controller-service-combo');
+                var newControllerServiceNameInput = newControllerServiceDialog.find('input.new-inline-controller-service-name');
                 var newControllerServiceBundle = newControllerServiceDialog.find('div.new-inline-controller-service-bundle');
                 var newControllerServiceTags = newControllerServiceDialog.find('div.new-inline-controller-service-tags');
                 var newControllerServiceDescription = newControllerServiceDialog.find('div.new-inline-controller-service-description');
-                var newControllerServiceNameInput = newControllerServiceDialog.find('input.new-inline-controller-service-name');
 
                 // include the required service
                 var formattedType = nfCommon.formatType({
@@ -1050,6 +1050,10 @@
                     return aName === bName ? -nfCommon.sortVersion(aCS.bundle.version, bCS.bundle.version) : aName > bName ? 1 : -1;
                 });
 
+                // default to the first service
+                var newControllerServiceNameDefault = nfCommon.formatClassName(controllerServiceLookup.get(0));
+                newControllerServiceNameInput.val(newControllerServiceNameDefault);
+
                 // build the combo field
                 newControllerServiceCombo.combo({
                     options: options,
@@ -1059,6 +1063,12 @@
                         newControllerServiceBundle.text(nfCommon.formatBundle(service.bundle));
                         newControllerServiceTags.text(service.tags.join(', '));
                         newControllerServiceDescription.text(service.description);
+
+                        // update default when no edits were made
+                        if (newControllerServiceNameDefault === newControllerServiceNameInput.val().trim()) {
+                            newControllerServiceNameDefault = nfCommon.formatClassName(service);
+                            newControllerServiceNameInput.val(newControllerServiceNameDefault);
+                        }
                     }
                 });
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/02c05bc2/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
index b1e2dec..646967e 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
@@ -418,12 +418,21 @@
         },
 
         /**
+         * Formats the class name of this component.
+         *
+         * @param dataContext component datum
+         */
+        formatClassName: function (dataContext) {
+            return nfCommon.substringAfterLast(dataContext.type, '.');
+        },
+
+        /**
          * Formats the type of this component.
          *
          * @param dataContext component datum
          */
         formatType: function (dataContext) {
-            var typeString = nfCommon.substringAfterLast(dataContext.type, '.');
+            var typeString = nfCommon.formatClassName(dataContext);
             if (dataContext.bundle.version !== 'unversioned') {
                 typeString += (' ' + dataContext.bundle.version);
             }