From 41d9506a2beea9506d6ee09e3ee9a154c13378e3 Mon Sep 17 00:00:00 2001 From: yuri1969 <1969yuri1969@gmail.com> Date: Wed, 4 Oct 2017 22:53:16 +0200 Subject: [PATCH] NIFI-4402 - Add component location in Summary view Implemented as described in the issue. Improvements are welcome. Reworded the title according to feedback. This closes #2195 --- .../webapp/js/nf/summary/nf-summary-table.js | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) 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 1cf0e49fef..dbc3b70cfc 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 @@ -413,6 +413,15 @@ resizable: true, formatter: nfCommon.genericValueFormatter }, + { + id: 'parentGroup', + field: 'parentProcessGroupName', + name: 'Process Group', + sortable: true, + resizable: true, + formatter: nfCommon.genericValueFormatter, + toolTip: 'Parent Process Group name' + }, runStatusColumn, inputColumn, ioColumn, @@ -430,7 +439,7 @@ var markup = ''; if (isInShell) { - markup += '
'; + markup += ''; } if (nfCommon.SUPPORTS_SVG) { @@ -2523,12 +2532,21 @@ * @argument {array} inputPortItems The input port data * @argument {array} outputPortItems The input port data * @argument {array} remoteProcessGroupItems The remote process group data - * @argument {object} aggregateSnapshot The process group status + * @argument {object} aggregateSnapshot The process group status + * @argument {array} ancestorsSnapshot The process group hierarchy */ - var populateProcessGroupStatus = function (processorItems, connectionItems, processGroupItems, inputPortItems, outputPortItems, remoteProcessGroupItems, aggregateSnapshot) { + var populateProcessGroupStatus = function (processorItems, connectionItems, processGroupItems, inputPortItems, outputPortItems, remoteProcessGroupItems, aggregateSnapshot, ancestorsSnapshot) { // add the processors to the summary grid $.each(aggregateSnapshot.processorStatusSnapshots, function (i, procStatusEntity) { - processorItems.push(procStatusEntity.processorStatusSnapshot); + var currentProcessorStatusSnapshot = procStatusEntity.processorStatusSnapshot; + + currentProcessorStatusSnapshot.parentProcessGroupName = aggregateSnapshot.name; + // construct a 'path' based on hierarchical group levels + currentProcessorStatusSnapshot.processGroupNamePath = ancestorsSnapshot.reduce(function(tempGroupNamesPath, ancestorGroup) { + return tempGroupNamesPath + '/' + ancestorGroup.name; + }, ''); + + processorItems.push(currentProcessorStatusSnapshot); }); // add the processors to the summary grid @@ -2556,10 +2574,23 @@ // add any child group's status $.each(aggregateSnapshot.processGroupStatusSnapshots, function (i, childProcessGroupEntity) { - populateProcessGroupStatus(processorItems, connectionItems, processGroupItems, inputPortItems, outputPortItems, remoteProcessGroupItems, childProcessGroupEntity.processGroupStatusSnapshot); + var childProcessGroupStatusSnapshot = childProcessGroupEntity.processGroupStatusSnapshot; + populateProcessGroupStatus(processorItems, connectionItems, processGroupItems, inputPortItems, outputPortItems, remoteProcessGroupItems, childProcessGroupStatusSnapshot, createUpdatedAncestorsSnapshot(ancestorsSnapshot, childProcessGroupStatusSnapshot)); }); }; + /** + * Creates a new process group hierarchy. + * + * @argument {array} ancestorsSnapshot The process group hierarchy + * @argument {object} newAncestor The process group to add + */ + var createUpdatedAncestorsSnapshot = function(ancestorsSnapshot, newAncestor) { + var snapshotCopy = ancestorsSnapshot.slice(); + snapshotCopy.push(newAncestor); + return snapshotCopy; + }; + /** * Applies the filter found in the filter expression text field. */ @@ -3105,7 +3136,7 @@ var remoteProcessGroupItems = []; // populate the tables - populateProcessGroupStatus(processorItems, connectionItems, processGroupItems, inputPortItems, outputPortItems, remoteProcessGroupItems, aggregateSnapshot); + populateProcessGroupStatus(processorItems, connectionItems, processGroupItems, inputPortItems, outputPortItems, remoteProcessGroupItems, aggregateSnapshot, [aggregateSnapshot]); // update the processors processorsData.setItems(processorItems);