Repository: nifi
Updated Branches:
  refs/heads/master 687a686b2 -> 3cc16d35e


http://git-wip-us.apache.org/repos/asf/nifi/blob/3cc16d35/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
index 9cfa194..cde1456 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js
@@ -101,9 +101,6 @@ nf.RemoteProcessGroup = (function () {
                 },
                 'fill': 'transparent',
                 'stroke': 'transparent'
-            })
-            .classed('unauthorized', function (d) {
-                return d.accessPolicy.canRead === false;
             });
 
         // remote process group body
@@ -118,9 +115,6 @@ nf.RemoteProcessGroup = (function () {
                 },
                 'filter': 'url(#component-drop-shadow)',
                 'stroke-width': 0
-            })
-            .classed('unauthorized', function (d) {
-                return d.accessPolicy.canRead === false;
             });
 
         // remote process group name background
@@ -156,14 +150,6 @@ nf.RemoteProcessGroup = (function () {
 
         // always support selection
         
remoteProcessGroup.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
-
-        // only support dragging and connecting when appropriate
-        remoteProcessGroup.filter(function (d) {
-            return d.accessPolicy.canWrite && d.accessPolicy.canRead;
-        }).call(nf.Draggable.activate).call(nf.Connectable.activate);
-
-        // call update to trigger some rendering
-        remoteProcessGroup.call(updateRemoteProcessGroups);
     };
 
     // attempt of space between component count and icon for process group 
contents
@@ -179,10 +165,25 @@ nf.RemoteProcessGroup = (function () {
             return;
         }
 
+        // remote process group border authorization
+        updated.select('rect.border')
+            .classed('unauthorized', function (d) {
+                return d.accessPolicy.canRead === false;
+            });
+
+        // remote process group body authorization
+        updated.select('rect.body')
+            .classed('unauthorized', function (d) {
+                return d.accessPolicy.canRead === false;
+            });
+
         updated.each(function (remoteProcessGroupData) {
             var remoteProcessGroup = d3.select(this);
             var details = 
remoteProcessGroup.select('g.remote-process-group-details');
 
+            // update the component behavior as appropriate
+            nf.CanvasUtils.editable(remoteProcessGroup);
+
             // if this processor is visible, render everything
             if (remoteProcessGroup.classed('visible')) {
                 if (details.empty()) {
@@ -223,28 +224,15 @@ nf.RemoteProcessGroup = (function () {
                             'y': 48
                         });
 
-                    if (remoteProcessGroupData.accessPolicy.canRead) {
-                        // remote process group uri
-                        details.append('text')
-                            .attr({
-                                'x': 30,
-                                'y': 48,
-                                'width': 305,
-                                'height': 12,
-                                'class': 'remote-process-group-uri'
-                            })
-                            .each(function (d) {
-                                var remoteProcessGroupUri = d3.select(this);
-
-                                // reset the remote process group name to 
handle any previous state
-                                
remoteProcessGroupUri.text(null).selectAll('title').remove();
-
-                                // apply ellipsis to the remote process group 
name as necessary
-                                nf.CanvasUtils.ellipsis(remoteProcessGroupUri, 
d.component.targetUri);
-                            }).append('title').text(function (d) {
-                            return d.component.name;
+                    // remote process group uri
+                    details.append('text')
+                        .attr({
+                            'x': 30,
+                            'y': 48,
+                            'width': 305,
+                            'height': 12,
+                            'class': 'remote-process-group-uri'
                         });
-                    }
 
                     // ----------------
                     // stats background
@@ -336,8 +324,8 @@ nf.RemoteProcessGroup = (function () {
                             'transform': 'translate(95, 75)'
                         });
 
-                    // queued value
-                    remoteProcessGroupStatsValue.append('text')
+                    // sent value
+                    var sentText = remoteProcessGroupStatsValue.append('text')
                         .attr({
                             'width': 180,
                             'height': 10,
@@ -346,8 +334,26 @@ nf.RemoteProcessGroup = (function () {
                             'class': 'remote-process-group-sent stats-value'
                         });
 
+                    // sent count
+                    sentText.append('tspan')
+                        .attr({
+                            'class': 'count'
+                        });
+
+                    // sent size
+                    sentText.append('tspan')
+                        .attr({
+                            'class': 'size'
+                        });
+
+                    // sent ports
+                    sentText.append('tspan')
+                        .attr({
+                            'class': 'ports'
+                        });
+
                     // received value
-                    remoteProcessGroupStatsValue.append('text')
+                    var receivedText = 
remoteProcessGroupStatsValue.append('text')
                         .attr({
                             'width': 180,
                             'height': 10,
@@ -356,6 +362,24 @@ nf.RemoteProcessGroup = (function () {
                             'class': 'remote-process-group-received 
stats-value'
                         });
 
+                    // received ports
+                    receivedText.append('tspan')
+                        .attr({
+                            'class': 'ports'
+                        });
+
+                    // received count
+                    receivedText.append('tspan')
+                        .attr({
+                            'class': 'count'
+                        });
+
+                    // received size
+                    receivedText.append('tspan')
+                        .attr({
+                            'class': 'size'
+                        });
+
                     // stats value container
                     var processGroupStatsInfo = details.append('g')
                         .attr({
@@ -470,6 +494,20 @@ nf.RemoteProcessGroup = (function () {
                 }
 
                 if (remoteProcessGroupData.accessPolicy.canRead) {
+                    // remote process group uri
+                    details.select('text.remote-process-group-uri')
+                        .each(function (d) {
+                            var remoteProcessGroupUri = d3.select(this);
+
+                            // reset the remote process group name to handle 
any previous state
+                            
remoteProcessGroupUri.text(null).selectAll('title').remove();
+
+                            // apply ellipsis to the remote process group name 
as necessary
+                            nf.CanvasUtils.ellipsis(remoteProcessGroupUri, 
d.component.targetUri);
+                        }).append('title').text(function (d) {
+                        return d.component.name;
+                    });
+
                     // update the process groups transmission status
                     
details.select('text.remote-process-group-transmission-secure')
                         .text(function (d) {
@@ -505,98 +543,6 @@ nf.RemoteProcessGroup = (function () {
                             nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
                         });
 
-                    // ----------------------
-                    // update the input ports
-                    // ----------------------
-
-                    // input port count
-                    
details.select('text.remote-process-group-input-port-count')
-                        .text(function (d) {
-                            return d.component.inputPortCount;
-                        });
-
-                    // get the input port container to help right align
-                    var inputContainer = 
details.select('rect.remote-process-group-input-container');
-
-                    // update input not transmitting
-                    var inputNotTransmittingCount = 
details.select('text.remote-process-group-input-not-transmitting-count')
-                        .text(function (d) {
-                            return d.component.inactiveRemoteInputPortCount;
-                        })
-                        .attr('x', function () {
-                            var containerX = 
parseInt(inputContainer.attr('x'), 10);
-                            var containerWidth = 
parseInt(inputContainer.attr('width'), 10);
-                            return containerX + containerWidth - 
this.getComputedTextLength() - CONTENTS_SPACER;
-                        });
-                    var inputNotTransmitting = 
details.select('image.remote-process-group-input-not-transmitting')
-                        .attr('x', function () {
-                            var inputNotTransmittingCountX = 
parseInt(inputNotTransmittingCount.attr('x'), 10);
-                            var width = 
parseInt(d3.select(this).attr('width'), 10);
-                            return inputNotTransmittingCountX - width - 
CONTENTS_SPACER;
-                        });
-
-                    // update input transmitting
-                    var inputTransmittingCount = 
details.select('text.remote-process-group-input-transmitting-count')
-                        .text(function (d) {
-                            return d.component.activeRemoteInputPortCount;
-                        })
-                        .attr('x', function () {
-                            var inputNotTransmittingX = 
parseInt(inputNotTransmitting.attr('x'), 10);
-                            return inputNotTransmittingX - 
this.getComputedTextLength() - CONTENTS_SPACER;
-                        });
-                    
details.select('image.remote-process-group-input-transmitting')
-                        .attr('x', function () {
-                            var inputTransmittingCountX = 
parseInt(inputTransmittingCount.attr('x'), 10);
-                            var width = 
parseInt(d3.select(this).attr('width'), 10);
-                            return inputTransmittingCountX - width - 
CONTENTS_SPACER;
-                        });
-
-                    // -----------------------
-                    // update the output ports
-                    // -----------------------
-
-                    // output port count
-                    
details.select('text.remote-process-group-output-port-count')
-                        .text(function (d) {
-                            return d.component.outputPortCount;
-                        });
-
-                    // get the output port container to help right align
-                    var outputContainer = 
details.select('rect.remote-process-group-output-container');
-
-                    // update input not transmitting
-                    var outputNotTransmittingCount = 
details.select('text.remote-process-group-output-not-transmitting-count')
-                        .text(function (d) {
-                            return d.component.inactiveRemoteOutputPortCount;
-                        })
-                        .attr('x', function () {
-                            var containerX = 
parseInt(outputContainer.attr('x'), 10);
-                            var containerWidth = 
parseInt(outputContainer.attr('width'), 10);
-                            return containerX + containerWidth - 
this.getComputedTextLength() - CONTENTS_SPACER;
-                        });
-                    var outputNotTransmitting = 
details.select('image.remote-process-group-output-not-transmitting')
-                        .attr('x', function () {
-                            var outputNotTransmittingCountX = 
parseInt(outputNotTransmittingCount.attr('x'), 10);
-                            var width = 
parseInt(d3.select(this).attr('width'), 10);
-                            return outputNotTransmittingCountX - width - 
CONTENTS_SPACER;
-                        });
-
-                    // update output transmitting
-                    var outputTransmittingCount = 
details.select('text.remote-process-group-output-transmitting-count')
-                        .text(function (d) {
-                            return d.component.activeRemoteOutputPortCount;
-                        })
-                        .attr('x', function () {
-                            var outputNotTransmittingX = 
parseInt(outputNotTransmitting.attr('x'), 10);
-                            return outputNotTransmittingX - 
this.getComputedTextLength() - CONTENTS_SPACER;
-                        });
-                    
details.select('image.remote-process-group-output-transmitting')
-                        .attr('x', function () {
-                            var outputTransmittingCountX = 
parseInt(outputTransmittingCount.attr('x'), 10);
-                            var width = 
parseInt(d3.select(this).attr('width'), 10);
-                            return outputTransmittingCountX - width - 
CONTENTS_SPACER;
-                        });
-
                     // ---------------
                     // update comments
                     // ---------------
@@ -643,6 +589,21 @@ nf.RemoteProcessGroup = (function () {
                         }).append('title').text(function (d) {
                         return d.component.name;
                     });
+                } else {
+                    // clear the target uri
+                    details.select('text.remote-process-group-uri').text(null);
+
+                    // clear the transmission secure icon
+                    
details.select('text.remote-process-group-transmission-secure').text(null);
+
+                    // clear the process group comments
+                    
details.select('text.remote-process-group-comments').text(null);
+
+                    // clear the last refresh
+                    
details.select('text.remote-process-group-last-refresh').text(null);
+
+                    // clear the name
+                    
remoteProcessGroup.select('text.remote-process-group-name').text(null);
                 }
 
                 // show the preview
@@ -688,24 +649,40 @@ nf.RemoteProcessGroup = (function () {
             return;
         }
 
-        // sent value
-        updated.select('text.remote-process-group-sent')
+        // sent count value
+        updated.select('text.remote-process-group-sent tspan.count')
             .text(function (d) {
-                if (nf.Common.isDefinedAndNotNull(d.status)) {
-                    return d.status.sent;
-                } else {
-                    return '- / -';
-                }
+                return 
nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.sent, ' ');
             });
 
-        // received value
-        updated.select('text.remote-process-group-received')
+        // sent size value
+        updated.select('text.remote-process-group-sent tspan.size')
             .text(function (d) {
-                if (nf.Common.isDefinedAndNotNull(d.status)) {
-                    return d.status.received;
-                } else {
-                    return '- / -';
-                }
+                return ' ' + 
nf.Common.substringAfterFirst(d.status.aggregateSnapshot.sent, ' ');
+            });
+
+        // sent ports value
+        updated.select('text.remote-process-group-sent tspan.ports')
+            .text(function (d) {
+                return ' ' + String.fromCharCode(8594) + ' ' + 
d.inputPortCount;
+            });
+
+        // received ports value
+        updated.select('text.remote-process-group-received tspan.ports')
+            .text(function (d) {
+                return d.inputPortCount + ' ' + String.fromCharCode(8594) + ' 
';
+            });
+
+        // received count value
+        updated.select('text.remote-process-group-received tspan.count')
+            .text(function (d) {
+                return 
nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.sent, ' ');
+            });
+
+        // received size value
+        updated.select('text.remote-process-group-received tspan.size')
+            .text(function (d) {
+                return ' ' + 
nf.Common.substringAfterFirst(d.status.aggregateSnapshot.sent, ' ');
             });
 
         // --------------------
@@ -717,7 +694,7 @@ nf.RemoteProcessGroup = (function () {
         updated.select('text.remote-process-group-transmission-status')
             .text(function (d) {
                 var icon = '';
-                if (nf.Common.isDefinedAndNotNull(d.status) && 
!nf.Common.isEmpty(d.status.authorizationIssues)) {
+                if 
(!nf.Common.isEmpty(d.status.aggregateSnapshot.authorizationIssues)) {
                     icon = '\uf071';
                 } else if (d.accessPolicy.canRead) {
                     if (d.component.transmitting === true) {
@@ -730,7 +707,7 @@ nf.RemoteProcessGroup = (function () {
             })
             .attr('font-family', function (d) {
                 var family = '';
-                if (nf.Common.isDefinedAndNotNull(d.status) && 
!nf.Common.isEmpty(d.status.authorizationIssues) || (d.accessPolicy.canRead && 
d.component.transmitting)) {
+                if 
(!nf.Common.isEmpty(d.status.aggregateSnapshot.authorizationIssues) || 
(d.accessPolicy.canRead && d.component.transmitting)) {
                     family = 'FontAwesome';
                 } else {
                     family = 'flowfont';
@@ -738,7 +715,7 @@ nf.RemoteProcessGroup = (function () {
                 return family;
             })
             .classed('has-authorization-errors', function (d) {
-                return nf.Common.isDefinedAndNotNull(d.status) && 
!nf.Common.isEmpty(d.status.authorizationIssues);
+                return 
!nf.Common.isEmpty(d.status.aggregateSnapshot.authorizationIssues);
             })
             .each(function (d) {
                 // remove the existing tip if necessary
@@ -748,14 +725,14 @@ nf.RemoteProcessGroup = (function () {
                 }
 
                 // if there are validation errors generate a tooltip
-                if (nf.Common.isDefinedAndNotNull(d.status) && 
!nf.Common.isEmpty(d.status.authorizationIssues)) {
+                if 
(!nf.Common.isEmpty(d.status.aggregateSnapshot.authorizationIssues)) {
                     tip = 
d3.select('#remote-process-group-tooltips').append('div')
                         .attr('id', function () {
                             return 'authorization-issues-' + d.id;
                         })
                         .attr('class', 'tooltip nifi-tooltip')
                         .html(function () {
-                            var list = 
nf.Common.formatUnorderedList(d.status.authorizationIssues);
+                            var list = 
nf.Common.formatUnorderedList(d.status.aggregateSnapshot.authorizationIssues);
                             if (list === null || list.length === 0) {
                                 return '';
                             } else {
@@ -785,7 +762,7 @@ nf.RemoteProcessGroup = (function () {
             // ---------
 
             
remoteProcessGroup.select('rect.bulletin-background').classed('has-bulletins', 
function () {
-                return nf.Common.isDefinedAndNotNull(d.status) && 
!nf.Common.isEmpty(d.status.bulletins);
+                return 
!nf.Common.isEmpty(d.status.aggregateSnapshot.bulletins);
             });
 
             nf.CanvasUtils.bulletins(remoteProcessGroup, d, function () {
@@ -837,13 +814,16 @@ nf.RemoteProcessGroup = (function () {
         },
 
         /**
-         * Populates the graph with the specified remote process groups.
+         * Adds the specified remote process group entity.
          *
-         * @argument {object | array} remoteProcessGroupEntities               
    The remote process groups to add
-         * @argument {boolean} selectAll                                    
Whether or not to select the new contents
+         * @param remoteProcessGroupEntities       The remote process group
+         * @param options           Configuration options
          */
-        add: function (remoteProcessGroupEntities, selectAll) {
-            selectAll = nf.Common.isDefinedAndNotNull(selectAll) ? selectAll : 
false;
+        add: function (remoteProcessGroupEntities, options) {
+            var selectAll = false;
+            if (nf.Common.isDefinedAndNotNull(options)) {
+                selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? 
options.selectAll : selectAll;
+            }
 
             var add = function (remoteProcessGroupEntity) {
                 // add the remote process group
@@ -858,12 +838,55 @@ nf.RemoteProcessGroup = (function () {
                 $.each(remoteProcessGroupEntities, function (_, 
remoteProcessGroupEntity) {
                     add(remoteProcessGroupEntity);
                 });
-            } else {
+            } else if 
(nf.Common.isDefinedAndNotNull(remoteProcessGroupEntities)) {
                 add(remoteProcessGroupEntities);
             }
 
+            // apply the selection and handle new remote process groups
+            var selection = select();
+            selection.enter().call(renderRemoteProcessGroups, selectAll);
+            selection.call(updateRemoteProcessGroups);
+        },
+        
+        /**
+         * Populates the graph with the specified remote process groups.
+         *
+         * @argument {object | array} remoteProcessGroupEntities               
    The remote process groups to add
+         * @argument {object} options                                    
Configuration options
+         */
+        set: function (remoteProcessGroupEntities, options) {
+            var selectAll = false;
+            var transition = false;
+            if (nf.Common.isDefinedAndNotNull(options)) {
+                selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? 
options.selectAll : selectAll;
+                transition = nf.Common.isDefinedAndNotNull(options.transition) 
? options.transition : transition;
+            }
+
+            var set = function (remoteProcessGroupEntity) {
+                // add the remote process group
+                remoteProcessGroupMap.set(remoteProcessGroupEntity.id, 
$.extend({
+                    type: 'RemoteProcessGroup',
+                    dimensions: dimensions
+                }, remoteProcessGroupEntity));
+            };
+
+            // determine how to handle the specified remote process groups
+            if ($.isArray(remoteProcessGroupEntities)) {
+                $.each(remoteProcessGroupMap.keys(), function (_, key) {
+                    remoteProcessGroupMap.remove(key);
+                });
+                $.each(remoteProcessGroupEntities, function (_, 
remoteProcessGroupEntity) {
+                    set(remoteProcessGroupEntity);
+                });
+            } else if 
(nf.Common.isDefinedAndNotNull(remoteProcessGroupEntities)) {
+                set(remoteProcessGroupEntities);
+            }
+
             // apply the selection and handle all new remote process groups
-            select().enter().call(renderRemoteProcessGroups, selectAll);
+            var selection = select();
+            selection.enter().call(renderRemoteProcessGroups, selectAll);
+            
selection.call(updateRemoteProcessGroups).call(nf.CanvasUtils.position, 
transition);
+            selection.exit().call(removeRemoteProcessGroups);
         },
 
         /**
@@ -935,35 +958,6 @@ nf.RemoteProcessGroup = (function () {
         },
 
         /**
-         * Sets the specified remote process group(s). If the is an array, it
-         * will set each remote process group. If it is not an array, it will
-         * attempt to set the specified remote process group.
-         *
-         * @param {object | array} remoteProcessGroupEntities
-         */
-        set: function (remoteProcessGroupEntities) {
-            var set = function (remoteProcessGroupEntity) {
-                if (remoteProcessGroupMap.has(remoteProcessGroupEntity.id)) {
-                    // update the current entry
-                    var remoteProcessGroupEntry = 
remoteProcessGroupMap.get(remoteProcessGroupEntity.id);
-                    $.extend(remoteProcessGroupEntry, 
remoteProcessGroupEntity);
-
-                    // update the remote process group in the UI
-                    d3.select('#id-' + 
remoteProcessGroupEntry.id).call(updateRemoteProcessGroups);
-                }
-            };
-
-            // determine how to handle the specified remote process group
-            if ($.isArray(remoteProcessGroupEntities)) {
-                $.each(remoteProcessGroupEntities, function (_, 
remoteProcessGroupEntity) {
-                    set(remoteProcessGroupEntity);
-                });
-            } else {
-                set(remoteProcessGroupEntities);
-            }
-        },
-
-        /**
          * Sets the remote process group status using the specified status.
          *
          * @param {array | object} remoteProcessGroupStatus       Remote 
process group status

http://git-wip-us.apache.org/repos/asf/nifi/blob/3cc16d35/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
index 5f22af5..4d2fbd4 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
@@ -204,8 +204,8 @@ nf.ReportingTask = (function () {
             dataType: 'json',
             contentType: 'application/json'
         }).done(function (response) {
-            // update the revision
-            nf.Client.setRevision(response.revision);
+            // TODO - update the revision
+            // nf.Client.setRevision(response.revision);
             
             // update the task
             renderReportingTask(response.reportingTask);
@@ -265,8 +265,8 @@ nf.ReportingTask = (function () {
                 contentType: 'application/json'
             }).done(function (response) {
                 if (nf.Common.isDefinedAndNotNull(response.reportingTask)) {
-                    // update the revision
-                    nf.Client.setRevision(response.revision);
+                    // TODO - update the revision
+                    // nf.Client.setRevision(response.revision);
                 }
             }).fail(handleReportingTaskConfigurationError);
         } else {
@@ -355,6 +355,7 @@ nf.ReportingTask = (function () {
             // initialize the property table
             $('#reporting-task-properties').propertytable({
                 readOnly: false,
+                groupId: nf.Canvas.getGroupId(),
                 dialogContainer: '#new-reporting-task-property-container',
                 descriptorDeferred: getReportingTaskPropertyDescriptor,
                 goToServiceDeferred: goToServiceFromProperty
@@ -376,6 +377,7 @@ nf.ReportingTask = (function () {
                 // initialize the property table
                 
$('#reporting-task-properties').propertytable('destroy').propertytable({
                     readOnly: false,
+                    groupId: nf.Canvas.getGroupId(),
                     dialogContainer: '#new-reporting-task-property-container',
                     descriptorDeferred: getReportingTaskPropertyDescriptor,
                     goToServiceDeferred: goToServiceFromProperty
@@ -722,8 +724,8 @@ nf.ReportingTask = (function () {
                 }),
                 dataType: 'json'
             }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
+                // TODO - update the revision
+                // nf.Client.setRevision(response.revision);
 
                 // remove the task
                 var reportingTaskGrid = 
$('#reporting-tasks-table').data('gridInstance');

http://git-wip-us.apache.org/repos/asf/nifi/blob/3cc16d35/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-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
index 8e4c0a5..5c2acb9 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
@@ -56,20 +56,12 @@ nf.Settings = (function () {
 
             // register the click listener for the archive link
             $('#archive-flow-link').click(function () {
-                var revision = nf.Client.getRevision();
-
                 $.ajax({
                     type: 'POST',
                     url: config.urls.controllerArchive,
-                    data: {
-                        version: revision.version,
-                        clientId: revision.clientId
-                    },
-                    dataType: 'json'
+                    dataType: 'json',
+                    contentType: 'application/json'
                 }).done(function (response) {
-                    // update the revision
-                    nf.Client.setRevision(response.revision);
-
                     // show the result dialog
                     nf.Dialog.showOkDialog({
                         dialogContent: 'A new flow archive was successfully 
created.',
@@ -83,7 +75,9 @@ nf.Settings = (function () {
                 // marshal the configuration details
                 var configuration = marshalConfiguration();
                 var entity = {
-                    'revision': nf.Client.getRevision(),
+                    'revision': nf.Client.getRevision({
+                        'version': 0
+                    }),
                     'config': configuration
                 };
 
@@ -95,15 +89,12 @@ nf.Settings = (function () {
                     dataType: 'json',
                     contentType: 'application/json'
                 }).done(function (response) {
-                    // update the revision
-                    nf.Client.setRevision(response.revision);
+                    // TODO - update the revision
+                    // nf.Client.setRevision(response.revision);
 
                     // update the displayed name
                     document.title = response.config.name;
 
-                    // set the data flow title and close the shell
-                    nf.Canvas.reload();
-
                     // close the settings dialog
                     nf.Dialog.showOkDialog({
                         dialogContent: 'Settings successfully applied.',
@@ -308,7 +299,6 @@ nf.Settings = (function () {
         
         // build the controller service entity
         var controllerServiceEntity = {
-            'revision': nf.Client.getRevision(),
             'controllerService': {
                 'type': controllerServiceType
             }
@@ -322,9 +312,6 @@ nf.Settings = (function () {
             dataType: 'json',
             contentType: 'application/json'
         }).done(function (response) {
-            // update the revision
-            nf.Client.setRevision(response.revision);
-
             // add the item
             var controllerService = response.controllerService;
             var controllerServicesGrid = 
$('#controller-services-table').data('gridInstance');
@@ -763,7 +750,9 @@ nf.Settings = (function () {
                 } else if (target.hasClass('delete-controller-service')) {
                     nf.ControllerService.remove(controllerService);
                 } else if (target.hasClass('view-state-controller-service')) {
-                    nf.ComponentState.showState(controllerService, 
controllerService.state === 'DISABLED');
+                    nf.ComponentState.showState(controllerService, {
+                        'version': 0
+                    }, controllerService.state === 'DISABLED');
                 }
             } else if (controllerServicesGrid.getColumns()[args.cell].id === 
'moreDetails') {
                 if (target.hasClass('view-controller-service')) {
@@ -1041,7 +1030,6 @@ nf.Settings = (function () {
         
         // build the reporting task entity
         var reportingTaskEntity = {
-            'revision': nf.Client.getRevision(),
             'reportingTask': {
                 'type': reportingTaskType
             }
@@ -1055,9 +1043,6 @@ nf.Settings = (function () {
             dataType: 'json',
             contentType: 'application/json'
         }).done(function (response) {
-            // update the revision
-            nf.Client.setRevision(response.revision);
-
             // add the item
             var reportingTask = response.reportingTask;
             var reportingTaskGrid = 
$('#reporting-tasks-table').data('gridInstance');
@@ -1419,7 +1404,9 @@ nf.Settings = (function () {
                     nf.ReportingTask.remove(reportingTask);
                 } else if (target.hasClass('view-state-reporting-task')) {
                     var canClear = reportingTask.state === 'STOPPED' && 
reportingTask.activeThreadCount === 0;
-                    nf.ComponentState.showState(reportingTask, canClear);
+                    nf.ComponentState.showState(reportingTask, {
+                        'version': 0
+                    }, canClear);
                 }
             } else if (reportingTasksGrid.getColumns()[args.cell].id === 
'moreDetails') {
                 if (target.hasClass('view-reporting-task')) {
@@ -1692,7 +1679,7 @@ nf.Settings = (function () {
         /**
          * Loads the settings.
          */
-        loadSettings: function (reloadStatus) {
+        loadSettings: function () {
             var settings = $.ajax({
                 type: 'GET',
                 url: config.urls.controllerConfig,
@@ -1726,12 +1713,7 @@ nf.Settings = (function () {
             var reportingTasks = loadReportingTasks();
 
             // return a deferred for all parts of the settings
-            return $.when(settings, controllerServices, 
reportingTasks).done(function () {
-                // always reload the status, unless the flag is specifically 
set to false
-                if (reloadStatus !== false) {
-                    nf.Canvas.reloadStatus();
-                }
-            }).fail(nf.Common.handleAjaxError);
+            return $.when(settings, controllerServices, 
reportingTasks).fail(nf.Common.handleAjaxError);
         },
 
         /**

http://git-wip-us.apache.org/repos/asf/nifi/blob/3cc16d35/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js
index c2d82b7..f523d03 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js
@@ -36,14 +36,14 @@ nf.Snippet = (function () {
             var snippet = {
                 parentGroupId: nf.Canvas.getGroupId(),
                 linked: nf.Common.isDefinedAndNotNull(linked) ? linked : false,
-                processors: [],
-                funnels: [],
-                inputPorts: [],
-                outputPorts: [],
-                remoteProcessGroups: [],
-                processGroups: [],
-                connections: [],
-                labels: []
+                processors: {},
+                funnels: {},
+                inputPorts: {},
+                outputPorts: {},
+                remoteProcessGroups: {},
+                processGroups: {},
+                connections: {},
+                labels: {}
             };
 
             // go through each component and identify its type
@@ -51,21 +51,21 @@ nf.Snippet = (function () {
                 var selected = d3.select(this);
 
                 if (nf.CanvasUtils.isProcessor(selected)) {
-                    snippet.processors.push(d.id);
+                    snippet.processors[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isFunnel(selected)) {
-                    snippet.funnels.push(d.id);
+                    snippet.funnels[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isLabel(selected)) {
-                    snippet.labels.push(d.id);
+                    snippet.labels[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isInputPort(selected)) {
-                    snippet.inputPorts.push(d.id);
+                    snippet.inputPorts[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isOutputPort(selected)) {
-                    snippet.outputPorts.push(d.id);
+                    snippet.outputPorts[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isProcessGroup(selected)) {
-                    snippet.processGroups.push(d.id);
+                    snippet.processGroups[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isRemoteProcessGroup(selected)) {
-                    snippet.remoteProcessGroups.push(d.id);
+                    snippet.remoteProcessGroups[d.id] = 
nf.Client.getRevision(selected.datum());
                 } else if (nf.CanvasUtils.isConnection(selected)) {
-                    snippet.connections.push(d.id);
+                    snippet.connections[d.id] = 
nf.Client.getRevision(selected.datum());
                 }
             });
 
@@ -79,7 +79,6 @@ nf.Snippet = (function () {
          */
         create: function (snippet) {
             var snippetEntity = {
-                'revision': nf.Client.getRevision(),
                 'snippet': snippet
             };
 
@@ -89,9 +88,6 @@ nf.Snippet = (function () {
                 data: JSON.stringify(snippetEntity),
                 dataType: 'json',
                 contentType: 'application/json'
-            }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
             });
         },
         
@@ -103,7 +99,6 @@ nf.Snippet = (function () {
          */
         copy: function (snippetId, origin) {
             var copySnippetRequestEntity = {
-                'revision': nf.Client.getRevision(),
                 'snippetId': snippetId,
                 'originX': origin.x,
                 'originY': origin.y
@@ -115,108 +110,93 @@ nf.Snippet = (function () {
                 data: JSON.stringify(copySnippetRequestEntity),
                 dataType: 'json',
                 contentType: 'application/json'
-            }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
             });
         },
         
         /**
          * Removes the specified snippet.
          * 
-         * @argument {string} snippetId         The snippet id
+         * @argument {string} snippetEntity         The snippet entity
          */
-        remove: function (snippetId) {
-            var revision = nf.Client.getRevision();
+        remove: function (snippetEntity) {
+            var revision = nf.Client.getRevision(snippetEntity);
 
             return $.ajax({
                 type: 'DELETE',
-                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetId) + '?' + $.param({
+                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetEntity.id) + '?' + $.param({
                     version: revision.version,
                     clientId: revision.clientId
                 })
-            }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
             });
         },
         
         /**
          * Moves the snippet into the specified group.
          * 
-         * @argument {string} snippetId         The snippet id
+         * @argument {object} snippetEntity         The snippet entity
          * @argument {string} newGroupId        The new group id
          */
-        move: function (snippetId, newGroupId) {
-            var snippetEntity = {
-                'revision': nf.Client.getRevision(),
+        move: function (snippetEntity, newGroupId) {
+            var moveSnippetEntity = {
+                'revision': nf.Client.getRevision(snippetEntity),
                 'snippet': {
-                    'id': snippetId,
+                    'id': snippetEntity.id,
                     'parentGroupId': newGroupId
                 }
             };
 
             return $.ajax({
                 type: 'PUT',
-                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetId),
-                data: JSON.stringify(snippetEntity),
+                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetEntity.id),
+                data: JSON.stringify(moveSnippetEntity),
                 dataType: 'json',
                 contentType: 'application/json'
-            }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
             });
         },
         
         /**
          * Unlinks the snippet from the actual data flow.
          * 
-         * @argument {string} snippetId         The snippet id
+         * @argument {object} snippetEntity       The snippet enmtity
          */
-        unlink: function (snippetId) {
-            var snippetEntity = {
-                'revision': nf.Client.getRevision(),
+        unlink: function (snippetEntity) {
+            var unlinkSnippetEntity = {
+                'revision': nf.Client.getRevision(snippetEntity),
                 'snippet': {
-                    'id': snippetId,
+                    'id': snippetEntity.id,
                     'linked': false
                 }
             };
 
             return $.ajax({
                 type: 'PUT',
-                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetId),
-                data: JSON.stringify(snippetEntity),
+                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetEntity.id),
+                data: JSON.stringify(unlinkSnippetEntity),
                 dataType: 'json',
                 contentType: 'application/json'
-            }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
             });
         },
         
         /**
          * Links the snippet from the actual data flow.
          * 
-         * @argument {string} snippetId         The snippet id
+         * @argument {object} snippetEntity         The snippet entity
          */
-        link: function (snippetId) {
-            var snippetEntity = {
-                'revision': nf.Client.getRevision(),
+        link: function (snippetEntity) {
+            var linkSnippetEntity = {
+                'revision': nf.Client.getRevision(snippetEntity),
                 'snippet': {
-                    'id': snippetId,
+                    'id': snippetEntity.id,
                     'linked': true
                 }
             };
 
             return $.ajax({
                 type: 'PUT',
-                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetId),
-                data: JSON.stringify(snippetEntity),
+                url: config.urls.processGroups + '/' + 
encodeURIComponent(nf.Canvas.getGroupId()) + '/snippets/' + 
encodeURIComponent(snippetEntity.id),
+                data: JSON.stringify(linkSnippetEntity),
                 dataType: 'json',
                 contentType: 'application/json'
-            }).done(function (response) {
-                // update the revision
-                nf.Client.setRevision(response.revision);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/nifi/blob/3cc16d35/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-client.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-client.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-client.js
index 0d490b7..0e366ff 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-client.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-client.js
@@ -17,43 +17,34 @@
 
 /* global nf */
 
-nf.Client = {};
-
-nf.Client.version = -1;
-nf.Client.clientId = null;
-
-/**
- * Gets the current revision.
- */
-nf.Client.getRevision = function () {
+nf.Client = (function() {
+    var clientId = null;
+    
     return {
-        version: nf.Client.version,
-        clientId: nf.Client.clientId
-    };
-};
+        /**
+         * Initializes the client.
+         * 
+         * @returns deferred
+         */
+        init: function () {
+            return $.ajax({
+                type: 'GET',
+                url: '../nifi-api/flow/client-id',
+            }).done(function (cid) {
+                clientId = cid;
+            });
+        },
 
-/**
- * Sets the current revision.
- * 
- * @argument {integer} revision     The revision
- */
-nf.Client.setRevision = function (revision) {
-    // ensure a value was returned
-    if (nf.Common.isDefinedAndNotNull(revision.version)) {
-        if (nf.Common.isDefinedAndNotNull(nf.Client.version)) {
-            // if the client version was already set, ensure
-            // the new value is greater
-            if (revision.version > nf.Client.version) {
-                nf.Client.version = revision.version;
-            }
-        } else {
-            // otherwise just set the value
-            nf.Client.version = revision.version;
+        /**
+         * Builds the revision fof the specified component
+         * @param d The component
+         * @returns The revision
+         */
+        getRevision: function (d) {
+            return {
+                'clientId': clientId,
+                'version': d.revision.version
+            };
         }
-    }
-
-    // ensure a value was returned
-    if (nf.Common.isDefinedAndNotNull(revision.clientId)) {
-        nf.Client.clientId = revision.clientId;
-    }
-};
\ No newline at end of file
+    };
+}());
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nifi/blob/3cc16d35/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 8826671..305775a 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
@@ -415,8 +415,7 @@ nf.Common = (function () {
                 nf.ContextMenu.hide();
 
                 // shut off the auto refresh
-                nf.Canvas.stopRevisionPolling();
-                nf.Canvas.stopStatusPolling();
+                nf.Canvas.stopPolling();
             }
         },
 

Reply via email to