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/12/16 16:54:27 UTC

nifi git commit: NIFI-1215: - Only showing the run duration setting when applicable. - Showing the user a warning that a source processor with a non 0 run duration could lose data when NiFi is restarted.

Repository: nifi
Updated Branches:
  refs/heads/master 51b8ecd01 -> b19ff7cf3


NIFI-1215:
- Only showing the run duration setting when applicable.
- Showing the user a warning that a source processor with a non 0 run duration could lose data when NiFi is restarted.


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

Branch: refs/heads/master
Commit: b19ff7cf37162934cafabdf46dedd4afc46f2a82
Parents: 51b8ecd
Author: Matt Gilman <ma...@gmail.com>
Authored: Wed Dec 16 10:53:15 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed Dec 16 10:53:15 2015 -0500

----------------------------------------------------------------------
 .../apache/nifi/web/api/dto/ProcessorDTO.java   | 15 ++++++++++
 .../org/apache/nifi/web/api/dto/DtoFactory.java |  1 +
 .../partials/canvas/processor-configuration.jsp | 11 ++++++--
 .../WEB-INF/partials/processor-details.jsp      |  3 +-
 .../main/webapp/css/processor-configuration.css | 17 ++++++++++--
 .../js/nf/canvas/nf-processor-configuration.js  | 29 ++++++++++++++++----
 6 files changed, 63 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/b19ff7cf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java
index 866d77c..0e4ddde 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java
@@ -36,6 +36,7 @@ public class ProcessorDTO extends NiFiComponentDTO {
     private String description;
     private Boolean supportsParallelProcessing;
     private Boolean supportsEventDriven;
+    private Boolean supportsBatching;
     private String inputRequirement;
 
     private ProcessorConfigDTO config;
@@ -150,6 +151,20 @@ public class ProcessorDTO extends NiFiComponentDTO {
     }
 
     /**
+     * @return whether this processor supports batching
+     */
+    @ApiModelProperty(
+        value = "Whether the processor supports batching. This makes the run duration settings available."
+    )
+    public Boolean getSupportsBatching() {
+        return supportsBatching;
+    }
+
+    public void setSupportsBatching(Boolean supportsBatching) {
+        this.supportsBatching = supportsBatching;
+    }
+
+    /**
      * Gets the available relationships that this processor currently supports.
      *
      * @return The available relationships

http://git-wip-us.apache.org/repos/asf/nifi/blob/b19ff7cf/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-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-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
index c16653e..f26d1b7 100644
--- a/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-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
@@ -1484,6 +1484,7 @@ public final class DtoFactory {
         dto.setDescription(getCapabilityDescription(node.getClass()));
         dto.setSupportsParallelProcessing(!node.isTriggeredSerially());
         dto.setSupportsEventDriven(node.isEventDrivenSupported());
+        dto.setSupportsBatching(node.isHighThroughputSupported());
         dto.setConfig(createProcessorConfigDto(node));
 
         final Collection<ValidationResult> validationErrors = node.getValidationErrors();

http://git-wip-us.apache.org/repos/asf/nifi/blob/b19ff7cf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/processor-configuration.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/processor-configuration.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/processor-configuration.jsp
index 3516de7..0363f72 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/processor-configuration.jsp
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/processor-configuration.jsp
@@ -103,7 +103,7 @@
                             </div>
                         </div>
                         <div id="event-driven-warning" class="hidden">
-                            <div id="event-driven-warning-icon"></div>
+                            <div class="processor-configuration-warning-icon"></div>
                             This strategy is experimental
                         </div>
                         <div class="clear"></div>
@@ -164,11 +164,12 @@
                     </div>
                 </div>
                 <div class="spacer">&nbsp;</div>
-                <div class="settings-right">
+                <div id="run-duration-setting-container" class="settings-right">
                     <div class="setting">
                         <div class="setting-name">
                             Run duration
-                            <img class="setting-icon icon-info" src="images/iconInfo.png" alt="Info" title="When scheduled to run, the processor will continue running for this duration. A run duration of 0ms will execute once when scheduled."/>
+                            <img class="setting-icon icon-info" src="images/iconInfo.png" alt="Info"
+                                 title="When scheduled to run, the processor will continue running for up to this duration. A run duration of 0ms will execute once when scheduled."/>
                         </div>
                         <div class="setting-field" style="overflow: visible;">
                             <div id="run-duration-container">
@@ -189,6 +190,10 @@
                                     <div id="max-run-duration-explanation">Higher throughput</div>
                                     <div class="clear"></div>
                                 </div>
+                                <div id="run-duration-data-loss" class="hidden">
+                                    <div class="processor-configuration-warning-icon"></div>
+                                    Source Processors with a run duration greater than 0ms and no incoming connections could lose data when NiFi is shutdown.
+                                </div>
                             </div>
                         </div>
                     </div>

http://git-wip-us.apache.org/repos/asf/nifi/blob/b19ff7cf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/processor-details.jsp
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/processor-details.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/processor-details.jsp
index 31df7c9..5375174 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/processor-details.jsp
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/processor-details.jsp
@@ -129,7 +129,8 @@
                     <div class="setting">
                         <div class="setting-name">
                             Run duration
-                            <img class="setting-icon icon-info" src="images/iconInfo.png" alt="Info" title="The amount of time this processor will run for when scheduled."/>
+                            <img class="setting-icon icon-info" src="images/iconInfo.png" alt="Info"
+                                 title="When scheduled to run, the processor will continue running for up to this duration. A run duration of 0ms will execute once when scheduled."/>
                         </div>
                         <div class="setting-field">
                             <span id="read-only-run-duration"></span>

http://git-wip-us.apache.org/repos/asf/nifi/blob/b19ff7cf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/processor-configuration.css
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/processor-configuration.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/processor-configuration.css
index 1dc52f3..1186aaa 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/processor-configuration.css
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/processor-configuration.css
@@ -113,13 +113,15 @@ div.processor-enabled-container {
 #event-driven-warning {
     padding-top: 22px;
     color: #f00;
+    float: left;
+    float: left;
+    margin-left: 10px;
 }
 
-#event-driven-warning-icon {
+div.processor-configuration-warning-icon {
     float: left;
     margin-top: -2px;
-    margin-right: 5px;
-    margin-left: 5px;
+    margin-right: 8px;
     width: 18px;
     height: 16px;
     background-image: url(../images/iconAlert.png);
@@ -216,6 +218,15 @@ div.relationship-description {
     line-height: normal;
 }
 
+#run-duration-data-loss {
+    margin-top: 15px;
+    color: #f00;
+}
+
+#run-duration-data-loss div.processor-configuration-warning-icon {
+    margin-top: 4px;
+}
+
 #min-run-duration-explanation {
     float: left;
 }

http://git-wip-us.apache.org/repos/asf/nifi/blob/b19ff7cf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
index 2e48579..6d04a00 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
@@ -271,8 +271,10 @@ nf.ProcessorConfiguration = (function () {
         processorConfigDto['comments'] = $('#processor-comments').val();
 
         // run duration
-        var runDurationIndex = $('#run-duration-slider').slider('value');
-        processorConfigDto['runDurationMillis'] = RUN_DURATION_VALUES[runDurationIndex];
+        if ($('#run-duration-setting-container').is(':visible')) {
+            var runDurationIndex = $('#run-duration-slider').slider('value');
+            processorConfigDto['runDurationMillis'] = RUN_DURATION_VALUES[runDurationIndex];
+        }
 
         // relationships
         processorConfigDto['autoTerminatedRelationships'] = marshalRelationships();
@@ -528,7 +530,15 @@ nf.ProcessorConfiguration = (function () {
             // initialize the run duration slider
             $('#run-duration-slider').slider({
                 min: 0,
-                max: RUN_DURATION_VALUES.length - 1
+                max: RUN_DURATION_VALUES.length - 1,
+                change: function (event, ui) {
+                    var processor = $('#processor-configuration').data('processorDetails');
+                    if (ui.value > 0 && (processor.inputRequirement === 'INPUT_FORBIDDEN' || processor.inputRequirement === 'INPUT_ALLOWED')) {
+                        $('#run-duration-data-loss').show();
+                    } else {
+                        $('#run-duration-data-loss').hide();
+                    }
+                }
             });
 
             // initialize the property table
@@ -598,9 +608,16 @@ nf.ProcessorConfiguration = (function () {
                     $('#yield-duration').val(processor.config['yieldDuration']);
                     $('#processor-comments').val(processor.config['comments']);
 
-                    // set the run duration
-                    var runDuration = RUN_DURATION_VALUES.indexOf(processor.config['runDurationMillis']);
-                    $('#run-duration-slider').slider('value', runDuration);
+                    // set the run duration if applicable
+                    if (processor.supportsBatching === true) {
+                        $('#run-duration-setting-container').show();
+
+                        // set the run duration slider value
+                        var runDuration = RUN_DURATION_VALUES.indexOf(processor.config['runDurationMillis']);
+                        $('#run-duration-slider').slider('value', runDuration);
+                    } else {
+                        $('#run-duration-setting-container').hide();
+                    }
 
                     // select the appropriate bulletin level
                     $('#bulletin-level-combo').combo('setSelectedOption', {