Repository: nifi
Updated Branches:
  refs/heads/master 9dfc6683e -> dd5032274


NIFI-5600: Recalculating the available columns for the queue listing and 
component state because they contain conditions which need to be re-evaluated.

Signed-off-by: Pierre Villard <[email protected]>

This closes #3055.


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

Branch: refs/heads/master
Commit: dd50322749aa667beb0dc16b2535a7aa1da1ca73
Parents: 9dfc668
Author: Matt Gilman <[email protected]>
Authored: Tue Oct 9 12:49:31 2018 -0400
Committer: Pierre Villard <[email protected]>
Committed: Wed Oct 10 09:32:54 2018 +0200

----------------------------------------------------------------------
 .../webapp/js/nf/canvas/nf-component-state.js   |  74 ++---
 .../webapp/js/nf/canvas/nf-queue-listing.js     | 272 ++++++++++---------
 2 files changed, 181 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/dd503227/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js
index 8f8bb6d..29f8b6e 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js
@@ -51,6 +51,45 @@
     'use strict';
 
     /**
+     * Get the component state column model.
+     */
+    var getComponentStateColumnModel = function () {
+        // initialize the queue listing table
+        var componentStateColumns = [
+            {
+                id: 'key',
+                field: 'key',
+                name: 'Key',
+                sortable: true,
+                resizable: true,
+                formatter: nfCommon.genericValueFormatter
+            },
+            {
+                id: 'value',
+                field: 'value',
+                name: 'Value',
+                sortable: true,
+                resizable: true,
+                formatter: nfCommon.genericValueFormatter
+            }
+        ];
+
+        // conditionally show the cluster node identifier
+        if (nfClusterSummary.isConnectedToCluster()) {
+            componentStateColumns.push({
+                id: 'scope',
+                field: 'scope',
+                name: 'Scope',
+                sortable: true,
+                resizable: true,
+                formatter: nfCommon.genericValueFormatter
+            });
+        }
+
+        return componentStateColumns;
+    };
+
+    /**
      * Filters the component state table.
      */
     var applyFilter = function () {
@@ -156,6 +195,7 @@
         var showPartialDetails = false;
 
         var componentStateGrid = 
$('#component-state-table').data('gridInstance');
+        componentStateGrid.setColumns(getComponentStateColumnModel());
         var componentStateData = componentStateGrid.getData();
 
         // begin the update
@@ -291,38 +331,6 @@
                 }
             });
 
-            // initialize the queue listing table
-            var componentStateColumns = [
-                {
-                    id: 'key',
-                    field: 'key',
-                    name: 'Key',
-                    sortable: true,
-                    resizable: true,
-                    formatter: nfCommon.genericValueFormatter
-                },
-                {
-                    id: 'value',
-                    field: 'value',
-                    name: 'Value',
-                    sortable: true,
-                    resizable: true,
-                    formatter: nfCommon.genericValueFormatter
-                }
-            ];
-
-            // conditionally show the cluster node identifier
-            if (nfClusterSummary.isClustered()) {
-                componentStateColumns.push({
-                    id: 'scope',
-                    field: 'scope',
-                    name: 'Scope',
-                    sortable: true,
-                    resizable: true,
-                    formatter: nfCommon.genericValueFormatter
-                });
-            }
-
             var componentStateOptions = {
                 forceFitColumns: true,
                 enableTextSelectionOnCells: true,
@@ -350,7 +358,7 @@
             }, componentStateData);
 
             // initialize the grid
-            var componentStateGrid = new Slick.Grid('#component-state-table', 
componentStateData, componentStateColumns, componentStateOptions);
+            var componentStateGrid = new Slick.Grid('#component-state-table', 
componentStateData, getComponentStateColumnModel(), componentStateOptions);
             componentStateGrid.setSelectionModel(new 
Slick.RowSelectionModel());
             componentStateGrid.registerPlugin(new Slick.AutoTooltips());
             componentStateGrid.setSortColumn('key', true);

http://git-wip-us.apache.org/repos/asf/nifi/blob/dd503227/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js
index 65f1311..7676b18 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js
@@ -90,6 +90,144 @@
     };
 
     /**
+     * Initializes the listing column model.
+     */
+    var getListingColumnModel = function () {
+        // define a custom formatter for showing more processor details
+        var moreDetailsFormatter = function (row, cell, value, columnDef, 
dataContext) {
+            return '<div class="pointer show-flowfile-details fa 
fa-info-circle" title="View Details" style="float: left;"></div>';
+        };
+
+        // function for formatting data sizes
+        var dataSizeFormatter = function (row, cell, value, columnDef, 
dataContext) {
+            return nfCommon.formatDataSize(value);
+        };
+
+        // function for formatting durations
+        var durationFormatter = function (row, cell, value, columnDef, 
dataContext) {
+            return nfCommon.formatDuration(value);
+        };
+
+        // function for formatting penalization
+        var penalizedFormatter = function (row, cell, value, columnDef, 
dataContext) {
+            var markup = '';
+
+            if (value === true) {
+                markup += 'Yes';
+            }
+
+            return markup;
+        };
+
+        // initialize the queue listing table
+        var queueListingColumns = [
+            {
+                id: 'moreDetails',
+                field: 'moreDetails',
+                name: '&nbsp;',
+                sortable: false,
+                resizable: false,
+                formatter: moreDetailsFormatter,
+                width: 50,
+                maxWidth: 50
+            },
+            {
+                id: 'position',
+                name: 'Position',
+                field: 'position',
+                sortable: false,
+                resizable: false,
+                width: 75,
+                maxWidth: 75,
+                formatter: nfCommon.genericValueFormatter
+            },
+            {
+                id: 'uuid',
+                name: 'UUID',
+                field: 'uuid',
+                sortable: false,
+                resizable: true,
+                formatter: nfCommon.genericValueFormatter
+            },
+            {
+                id: 'filename',
+                name: 'Filename',
+                field: 'filename',
+                sortable: false,
+                resizable: true,
+                formatter: nfCommon.genericValueFormatter
+            },
+            {
+                id: 'size',
+                name: 'File Size',
+                field: 'size',
+                sortable: false,
+                resizable: true,
+                defaultSortAsc: false,
+                formatter: dataSizeFormatter
+            },
+            {
+                id: 'queuedDuration',
+                name: 'Queued Duration',
+                field: 'queuedDuration',
+                sortable: false,
+                resizable: true,
+                formatter: durationFormatter
+            },
+            {
+                id: 'lineageDuration',
+                name: 'Lineage Duration',
+                field: 'lineageDuration',
+                sortable: false,
+                resizable: true,
+                formatter: durationFormatter
+            },
+            {
+                id: 'penalized',
+                name: 'Penalized',
+                field: 'penalized',
+                sortable: false,
+                resizable: false,
+                width: 100,
+                maxWidth: 100,
+                formatter: penalizedFormatter
+            }
+        ];
+
+        // conditionally show the cluster node identifier
+        if (nfClusterSummary.isConnectedToCluster()) {
+            queueListingColumns.push({
+                id: 'clusterNodeAddress',
+                name: 'Node',
+                field: 'clusterNodeAddress',
+                sortable: false,
+                resizable: true,
+                formatter: nfCommon.genericValueFormatter
+            });
+        }
+
+        // add an actions column when the user can access provenance
+        if (nfCommon.canAccessProvenance()) {
+            // function for formatting actions
+            var actionsFormatter = function () {
+                return '<div title="Provenance" class="pointer icon 
icon-provenance view-provenance"></div>';
+            };
+
+            queueListingColumns.push({
+                id: 'actions',
+                name: '&nbsp;',
+                resizable: false,
+                formatter: actionsFormatter,
+                sortable: false,
+                width: 50,
+                maxWidth: 50
+            });
+        }
+
+        return queueListingColumns;
+    };
+
+    /**
      * Downloads the content for the flowfile currently being viewed.
      */
     var downloadContent = function () {
@@ -306,6 +444,7 @@
 
                         // get the grid to load the data
                         var queueListingGrid = 
$('#queue-listing-table').data('gridInstance');
+                        queueListingGrid.setColumns(getListingColumnModel());
                         var queueListingData = queueListingGrid.getData();
 
                         // load the flowfiles
@@ -497,137 +636,6 @@
                 performListing(connection);
             });
 
-            // define a custom formatter for showing more processor details
-            var moreDetailsFormatter = function (row, cell, value, columnDef, 
dataContext) {
-                return '<div class="pointer show-flowfile-details fa 
fa-info-circle" title="View Details" style="float: left;"></div>';
-            };
-
-            // function for formatting data sizes
-            var dataSizeFormatter = function (row, cell, value, columnDef, 
dataContext) {
-                return nfCommon.formatDataSize(value);
-            };
-
-            // function for formatting durations
-            var durationFormatter = function (row, cell, value, columnDef, 
dataContext) {
-                return nfCommon.formatDuration(value);
-            };
-
-            // function for formatting penalization
-            var penalizedFormatter = function (row, cell, value, columnDef, 
dataContext) {
-                var markup = '';
-
-                if (value === true) {
-                    markup += 'Yes';
-                }
-
-                return markup;
-            };
-
-            // initialize the queue listing table
-            var queueListingColumns = [
-                {
-                    id: 'moreDetails',
-                    field: 'moreDetails',
-                    name: '&nbsp;',
-                    sortable: false,
-                    resizable: false,
-                    formatter: moreDetailsFormatter,
-                    width: 50,
-                    maxWidth: 50
-                },
-                {
-                    id: 'position',
-                    name: 'Position',
-                    field: 'position',
-                    sortable: false,
-                    resizable: false,
-                    width: 75,
-                    maxWidth: 75,
-                    formatter: nfCommon.genericValueFormatter
-                },
-                {
-                    id: 'uuid',
-                    name: 'UUID',
-                    field: 'uuid',
-                    sortable: false,
-                    resizable: true,
-                    formatter: nfCommon.genericValueFormatter
-                },
-                {
-                    id: 'filename',
-                    name: 'Filename',
-                    field: 'filename',
-                    sortable: false,
-                    resizable: true,
-                    formatter: nfCommon.genericValueFormatter
-                },
-                {
-                    id: 'size',
-                    name: 'File Size',
-                    field: 'size',
-                    sortable: false,
-                    resizable: true,
-                    defaultSortAsc: false,
-                    formatter: dataSizeFormatter
-                },
-                {
-                    id: 'queuedDuration',
-                    name: 'Queued Duration',
-                    field: 'queuedDuration',
-                    sortable: false,
-                    resizable: true,
-                    formatter: durationFormatter
-                },
-                {
-                    id: 'lineageDuration',
-                    name: 'Lineage Duration',
-                    field: 'lineageDuration',
-                    sortable: false,
-                    resizable: true,
-                    formatter: durationFormatter
-                },
-                {
-                    id: 'penalized',
-                    name: 'Penalized',
-                    field: 'penalized',
-                    sortable: false,
-                    resizable: false,
-                    width: 100,
-                    maxWidth: 100,
-                    formatter: penalizedFormatter
-                }
-            ];
-
-            // conditionally show the cluster node identifier
-            if (nfClusterSummary.isClustered()) {
-                queueListingColumns.push({
-                    id: 'clusterNodeAddress',
-                    name: 'Node',
-                    field: 'clusterNodeAddress',
-                    sortable: false,
-                    resizable: true,
-                    formatter: nfCommon.genericValueFormatter
-                });
-            }
-
-            // add an actions column when the user can access provenance
-            if (nfCommon.canAccessProvenance()) {
-                // function for formatting actions
-                var actionsFormatter = function () {
-                    return '<div title="Provenance" class="pointer icon 
icon-provenance view-provenance"></div>';
-                };
-
-                queueListingColumns.push({
-                    id: 'actions',
-                    name: '&nbsp;',
-                    resizable: false,
-                    formatter: actionsFormatter,
-                    sortable: false,
-                    width: 50,
-                    maxWidth: 50
-                });
-            }
-
             var queueListingOptions = {
                 forceFitColumns: true,
                 enableTextSelectionOnCells: true,
@@ -644,7 +652,7 @@
             queueListingData.setItems([]);
 
             // initialize the grid
-            var queueListingGrid = new Slick.Grid('#queue-listing-table', 
queueListingData, queueListingColumns, queueListingOptions);
+            var queueListingGrid = new Slick.Grid('#queue-listing-table', 
queueListingData, getListingColumnModel(), queueListingOptions);
             queueListingGrid.setSelectionModel(new Slick.RowSelectionModel());
             queueListingGrid.registerPlugin(new Slick.AutoTooltips());
 

Reply via email to