Repository: nifi Updated Branches: refs/heads/master 8eb0a3882 -> ce5330330
http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-lineage.js ---------------------------------------------------------------------- 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 04a2204..5d1d76a 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 @@ -26,7 +26,7 @@ nf.ProvenanceLineage = (function () { sliderTickCount: 75, urls: { lineage: '../nifi-api/provenance/lineage', - events: '../nifi-api/provenance/events/' + events: '../nifi-api/provenance-events/' } }; http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance-table.js ---------------------------------------------------------------------- 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 f024866..9f739a3 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 @@ -33,9 +33,10 @@ nf.ProvenanceTable = (function () { }, urls: { searchOptions: '../nifi-api/provenance/search-options', - replays: '../nifi-api/provenance/replays', + replays: '../nifi-api/provenance-events/replays', provenance: '../nifi-api/provenance', - cluster: '../nifi-api/controller/cluster', + provenanceEvents: '../nifi-api/provenance-events', + clusterSearch: '../nifi-api/flow/cluster/search-results', d3Script: 'js/d3/d3.min.js', lineageScript: 'js/nf/provenance/nf-provenance-lineage.js', uiExtensionToken: '../nifi-api/access/ui-extension-token', @@ -57,7 +58,7 @@ nf.ProvenanceTable = (function () { var eventId = $('#provenance-event-id').text(); // build the url - var dataUri = config.urls.provenance + '/events/' + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction); + var dataUri = config.urls.provenanceEvents + '/' + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction); // perform the request once we've received a token nf.Common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { @@ -98,7 +99,7 @@ nf.ProvenanceTable = (function () { var eventId = $('#provenance-event-id').text(); // build the uri to the data - var dataUri = controllerUri + 'provenance/events/' + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction); + var dataUri = config.urls.provenanceEvents + '/' + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction); // generate tokens as necessary var getAccessTokens = $.Deferred(function (deferred) { @@ -258,38 +259,35 @@ nf.ProvenanceTable = (function () { } // handle the replay and downloading - if (nf.Common.isDFM()) { - // replay - $('#replay-content').on('click', function () { - var replayEntity = { - 'eventId': $('#provenance-event-id').text() - }; + $('#replay-content').on('click', function () { + var replayEntity = { + 'eventId': $('#provenance-event-id').text() + }; - // conditionally include the cluster node id - var clusterNodeId = $('#provenance-event-cluster-node-id').text(); - if (!nf.Common.isBlank(clusterNodeId)) { - replayEntity['clusterNodeId'] = clusterNodeId; - } + // conditionally include the cluster node id + var clusterNodeId = $('#provenance-event-cluster-node-id').text(); + if (!nf.Common.isBlank(clusterNodeId)) { + replayEntity['clusterNodeId'] = clusterNodeId; + } - $.ajax({ - type: 'POST', - url: config.urls.replays, - data: JSON.stringify(replayEntity), - dataType: 'json', - contentType: 'application/json' - }).done(function (response) { - nf.Dialog.showOkDialog({ - headerText: 'Provenance', - dialogContent: 'Successfully submitted replay request.' - }); - }).fail(nf.Common.handleAjaxError); + $.ajax({ + type: 'POST', + url: config.urls.replays, + data: JSON.stringify(replayEntity), + dataType: 'json', + contentType: 'application/json' + }).done(function (response) { + nf.Dialog.showOkDialog({ + headerText: 'Provenance', + dialogContent: 'Successfully submitted replay request.' + }); + }).fail(nf.Common.handleAjaxError); - $('#event-details-dialog').modal('hide'); - }); + $('#event-details-dialog').modal('hide'); + }); - // show the replay panel - $('#replay-details').show(); - } + // show the replay panel + $('#replay-details').show(); }; /** @@ -323,11 +321,10 @@ nf.ProvenanceTable = (function () { // get the nodes in the cluster $.ajax({ type: 'GET', - url: config.urls.cluster, + url: config.urls.clusterSearch, dataType: 'json' }).done(function (response) { - var cluster = response.cluster; - var nodes = cluster.nodes; + var nodeResults = response.nodeResults; // create the searchable options var searchableOptions = [{ @@ -336,17 +333,17 @@ nf.ProvenanceTable = (function () { }]; // sort the nodes - nodes.sort(function (a, b) { - var compA = (a.address + ':' + a.apiPort).toUpperCase(); - var compB = (b.address + ':' + b.apiPort).toUpperCase(); + nodeResults.sort(function (a, b) { + var compA = a.address.toUpperCase(); + var compB = b.address.toUpperCase(); return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; }); // add each node - $.each(nodes, function (_, node) { + $.each(nodeResults, function (_, nodeResult) { searchableOptions.push({ - text: node.address + ':' + node.apiPort, - value: node.nodeId + text: nodeResult.address, + value: nodeResult.id }); }); @@ -1430,15 +1427,13 @@ nf.ProvenanceTable = (function () { $('#output-content-view').hide(); } - if (nf.Common.isDFM()) { - if (event.replayAvailable === true) { - $('#replay-content, #replay-content-connection').show(); - formatContentValue($('#replay-connection-id'), event.sourceConnectionIdentifier); - $('#replay-content-message').hide(); - } else { - $('#replay-content, #replay-content-connection').hide(); - $('#replay-content-message').text(event.replayExplanation).show(); - } + if (event.replayAvailable === true) { + $('#replay-content, #replay-content-connection').show(); + formatContentValue($('#replay-connection-id'), event.sourceConnectionIdentifier); + $('#replay-content-message').hide(); + } else { + $('#replay-content, #replay-content-connection').hide(); + $('#replay-content-message').text(event.replayExplanation).show(); } // show the dialog http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/provenance/nf-provenance.js ---------------------------------------------------------------------- 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 a04aad7..fe16705 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 @@ -32,7 +32,7 @@ nf.Provenance = (function () { flowConfig: '../nifi-api/flow/config', banners: '../nifi-api/flow/banners', about: '../nifi-api/flow/about', - authorities: '../nifi-api/flow/authorities' + currentUser: '../nifi-api/flow/current-user' } }; @@ -81,27 +81,16 @@ nf.Provenance = (function () { }; /** - * Loads the current users authorities. + * Loads the current user. */ - var loadAuthorities = function () { - return $.Deferred(function (deferred) { - $.ajax({ - type: 'GET', - url: config.urls.authorities, - dataType: 'json' - }).done(function (response) { - if (nf.Common.isDefinedAndNotNull(response.authorities)) { - // record the users authorities - nf.Common.setAuthorities(response.authorities); - deferred.resolve(response); - } else { - deferred.reject(); - } - }).fail(function (xhr, status, error) { - nf.Common.handleAjaxError(xhr, status, error); - deferred.reject(); - }); - }).promise(); + var loadCurrentUser = function () { + return $.ajax({ + type: 'GET', + url: config.urls.currentUser, + dataType: 'json' + }).done(function (currentUser) { + nf.Common.setCurrentUser(currentUser); + }).fail(nf.Common.handleAjaxError); }; /** @@ -170,8 +159,8 @@ nf.Provenance = (function () { init: function () { nf.Storage.init(); - // load the users authorities and detect if the NiFi is clustered - $.when(loadAbout(), loadAuthorities(), detectedCluster()).done(function () { + // load the user and detect if the NiFi is clustered + $.when(loadAbout(), loadCurrentUser(), detectedCluster()).done(function () { // create the provenance table nf.ProvenanceTable.init(isClustered).done(function () { var searchTerms = {}; http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js index 8162c2c..eedeed2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js @@ -21,7 +21,7 @@ nf.ClusterSearch = (function () { var config = { search: 'Search nodes', urls: { - clusterSearch: '../nifi-api/controller/cluster/search-results' + clusterSearch: '../nifi-api/flow/cluster/search-results' } }; http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js index 81b80b7..5477a31 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates-table.js @@ -28,17 +28,12 @@ nf.TemplatesTable = (function () { filterList: 'templates-filter-list' }, urls: { - api: '../nifi-api', + templates: '../nifi-api/flow/templates', downloadToken: '../nifi-api/access/download-token' } }; /** - * the current group id - */ - var groupId; - - /** * Sorts the specified data using the specified sort details. * * @param {object} sortDetails @@ -52,8 +47,8 @@ nf.TemplatesTable = (function () { var bDate = nf.Common.parseDateTime(b[sortDetails.columnId]); return aDate.getTime() - bDate.getTime(); } else { - var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; - var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; + var aString = nf.Common.isDefinedAndNotNull(a.template[sortDetails.columnId]) ? a.template[sortDetails.columnId] : ''; + var bString = nf.Common.isDefinedAndNotNull(b.template[sortDetails.columnId]) ? b.template[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; } }; @@ -65,15 +60,15 @@ nf.TemplatesTable = (function () { /** * Prompts the user before attempting to delete the specified template. * - * @argument {object} template The template + * @argument {object} templateEntity The template */ - var promptToDeleteTemplate = function (template) { + var promptToDeleteTemplate = function (templateEntity) { // prompt for deletion nf.Dialog.showYesNoDialog({ headerText: 'Delete Template', - dialogContent: 'Delete template \'' + nf.Common.escapeHtml(template.name) + '\'?', + dialogContent: 'Delete template \'' + nf.Common.escapeHtml(templateEntity.template.name) + '\'?', yesHandler: function () { - deleteTemplate(template); + deleteTemplate(templateEntity); } }); }; @@ -81,17 +76,17 @@ nf.TemplatesTable = (function () { /** * Deletes the template with the specified id. * - * @argument {string} template The template + * @argument {string} templateEntity The template */ - var deleteTemplate = function (template) { + var deleteTemplate = function (templateEntity) { $.ajax({ type: 'DELETE', - url: template.uri, + url: templateEntity.template.uri, dataType: 'json' }).done(function () { var templatesGrid = $('#templates-table').data('gridInstance'); var templatesData = templatesGrid.getData(); - templatesData.deleteItem(template.id); + templatesData.deleteItem(templateEntity.id); // update the total number of templates $('#total-templates').text(templatesData.getItems().length); @@ -153,15 +148,15 @@ nf.TemplatesTable = (function () { } // perform the filter - return item[args.property].search(filterExp) >= 0; + return item.template[args.property].search(filterExp) >= 0; }; /** * Downloads the specified template. * - * @param {object} template The template + * @param {object} templateEntity The template */ - var downloadTemplate = function (template) { + var downloadTemplate = function (templateEntity) { nf.Common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { var parameters = {}; @@ -172,9 +167,9 @@ nf.TemplatesTable = (function () { // open the url if ($.isEmptyObject(parameters)) { - window.open(template.uri + '/download'); + window.open(templateEntity.template.uri + '/download'); } else { - window.open(template.uri + '/download' + '?' + $.param(parameters)); + window.open(templateEntity.template.uri + '/download' + '?' + $.param(parameters)); } }).fail(function () { nf.Dialog.showOkDialog({ @@ -216,22 +211,48 @@ nf.TemplatesTable = (function () { } }); - // enable template uploading if DFM - if (nf.Common.isDFM()) { - $('#upload-template-container').show(); - } + var timestampFormatter = function (row, cell, value, columnDef, dataContext) { + if (!dataContext.accessPolicy.canRead) { + return ''; + } - // function for formatting the last accessed time - var valueFormatter = function (row, cell, value, columnDef, dataContext) { - return nf.Common.formatValue(value); + return dataContext.template.timestamp; + }; + + var nameFormatter = function (row, cell, value, columnDef, dataContext) { + if (!dataContext.accessPolicy.canRead) { + return '<span class="blank">' + dataContext.id + '</span>'; + } + + return dataContext.template.name; + }; + + var descriptionFormatter = function (row, cell, value, columnDef, dataContext) { + if (!dataContext.accessPolicy.canRead) { + return ''; + } + + return nf.Common.formatValue(dataContext.template.description); + }; + + var groupIdFormatter = function (row, cell, value, columnDef, dataContext) { + if (!dataContext.accessPolicy.canRead) { + return ''; + } + + return dataContext.template.groupId; }; // function for formatting the actions column var actionFormatter = function (row, cell, value, columnDef, dataContext) { - var markup = '<div title="Download" class="pointer export-template icon icon-template-save" style="margin-top: 2px;"></div>'; + var markup = ''; + + if (dataContext.accessPolicy.canRead === true) { + markup += '<div title="Download" class="pointer export-template icon icon-template-save" style="margin-top: 2px;"></div>'; + } // all DFMs to remove templates - if (nf.Common.isDFM()) { + if (dataContext.accessPolicy.canWrite === true) { markup += '<div title="Remove Template" class="pointer prompt-to-delete-template fa fa-trash" style="margin-top: 2px; margin-left: 3px;"></div>'; } return markup; @@ -239,9 +260,10 @@ nf.TemplatesTable = (function () { // initialize the templates table var templatesColumns = [ - {id: 'timestamp', name: 'Date/Time', field: 'timestamp', sortable: true, defaultSortAsc: false, resizable: false, formatter: valueFormatter, width: 225, maxWidth: 225}, - {id: 'name', name: 'Name', field: 'name', sortable: true, resizable: true}, - {id: 'description', name: 'Description', field: 'description', sortable: true, resizable: true, formatter: valueFormatter}, + {id: 'timestamp', name: 'Date/Time', sortable: true, defaultSortAsc: false, resizable: false, formatter: timestampFormatter, width: 225, maxWidth: 225}, + {id: 'name', name: 'Name', sortable: true, resizable: true, formatter: nameFormatter}, + {id: 'description', name: 'Description', sortable: true, resizable: true, formatter: descriptionFormatter}, + {id: 'groupId', name: 'Process Group Id', sortable: true, resizable: true, formatter: groupIdFormatter}, {id: 'actions', name: ' ', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100} ]; var templatesOptions = { @@ -277,7 +299,7 @@ nf.TemplatesTable = (function () { templatesGrid.setSortColumn('timestamp', false); templatesGrid.onSort.subscribe(function (e, args) { sort({ - columnId: args.sortCol.field, + columnId: args.sortCol.id, sortAsc: args.sortAsc }, templatesData); }); @@ -333,17 +355,9 @@ nf.TemplatesTable = (function () { * Load the processor templates table. */ loadTemplatesTable: function () { - groupId = $('#template-group-id').text(); - if (nf.Common.isUndefined(groupId) || nf.Common.isNull(groupId)) { - nf.Dialog.showOkDialog({ - headerText: 'Load Templates', - content: 'Group id not specified.' - }); - } - return $.ajax({ type: 'GET', - url: config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/templates', + url: config.urls.templates, data: { verbose: false }, http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates.js index 86d9934..678c25f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/templates/nf-templates.js @@ -31,37 +31,21 @@ nf.Templates = (function () { urls: { banners: '../nifi-api/flow/banners', about: '../nifi-api/flow/about', - authorities: '../nifi-api/flow/authorities' + currentUser: '../nifi-api/flow/current-user' } }; /** - * the current group id + * Loads the current users. */ - var groupId; - - /** - * Loads the current users authorities. - */ - var loadAuthorities = function () { - return $.Deferred(function (deferred) { - $.ajax({ - type: 'GET', - url: config.urls.authorities, - dataType: 'json' - }).done(function (response) { - if (nf.Common.isDefinedAndNotNull(response.authorities)) { - // record the users authorities - nf.Common.setAuthorities(response.authorities); - deferred.resolve(); - } else { - deferred.reject(); - } - }).fail(function (xhr, status, error) { - nf.Common.handleAjaxError(xhr, status, error); - deferred.reject(); - }); - }).promise(); + var loadCurrentUser = function () { + return $.ajax({ + type: 'GET', + url: config.urls.currentUser, + dataType: 'json' + }).done(function (currentUser) { + nf.Common.setCurrentUser(currentUser); + }).fail(nf.Common.handleAjaxError); }; /** @@ -73,81 +57,6 @@ nf.Templates = (function () { nf.TemplatesTable.loadTemplatesTable(); }); - // add a handler for the change file input chain event - $('#template-file-field').on('change', function (e) { - var filename = $(this).val(); - if (!nf.Common.isBlank(filename)) { - filename = filename.replace(/^.*[\\\/]/, ''); - } - - // set the filename - $('#selected-template-name').text(filename); - - // update the container visibility - $('#select-template-container').hide(); - $('#submit-template-container').show(); - }); - - // handles any uploading error - could be an error response or a successful response with an encoded error - var handleError = function (error) { - // show any errors - $('#upload-template-status').removeClass('import-status').addClass('import-status-error').text(error); - - // clear the form - $('#cancel-upload-template-button').click(); - }; - - // initialize the form - var templateForm = $('#template-upload-form').ajaxForm({ - url: '../nifi-api/process-groups/' + encodeURIComponent(groupId) + '/templates/upload', - dataType: 'xml', - success: function (response, statusText, xhr, form) { - // see if the import was successful - if (response.documentElement.tagName === 'templateEntity') { - // reset the status message - $('#upload-template-status').removeClass('import-status-error').addClass('import-status'); - - // clear the form - $('#cancel-upload-template-button').click(); - - // reload the templates table - nf.TemplatesTable.loadTemplatesTable(); - } else { - // import failed - var status = 'Unable to import template. Please check the log for errors.'; - if (response.documentElement.tagName === 'errorResponse') { - // if a more specific error was given, use it - var errorMessage = response.documentElement.getAttribute('statusText'); - if (!nf.Common.isBlank(errorMessage)) { - status = errorMessage; - } - } - handleError(status); - } - }, - error: function (xhr, statusText, error) { - handleError(error); - } - }); - - // add a handler for the upload button - $('#upload-template-button').click(function () { - templateForm.submit(); - }); - - // add a handler for the cancel upload button - $('#cancel-upload-template-button').click(function () { - // set the filename - $('#selected-template-name').text(''); - - // reset the form to ensure that the change fire will fire - templateForm.resetForm(); - - // update the container visibility - $('#select-template-container').show(); - $('#submit-template-container').hide(); - }); - // get the banners if we're not in the shell return $.Deferred(function (deferred) { if (top === window) { @@ -204,17 +113,8 @@ nf.Templates = (function () { init: function () { nf.Storage.init(); - // ensure the group id is specified - groupId = $('#template-group-id').text(); - if (nf.Common.isUndefined(groupId) || nf.Common.isNull(groupId)) { - nf.Dialog.showOkDialog({ - headerText: 'Load Templates', - content: 'Group id not specified.' - }); - } - - // load the users authorities - loadAuthorities().done(function () { + // load the current user + loadCurrentUser().done(function () { // create the templates table nf.TemplatesTable.init(); http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java index adb335c..3b827eb 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/PersistentProvenanceRepository.java @@ -16,51 +16,6 @@ */ package org.apache.nifi.provenance; -import java.io.EOFException; -import java.io.File; -import java.io.FileFilter; -import java.io.FileNotFoundException; -import java.io.FilenameFilter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - import org.apache.lucene.document.Document; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexNotFoundException; @@ -111,6 +66,51 @@ import org.apache.nifi.web.ResourceNotFoundException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.EOFException; +import java.io.File; +import java.io.FileFilter; +import java.io.FileNotFoundException; +import java.io.FilenameFilter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + public class PersistentProvenanceRepository implements ProvenanceEventRepository { public static final String DEPRECATED_CLASS_NAME = "nifi.controller.repository.provenance.PersistentProvenanceRepository"; @@ -416,7 +416,7 @@ public class PersistentProvenanceRepository implements ProvenanceEventRepository return false; } - final AuthorizationResult result = eventAuthorizable.checkAuthorization(authorizer, RequestAction.READ, user); + final AuthorizationResult result = eventAuthorizable.checkAuthorization(authorizer, RequestAction.READ, user, event.getAttributes()); return Result.Approved.equals(result.getResult()); } @@ -426,7 +426,7 @@ public class PersistentProvenanceRepository implements ProvenanceEventRepository } final Authorizable eventAuthorizable = resourceFactory.createProvenanceAuthorizable(event.getComponentId()); - eventAuthorizable.authorize(authorizer, RequestAction.READ, user); + eventAuthorizable.authorize(authorizer, RequestAction.READ, user, event.getAttributes()); } private List<ProvenanceEventRecord> filterUnauthorizedEvents(final List<ProvenanceEventRecord> events, final NiFiUser user) { http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java index 5417669..835e06e 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/test/java/org/apache/nifi/provenance/TestPersistentProvenanceRepository.java @@ -16,33 +16,6 @@ */ package org.apache.nifi.provenance; -import static org.apache.nifi.provenance.TestUtil.createFlowFile; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Collectors; -import java.util.zip.GZIPOutputStream; - import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.core.SimpleAnalyzer; import org.apache.lucene.document.Document; @@ -85,6 +58,33 @@ import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; +import java.io.File; +import java.io.FileFilter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.stream.Collectors; +import java.util.zip.GZIPOutputStream; + +import static org.apache.nifi.provenance.TestUtil.createFlowFile; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + public class TestPersistentProvenanceRepository { @Rule @@ -1735,11 +1735,6 @@ public class TestPersistentProvenanceRepository { } @Override - public String getUserName() { - return "Unit Test"; - } - - @Override public NiFiUser getChain() { return null; } http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java index 888f55a..ce53393 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/main/java/org/apache/nifi/provenance/VolatileProvenanceRepository.java @@ -16,27 +16,6 @@ */ package org.apache.nifi.provenance; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.regex.Pattern; - import org.apache.nifi.authorization.AccessDeniedException; import org.apache.nifi.authorization.AuthorizationResult; import org.apache.nifi.authorization.AuthorizationResult.Result; @@ -64,6 +43,27 @@ import org.apache.nifi.util.RingBuffer.ForEachEvaluator; import org.apache.nifi.util.RingBuffer.IterationDirection; import org.apache.nifi.web.ResourceNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.regex.Pattern; + public class VolatileProvenanceRepository implements ProvenanceEventRepository { // properties @@ -246,7 +246,7 @@ public class VolatileProvenanceRepository implements ProvenanceEventRepository { return false; } - final AuthorizationResult result = eventAuthorizable.checkAuthorization(authorizer, RequestAction.READ, user); + final AuthorizationResult result = eventAuthorizable.checkAuthorization(authorizer, RequestAction.READ, user, event.getAttributes()); return Result.Approved.equals(result.getResult()); } @@ -256,7 +256,7 @@ public class VolatileProvenanceRepository implements ProvenanceEventRepository { } final Authorizable eventAuthorizable = resourceFactory.createProvenanceAuthorizable(event.getComponentId()); - eventAuthorizable.authorize(authorizer, RequestAction.READ, user); + eventAuthorizable.authorize(authorizer, RequestAction.READ, user, event.getAttributes()); } private Filter<ProvenanceEventRecord> createFilter(final Query query, final NiFiUser user) { http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/test/java/org/apache/nifi/provenance/TestVolatileProvenanceRepository.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/test/java/org/apache/nifi/provenance/TestVolatileProvenanceRepository.java b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/test/java/org/apache/nifi/provenance/TestVolatileProvenanceRepository.java index d35ceac..7a7a334 100644 --- a/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/test/java/org/apache/nifi/provenance/TestVolatileProvenanceRepository.java +++ b/nifi-nar-bundles/nifi-provenance-repository-bundle/nifi-volatile-provenance-repository/src/test/java/org/apache/nifi/provenance/TestVolatileProvenanceRepository.java @@ -16,7 +16,14 @@ */ package org.apache.nifi.provenance; -import static org.junit.Assert.assertEquals; +import org.apache.nifi.authorization.user.NiFiUser; +import org.apache.nifi.flowfile.FlowFile; +import org.apache.nifi.provenance.search.Query; +import org.apache.nifi.provenance.search.QuerySubmission; +import org.apache.nifi.provenance.search.SearchTerms; +import org.apache.nifi.util.NiFiProperties; +import org.junit.BeforeClass; +import org.junit.Test; import java.io.IOException; import java.util.HashMap; @@ -26,15 +33,7 @@ import java.util.Map; import java.util.Set; import java.util.UUID; -import org.apache.nifi.authorization.user.NiFiUser; -import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.provenance.search.Query; -import org.apache.nifi.provenance.search.QuerySubmission; -import org.apache.nifi.provenance.search.SearchTerms; -import org.apache.nifi.util.NiFiProperties; - -import org.junit.BeforeClass; -import org.junit.Test; +import static org.junit.Assert.assertEquals; public class TestVolatileProvenanceRepository { @@ -184,11 +183,6 @@ public class TestVolatileProvenanceRepository { } @Override - public String getUserName() { - return "Unit Test"; - } - - @Override public NiFiUser getChain() { return null; } http://git-wip-us.apache.org/repos/asf/nifi/blob/ce533033/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/groovy/org/apache/nifi/processors/script/ExecuteScriptGroovyTest.groovy ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/groovy/org/apache/nifi/processors/script/ExecuteScriptGroovyTest.groovy b/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/groovy/org/apache/nifi/processors/script/ExecuteScriptGroovyTest.groovy index e7e9d48..86f119a 100644 --- a/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/groovy/org/apache/nifi/processors/script/ExecuteScriptGroovyTest.groovy +++ b/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/groovy/org/apache/nifi/processors/script/ExecuteScriptGroovyTest.groovy @@ -69,9 +69,9 @@ class ExecuteScriptGroovyTest extends BaseScriptTest { runner.setProperty(ExecuteScript.SCRIPT_FILE, TEST_RESOURCE_LOCATION + "groovy/testAddTimeAndThreadAttribute.groovy") runner.setProperty(ExecuteScript.MODULES, TEST_RESOURCE_LOCATION + "groovy") - // Override context value + // Override userContext value runner.processContext.maxConcurrentTasks = poolSize - logger.info("Overrode context max concurrent tasks to ${runner.processContext.maxConcurrentTasks}") + logger.info("Overrode userContext max concurrent tasks to ${runner.processContext.maxConcurrentTasks}") } @Test
