Repository: nifi Updated Branches: refs/heads/master 1089f0a95 -> b25db650f
NIFI-1400: - Addressing sort issues with the controller service and reporting task tables. Specifically addressing bulletins, type, and state. Signed-off-by: Aldrin Piri <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/b25db650 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/b25db650 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/b25db650 Branch: refs/heads/master Commit: b25db650fdac917ad1dad2ac21e57334b7e705aa Parents: 1089f0a Author: Matt Gilman <[email protected]> Authored: Fri Jan 15 15:05:59 2016 -0500 Committer: Aldrin Piri <[email protected]> Committed: Fri Jan 22 16:41:14 2016 -0500 ---------------------------------------------------------------------- .../src/main/webapp/js/nf/canvas/nf-settings.js | 36 +++++++++++++++++--- .../webapp/js/nf/summary/nf-summary-table.js | 6 ++-- 2 files changed, 34 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/b25db650/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 ee75e5c..c07d52c 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 @@ -583,9 +583,35 @@ nf.Settings = (function () { var sort = function (sortDetails, data) { // defines a function for sorting var comparer = function (a, b) { - var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; - var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; - return aString === bString ? 0 : aString > bString ? 1 : -1; + 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 bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; + return aString === bString ? 0 : aString > bString ? 1 : -1; + } }; // perform the sort @@ -674,7 +700,7 @@ nf.Settings = (function () { // define the column model for the controller services table var controllerServicesColumns = [ - {id: 'moreDetails', name: ' ', resizable: false, formatter: moreControllerServiceDetails, sortable: false, width: 65, maxWidth: 65}, + {id: 'moreDetails', field: 'moreDetails', name: ' ', 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: 'type', field: 'type', name: 'Type', formatter: typeFormatter, sortable: true, resizable: 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 var reportingTasksColumnModel = [ - {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 65, maxWidth: 65}, + {id: 'moreDetails', field: 'moreDetails', name: ' ', 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: 'type', field: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter}, {id: 'state', field: 'state', name: 'Run Status', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter} http://git-wip-us.apache.org/repos/asf/nifi/blob/b25db650/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js index 156ad4c..a48758a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js @@ -335,7 +335,7 @@ nf.SummaryTable = (function () { // define the column model for the processor summary table var processorsColumnModel = [ - {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreProcessorDetails, sortable: true, width: 50, maxWidth: 50}, + {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreProcessorDetails, sortable: true, width: 50, maxWidth: 50, toolTip: 'Sorts based on presence of bulletins'}, nameColumn, {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true}, runStatusColumn, @@ -820,7 +820,7 @@ nf.SummaryTable = (function () { return markup; }; - var moreDetailsColumn = {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50}; + var moreDetailsColumn = {id: 'moreDetails', field: 'moreDetails', name: ' ', 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> / <span class="transferred-size-title">Size</span> <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> / <span class="sent-size-title">Size</span> <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> / <span class="received-size-title">Size</span> <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 var remoteProcessGroupsColumnModel = [ - {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50}, + {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreDetails, sortable: true, width: 50, maxWidth: 50, toolTip: 'Sorts based on presence of bulletins'}, nameColumn, targetUriColumn, transmissionStatusColumn,
