You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/01/29 19:02:36 UTC

incubator-nifi git commit: NIFI-250: - Showing components that reference a given controller service.

Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-250 60ad99815 -> b98a7220c


NIFI-250:
- Showing components that reference a given controller service.

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

Branch: refs/heads/NIFI-250
Commit: b98a7220c04582ad7305429ddee850096c2139cd
Parents: 60ad998
Author: Matt Gilman <ma...@gmail.com>
Authored: Thu Jan 29 12:56:15 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Thu Jan 29 12:56:15 2015 -0500

----------------------------------------------------------------------
 .../css/controller-service-configuration.css    | 32 +++++++++
 .../src/main/webapp/css/settings.css            |  2 +-
 .../nf-controller-service-configuration.js      | 71 ++++++++++++++++----
 3 files changed, 91 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b98a7220/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service-configuration.css
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service-configuration.css b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service-configuration.css
index 9b950ce..357aa6b 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service-configuration.css
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/controller-service-configuration.css
@@ -111,6 +111,10 @@ div.availability-setting {
     line-height: 18px;
 }
 
+/*
+    Service references
+*/
+
 #controller-service-references {
     border: 0 solid #CCCCCC;
     height: 280px;
@@ -120,6 +124,34 @@ div.availability-setting {
     width: 376px;
 }
 
+div.reference-block {
+    margin-bottom: 4px;
+}
+
+span.reference-title {
+    margin-left: 5px;
+    font-weight: bold
+}
+
+span.reference-count {
+    margin-left: 5px;
+    color: #aaa;
+}
+
+ul.reference-listing {
+    margin-left: 20px;
+    margin-bottom: 8px;
+}
+
+ul.reference-listing li {
+    margin-bottom: 3px;
+}
+
+span.reference-type {
+    margin-left: 5px;
+    color: #aaa;
+}
+
 /*
     Comments
 */

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b98a7220/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/settings.css
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/settings.css b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/settings.css
index 91805e1..e1a8cc9 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/settings.css
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/settings.css
@@ -46,7 +46,7 @@
 span.expansion-button {
     width: 10px;
     height: 10px;
-    float: left;
+    display: inline-block;
 }
 
 span.ancestor-type {

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/b98a7220/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service-configuration.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-configuration.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-configuration.js
index 951103b..64e5a23 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-configuration.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-configuration.js
@@ -169,34 +169,79 @@ nf.ControllerServiceConfiguration = (function () {
      * @param {array} references
      */
     var createReferences = function (references) {
-        var processors = $('<ul class="processor-references"></ul>');
-        var services = $('<ul class="controller-service-references"></ul>');
-        var tasks = $('<ul class="reporting-task-references"></ul>');
+        var processors = $('<ul class="reference-listing clear"></ul>');
+        var services = $('<ul class="reference-listing clear"></ul>');
+        var tasks = $('<ul class="reference-listing clear"></ul>');
         $.each(references, function (_, reference) {
             if (reference.referenceType === 'Processor') {
-                var processorItem = $('<li></li>').text(reference.name);
+                var processorLink = $('<span class="link"></span>').text(reference.name).on('click', function () {
+                    // show the component
+                    nf.CanvasUtils.showComponent(reference.groupId, reference.id);
+                    
+                    // close the dialog and shell
+                    $('#controller-service-configuration').modal('hide');
+                    $('#shell-close-button').click();
+                });
+                
+                var processorType = $('<span class="reference-type"></span>').text('(' + nf.Common.substringAfterLast(reference.type, '.') + ')');
+                var processorItem = $('<li></li>').append(processorLink).append(processorType);
                 processors.append(processorItem);
             } else if (reference.referenceType === 'ControllerService') {
-                var serviceItem = $('<li></li>').text(reference.name);
+                var serviceItem = $('<li></li>').text(reference.name).on('click', function () {
+                    
+                });
                 services.append(serviceItem);
             } else if (reference.referenceType === 'ReportingTask') {
-                var taskItem = $('<li></li>').text(reference.name);
+                var taskItem = $('<li></li>').text(reference.name).on('click', function () {
+                    
+                });
                 tasks.append(taskItem);
             }
         });
         
-//        .append('<span class="expansion-button expanded"></span>')
+        // toggles the visibility of a listing
+        var toggle = function (twist, list) {
+            if (twist.hasClass('expanded')) {
+                twist.removeClass('expanded').addClass('collapsed');
+                list.hide();
+            } else {
+                twist.removeClass('collapsed').addClass('expanded');
+                list.show();
+            }
+        };
         
+        // create the collapsable listing for each type
         var controllerServiceReferences = $('#controller-service-references');
-        $('<div>Processors</div>').on('click', function () {
+        var createReferenceBlock = function (titleText, list) {
+            var twist = $('<span class="expansion-button expanded"></span>');
+            var title = $('<span class="reference-title"></span>').text(titleText);
+            var count = $('<span class="reference-count"></span>').text('(' + list.children().length + ')');
             
-        }).append(processors).appendTo(controllerServiceReferences);
-        $('<div>Controller Services</div>').on('click', function () {
+            // create the reference block
+            $('<div class="reference-block pointer unselectable"></div>').on('click', function () {
+                // toggle this block
+                toggle(twist, list);
+                
+                // update the border if necessary
+                showReferencesBorder();
+            }).append(twist).append(title).append(count).appendTo(controllerServiceReferences);
             
-        }).append(services).appendTo(controllerServiceReferences);
-        $('<div>Reporting Tasks</div>').on('click', function () {
+            // show message for empty list
+            if (list.is(':empty')) {
+                list.append('<li class="unset" style="margin-top: 2px;">No ' + titleText.toLowerCase() + ' reference this service.</li>');
+            }
             
-        }).append(tasks).appendTo(controllerServiceReferences);
+            // add the listing
+            list.appendTo(controllerServiceReferences);
+        };
+        
+        // create blocks for each type of component
+        createReferenceBlock('Processors', processors);
+        createReferenceBlock('Controller Services', services);
+        createReferenceBlock('Reporting Tasks', tasks);
+        
+        // update the border if necessary
+        showReferencesBorder();
     };
     
     /**