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.
This commit is contained in:
Freedom9339 2023-08-21 11:23:38 -05:00 committed by GitHub
parent 5d90c9c14b
commit 52cc831a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 20 deletions

View File

@ -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";

View File

@ -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

View File

@ -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.
*