This is an automated email from the ASF dual-hosted git repository.

mtien pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 52cc831a2a NIFI-11303 Added a go-to entry on the right click context 
menu for th… (#7461)
52cc831a2a is described below

commit 52cc831a2a6c20578e99ef6ea02b5c732611363a
Author: Freedom9339 <[email protected]>
AuthorDate: Mon Aug 21 11:23:38 2023 -0500

    NIFI-11303 Added a go-to entry on the right click context menu for th… 
(#7461)
    
    * NIFI-11303 Added a go-to entry on the right click context menu for the 
provenance lineage tree to take you to the specified component in the graph
    
    * nifi-11303 Removed unused variable.
    
    Merged #7461 into main.
---
 .../nifi-web-ui/src/main/webapp/css/provenance.css |  7 ++++
 .../js/nf/provenance/nf-provenance-lineage.js      | 11 ++++++
 .../webapp/js/nf/provenance/nf-provenance-table.js | 45 ++++++++++++----------
 3 files changed, 43 insertions(+), 20 deletions(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/provenance.css
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/provenance.css
index 44422e36f1..7264fa0302 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/provenance.css
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/provenance.css
@@ -454,6 +454,13 @@ div.lineage-view-event:before {
     color: #004849;
 }
 
+div.lineage-go-to:before {
+    font-family: FontAwesome;
+    content: "\f178";
+    font-size: 16px;
+    color: #004849;
+}
+
 div.lineage-view-parents:before {
     font-family: FontAwesome;
     content: "\f1e5";
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
index 09dc4ddb4e..2d1e27fd32 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js
@@ -741,6 +741,17 @@
                     }
                 }];
 
+                // conditionally support going to the component
+                if (top !== window) {
+                    menuItems.push({
+                        'class': 'lineage-go-to',
+                        'text': 'Go To',
+                        'click': function () {
+                            provenanceTableCtrl.goTo(d);
+                        }
+                    });
+                }
+
                 // if this is a spawn event show appropriate actions
                 if (d.eventType === 'SPAWN' || d.eventType === 'CLONE' || 
d.eventType === 'FORK' || d.eventType === 'JOIN' || d.eventType === 'REPLAY') {
                     // starts the lineage expansion process
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js
index cfb48eb718..09d134c547 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js
@@ -704,6 +704,7 @@
             var provenanceData = new Slick.Data.DataView({
                 inlineFilters: false
             });
+            provenanceTableCtrl.provenanceData = provenanceData;
             provenanceData.setItems([]);
             provenanceData.setFilterArgs({
                 searchString: '',
@@ -743,7 +744,7 @@
                     if (target.hasClass('show-lineage')) {
                         provenanceLineageCtrl.showLineage(item.flowFileUuid, 
item.eventId.toString(), item.clusterNodeId, provenanceTableCtrl);
                     } else if (target.hasClass('go-to')) {
-                        goTo(item);
+                        provenanceTableCtrl.goTo(item);
                     }
                 } else if (provenanceGrid.getColumns()[args.cell].id === 
'moreDetails') {
                     if (target.hasClass('show-event-details')) {
@@ -1002,25 +1003,6 @@
             }
         };
 
-        /**
-         * Goes to the specified component if possible.
-         *
-         * @argument {object} item       The event it
-         */
-        var goTo = function (item) {
-            // ensure the component is still present in the flow
-            if (nfCommon.isDefinedAndNotNull(item.groupId)) {
-                // only attempt this if we're within a frame
-                if (top !== window) {
-                    // and our parent has canvas utils and shell defined
-                    if (nfCommon.isDefinedAndNotNull(parent.nf) && 
nfCommon.isDefinedAndNotNull(parent.nf.CanvasUtils) && 
nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
-                        parent.nf.CanvasUtils.showComponent(item.groupId, 
item.componentId);
-                        parent.$('#shell-close-button').click();
-                    }
-                }
-            }
-        };
-
         function ProvenanceTableCtrl() {
 
             /**
@@ -1246,6 +1228,29 @@
                 }).fail(nfErrorHandler.handleAjaxError);
             },
 
+            /**
+             * Goes to the specified component if possible.
+             *
+             * @argument {object} item       The event it
+            */
+            goTo: function (item) {
+                // if being called by context menu
+                if (!Object.hasOwn(item, 'componentId') && Object.hasOwn(item, 
'id')) {
+                    item = this.provenanceData.getItemById(item.id);
+                }
+                // ensure the component is still present in the flow
+                if (nfCommon.isDefinedAndNotNull(item.groupId)) {
+                    // only attempt this if we're within a frame
+                    if (top !== window) {
+                        // and our parent has canvas utils and shell defined
+                        if (nfCommon.isDefinedAndNotNull(parent.nf) && 
nfCommon.isDefinedAndNotNull(parent.nf.CanvasUtils) && 
nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
+                            parent.nf.CanvasUtils.showComponent(item.groupId, 
item.componentId);
+                            parent.$('#shell-close-button').click();
+                        }
+                    }
+                }
+            },
+
             /**
              * Shows the details for the specified action.
              *

Reply via email to