Repository: nifi Updated Branches: refs/heads/master cc95e5d8c -> 75bb4bfaa
NIFI-1781: - Listening for window resize events more selectively. - Fixing malformed request when configuring remote process group ports. - Fixing malformed request when starting/stopping a selected process group. - Fixing default value for authorizers.xml. - This closes #524 Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/75bb4bfa Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/75bb4bfa Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/75bb4bfa Branch: refs/heads/master Commit: 75bb4bfaa2d0ba99d30a550670b35d12801e8f04 Parents: cc95e5d Author: Matt Gilman <matt.c.gil...@gmail.com> Authored: Mon Jun 13 12:53:39 2016 -0400 Committer: Matt Gilman <matt.c.gil...@gmail.com> Committed: Mon Jun 13 16:55:01 2016 -0400 ---------------------------------------------------------------------- .../org/apache/nifi/util/NiFiProperties.java | 4 +- .../web/api/RemoteProcessGroupResource.java | 61 ++--- .../nf-ng-canvas-graph-controls-controller.js | 19 +- .../src/main/webapp/js/nf/canvas/nf-actions.js | 82 +++---- .../src/main/webapp/js/nf/canvas/nf-canvas.js | 11 + .../nf/canvas/nf-process-group-configuration.js | 5 - .../webapp/js/nf/canvas/nf-queue-listing.js | 37 ++- .../nf/canvas/nf-remote-process-group-ports.js | 225 ++++++++++--------- .../js/nf/canvas/nf-remote-process-group.js | 2 +- .../src/main/webapp/js/nf/canvas/nf-settings.js | 5 - .../src/main/webapp/js/nf/nf-shell.js | 31 ++- 11 files changed, 251 insertions(+), 231 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java ---------------------------------------------------------------------- diff --git a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java index bb74b25..ea3b959 100644 --- a/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java +++ b/nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java @@ -186,7 +186,7 @@ public class NiFiProperties extends Properties { // defaults public static final String DEFAULT_TITLE = "NiFi"; public static final Boolean DEFAULT_AUTO_RESUME_STATE = true; - public static final String DEFAULT_AUTHORITY_PROVIDER_CONFIGURATION_FILE = "conf/authority-providers.xml"; + public static final String DEFAULT_AUTHORIZER_CONFIGURATION_FILE = "conf/authorizers.xml"; public static final String DEFAULT_LOGIN_IDENTITY_PROVIDER_CONFIGURATION_FILE = "conf/login-identity-providers.xml"; public static final String DEFAULT_USER_CREDENTIAL_CACHE_DURATION = "24 hours"; public static final Integer DEFAULT_REMOTE_INPUT_PORT = null; @@ -511,7 +511,7 @@ public class NiFiProperties extends Properties { public File getAuthorizerConfiguraitonFile() { final String value = getProperty(AUTHORIZER_CONFIGURATION_FILE); if (StringUtils.isBlank(value)) { - return new File(DEFAULT_AUTHORITY_PROVIDER_CONFIGURATION_FILE); + return new File(DEFAULT_AUTHORIZER_CONFIGURATION_FILE); } else { return new File(value); } http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java index 61549c3..1e9e720 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/RemoteProcessGroupResource.java @@ -16,24 +16,12 @@ */ package org.apache.nifi.web.api; -import java.net.URI; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - +import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiOperation; +import com.wordnik.swagger.annotations.ApiParam; +import com.wordnik.swagger.annotations.ApiResponse; +import com.wordnik.swagger.annotations.ApiResponses; +import com.wordnik.swagger.annotations.Authorization; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.authorization.Authorizer; import org.apache.nifi.authorization.RequestAction; @@ -49,12 +37,22 @@ import org.apache.nifi.web.api.entity.RemoteProcessGroupPortEntity; import org.apache.nifi.web.api.request.ClientIdParameter; import org.apache.nifi.web.api.request.LongParameter; -import com.wordnik.swagger.annotations.Api; -import com.wordnik.swagger.annotations.ApiOperation; -import com.wordnik.swagger.annotations.ApiParam; -import com.wordnik.swagger.annotations.ApiResponse; -import com.wordnik.swagger.annotations.ApiResponses; -import com.wordnik.swagger.annotations.Authorization; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.net.URI; +import java.util.Set; /** * RESTful endpoint for managing a Remote group. @@ -310,11 +308,16 @@ public class RemoteProcessGroupResource extends ApplicationResource { + "remote process group port id of the requested resource (%s).", requestRemoteProcessGroupPort.getId(), portId)); } + // ensure the group ids are the same + if (!id.equals(requestRemoteProcessGroupPort.getGroupId())) { + throw new IllegalArgumentException(String.format("The remote process group id (%s) in the request body does not equal the " + + "remote process group id of the requested resource (%s).", requestRemoteProcessGroupPort.getGroupId(), id)); + } + if (isReplicateRequest()) { return replicate(HttpMethod.PUT, remoteProcessGroupPortEntity); } - // handle expects request (usually from the cluster manager) final Revision revision = getRevision(remoteProcessGroupPortEntity, id); return withWriteLock( serviceFacade, @@ -393,12 +396,18 @@ public class RemoteProcessGroupResource extends ApplicationResource { + "remote process group port id of the requested resource (%s).", requestRemoteProcessGroupPort.getId(), portId)); } + // ensure the group ids are the same + if (!id.equals(requestRemoteProcessGroupPort.getGroupId())) { + throw new IllegalArgumentException(String.format("The remote process group id (%s) in the request body does not equal the " + + "remote process group id of the requested resource (%s).", requestRemoteProcessGroupPort.getGroupId(), id)); + } + if (isReplicateRequest()) { return replicate(HttpMethod.PUT, remoteProcessGroupPortEntity); } // handle expects request (usually from the cluster manager) - final Revision revision = getRevision(remoteProcessGroupPortEntity, portId); + final Revision revision = getRevision(remoteProcessGroupPortEntity, id); return withWriteLock( serviceFacade, revision, http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-graph-controls-controller.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-graph-controls-controller.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-graph-controls-controller.js index bc6a0df..63cce54 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-graph-controls-controller.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-graph-controls-controller.js @@ -112,13 +112,14 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat this.navigateCtrl = navigateCtrl; this.operateCtrl = operateCtrl; } + GraphControlsCtrl.prototype = { constructor: GraphControlsCtrl, /** * Register the header controller. */ - register: function() { + register: function () { if (serviceProvider.graphControlsCtrl === undefined) { serviceProvider.register('graphControlsCtrl', graphControlsCtrl); } @@ -127,7 +128,7 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat /** * Initialize the graph controls. */ - init: function() { + init: function () { this.operateCtrl.init(); // initial the graph control visibility var graphControlVisibility = nf.Storage.getItem('graph-control-visibility'); @@ -144,18 +145,22 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat }); } - // listen for browser resize events to reset the graph control positioning - $(window).resize(positionGraphControls); - // set the initial position positionGraphControls(); }, /** + * Position the graph controls + */ + positionGraphControls: function () { + positionGraphControls(); + }, + + /** * Undock the graph control. * @param {jQuery} $event */ - undock: function($event) { + undock: function ($event) { openGraphControl($($event.target).parent().parent()); }, @@ -163,7 +168,7 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat * Expand the graph control. * @param {jQuery} $event */ - expand: function($event) { + expand: function ($event) { var icon = $($event.target); if (icon.hasClass('fa-plus-square-o')) { openGraphControl(icon.closest('div.graph-control')); http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js index 9c5b0a9..cb3e7af 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js @@ -512,33 +512,28 @@ nf.Actions = (function () { componentsToStart.each(function (d) { var selected = d3.select(this); - // processor endpoint does not use running flag... - var component = { - 'id': d.id, - }; - if (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) { - component['state'] = 'RUNNING'; + // prepare the request + var uri, entity; + if (nf.CanvasUtils.isProcessGroup(selected)) { + uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id); + entity = { + 'id': d.id, + 'state': 'RUNNING' + } } else { - component['running'] = true; + uri = d.component.uri; + entity = { + 'revision': nf.Client.getRevision(d), + 'component': { + 'id': d.id, + 'state': 'RUNNING' + } + }; } - // build the entity - var entity = { - 'revision': nf.Client.getRevision(d), - 'component': component - }; - - startRequests.push(updateResource(d.component.uri, entity).done(function (response) { + startRequests.push(updateResource(uri, entity).done(function (response) { if (nf.CanvasUtils.isProcessGroup(selected)) { - nf.ProcessGroup.set(response); - - // reload the group's connections - var connections = nf.Connection.getComponentConnections(response.id); - $.each(connections, function (_, connection) { - if (connection.accessPolicy.canRead) { - nf.Connection.reload(connection.component); - } - }); + nf.ProcessGroup.reload(d.component); } else { nf[d.type].set(response); } @@ -587,33 +582,28 @@ nf.Actions = (function () { componentsToStop.each(function (d) { var selected = d3.select(this); - // processor endpoint does not use running flag... - var component = { - 'id': d.id, - }; - if (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) { - component['state'] = 'STOPPED'; + // prepare the request + var uri, entity; + if (nf.CanvasUtils.isProcessGroup(selected)) { + uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id); + entity = { + 'id': d.id, + 'state': 'STOPPED' + }; } else { - component['running'] = false; + uri = d.component.uri; + entity = { + 'revision': nf.Client.getRevision(d), + 'component': { + 'id': d.id, + 'state': 'STOPPED' + } + }; } - // build the entity - var entity = { - 'revision': nf.Client.getRevision(d), - 'component': component - }; - - stopRequests.push(updateResource(d.component.uri, entity).done(function (response) { + stopRequests.push(updateResource(uri, entity).done(function (response) { if (nf.CanvasUtils.isProcessGroup(selected)) { - nf.ProcessGroup.set(response); - - // reload the group's connections - var connections = nf.Connection.getComponentConnections(response.id); - $.each(connections, function (_, connection) { - if (connection.accessPolicy.canRead) { - nf.Connection.reload(connection.component); - } - }); + nf.ProcessGroup.reload(d.component); } else { nf[d.type].set(response); } http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js index 9d9e7c5..eef9b44 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js @@ -523,6 +523,17 @@ nf.Canvas = (function () { if (e.target === window) { updateGraphSize(); updateFlowStatusContainerSize(); + + nf.ng.Bridge.get('appCtrl.serviceProvider.graphControlsCtrl').positionGraphControls(); + + // resize grids when appropriate + if ($('#process-group-controller-services-table').is(':visible')) { + nf.ProcessGroupConfiguration.resetTableSize(); + } else if ($('#controller-services-table').is(':visible') || $('#reporting-tasks-table').is(':visible')) { + nf.Settings.resetTableSize(); + } else if ($('#queue-listing-table').is(':visible')) { + nf.QueueListing.resetTableSize(); + } } }).on('keydown', function (evt) { // if a dialog is open, disable canvas shortcuts http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js index 744869c..884e017 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js @@ -229,11 +229,6 @@ nf.ProcessGroupConfiguration = (function () { // settings refresh button... nf.Common.addHoverEffect('#process-group-configuration-refresh-button', 'button-refresh', 'button-refresh-hover'); - // handle window resizing - $(window).on('resize', function (e) { - nf.ProcessGroupConfiguration.resetTableSize(); - }); - // initialize each tab initGeneral(); nf.ControllerServices.init(getControllerServicesTable()); http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js ---------------------------------------------------------------------- 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 95755ed..c6dcbb2 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 @@ -365,7 +365,7 @@ nf.QueueListing = (function () { type: 'GET', url: listingRequest.uri, dataType: 'json' - }).done(function(response) { + }).done(function (response) { listingRequest = response.listingRequest; processListingRequest(nextDelay); }).fail(completeListingRequest).fail(nf.Common.handleAjaxError); @@ -377,7 +377,7 @@ nf.QueueListing = (function () { url: '../nifi-api/flowfile-queues/' + connection.id + '/listing-requests', dataType: 'json', contentType: 'application/json' - }).done(function(response) { + }).done(function (response) { // initialize the progress bar value updateProgress(0); @@ -424,7 +424,7 @@ nf.QueueListing = (function () { url: flowFileSummary.uri, data: params, dataType: 'json' - }).done(function(response) { + }).done(function (response) { var flowFile = response.flowFile; // show the URI to this flowfile @@ -491,26 +491,11 @@ nf.QueueListing = (function () { }).fail(nf.Common.handleAjaxError); }; - /** - * Resets the table size. - */ - var resetTableSize = function () { - var queueListingGrid = $('#queue-listing-table').data('gridInstance'); - if (nf.Common.isDefinedAndNotNull(queueListingGrid)) { - queueListingGrid.resizeCanvas(); - } - }; - return { init: function () { initializeListingRequestStatusDialog(); initFlowFileDetailsDialog(); - // listen for browser resize events to update the page size - $(window).resize(function () { - resetTableSize(); - }); - // define mouse over event for the refresh button nf.Common.addHoverEffect('#queue-listing-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () { var connection = $('#queue-listing-table').data('connection'); @@ -608,8 +593,8 @@ nf.QueueListing = (function () { // open the provenance page with the specified component nf.Shell.showPage('provenance?' + $.param({ - flowFileUuid: item.uuid - })); + flowFileUuid: item.uuid + })); } } }); @@ -635,6 +620,16 @@ nf.QueueListing = (function () { }, /** + * Update the size of the grid based on its container's current size. + */ + resetTableSize: function () { + var queueListingGrid = $('#queue-listing-table').data('gridInstance'); + if (nf.Common.isDefinedAndNotNull(queueListingGrid)) { + queueListingGrid.resizeCanvas(); + } + }, + + /** * Shows the listing of the FlowFiles from a given connection. * * @param {object} The connection @@ -668,7 +663,7 @@ nf.QueueListing = (function () { }); // adjust the table size - resetTableSize(); + nf.QueueListing.resetTableSize(); // store the connection for access later $('#queue-listing-table').data('connection', connection); http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js index baeed4c..4ab9b1f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js @@ -27,99 +27,99 @@ nf.RemoteProcessGroupPorts = (function () { headerText: 'Configure Remote Port', overlayBackground: false, buttons: [{ - buttonText: 'Apply', - handler: { - click: function () { - var remotePortConcurrentTasks = $('#remote-port-concurrent-tasks').val(); - - // ensure the property name and value is specified - if ($.isNumeric(remotePortConcurrentTasks)) { - var remoteProcessGroupId = $('#remote-process-group-ports-id').text(); - var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); - var remotePortId = $('#remote-port-id').text(); - - // create the remote process group details - var remoteProcessGroupPortEntity = { - 'revision': nf.Client.getRevision(remoteProcessGroupData), - 'remoteProcessGroupPort': { - id: remotePortId, - groupId: remoteProcessGroupId, - useCompression: $('#remote-port-use-compression').hasClass('checkbox-checked'), - concurrentlySchedulableTaskCount: remotePortConcurrentTasks - } - }; + buttonText: 'Apply', + handler: { + click: function () { + var remotePortConcurrentTasks = $('#remote-port-concurrent-tasks').val(); + + // ensure the property name and value is specified + if ($.isNumeric(remotePortConcurrentTasks)) { + var remoteProcessGroupId = $('#remote-process-group-ports-id').text(); + var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); + var remotePortId = $('#remote-port-id').text(); + + // create the remote process group details + var remoteProcessGroupPortEntity = { + 'revision': nf.Client.getRevision(remoteProcessGroupData), + 'remoteProcessGroupPort': { + id: remotePortId, + groupId: remoteProcessGroupId, + useCompression: $('#remote-port-use-compression').hasClass('checkbox-checked'), + concurrentlySchedulableTaskCount: remotePortConcurrentTasks + } + }; + + // determine the type of port this is + var portContextPath = '/output-ports/'; + if ($('#remote-port-type').text() === 'input') { + portContextPath = '/input-ports/'; + } - // determine the type of port this is - var portContextPath = '/output-ports/'; - if ($('#remote-port-type').text() === 'input') { - portContextPath = '/input-ports/'; + // update the selected component + $.ajax({ + type: 'PUT', + data: JSON.stringify(remoteProcessGroupPortEntity), + url: remoteProcessGroupData.component.uri + portContextPath + encodeURIComponent(remotePortId), + dataType: 'json', + contentType: 'application/json' + }).done(function (response) { + // TODO - update the revision + // nf.Client.setRevision(response.revision); + + // get the response + var remotePort = response.remoteProcessGroupPort; + + // determine the compression label + var compressionLabel = 'No'; + if (remotePort.useCompression === true) { + compressionLabel = 'Yes'; } - // update the selected component - $.ajax({ - type: 'PUT', - data: JSON.stringify(remoteProcessGroupPortEntity), - url: remoteProcessGroupData.component.uri + portContextPath + encodeURIComponent(remotePortId), - dataType: 'json', - contentType: 'application/json' - }).done(function (response) { - // TODO - update the revision - // nf.Client.setRevision(response.revision); - - // get the response - var remotePort = response.remoteProcessGroupPort; - - // determine the compression label - var compressionLabel = 'No'; - if (remotePort.useCompression === true) { - compressionLabel = 'Yes'; - } + // set the new values + $('#' + remotePortId + '-concurrent-tasks').text(remotePort.concurrentlySchedulableTaskCount); + $('#' + remotePortId + '-compression').text(compressionLabel); + }).fail(function (xhr, status, error) { + if (xhr.status === 400) { + var errors = xhr.responseText.split('\n'); - // set the new values - $('#' + remotePortId + '-concurrent-tasks').text(remotePort.concurrentlySchedulableTaskCount); - $('#' + remotePortId + '-compression').text(compressionLabel); - }).fail(function (xhr, status, error) { - if (xhr.status === 400) { - var errors = xhr.responseText.split('\n'); - - var content; - if (errors.length === 1) { - content = $('<span></span>').text(errors[0]); - } else { - content = nf.Common.formatUnorderedList(errors); - } - - nf.Dialog.showOkDialog({ - dialogContent: content, - overlayBackground: false, - headerText: 'Configuration Error' - }); + var content; + if (errors.length === 1) { + content = $('<span></span>').text(errors[0]); } else { - nf.Common.handleAjaxError(xhr, status, error); + content = nf.Common.formatUnorderedList(errors); } - }).always(function () { - // close the dialog - $('#remote-port-configuration').modal('hide'); - }); - } else { - nf.Dialog.showOkDialog({ - dialogContent: 'Concurrent tasks must be an integer value.', - overlayBackground: false - }); + nf.Dialog.showOkDialog({ + dialogContent: content, + overlayBackground: false, + headerText: 'Configuration Error' + }); + } else { + nf.Common.handleAjaxError(xhr, status, error); + } + }).always(function () { // close the dialog $('#remote-port-configuration').modal('hide'); - } - } - } - }, { - buttonText: 'Cancel', - handler: { - click: function () { + }); + } else { + nf.Dialog.showOkDialog({ + dialogContent: 'Concurrent tasks must be an integer value.', + overlayBackground: false + }); + + // close the dialog $('#remote-port-configuration').modal('hide'); } } - }], + } + }, { + buttonText: 'Cancel', + handler: { + click: function () { + $('#remote-port-configuration').modal('hide'); + } + } + }], handler: { close: function () { // clear the name/value textfields @@ -140,31 +140,31 @@ nf.RemoteProcessGroupPorts = (function () { headerText: 'Remote Process Group Ports', overlayBackground: true, buttons: [{ - buttonText: 'Close', - handler: { - click: function () { - // if this is a DFM, the over status of this node may have changed - if (nf.Common.isDFM()) { - // get the component in question - var remoteProcessGroupId = $('#remote-process-group-ports-id').text(); - var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); - - // reload the remote process group - nf.RemoteProcessGroup.reload(remoteProcessGroupData.component); - } - - // hide the dialog - $('#remote-process-group-ports').modal('hide'); + buttonText: 'Close', + handler: { + click: function () { + // if this is a DFM, the over status of this node may have changed + if (nf.Common.isDFM()) { + // get the component in question + var remoteProcessGroupId = $('#remote-process-group-ports-id').text(); + var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); + + // reload the remote process group + nf.RemoteProcessGroup.reload(remoteProcessGroupData.component); } + + // hide the dialog + $('#remote-process-group-ports').modal('hide'); } - }], + } + }], handler: { close: function () { // clear the remote process group details $('#remote-process-group-ports-id').text(''); $('#remote-process-group-ports-name').text(''); $('#remote-process-group-ports-url').text(''); - + // clear any tooltips var dialog = $('#remote-process-group-ports'); nf.Common.cleanUpTooltips(dialog, 'div.remote-port-removed'); @@ -180,7 +180,7 @@ nf.RemoteProcessGroupPorts = (function () { /** * Creates the markup for configuration concurrent tasks for a port. - * + * * @argument {jQuery} container The container * @argument {object} port The port * @argument {string} portType The type of port @@ -260,6 +260,7 @@ nf.RemoteProcessGroupPorts = (function () { 'revision': nf.Client.getRevision(remoteProcessGroupData), 'remoteProcessGroupPort': { id: port.id, + groupId: remoteProcessGroupId, transmitting: isTransmitting } }; @@ -369,10 +370,10 @@ nf.RemoteProcessGroupPorts = (function () { // add this ports concurrent tasks $('<div>' + '<div class="setting-name">' + - 'Concurrent tasks' + - '<img class="processor-setting concurrent-tasks-info" src="images/iconInfo.png" alt="Info"/>' + + 'Concurrent tasks' + + '<img class="processor-setting concurrent-tasks-info" src="images/iconInfo.png" alt="Info"/>' + '</div>' + - '</div>').append(concurrentTasks).appendTo(concurrentTasksContainer).find('img.concurrent-tasks-info').qtip($.extend({ + '</div>').append(concurrentTasks).appendTo(concurrentTasksContainer).find('img.concurrent-tasks-info').qtip($.extend({ content: 'The number of tasks that should be concurrently scheduled for this port.' }, nf.Common.config.tooltipConfig)); @@ -386,13 +387,13 @@ nf.RemoteProcessGroupPorts = (function () { // add this ports compression config $('<div>' + - '<div class="setting-name">' + - 'Compressed' + - '</div>' + - '<div class="setting-value">' + - '<div id="' + portId + '-compression">' + compressionLabel + '</div>' + - '</div>' + - '</div>').appendTo(compressionContainer); + '<div class="setting-name">' + + 'Compressed' + + '</div>' + + '<div class="setting-value">' + + '<div id="' + portId + '-compression">' + compressionLabel + '</div>' + + '</div>' + + '</div>').appendTo(compressionContainer); // clear $('<div class="clear"></div>').appendTo(portContainer); @@ -403,7 +404,7 @@ nf.RemoteProcessGroupPorts = (function () { /** * Configures the specified remote port. - * + * * @argument {string} portId The port id * @argument {string} portName The port name * @argument {int} portConcurrentTasks The number of concurrent tasks for the port @@ -435,10 +436,10 @@ nf.RemoteProcessGroupPorts = (function () { initRemotePortConfigurationDialog(); initRemoteProcessGroupConfigurationDialog(); }, - + /** * Shows the details for the remote process group in the specified selection. - * + * * @argument {selection} selection The selection */ showPorts: function (selection) { http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js index 466c435..2b835e6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group.js @@ -670,7 +670,7 @@ nf.RemoteProcessGroup = (function () { // received ports value updated.select('text.remote-process-group-received tspan.ports') .text(function (d) { - return d.inputPortCount + ' ' + String.fromCharCode(8594) + ' '; + return d.outputPortCount + ' ' + String.fromCharCode(8594) + ' '; }); // received count value http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js index a47cea7..1d8d312 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js @@ -990,11 +990,6 @@ nf.Settings = (function () { } }); - // handle window resizing - $(window).on('resize', function (e) { - nf.Settings.resetTableSize(); - }); - // initialize each tab initGeneral(); nf.ControllerServices.init(getControllerServicesTable()); http://git-wip-us.apache.org/repos/asf/nifi/blob/75bb4bfa/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-shell.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-shell.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-shell.js index bac57f6..cfd6635 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-shell.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-shell.js @@ -48,6 +48,9 @@ $(document).ready(function () { nf.Shell = (function () { + var showPageResize = null; + var showContentResize = null; + return { /** * Shows a page in the shell. @@ -99,13 +102,21 @@ nf.Shell = (function () { height: shell.height() }).appendTo(shell); - // add a window resize listener - $(window).resize(function () { + // remove the window resize listener + if (typeof showPageResize === 'function') { + $(window).off('resize', showPageResize); + } + + // handle resize + showPageResize = function () { shellIframe.css({ width: shell.width(), height: shell.height() }); - }); + }; + + // add a window resize listener + $(window).resize(showPageResize); }).promise(); }, @@ -152,17 +163,25 @@ nf.Shell = (function () { height: shell.height() }).append(content).appendTo(shell); + // remove the window resize listener + if (typeof showContentResize === 'function') { + $(window).off('resize', showContentResize); + } + // show the content $('#shell-dialog').modal('show'); content.show(); - // add a window resize listener - $(window).resize(function () { + // handle resizes + showContentResize = function () { contentContainer.css({ width: shell.width(), height: shell.height() }); - }); + }; + + // add a window resize listener + $(window).resize(showContentResize); } }).promise(); }