NIFI-1400: - Addressing sort issues with the controller service and reporting task tables. Specifically addressing bulletins, type, and state.

Signed-off-by: Aldrin Piri <aldrin@apache.org>
This commit is contained in:
Matt Gilman 2016-01-15 15:05:59 -05:00 committed by Aldrin Piri
parent 1089f0a956
commit b25db650fd
2 changed files with 34 additions and 8 deletions

View File

@ -583,9 +583,35 @@ nf.Settings = (function () {
var sort = function (sortDetails, data) { var sort = function (sortDetails, data) {
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
if (sortDetails.columnId === 'moreDetails') {
var aBulletins = 0;
if (!nf.Common.isEmpty(a.bulletins)) {
aBulletins = a.bulletins.length;
}
var bBulletins = 0;
if (!nf.Common.isEmpty(b.bulletins)) {
bBulletins = b.bulletins.length;
}
return aBulletins - bBulletins;
} else if (sortDetails.columnId === 'type') {
var aType = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? nf.Common.substringAfterLast(a[sortDetails.columnId], '.') : '';
var bType = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? nf.Common.substringAfterLast(b[sortDetails.columnId], '.') : '';
return aType === bType ? 0 : aType > bType ? 1 : -1;
} else if (sortDetails.columnId === 'state') {
var aState = 'Invalid';
if (nf.Common.isEmpty(a.validationErrors)) {
aState = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
}
var bState = 'Invalid';
if (nf.Common.isEmpty(b.validationErrors)) {
bState = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
}
return aState === bState ? 0 : aState > bState ? 1 : -1;
} else {
var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
}
}; };
// perform the sort // perform the sort
@ -674,7 +700,7 @@ nf.Settings = (function () {
// define the column model for the controller services table // define the column model for the controller services table
var controllerServicesColumns = [ var controllerServicesColumns = [
{id: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreControllerServiceDetails, sortable: false, width: 65, maxWidth: 65}, {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreControllerServiceDetails, sortable: true, width: 65, maxWidth: 65, toolTip: 'Sorts based on presence of bulletins'},
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true}, {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
{id: 'type', field: 'type', name: 'Type', formatter: typeFormatter, sortable: true, resizable: true}, {id: 'type', field: 'type', name: 'Type', formatter: typeFormatter, sortable: true, resizable: true},
{id: 'state', field: 'state', name: 'State', formatter: controllerServiceStateFormatter, sortable: true, resizeable: true} {id: 'state', field: 'state', name: 'State', formatter: controllerServiceStateFormatter, sortable: true, resizeable: true}
@ -1321,7 +1347,7 @@ nf.Settings = (function () {
// define the column model for the reporting tasks table // define the column model for the reporting tasks table
var reportingTasksColumnModel = [ var reportingTasksColumnModel = [
{id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 65, maxWidth: 65}, {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 65, maxWidth: 65, toolTip: 'Sorts based on presence of bulletins'},
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true}, {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
{id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter}, {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter},
{id: 'state', field: 'state', name: 'Run Status', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter} {id: 'state', field: 'state', name: 'Run Status', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter}

View File

@ -335,7 +335,7 @@ nf.SummaryTable = (function () {
// define the column model for the processor summary table // define the column model for the processor summary table
var processorsColumnModel = [ var processorsColumnModel = [
{id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreProcessorDetails, sortable: true, width: 50, maxWidth: 50}, {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreProcessorDetails, sortable: true, width: 50, maxWidth: 50, toolTip: 'Sorts based on presence of bulletins'},
nameColumn, nameColumn,
{id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true}, {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true},
runStatusColumn, runStatusColumn,
@ -820,7 +820,7 @@ nf.SummaryTable = (function () {
return markup; return markup;
}; };
var moreDetailsColumn = {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50}; var moreDetailsColumn = {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50, toolTip: 'Sorts based on presence of bulletins'};
var transferredColumn = {id: 'transferred', field: 'transferred', name: '<span class="transferred-title">Transferred</span>&nbsp;/&nbsp;<span class="transferred-size-title">Size</span>&nbsp;<span style="font-weight: normal; overflow: hidden;">5 min</span>', toolTip: 'Count / data size transferred to and from connections in the last 5 min', resizable: true, defaultSortAsc: false, sortable: true}; var transferredColumn = {id: 'transferred', field: 'transferred', name: '<span class="transferred-title">Transferred</span>&nbsp;/&nbsp;<span class="transferred-size-title">Size</span>&nbsp;<span style="font-weight: normal; overflow: hidden;">5 min</span>', toolTip: 'Count / data size transferred to and from connections in the last 5 min', resizable: true, defaultSortAsc: false, sortable: true};
var sentColumn = {id: 'sent', field: 'sent', name: '<span class="sent-title">Sent</span>&nbsp;/&nbsp;<span class="sent-size-title">Size</span>&nbsp;<span style="font-weight: normal; overflow: hidden;">5 min</span>', toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, resizable: true}; var sentColumn = {id: 'sent', field: 'sent', name: '<span class="sent-title">Sent</span>&nbsp;/&nbsp;<span class="sent-size-title">Size</span>&nbsp;<span style="font-weight: normal; overflow: hidden;">5 min</span>', toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, resizable: true};
var receivedColumn = {id: 'received', field: 'received', name: '<span class="received-title">Received</span>&nbsp;/&nbsp;<span class="received-size-title">Size</span>&nbsp;<span style="font-weight: normal; overflow: hidden;">5 min</span>', toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, resizable: true}; var receivedColumn = {id: 'received', field: 'received', name: '<span class="received-title">Received</span>&nbsp;/&nbsp;<span class="received-size-title">Size</span>&nbsp;<span style="font-weight: normal; overflow: hidden;">5 min</span>', toolTip: 'Count / data size in the last 5 min', sortable: true, defaultSortAsc: false, resizable: true};
@ -1544,7 +1544,7 @@ nf.SummaryTable = (function () {
// define the column model for the summary table // define the column model for the summary table
var remoteProcessGroupsColumnModel = [ var remoteProcessGroupsColumnModel = [
{id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50}, {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50, toolTip: 'Sorts based on presence of bulletins'},
nameColumn, nameColumn,
targetUriColumn, targetUriColumn,
transmissionStatusColumn, transmissionStatusColumn,