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
This commit is contained in:
Matt Gilman 2016-06-13 12:53:39 -04:00
parent cc95e5d8c5
commit 75bb4bfaa2
11 changed files with 248 additions and 228 deletions

View File

@ -186,7 +186,7 @@ public class NiFiProperties extends Properties {
// defaults // defaults
public static final String DEFAULT_TITLE = "NiFi"; public static final String DEFAULT_TITLE = "NiFi";
public static final Boolean DEFAULT_AUTO_RESUME_STATE = true; 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_LOGIN_IDENTITY_PROVIDER_CONFIGURATION_FILE = "conf/login-identity-providers.xml";
public static final String DEFAULT_USER_CREDENTIAL_CACHE_DURATION = "24 hours"; public static final String DEFAULT_USER_CREDENTIAL_CACHE_DURATION = "24 hours";
public static final Integer DEFAULT_REMOTE_INPUT_PORT = null; public static final Integer DEFAULT_REMOTE_INPUT_PORT = null;
@ -511,7 +511,7 @@ public class NiFiProperties extends Properties {
public File getAuthorizerConfiguraitonFile() { public File getAuthorizerConfiguraitonFile() {
final String value = getProperty(AUTHORIZER_CONFIGURATION_FILE); final String value = getProperty(AUTHORIZER_CONFIGURATION_FILE);
if (StringUtils.isBlank(value)) { if (StringUtils.isBlank(value)) {
return new File(DEFAULT_AUTHORITY_PROVIDER_CONFIGURATION_FILE); return new File(DEFAULT_AUTHORIZER_CONFIGURATION_FILE);
} else { } else {
return new File(value); return new File(value);
} }

View File

@ -16,24 +16,12 @@
*/ */
package org.apache.nifi.web.api; package org.apache.nifi.web.api;
import java.net.URI; import com.wordnik.swagger.annotations.Api;
import java.util.Set; import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import javax.servlet.http.HttpServletRequest; import com.wordnik.swagger.annotations.ApiResponse;
import javax.ws.rs.Consumes; import com.wordnik.swagger.annotations.ApiResponses;
import javax.ws.rs.DELETE; import com.wordnik.swagger.annotations.Authorization;
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 org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.authorization.Authorizer; import org.apache.nifi.authorization.Authorizer;
import org.apache.nifi.authorization.RequestAction; 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.ClientIdParameter;
import org.apache.nifi.web.api.request.LongParameter; import org.apache.nifi.web.api.request.LongParameter;
import com.wordnik.swagger.annotations.Api; import javax.servlet.http.HttpServletRequest;
import com.wordnik.swagger.annotations.ApiOperation; import javax.ws.rs.Consumes;
import com.wordnik.swagger.annotations.ApiParam; import javax.ws.rs.DELETE;
import com.wordnik.swagger.annotations.ApiResponse; import javax.ws.rs.DefaultValue;
import com.wordnik.swagger.annotations.ApiResponses; import javax.ws.rs.GET;
import com.wordnik.swagger.annotations.Authorization; 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. * 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)); + "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()) { if (isReplicateRequest()) {
return replicate(HttpMethod.PUT, remoteProcessGroupPortEntity); return replicate(HttpMethod.PUT, remoteProcessGroupPortEntity);
} }
// handle expects request (usually from the cluster manager)
final Revision revision = getRevision(remoteProcessGroupPortEntity, id); final Revision revision = getRevision(remoteProcessGroupPortEntity, id);
return withWriteLock( return withWriteLock(
serviceFacade, serviceFacade,
@ -393,12 +396,18 @@ public class RemoteProcessGroupResource extends ApplicationResource {
+ "remote process group port id of the requested resource (%s).", requestRemoteProcessGroupPort.getId(), portId)); + "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()) { if (isReplicateRequest()) {
return replicate(HttpMethod.PUT, remoteProcessGroupPortEntity); return replicate(HttpMethod.PUT, remoteProcessGroupPortEntity);
} }
// handle expects request (usually from the cluster manager) // handle expects request (usually from the cluster manager)
final Revision revision = getRevision(remoteProcessGroupPortEntity, portId); final Revision revision = getRevision(remoteProcessGroupPortEntity, id);
return withWriteLock( return withWriteLock(
serviceFacade, serviceFacade,
revision, revision,

View File

@ -112,13 +112,14 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat
this.navigateCtrl = navigateCtrl; this.navigateCtrl = navigateCtrl;
this.operateCtrl = operateCtrl; this.operateCtrl = operateCtrl;
} }
GraphControlsCtrl.prototype = { GraphControlsCtrl.prototype = {
constructor: GraphControlsCtrl, constructor: GraphControlsCtrl,
/** /**
* Register the header controller. * Register the header controller.
*/ */
register: function() { register: function () {
if (serviceProvider.graphControlsCtrl === undefined) { if (serviceProvider.graphControlsCtrl === undefined) {
serviceProvider.register('graphControlsCtrl', graphControlsCtrl); serviceProvider.register('graphControlsCtrl', graphControlsCtrl);
} }
@ -127,7 +128,7 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat
/** /**
* Initialize the graph controls. * Initialize the graph controls.
*/ */
init: function() { init: function () {
this.operateCtrl.init(); this.operateCtrl.init();
// initial the graph control visibility // initial the graph control visibility
var graphControlVisibility = nf.Storage.getItem('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 // set the initial position
positionGraphControls(); positionGraphControls();
}, },
/**
* Position the graph controls
*/
positionGraphControls: function () {
positionGraphControls();
},
/** /**
* Undock the graph control. * Undock the graph control.
* @param {jQuery} $event * @param {jQuery} $event
*/ */
undock: function($event) { undock: function ($event) {
openGraphControl($($event.target).parent().parent()); openGraphControl($($event.target).parent().parent());
}, },
@ -163,7 +168,7 @@ nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operat
* Expand the graph control. * Expand the graph control.
* @param {jQuery} $event * @param {jQuery} $event
*/ */
expand: function($event) { expand: function ($event) {
var icon = $($event.target); var icon = $($event.target);
if (icon.hasClass('fa-plus-square-o')) { if (icon.hasClass('fa-plus-square-o')) {
openGraphControl(icon.closest('div.graph-control')); openGraphControl(icon.closest('div.graph-control'));

View File

@ -512,33 +512,28 @@ nf.Actions = (function () {
componentsToStart.each(function (d) { componentsToStart.each(function (d) {
var selected = d3.select(this); var selected = d3.select(this);
// processor endpoint does not use running flag... // prepare the request
var component = { var uri, entity;
'id': d.id, if (nf.CanvasUtils.isProcessGroup(selected)) {
}; uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id);
if (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) { entity = {
component['state'] = 'RUNNING'; 'id': d.id,
'state': 'RUNNING'
}
} else { } else {
component['running'] = true; uri = d.component.uri;
entity = {
'revision': nf.Client.getRevision(d),
'component': {
'id': d.id,
'state': 'RUNNING'
}
};
} }
// build the entity startRequests.push(updateResource(uri, entity).done(function (response) {
var entity = {
'revision': nf.Client.getRevision(d),
'component': component
};
startRequests.push(updateResource(d.component.uri, entity).done(function (response) {
if (nf.CanvasUtils.isProcessGroup(selected)) { if (nf.CanvasUtils.isProcessGroup(selected)) {
nf.ProcessGroup.set(response); nf.ProcessGroup.reload(d.component);
// 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);
}
});
} else { } else {
nf[d.type].set(response); nf[d.type].set(response);
} }
@ -587,33 +582,28 @@ nf.Actions = (function () {
componentsToStop.each(function (d) { componentsToStop.each(function (d) {
var selected = d3.select(this); var selected = d3.select(this);
// processor endpoint does not use running flag... // prepare the request
var component = { var uri, entity;
'id': d.id, if (nf.CanvasUtils.isProcessGroup(selected)) {
}; uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id);
if (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) { entity = {
component['state'] = 'STOPPED'; 'id': d.id,
'state': 'STOPPED'
};
} else { } else {
component['running'] = false; uri = d.component.uri;
entity = {
'revision': nf.Client.getRevision(d),
'component': {
'id': d.id,
'state': 'STOPPED'
}
};
} }
// build the entity stopRequests.push(updateResource(uri, entity).done(function (response) {
var entity = {
'revision': nf.Client.getRevision(d),
'component': component
};
stopRequests.push(updateResource(d.component.uri, entity).done(function (response) {
if (nf.CanvasUtils.isProcessGroup(selected)) { if (nf.CanvasUtils.isProcessGroup(selected)) {
nf.ProcessGroup.set(response); nf.ProcessGroup.reload(d.component);
// 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);
}
});
} else { } else {
nf[d.type].set(response); nf[d.type].set(response);
} }

View File

@ -523,6 +523,17 @@ nf.Canvas = (function () {
if (e.target === window) { if (e.target === window) {
updateGraphSize(); updateGraphSize();
updateFlowStatusContainerSize(); 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) { }).on('keydown', function (evt) {
// if a dialog is open, disable canvas shortcuts // if a dialog is open, disable canvas shortcuts

View File

@ -229,11 +229,6 @@ nf.ProcessGroupConfiguration = (function () {
// settings refresh button... // settings refresh button...
nf.Common.addHoverEffect('#process-group-configuration-refresh-button', 'button-refresh', 'button-refresh-hover'); 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 // initialize each tab
initGeneral(); initGeneral();
nf.ControllerServices.init(getControllerServicesTable()); nf.ControllerServices.init(getControllerServicesTable());

View File

@ -365,7 +365,7 @@ nf.QueueListing = (function () {
type: 'GET', type: 'GET',
url: listingRequest.uri, url: listingRequest.uri,
dataType: 'json' dataType: 'json'
}).done(function(response) { }).done(function (response) {
listingRequest = response.listingRequest; listingRequest = response.listingRequest;
processListingRequest(nextDelay); processListingRequest(nextDelay);
}).fail(completeListingRequest).fail(nf.Common.handleAjaxError); }).fail(completeListingRequest).fail(nf.Common.handleAjaxError);
@ -377,7 +377,7 @@ nf.QueueListing = (function () {
url: '../nifi-api/flowfile-queues/' + connection.id + '/listing-requests', url: '../nifi-api/flowfile-queues/' + connection.id + '/listing-requests',
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function(response) { }).done(function (response) {
// initialize the progress bar value // initialize the progress bar value
updateProgress(0); updateProgress(0);
@ -424,7 +424,7 @@ nf.QueueListing = (function () {
url: flowFileSummary.uri, url: flowFileSummary.uri,
data: params, data: params,
dataType: 'json' dataType: 'json'
}).done(function(response) { }).done(function (response) {
var flowFile = response.flowFile; var flowFile = response.flowFile;
// show the URI to this flowfile // show the URI to this flowfile
@ -491,26 +491,11 @@ nf.QueueListing = (function () {
}).fail(nf.Common.handleAjaxError); }).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 { return {
init: function () { init: function () {
initializeListingRequestStatusDialog(); initializeListingRequestStatusDialog();
initFlowFileDetailsDialog(); initFlowFileDetailsDialog();
// listen for browser resize events to update the page size
$(window).resize(function () {
resetTableSize();
});
// define mouse over event for the refresh button // define mouse over event for the refresh button
nf.Common.addHoverEffect('#queue-listing-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () { nf.Common.addHoverEffect('#queue-listing-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () {
var connection = $('#queue-listing-table').data('connection'); var connection = $('#queue-listing-table').data('connection');
@ -608,8 +593,8 @@ nf.QueueListing = (function () {
// open the provenance page with the specified component // open the provenance page with the specified component
nf.Shell.showPage('provenance?' + $.param({ nf.Shell.showPage('provenance?' + $.param({
flowFileUuid: item.uuid flowFileUuid: item.uuid
})); }));
} }
} }
}); });
@ -634,6 +619,16 @@ nf.QueueListing = (function () {
$('#displayed-flowfiles').text('0'); $('#displayed-flowfiles').text('0');
}, },
/**
* 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. * Shows the listing of the FlowFiles from a given connection.
* *
@ -668,7 +663,7 @@ nf.QueueListing = (function () {
}); });
// adjust the table size // adjust the table size
resetTableSize(); nf.QueueListing.resetTableSize();
// store the connection for access later // store the connection for access later
$('#queue-listing-table').data('connection', connection); $('#queue-listing-table').data('connection', connection);

View File

@ -27,99 +27,99 @@ nf.RemoteProcessGroupPorts = (function () {
headerText: 'Configure Remote Port', headerText: 'Configure Remote Port',
overlayBackground: false, overlayBackground: false,
buttons: [{ buttons: [{
buttonText: 'Apply', buttonText: 'Apply',
handler: { handler: {
click: function () { click: function () {
var remotePortConcurrentTasks = $('#remote-port-concurrent-tasks').val(); var remotePortConcurrentTasks = $('#remote-port-concurrent-tasks').val();
// ensure the property name and value is specified // ensure the property name and value is specified
if ($.isNumeric(remotePortConcurrentTasks)) { if ($.isNumeric(remotePortConcurrentTasks)) {
var remoteProcessGroupId = $('#remote-process-group-ports-id').text(); var remoteProcessGroupId = $('#remote-process-group-ports-id').text();
var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum();
var remotePortId = $('#remote-port-id').text(); var remotePortId = $('#remote-port-id').text();
// create the remote process group details // create the remote process group details
var remoteProcessGroupPortEntity = { var remoteProcessGroupPortEntity = {
'revision': nf.Client.getRevision(remoteProcessGroupData), 'revision': nf.Client.getRevision(remoteProcessGroupData),
'remoteProcessGroupPort': { 'remoteProcessGroupPort': {
id: remotePortId, id: remotePortId,
groupId: remoteProcessGroupId, groupId: remoteProcessGroupId,
useCompression: $('#remote-port-use-compression').hasClass('checkbox-checked'), useCompression: $('#remote-port-use-compression').hasClass('checkbox-checked'),
concurrentlySchedulableTaskCount: remotePortConcurrentTasks concurrentlySchedulableTaskCount: remotePortConcurrentTasks
} }
}; };
// determine the type of port this is // determine the type of port this is
var portContextPath = '/output-ports/'; var portContextPath = '/output-ports/';
if ($('#remote-port-type').text() === 'input') { if ($('#remote-port-type').text() === 'input') {
portContextPath = '/input-ports/'; 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 // set the new values
$.ajax({ $('#' + remotePortId + '-concurrent-tasks').text(remotePort.concurrentlySchedulableTaskCount);
type: 'PUT', $('#' + remotePortId + '-compression').text(compressionLabel);
data: JSON.stringify(remoteProcessGroupPortEntity), }).fail(function (xhr, status, error) {
url: remoteProcessGroupData.component.uri + portContextPath + encodeURIComponent(remotePortId), if (xhr.status === 400) {
dataType: 'json', var errors = xhr.responseText.split('\n');
contentType: 'application/json'
}).done(function (response) {
// TODO - update the revision
// nf.Client.setRevision(response.revision);
// get the response var content;
var remotePort = response.remoteProcessGroupPort; if (errors.length === 1) {
content = $('<span></span>').text(errors[0]);
// 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');
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'
});
} else { } 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 // close the dialog
$('#remote-port-configuration').modal('hide'); $('#remote-port-configuration').modal('hide');
} });
} } else {
} nf.Dialog.showOkDialog({
}, { dialogContent: 'Concurrent tasks must be an integer value.',
buttonText: 'Cancel', overlayBackground: false
handler: { });
click: function () {
// close the dialog
$('#remote-port-configuration').modal('hide'); $('#remote-port-configuration').modal('hide');
} }
} }
}], }
}, {
buttonText: 'Cancel',
handler: {
click: function () {
$('#remote-port-configuration').modal('hide');
}
}
}],
handler: { handler: {
close: function () { close: function () {
// clear the name/value textfields // clear the name/value textfields
@ -140,31 +140,31 @@ nf.RemoteProcessGroupPorts = (function () {
headerText: 'Remote Process Group Ports', headerText: 'Remote Process Group Ports',
overlayBackground: true, overlayBackground: true,
buttons: [{ buttons: [{
buttonText: 'Close', buttonText: 'Close',
handler: { handler: {
click: function () { click: function () {
// if this is a DFM, the over status of this node may have changed // if this is a DFM, the over status of this node may have changed
if (nf.Common.isDFM()) { if (nf.Common.isDFM()) {
// get the component in question // get the component in question
var remoteProcessGroupId = $('#remote-process-group-ports-id').text(); var remoteProcessGroupId = $('#remote-process-group-ports-id').text();
var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum();
// reload the remote process group // reload the remote process group
nf.RemoteProcessGroup.reload(remoteProcessGroupData.component); nf.RemoteProcessGroup.reload(remoteProcessGroupData.component);
}
// hide the dialog
$('#remote-process-group-ports').modal('hide');
} }
// hide the dialog
$('#remote-process-group-ports').modal('hide');
} }
}], }
}],
handler: { handler: {
close: function () { close: function () {
// clear the remote process group details // clear the remote process group details
$('#remote-process-group-ports-id').text(''); $('#remote-process-group-ports-id').text('');
$('#remote-process-group-ports-name').text(''); $('#remote-process-group-ports-name').text('');
$('#remote-process-group-ports-url').text(''); $('#remote-process-group-ports-url').text('');
// clear any tooltips // clear any tooltips
var dialog = $('#remote-process-group-ports'); var dialog = $('#remote-process-group-ports');
nf.Common.cleanUpTooltips(dialog, 'div.remote-port-removed'); 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. * Creates the markup for configuration concurrent tasks for a port.
* *
* @argument {jQuery} container The container * @argument {jQuery} container The container
* @argument {object} port The port * @argument {object} port The port
* @argument {string} portType The type of port * @argument {string} portType The type of port
@ -260,6 +260,7 @@ nf.RemoteProcessGroupPorts = (function () {
'revision': nf.Client.getRevision(remoteProcessGroupData), 'revision': nf.Client.getRevision(remoteProcessGroupData),
'remoteProcessGroupPort': { 'remoteProcessGroupPort': {
id: port.id, id: port.id,
groupId: remoteProcessGroupId,
transmitting: isTransmitting transmitting: isTransmitting
} }
}; };
@ -369,10 +370,10 @@ nf.RemoteProcessGroupPorts = (function () {
// add this ports concurrent tasks // add this ports concurrent tasks
$('<div>' + $('<div>' +
'<div class="setting-name">' + '<div class="setting-name">' +
'Concurrent tasks' + 'Concurrent tasks' +
'<img class="processor-setting concurrent-tasks-info" src="images/iconInfo.png" alt="Info"/>' + '<img class="processor-setting concurrent-tasks-info" src="images/iconInfo.png" alt="Info"/>' +
'</div>' + '</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.' content: 'The number of tasks that should be concurrently scheduled for this port.'
}, nf.Common.config.tooltipConfig)); }, nf.Common.config.tooltipConfig));
@ -386,13 +387,13 @@ nf.RemoteProcessGroupPorts = (function () {
// add this ports compression config // add this ports compression config
$('<div>' + $('<div>' +
'<div class="setting-name">' + '<div class="setting-name">' +
'Compressed' + 'Compressed' +
'</div>' + '</div>' +
'<div class="setting-value">' + '<div class="setting-value">' +
'<div id="' + portId + '-compression">' + compressionLabel + '</div>' + '<div id="' + portId + '-compression">' + compressionLabel + '</div>' +
'</div>' + '</div>' +
'</div>').appendTo(compressionContainer); '</div>').appendTo(compressionContainer);
// clear // clear
$('<div class="clear"></div>').appendTo(portContainer); $('<div class="clear"></div>').appendTo(portContainer);
@ -403,7 +404,7 @@ nf.RemoteProcessGroupPorts = (function () {
/** /**
* Configures the specified remote port. * Configures the specified remote port.
* *
* @argument {string} portId The port id * @argument {string} portId The port id
* @argument {string} portName The port name * @argument {string} portName The port name
* @argument {int} portConcurrentTasks The number of concurrent tasks for the port * @argument {int} portConcurrentTasks The number of concurrent tasks for the port
@ -435,10 +436,10 @@ nf.RemoteProcessGroupPorts = (function () {
initRemotePortConfigurationDialog(); initRemotePortConfigurationDialog();
initRemoteProcessGroupConfigurationDialog(); initRemoteProcessGroupConfigurationDialog();
}, },
/** /**
* Shows the details for the remote process group in the specified selection. * Shows the details for the remote process group in the specified selection.
* *
* @argument {selection} selection The selection * @argument {selection} selection The selection
*/ */
showPorts: function (selection) { showPorts: function (selection) {

View File

@ -670,7 +670,7 @@ nf.RemoteProcessGroup = (function () {
// received ports value // received ports value
updated.select('text.remote-process-group-received tspan.ports') updated.select('text.remote-process-group-received tspan.ports')
.text(function (d) { .text(function (d) {
return d.inputPortCount + ' ' + String.fromCharCode(8594) + ' '; return d.outputPortCount + ' ' + String.fromCharCode(8594) + ' ';
}); });
// received count value // received count value

View File

@ -990,11 +990,6 @@ nf.Settings = (function () {
} }
}); });
// handle window resizing
$(window).on('resize', function (e) {
nf.Settings.resetTableSize();
});
// initialize each tab // initialize each tab
initGeneral(); initGeneral();
nf.ControllerServices.init(getControllerServicesTable()); nf.ControllerServices.init(getControllerServicesTable());

View File

@ -48,6 +48,9 @@ $(document).ready(function () {
nf.Shell = (function () { nf.Shell = (function () {
var showPageResize = null;
var showContentResize = null;
return { return {
/** /**
* Shows a page in the shell. * Shows a page in the shell.
@ -99,13 +102,21 @@ nf.Shell = (function () {
height: shell.height() height: shell.height()
}).appendTo(shell); }).appendTo(shell);
// add a window resize listener // remove the window resize listener
$(window).resize(function () { if (typeof showPageResize === 'function') {
$(window).off('resize', showPageResize);
}
// handle resize
showPageResize = function () {
shellIframe.css({ shellIframe.css({
width: shell.width(), width: shell.width(),
height: shell.height() height: shell.height()
}); });
}); };
// add a window resize listener
$(window).resize(showPageResize);
}).promise(); }).promise();
}, },
@ -152,17 +163,25 @@ nf.Shell = (function () {
height: shell.height() height: shell.height()
}).append(content).appendTo(shell); }).append(content).appendTo(shell);
// remove the window resize listener
if (typeof showContentResize === 'function') {
$(window).off('resize', showContentResize);
}
// show the content // show the content
$('#shell-dialog').modal('show'); $('#shell-dialog').modal('show');
content.show(); content.show();
// add a window resize listener // handle resizes
$(window).resize(function () { showContentResize = function () {
contentContainer.css({ contentContainer.css({
width: shell.width(), width: shell.width(),
height: shell.height() height: shell.height()
}); });
}); };
// add a window resize listener
$(window).resize(showContentResize);
} }
}).promise(); }).promise();
} }