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/28 16:32:30 UTC

[2/4] incubator-nifi git commit: NIFI-250: - Only showing the availability field when clustered.

NIFI-250:
- Only showing the availability field when clustered.

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

Branch: refs/heads/NIFI-250
Commit: e06e423ff191696f0ab2a081434ac7b26e183b91
Parents: 91aa952
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Jan 28 09:30:33 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Jan 28 09:30:33 2015 -0500

----------------------------------------------------------------------
 .../canvas/controller-service-configuration.jsp |  6 ++--
 .../css/controller-service-configuration.css    | 11 ++++++
 .../nf-controller-service-configuration.js      | 38 ++++++++++++++++++++
 3 files changed, 52 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e06e423f/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/controller-service-configuration.jsp
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/controller-service-configuration.jsp b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/controller-service-configuration.jsp
index b1454c4..1cadf1d 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/controller-service-configuration.jsp
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/controller-service-configuration.jsp
@@ -43,14 +43,14 @@
                             <span id="controller-service-type"></span>
                         </div>
                     </div>
-                    <div class="setting">
-                        <div class="bulletin-setting">
+                    <div id="availability-setting-container" class="setting hidden">
+                        <div class="availability-setting">
                             <div class="setting-name">
                                 Availability
                                 <img class="setting-icon icon-info" src="images/iconInfo.png" alt="Info" title="Where this controller service will be available."/>
                             </div>
                             <div class="setting-field">
-                                <div id="bulletin-level-combo"></div>
+                                <div id="availability-combo"></div>
                             </div>
                         </div>
                         <div class="clear"></div>

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e06e423f/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 c18a8fb..9b950ce 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
@@ -100,6 +100,17 @@ div.controller-service-enabled-container {
     margin-left: 10px;
 }
 
+div.availability-setting {
+    float: left;
+    width: 140px;
+}
+
+#availability-combo {
+    width: 130px;
+    height: 18px;
+    line-height: 18px;
+}
+
 #controller-service-references {
     border: 0 solid #CCCCCC;
     height: 280px;

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e06e423f/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 5d6a496..5620cf9 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
@@ -65,6 +65,12 @@ nf.ControllerServiceConfiguration = (function () {
         } else if ($('#controller-service-enabled').hasClass('checkbox-unchecked') && details['enabled'] === true) {
             return true;
         }
+        
+        if (nf.Canvas.isClustered()) {
+            if ($('#availability-combo').combo('getSelectedOption').value !== (details['availability'] + '')) {
+                return true;
+            }
+        }
 
         // defer to the properties
         return $('#controller-service-properties').propertytable('isSaveRequired');
@@ -94,6 +100,11 @@ nf.ControllerServiceConfiguration = (function () {
             controllerServiceDto['enabled'] = true;
         }
 
+        // add the availability if appropriate
+        if (nf.Canvas.isClustered()) {
+            controllerServiceDto['availability'] = $('#availability-combo').combo('getSelectedOption').value;
+        }
+
         // create the controller service entity
         var controllerServiceEntity = {};
         controllerServiceEntity['revision'] = nf.Client.getRevision();
@@ -186,6 +197,26 @@ nf.ControllerServiceConfiguration = (function () {
 //                    }
                 }
             });
+            
+            // we clustered we need to show the controls for editing the availability
+            if (nf.Canvas.isClustered()) {
+                $('#availability-combo').combo({
+                    options: [{
+                        text: 'Cluster Manager',
+                        value: 'CLUSTER_MANAGER_ONLY',
+                        description: 'This controller service will be available on the cluster manager only.'
+                    }, {
+                        text: 'Node',
+                        value: 'NODE',
+                        description: 'This controller service will be available on the nodes only.'
+                    }, {
+                        text: 'Both',
+                        value: 'BOTH',
+                        description: 'This controller service will be available on the cluster manager and the nodes.'
+                    }]
+                });
+                $('#availability-setting-container').show();
+            }
 
             // initialize the conroller service configuration dialog
             $('#controller-service-configuration').modal({
@@ -238,6 +269,13 @@ nf.ControllerServiceConfiguration = (function () {
             $('#controller-service-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(controllerServiceEnableStyle);
             $('#controller-service-comments').val(controllerService['comments']);
 
+            // select the availability when appropriate
+            if (nf.Canvas.isClustered()) {
+                $('#availability-combo').combo('setSelectedOption', {
+                    value: controllerService['availability']
+                });
+            }
+
             // load the property table
             $('#controller-service-properties').propertytable('loadProperties', controllerService.properties, controllerService.descriptors, {});