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 <pierre.villard.fr@gmail.com>

This closes #3055.
This commit is contained in:
Matt Gilman 2018-10-09 12:49:31 -04:00 committed by Pierre Villard
parent 9dfc6683ee
commit dd50322749
2 changed files with 181 additions and 165 deletions

View File

@ -50,6 +50,45 @@
}(this, function ($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon) {
'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.
*/
@ -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);

View File

@ -89,6 +89,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.
*/
@ -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());