From a7d3f8d75f9b42289892b5b0d25354d69868683e Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Fri, 22 Jan 2016 14:46:43 -0500 Subject: [PATCH] NIFI-1428: - Adding a button to link from a flowfile in a queue listing to a provenance search for that flowfile. Signed-off-by: Aldrin Piri --- .../provenance/provenance-content.jsp | 1 + .../src/main/webapp/css/queue-listing.css | 8 +++++++ .../webapp/js/nf/canvas/nf-queue-listing.js | 24 +++++++++++++++++-- .../js/nf/provenance/nf-provenance-table.js | 6 +++-- .../webapp/js/nf/provenance/nf-provenance.js | 18 +++++++++++--- 5 files changed, 50 insertions(+), 7 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/provenance/provenance-content.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/provenance/provenance-content.jsp index 8e6a3db582..e700e7c16b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/provenance/provenance-content.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/provenance/provenance-content.jsp @@ -18,6 +18,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css index 49c0525ea6..0047c99d6d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/css/queue-listing.css @@ -96,6 +96,14 @@ overflow: hidden; } +div.provenance-icon { + background-image: url(../images/iconProvenance.png); + background-position: top left; + background-size: cover; + width: 20px; + height: 20px; +} + /* queue listing table */ #queue-listing-message { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js index c131432120..ef88c70036 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js @@ -459,7 +459,7 @@ nf.QueueListing = (function () { // function for formatting durations var durationFormatter = function (row, cell, value, columnDef, dataContext) { return nf.Common.formatDuration(value); - } + }; // function for formatting penalization var penalizedFormatter = function (row, cell, value, columnDef, dataContext) { @@ -470,7 +470,7 @@ nf.QueueListing = (function () { } return markup; - } + }; // initialize the queue listing table var queueListingColumns = [ @@ -489,6 +489,16 @@ nf.QueueListing = (function () { queueListingColumns.push({id: 'clusterNodeAddress', name: 'Node', field: 'clusterNodeAddress', sortable: false, resizable: true}); } + // add an actions column when the user can access provenance + if (nf.Common.canAccessProvenance()) { + // function for formatting actions + var actionsFormatter = function () { + return '
'; + }; + + queueListingColumns.push({id: 'actions', name: ' ', resizable: false, formatter: actionsFormatter, sortable: false, width: 50, maxWidth: 50}); + } + var queueListingOptions = { forceFitColumns: true, enableTextSelectionOnCells: true, @@ -520,6 +530,16 @@ nf.QueueListing = (function () { if (target.hasClass('show-flowfile-details')) { showFlowFileDetails(item); } + } else if (queueListingGrid.getColumns()[args.cell].id === 'actions') { + if (target.hasClass('view-provenance')) { + // close the settings dialog + $('#shell-close-button').click(); + + // open the provenance page with the specified component + nf.Shell.showPage('provenance?' + $.param({ + flowFileUuid: item.uuid + })); + } } }); 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 06aed9911d..cdad348555 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 @@ -431,9 +431,11 @@ nf.ProvenanceTable = (function () { $('
').appendTo(searchableField); $('
').appendTo(searchableField); - // make the component id accessible for populating + // make the searchable accessible for populating if (field.id === 'ProcessorID') { searchableField.find('input').addClass('searchable-component-id'); + } else if (field.id === 'FlowFileUUID') { + searchableField.find('input').addClass('searchable-flowfile-uuid'); } // ensure the no searchable fields message is hidden @@ -997,7 +999,7 @@ nf.ProvenanceTable = (function () { * query. If not query is specified or it is empty, the most recent entries will * be returned. * - * @param {type} query + * @param {object} query */ loadProvenanceTable: function (query) { var provenanceProgress = $('#provenance-percent-complete'); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance.js index 876e06ddaa..1756c54c41 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance.js @@ -180,7 +180,7 @@ nf.Provenance = (function () { $.when(loadControllerConfig(), loadAuthorities(), detectedCluster()).done(function () { // create the provenance table nf.ProvenanceTable.init(isClustered).done(function () { - var search; + var search = {}; // look for a processor id in the query search var initialComponentId = $('#intial-component-query').text(); @@ -189,9 +189,21 @@ nf.Provenance = (function () { $('input.searchable-component-id').val(initialComponentId); // build the search criteria - search = { + search = $.extend(search, { 'search[ProcessorID]': initialComponentId - }; + }); + } + + // look for a flowfile uuid in the query search + var initialFlowFileUuid = $('#intial-flowfile-query').text(); + if ($.trim(initialFlowFileUuid) !== '') { + // populate initial search component + $('input.searchable-flowfile-uuid').val(initialFlowFileUuid); + + // build the search criteria + search = $.extend(search, { + 'search[FlowFileUUID]': initialFlowFileUuid + }); } // load the provenance table