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:29 UTC

[1/4] incubator-nifi git commit: NIFI-250: - Adding support to enable/disable controller services through the actions in the table.

Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-250 5d5cb8f10 -> 6581eb136


NIFI-250:
- Adding support to enable/disable controller services through the actions in the table.

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

Branch: refs/heads/NIFI-250
Commit: 91aa952f017dac0bf8cb1597ec3440f9bd8cda7a
Parents: 5d5cb8f
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Jan 28 09:24:27 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Jan 28 09:24:27 2015 -0500

----------------------------------------------------------------------
 .../src/main/webapp/js/nf/canvas/nf-settings.js | 43 ++++++++++++--------
 1 file changed, 26 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/91aa952f/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.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-settings.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
index 37f218b..fd504f8 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
@@ -694,6 +694,29 @@ nf.Settings = (function () {
         controllerServicesGrid.setSelectionModel(new Slick.RowSelectionModel());
         controllerServicesGrid.registerPlugin(new Slick.AutoTooltips());
         controllerServicesGrid.setSortColumn('name', true);
+        
+        // sets whether the specified controller service is enabled
+        var setEnabled = function (controllerService, enabled) {
+            var revision = nf.Client.getRevision();
+            return $.ajax({
+                type: 'PUT',
+                url: controllerService.uri,
+                data: {
+                    clientId: revision.clientId,
+                    version: revision.version,
+                    enabled: enabled
+                },
+                dataType: 'json'
+            }).done(function (response) {
+                // update the revision
+                nf.Client.setRevision(response.revision);
+
+                // update the service
+                controllerServicesData.updateItem(controllerService.id, response.controllerService);
+            }).fail(nf.Common.handleAjaxError);
+        };
+        
+        // configure a click listener
         controllerServicesGrid.onClick.subscribe(function (e, args) {
             var target = $(e.target);
             
@@ -705,23 +728,9 @@ nf.Settings = (function () {
                 if (target.hasClass('edit-controller-service')) {
                     nf.ControllerServiceConfiguration.showConfiguration(controllerService);
                 } else if (target.hasClass('enable-controller-service')) {
-                    var revision = nf.Client.getRevision();
-                    return $.ajax({
-                        type: 'PUT',
-                        url: controllerService.uri,
-                        data: {
-                            clientId: revision.clientId,
-                            version: revision.version,
-                            enabled: true
-                        },
-                        dataType: 'json'
-                    }).done(function (response) {
-                        // update the revision
-                        nf.Client.setRevision(response.revision);
-                        
-                        // update the service
-                        controllerServicesData.updateItem(controllerService.id, response.controllerService);
-                    }).fail(nf.Common.handleAjaxError);
+                    setEnabled(controllerService, true);
+                } else if (target.hasClass('disable-controller-service')) {
+                    setEnabled(controllerService, false);
                 } else if (target.hasClass('delete-controller-service')) {
                     var revision = nf.Client.getRevision();
                     return $.ajax({


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

Posted by mc...@apache.org.
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, {});
 


[3/4] incubator-nifi git commit: NIFI-250: - Fixing the NODE_ONLY value.

Posted by mc...@apache.org.
NIFI-250:
- Fixing the NODE_ONLY value.

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

Branch: refs/heads/NIFI-250
Commit: 68583ab90a50f5929859144326dc105cc4753acd
Parents: e06e423
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Jan 28 09:36:34 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Jan 28 09:36:34 2015 -0500

----------------------------------------------------------------------
 .../webapp/js/nf/canvas/nf-controller-service-configuration.js     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/68583ab9/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 5620cf9..575e6e7 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
@@ -207,7 +207,7 @@ nf.ControllerServiceConfiguration = (function () {
                         description: 'This controller service will be available on the cluster manager only.'
                     }, {
                         text: 'Node',
-                        value: 'NODE',
+                        value: 'NODE_ONLY',
                         description: 'This controller service will be available on the nodes only.'
                     }, {
                         text: 'Both',


[4/4] incubator-nifi git commit: NIFI-250: - Including the controller service references.

Posted by mc...@apache.org.
NIFI-250:
- Including the controller service references.

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

Branch: refs/heads/NIFI-250
Commit: 6581eb1360902225312d532c07b86343df175bc5
Parents: 68583ab
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Jan 28 10:32:15 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Jan 28 10:32:15 2015 -0500

----------------------------------------------------------------------
 .../nifi/web/api/dto/ControllerServiceDTO.java  | 104 +++++++++++++++++++
 .../org/apache/nifi/web/api/dto/DtoFactory.java |  25 +++++
 2 files changed, 129 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6581eb13/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
index 05e6ad6..e8f5763 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
@@ -17,6 +17,7 @@
 package org.apache.nifi.web.api.dto;
 
 import java.util.Map;
+import java.util.Set;
 import javax.xml.bind.annotation.XmlType;
 
 /**
@@ -35,6 +36,8 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
     private Map<String, PropertyDescriptorDTO> descriptors;
  
     private String annotationData;
+    
+    private Set<ControllerServiceReferenceDTO> references;
 
     /**
      * The controller service name.
@@ -139,9 +142,110 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
     public void setAnnotationData(String annotationData) {
         this.annotationData = annotationData;
     }
+
+    /**
+     * All components referencing this controller service.
+     * 
+     * @return 
+     */
+    public Set<ControllerServiceReferenceDTO> getReferences() {
+        return references;
+    }
+
+    public void setReferences(Set<ControllerServiceReferenceDTO> references) {
+        this.references = references;
+    }
     
     @XmlType(name = "controllerServiceReference")
     public static class ControllerServiceReferenceDTO {
+        private String groupId;
+        private String id;
+        private String name;
+        private String type;
+        private String state;
+        private Boolean enabled;
+
+        /**
+         * Group id for this component referencing a controller service. If this
+         * component is another service, this field is blank.
+         * 
+         * @return 
+         */
+        public String getGroupId() {
+            return groupId;
+        }
+
+        public void setGroupId(String groupId) {
+            this.groupId = groupId;
+        }
+
+        /**
+         * The id for this component referencing a controller service.
+         * 
+         * @return 
+         */
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        /**
+         * The name for this component referencing a controller service.
+         * 
+         * @return 
+         */
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /**
+         * The type for this component referencing a controller service.
+         * 
+         * @return 
+         */
+        public String getType() {
+            return type;
+        }
+
+        public void setType(String type) {
+            this.type = type;
+        }
+
+        /**
+         * The state of the processor referencing a controller service. If this
+         * component is another service, this field is blank.
+         * 
+         * @return 
+         */
+        public String getState() {
+            return state;
+        }
+
+        public void setState(String state) {
+            this.state = state;
+        }
+
+        /**
+         * The enabled state of the controller service referencing a controller service.
+         * If this component is a processor, this field is blank.
+         * 
+         * @return 
+         */
+        public Boolean getEnabled() {
+            return enabled;
+        }
+
+        public void setEnabled(Boolean enabled) {
+            this.enabled = enabled;
+        }
+        
         
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6581eb13/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
index 132797d..78d3c85 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
@@ -123,7 +123,9 @@ import org.apache.nifi.web.api.dto.status.ProcessorStatusDTO;
 import org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO;
 import org.apache.nifi.web.api.dto.status.StatusDTO;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.controller.ConfiguredComponent;
 import org.apache.nifi.controller.service.ControllerServiceNode;
+import org.apache.nifi.web.api.dto.ControllerServiceDTO.ControllerServiceReferenceDTO;
 
 /**
  *
@@ -886,6 +888,29 @@ public final class DtoFactory {
             dto.getProperties().put(descriptor.getName(), propertyValue);
         }
         
+        // initialize the references
+        dto.setReferences(new LinkedHashSet<ControllerServiceReferenceDTO>());
+        
+        // get all references
+        for (final ConfiguredComponent component : controllerServiceNode.getReferences().getReferencingComponents()) {
+            final ControllerServiceReferenceDTO reference = new ControllerServiceReferenceDTO();
+            reference.setId(component.getIdentifier());
+            reference.setName(component.getName());
+
+            if (component instanceof ProcessorNode) {
+                final ProcessorNode node = ((ProcessorNode) component);
+                reference.setGroupId(node.getProcessGroup().getIdentifier());
+                reference.setState(node.getScheduledState().name());
+                reference.setType(node.getProcessor().getClass().getName());
+            } else if (component instanceof ControllerServiceNode) {
+                final ControllerServiceNode node = ((ControllerServiceNode) component);
+                reference.setEnabled(!node.isDisabled());
+                reference.setType(node.getControllerServiceImplementation().getClass().getName());
+            }
+            
+            dto.getReferences().add(reference);
+        }
+        
         return dto;
     }