mirror of https://github.com/apache/nifi.git
NIFI-1870: - Restoring the upstream/downstream connections dialog. - Correcting input port label when showing downstream components.
This closes #1028. Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
parent
f11682202b
commit
0218bc61ef
|
@ -15,7 +15,7 @@
|
|||
limitations under the License.
|
||||
--%>
|
||||
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
|
||||
<div id="connections-dialog" layout="column" class="hidden large-dialog">
|
||||
<div id="connections-dialog" class="hidden">
|
||||
<div class="dialog-content">
|
||||
<div class="setting">
|
||||
<div class="setting-name">Selected component</div>
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
|
||||
#fill-color-dialog {
|
||||
display: none;
|
||||
width: 215px;
|
||||
width: 240px;
|
||||
height: 470px;
|
||||
}
|
||||
|
||||
#fill-color-value {
|
||||
width: 100%;
|
||||
width: 175px;
|
||||
}
|
||||
|
||||
#fill-color-processor-preview {
|
||||
|
@ -58,19 +58,26 @@ div.connections-component-name {
|
|||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#connections-dialog {
|
||||
height: 400px;
|
||||
width: 680px;
|
||||
}
|
||||
|
||||
#connections-context {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#connections-source {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#connections-destination {
|
||||
float: left;
|
||||
margin-left: 370px;
|
||||
margin-left: 360px;
|
||||
}
|
||||
|
||||
#connections-container {
|
||||
width: 612px;
|
||||
height: 190px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 5px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
|
|
@ -186,16 +186,14 @@ nf.ContextMenu = (function () {
|
|||
* @param {selection} selection The selection
|
||||
*/
|
||||
var hasDownstream = function (selection) {
|
||||
// TODO
|
||||
// // ensure the correct number of components are selected
|
||||
// if (selection.size() !== 1) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return nf.CanvasUtils.isFunnel(selection) || nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
|
||||
// nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isInputPort(selection) ||
|
||||
// (nf.CanvasUtils.isOutputPort(selection) && nf.Canvas.getParentGroupId() !== null);
|
||||
// ensure the correct number of components are selected
|
||||
if (selection.size() !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return nf.CanvasUtils.isFunnel(selection) || nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
|
||||
nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isInputPort(selection) ||
|
||||
(nf.CanvasUtils.isOutputPort(selection) && nf.Canvas.getParentGroupId() !== null);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -204,16 +202,14 @@ nf.ContextMenu = (function () {
|
|||
* @param {selection} selection The selection
|
||||
*/
|
||||
var hasUpstream = function (selection) {
|
||||
// TODO
|
||||
// // ensure the correct number of components are selected
|
||||
// if (selection.size() !== 1) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return nf.CanvasUtils.isFunnel(selection) || nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
|
||||
// nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isOutputPort(selection) ||
|
||||
// (nf.CanvasUtils.isInputPort(selection) && nf.Canvas.getParentGroupId() !== null);
|
||||
// ensure the correct number of components are selected
|
||||
if (selection.size() !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return nf.CanvasUtils.isFunnel(selection) || nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
|
||||
nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isOutputPort(selection) ||
|
||||
(nf.CanvasUtils.isInputPort(selection) && nf.Canvas.getParentGroupId() !== null);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,70 +25,50 @@ nf.GoTo = (function () {
|
|||
var config = {
|
||||
urls: {
|
||||
api: '../nifi-api',
|
||||
processGroups: '../nifi-api/process-groups/'
|
||||
processGroups: '../nifi-api/flow/process-groups/'
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a deferred for the process group.
|
||||
*
|
||||
* @param {string} processGroupId
|
||||
*/
|
||||
var getProcessGroup = function (processGroupId) {
|
||||
return $.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.processGroups + encodeURIComponent(processGroupId),
|
||||
dataType: 'json'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a deferred for the remote process group.
|
||||
*
|
||||
* @param {string} parentGroupId
|
||||
* @param {string} remoteProcessGroupId
|
||||
*/
|
||||
var getRemoteProcessGroup = function (parentGroupId, remoteProcessGroupId) {
|
||||
return $.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.processGroups + encodeURIComponent(parentGroupId) + '/remote-process-groups/' + encodeURIComponent(remoteProcessGroupId),
|
||||
dataType: 'json'
|
||||
});
|
||||
};
|
||||
var currentComponentId;
|
||||
var currentComponentLabel;
|
||||
|
||||
/**
|
||||
* Adds a connection to the connections dialog.
|
||||
*
|
||||
* @param {object} connection
|
||||
* @param {string} parentProcessGroupId
|
||||
* @param {object} connectionEntity
|
||||
* @param {array} processGroupEntities
|
||||
* @param {array} remoteProcessGroupEntities
|
||||
*/
|
||||
var addConnection = function (connection) {
|
||||
var addConnection = function (parentProcessGroupId, connectionEntity, processGroupEntities, remoteProcessGroupEntities) {
|
||||
var container = $('<div class="source-destination-connection"></div>').appendTo('#connections-container');
|
||||
|
||||
var source;
|
||||
if (connection.source.type === 'OUTPUT_PORT') {
|
||||
source = addSourceOutputPort(container, connection);
|
||||
} else if (connection.source.type === 'REMOTE_OUTPUT_PORT') {
|
||||
source = addSourceRemoteOutputPort(container, connection);
|
||||
if (connectionEntity.sourceType === 'OUTPUT_PORT') {
|
||||
addSourceOutputPort(parentProcessGroupId, container, connectionEntity, processGroupEntities);
|
||||
} else if (connectionEntity.sourceType === 'REMOTE_OUTPUT_PORT') {
|
||||
addSourceRemoteOutputPort(parentProcessGroupId, container, connectionEntity, remoteProcessGroupEntities);
|
||||
} else {
|
||||
source = addSourceComponent(container, connection);
|
||||
addSourceComponent(container, connectionEntity);
|
||||
}
|
||||
|
||||
source.done(function () {
|
||||
var connectionEntry = $('<div class="connection-entry"></div>').appendTo(container);
|
||||
|
||||
// format the connection name.. fall back to id
|
||||
var connectionStyle = '';
|
||||
var connectionName = nf.CanvasUtils.formatConnectionName(connection);
|
||||
if (connectionName === '') {
|
||||
connectionStyle = 'unset';
|
||||
connectionName = 'Connection';
|
||||
var connectionStyle = 'unset';
|
||||
var connectionName = 'Connection';
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
var formattedConnectionName = nf.CanvasUtils.formatConnectionName(connectionEntity.component);
|
||||
if (formattedConnectionName !== '') {
|
||||
connectionStyle = '';
|
||||
connectionName = formattedConnectionName;
|
||||
}
|
||||
}
|
||||
|
||||
// connection
|
||||
$('<div class="search-result-icon connection-small-icon"></div>').appendTo(connectionEntry);
|
||||
$('<div class="search-result-icon icon-connect"></div>').appendTo(connectionEntry);
|
||||
$('<div class="connection-entry-name go-to-link"></div>').attr('title', connectionName).addClass(connectionStyle).text(connectionName).on('click', function () {
|
||||
// go to the connection
|
||||
nf.CanvasUtils.showComponent(connection.parentGroupId, connection.id);
|
||||
nf.CanvasUtils.showComponent(parentProcessGroupId, connectionEntity.id);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
|
@ -97,44 +77,47 @@ nf.GoTo = (function () {
|
|||
// clear
|
||||
$('<div class="clear"></div>').appendTo(connectionEntry);
|
||||
|
||||
var destination;
|
||||
if (connection.destination.type === 'INPUT_PORT') {
|
||||
destination = addDestinationInputPort(container, connection);
|
||||
} else if (connection.destination.type === 'REMOTE_INPUT_PORT') {
|
||||
destination = addDestinationRemoteInputPort(container, connection);
|
||||
if (connectionEntity.destinationType === 'INPUT_PORT') {
|
||||
addDestinationInputPort(parentProcessGroupId, container, connectionEntity, processGroupEntities);
|
||||
} else if (connectionEntity.destinationType === 'REMOTE_INPUT_PORT') {
|
||||
addDestinationRemoteInputPort(parentProcessGroupId, container, connectionEntity, remoteProcessGroupEntities);
|
||||
} else {
|
||||
destination = addDestinationComponent(container, connection);
|
||||
addDestinationComponent(container, connectionEntity);
|
||||
}
|
||||
|
||||
destination.done(function () {
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(container);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a destination component to the dialog.
|
||||
*
|
||||
* @param {jQuery} container The container to add to
|
||||
* @param {object} connection The connection to the downstream component
|
||||
* @param {object} connectionEntity The connection to the downstream component
|
||||
*/
|
||||
var addDestinationComponent = function (container, connection) {
|
||||
return $.Deferred(function (deferred) {
|
||||
var addDestinationComponent = function (container, connectionEntity) {
|
||||
// get the appropriate component icon
|
||||
var smallIconClass = '';
|
||||
if (connection.destination.type === 'PROCESSOR') {
|
||||
smallIconClass = 'processor-small-icon';
|
||||
} else if (connection.destination.type === 'OUTPUT_PORT') {
|
||||
smallIconClass = 'output-port-small-icon';
|
||||
var smallIconClass = 'icon-funnel';
|
||||
if (connectionEntity.destinationType === 'PROCESSOR') {
|
||||
smallIconClass = 'icon-processor';
|
||||
} else if (connectionEntity.destinationType === 'OUTPUT_PORT') {
|
||||
smallIconClass = 'icon-port-out';
|
||||
}
|
||||
|
||||
// get the source name
|
||||
var destinationName = connectionEntity.destinationId;
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
destinationName = connectionEntity.component.destination.name;
|
||||
} else if (currentComponentId === connectionEntity.destinationId) {
|
||||
destinationName = currentComponentLabel;
|
||||
}
|
||||
|
||||
// component
|
||||
var downstreamComponent = $('<div class="destination-component"></div>').appendTo(container);
|
||||
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(downstreamComponent);
|
||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', connection.destination.name).text(connection.destination.name).on('click', function () {
|
||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', destinationName).text(destinationName).on('click', function () {
|
||||
// go to the component
|
||||
nf.CanvasUtils.showComponent(connection.destination.groupId, connection.destination.id);
|
||||
nf.CanvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
|
@ -142,28 +125,34 @@ nf.GoTo = (function () {
|
|||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(downstreamComponent);
|
||||
|
||||
deferred.resolve();
|
||||
}).promise();
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a destination input port to the dialog.
|
||||
*
|
||||
* @param {string} parentProcessGroupId The process group id
|
||||
* @param {jQuery} container The container to add to
|
||||
* @param {object} connection The connection to the downstream input port
|
||||
* @param {object} connectionEntity The connection to the downstream input port
|
||||
* @param {array} processGroupEntities The process groups
|
||||
*/
|
||||
var addDestinationInputPort = function (container, connection) {
|
||||
// get the remote process group
|
||||
return getProcessGroup(connection.destination.groupId).done(function (response) {
|
||||
var processGroup = response.component;
|
||||
var addDestinationInputPort = function (parentProcessGroupId, container, connectionEntity, processGroupEntities) {
|
||||
var processGroupEntity;
|
||||
$.each(processGroupEntities, function (_, pge) {
|
||||
if (connectionEntity.destinationGroupId === pge.id) {
|
||||
processGroupEntity = pge;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// get the group label
|
||||
var groupLabel = getDisplayName(processGroupEntity);
|
||||
|
||||
// process group
|
||||
var downstreamComponent = $('<div class="destination-component"></div>').appendTo(container);
|
||||
$('<div class="search-result-icon process-group-small-icon"></div>').appendTo(downstreamComponent);
|
||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', processGroup.name).text(processGroup.name).on('click', function () {
|
||||
$('<div class="search-result-icon icon-group"></div>').appendTo(downstreamComponent);
|
||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
|
||||
// go to the remote process group
|
||||
nf.CanvasUtils.showComponent(processGroup.parentGroupId, processGroup.id);
|
||||
nf.CanvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
|
@ -172,12 +161,20 @@ nf.GoTo = (function () {
|
|||
// clear
|
||||
$('<div class="clear"></div>').appendTo(downstreamComponent);
|
||||
|
||||
// get the port label
|
||||
var portLabel = connectionEntity.destinationId;
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
portLabel = connectionEntity.component.destination.name;
|
||||
} else if (currentComponentId === connectionEntity.destinationId) {
|
||||
portLabel = currentComponentLabel;
|
||||
}
|
||||
|
||||
// input port
|
||||
var downstreamInputPort = $('<div class="destination-input-port"></div>').appendTo(downstreamComponent);
|
||||
$('<div class="search-result-icon input-port-small-icon"></div>').appendTo(downstreamInputPort);
|
||||
$('<div class="destination-input-port-name go-to-link"></div>').attr('title', connection.destination.name).text(connection.destination.name).on('click', function () {
|
||||
$('<div class="search-result-icon icon-port-in"></div>').appendTo(downstreamInputPort);
|
||||
$('<div class="destination-input-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
|
||||
// go to the remote process group
|
||||
nf.CanvasUtils.showComponent(connection.destination.groupId, connection.destination.id);
|
||||
nf.CanvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
|
@ -185,26 +182,34 @@ nf.GoTo = (function () {
|
|||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(downstreamComponent);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a destination remote input port to the dialog.
|
||||
*
|
||||
* @param {string} parentProcessGroupId The process group id
|
||||
* @param {jQuery} container The container to add to
|
||||
* @param {object} connection The connection to the downstream remote input port
|
||||
* @param {object} connectionEntity The connection to the downstream remote input port
|
||||
* @param {array} remoteProcessGroupEntities The remote process groups
|
||||
*/
|
||||
var addDestinationRemoteInputPort = function (container, connection) {
|
||||
// get the remote process group
|
||||
return getRemoteProcessGroup(connection.parentGroupId, connection.destination.groupId).done(function (response) {
|
||||
var remoteProcessGroup = response.remoteProcessGroup;
|
||||
var addDestinationRemoteInputPort = function (parentProcessGroupId, container, connectionEntity, remoteProcessGroupEntities) {
|
||||
var remoteProcessGroupEntity;
|
||||
$.each(remoteProcessGroupEntities, function (_, rpge) {
|
||||
if (connectionEntity.destinationGroupId === rpge.id) {
|
||||
remoteProcessGroupEntity = rpge;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// get the group label
|
||||
var remoteGroupLabel = getDisplayName(remoteProcessGroupEntity);
|
||||
|
||||
// remote process group
|
||||
var downstreamComponent = $('<div class="destination-component"></div>').appendTo(container);
|
||||
$('<div class="search-result-icon remote-process-group-small-icon"></div>').appendTo(downstreamComponent);
|
||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', remoteProcessGroup.name).text(remoteProcessGroup.name).on('click', function () {
|
||||
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(downstreamComponent);
|
||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
|
||||
// go to the remote process group
|
||||
nf.CanvasUtils.showComponent(remoteProcessGroup.parentGroupId, remoteProcessGroup.id);
|
||||
nf.CanvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
|
@ -213,107 +218,182 @@ nf.GoTo = (function () {
|
|||
// clear
|
||||
$('<div class="clear"></div>').appendTo(downstreamComponent);
|
||||
|
||||
// get the port label
|
||||
var remotePortLabel = connectionEntity.destinationId;
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
remotePortLabel = connectionEntity.component.destination.name;
|
||||
} else if (currentComponentId === connectionEntity.destinationId) {
|
||||
remotePortLabel = currentComponentLabel;
|
||||
}
|
||||
|
||||
// remote input port
|
||||
var downstreamInputPort = $('<div class="destination-input-port"></div>').appendTo(downstreamComponent);
|
||||
$('<div class="search-result-icon input-port-small-icon"></div>').appendTo(downstreamInputPort);
|
||||
$('<div class="destination-input-port-name"></div>').attr('title', connection.destination.name).text(connection.destination.name).appendTo(downstreamInputPort);
|
||||
$('<div class="search-result-icon icon-port-in"></div>').appendTo(downstreamInputPort);
|
||||
$('<div class="destination-input-port-name"></div>').attr('title', remotePortLabel).text(remotePortLabel).appendTo(downstreamInputPort);
|
||||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(downstreamComponent);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a source component to the dialog.
|
||||
*
|
||||
* @param {jQuery} container The container to add to
|
||||
* @param {object} connection The connection to the upstream component
|
||||
* @param {object} connectionEntity The connection to the upstream component
|
||||
*/
|
||||
var addSourceComponent = function (container, connection) {
|
||||
return $.Deferred(function (deferred) {
|
||||
var addSourceComponent = function (container, connectionEntity) {
|
||||
// get the appropriate component icon
|
||||
var smallIconClass = '';
|
||||
if (connection.source.type === 'PROCESSOR') {
|
||||
smallIconClass = 'processor-small-icon';
|
||||
} else if (connection.source.type === 'INPUT_PORT') {
|
||||
smallIconClass = 'input-port-small-icon';
|
||||
var smallIconClass = 'icon-funnel';
|
||||
if (connectionEntity.sourceType === 'PROCESSOR') {
|
||||
smallIconClass = 'icon-processor';
|
||||
} else if (connectionEntity.sourceType === 'INPUT_PORT') {
|
||||
smallIconClass = 'icon-port-in';
|
||||
}
|
||||
|
||||
// get the source name
|
||||
var sourceName = connectionEntity.sourceId;
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
sourceName = connectionEntity.component.source.name;
|
||||
} else if (currentComponentId === connectionEntity.sourceId) {
|
||||
sourceName = currentComponentLabel;
|
||||
}
|
||||
|
||||
// component
|
||||
var sourceComponent = $('<div class="source-component"></div>').appendTo(container);
|
||||
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(sourceComponent);
|
||||
$('<div class="source-component-name go-to-link"></div>').attr('title', connection.source.name).text(connection.source.name).on('click', function () {
|
||||
$('<div class="source-component-name go-to-link"></div>').attr('title', sourceName).text(sourceName).on('click', function () {
|
||||
// go to the component
|
||||
nf.CanvasUtils.showComponent(connection.source.groupId, connection.source.id);
|
||||
nf.CanvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
}).appendTo(sourceComponent);
|
||||
|
||||
deferred.resolve();
|
||||
}).promise();
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(sourceComponent);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a source output port to the dialog.
|
||||
*
|
||||
* @param {string} parentProcessGroupId The process group id
|
||||
* @param {jQuery} container The container to add to
|
||||
* @param {object} connection The connection
|
||||
* @param {object} connectionEntity The connection
|
||||
* @param {array} processGroupEntities The process groups
|
||||
*/
|
||||
var addSourceOutputPort = function (container, connection) {
|
||||
// get the remote process group
|
||||
return getProcessGroup(connection.source.groupId).done(function (response) {
|
||||
var processGroup = response.component;
|
||||
var addSourceOutputPort = function (parentProcessGroupId, container, connectionEntity, processGroupEntities) {
|
||||
var processGroupEntity;
|
||||
$.each(processGroupEntities, function (_, pge) {
|
||||
if (connectionEntity.sourceGroupId === pge.id) {
|
||||
processGroupEntity = pge;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// get the group label
|
||||
var groupLabel = getDisplayName(processGroupEntity);
|
||||
|
||||
// process group
|
||||
var sourceComponent = $('<div class="source-component"></div>').appendTo(container);
|
||||
$('<div class="search-result-icon process-group-small-icon"></div>').appendTo(sourceComponent);
|
||||
$('<div class="source-component-name go-to-link"></div>').attr('title', processGroup.name).text(processGroup.name).on('click', function () {
|
||||
$('<div class="search-result-icon icon-group"></div>').appendTo(sourceComponent);
|
||||
$('<div class="source-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
|
||||
// go to the process group
|
||||
nf.CanvasUtils.showComponent(processGroup.parentGroupId, processGroup.id);
|
||||
nf.CanvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
}).appendTo(sourceComponent);
|
||||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(sourceComponent);
|
||||
|
||||
// get the port label
|
||||
var portLabel = connectionEntity.sourceId;
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
portLabel = connectionEntity.component.source.name;
|
||||
} else if (currentComponentId === connectionEntity.sourceId) {
|
||||
portLabel = currentComponentLabel;
|
||||
}
|
||||
|
||||
var sourceOutputPort = $('<div class="source-output-port"></div>').appendTo(sourceComponent);
|
||||
$('<div class="search-result-icon output-port-small-icon"></div>').appendTo(sourceOutputPort);
|
||||
$('<div class="source-output-port-name go-to-link"></div>').attr('title', connection.source.name).text(connection.source.name).on('click', function () {
|
||||
$('<div class="search-result-icon icon-port-out"></div>').appendTo(sourceOutputPort);
|
||||
$('<div class="source-output-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
|
||||
// go to the output port
|
||||
nf.CanvasUtils.showComponent(connection.source.groupId, connection.source.id);
|
||||
nf.CanvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
}).appendTo(sourceOutputPort);
|
||||
});
|
||||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(sourceComponent);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a source remote output port to the dialog.
|
||||
*
|
||||
* @param {string} parentProcessGroupId The process group id
|
||||
* @param {jQuery} container The container to add to
|
||||
* @param {object} connection The connection to the downstream remote output port
|
||||
* @param {object} connectionEntity The connection to the downstream remote output port
|
||||
* @param {array} remoteProcessGroupEntities The remote process groups
|
||||
*/
|
||||
var addSourceRemoteOutputPort = function (container, connection) {
|
||||
// get the remote process group
|
||||
return getRemoteProcessGroup(connection.parentGroupId, connection.source.groupId).done(function (response) {
|
||||
var remoteProcessGroup = response.remoteProcessGroup;
|
||||
var addSourceRemoteOutputPort = function (parentProcessGroupId, container, connectionEntity, remoteProcessGroupEntities) {
|
||||
var remoteProcessGroupEntity;
|
||||
$.each(remoteProcessGroupEntities, function (_, rpge) {
|
||||
if (connectionEntity.sourceGroupId === rpge.id) {
|
||||
remoteProcessGroupEntity = rpge;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// get the group label
|
||||
var remoteGroupLabel = getDisplayName(remoteProcessGroupEntity);
|
||||
|
||||
// remote process group
|
||||
var sourceComponent = $('<div class="source-component"></div>').appendTo(container);
|
||||
$('<div class="search-result-icon remote-process-group-small-icon"></div>').appendTo(sourceComponent);
|
||||
$('<div class="source-component-name go-to-link"></div>').attr('title', remoteProcessGroup.name).text(remoteProcessGroup.name).on('click', function () {
|
||||
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(sourceComponent);
|
||||
$('<div class="source-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
|
||||
// go to the remote process group
|
||||
nf.CanvasUtils.showComponent(remoteProcessGroup.parentGroupId, remoteProcessGroup.id);
|
||||
nf.CanvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
|
||||
|
||||
// close the dialog
|
||||
$('#connections-dialog').modal('hide');
|
||||
}).appendTo(sourceComponent);
|
||||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(sourceComponent);
|
||||
|
||||
// get the port label
|
||||
var remotePortLabel = connectionEntity.sourceId;
|
||||
if (connectionEntity.permissions.canRead === true) {
|
||||
remotePortLabel = connectionEntity.component.source.name;
|
||||
} else if (connectionEntity.sourceId === currentComponentId) {
|
||||
remotePortLabel = currentComponentLabel;
|
||||
}
|
||||
|
||||
// port markup
|
||||
var sourceOutputPort = $('<div class="source-output-port"></div>').appendTo(sourceComponent);
|
||||
$('<div class="search-result-icon output-port-small-icon"></div>').appendTo(sourceOutputPort);
|
||||
$('<div class="source-output-port-name"></div>').attr('title', connection.source.name).text(connection.source.name).appendTo(sourceOutputPort);
|
||||
});
|
||||
$('<div class="search-result-icon icon-port-out"></div>').appendTo(sourceOutputPort);
|
||||
$('<div class="source-output-port-name"></div>').attr('title', remotePortLabel).text(remotePortLabel).appendTo(sourceOutputPort);
|
||||
|
||||
// clear
|
||||
$('<div class="clear"></div>').appendTo(sourceComponent);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the display name for the specified entity.
|
||||
*
|
||||
* @param entity entity
|
||||
* @returns display name
|
||||
*/
|
||||
var getDisplayName = function (entity) {
|
||||
if (entity.permissions.canRead === true) {
|
||||
return entity.component.name;
|
||||
} else if (currentComponentId === entity.id) {
|
||||
return currentComponentLabel;
|
||||
} else {
|
||||
return entity.id;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
|
@ -351,26 +431,28 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The processor selection
|
||||
*/
|
||||
showDownstreamFromProcessor: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var processorEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var processorLabel = getDisplayName(processorEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = processorEntity.id;
|
||||
currentComponentLabel = processorLabel;
|
||||
|
||||
// populate the downstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon processor-small-icon"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append('<div class="search-result-icon icon-processor"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(processorLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the destination for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the source
|
||||
if (connection.source.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.sourceId === processorEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -381,7 +463,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the downstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -390,26 +471,28 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The processor selection
|
||||
*/
|
||||
showUpstreamFromProcessor: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var processorEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var processorLabel = getDisplayName(processorEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = processorEntity.id;
|
||||
currentComponentLabel = processorLabel;
|
||||
|
||||
// populate the upstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon processor-small-icon"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append('<div class="search-result-icon icon-processor"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(processorLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the source for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the destination
|
||||
if (connection.destination.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.destinationId === processorEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -420,7 +503,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the upstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -429,26 +511,33 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The process group or remote process group selection
|
||||
*/
|
||||
showDownstreamFromGroup: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var groupEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var iconStyle = 'icon-group';
|
||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
||||
iconStyle = 'icon-group-remote';
|
||||
}
|
||||
|
||||
var groupLabel = getDisplayName(groupEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = groupEntity.id;
|
||||
currentComponentLabel = groupLabel;
|
||||
|
||||
// populate the downstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon process-group-small-icon"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append($('<div class="search-result-icon"></div>').addClass(iconStyle))
|
||||
.append($('<div class="connections-component-name"></div>').text(groupLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the destination for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the source
|
||||
if (connection.source.groupId === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.sourceGroupId === groupEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -459,7 +548,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the downstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -468,26 +556,33 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The process group or remote process group selection
|
||||
*/
|
||||
showUpstreamFromGroup: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var groupEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var iconStyle = 'icon-group';
|
||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
||||
iconStyle = 'icon-group-remote';
|
||||
}
|
||||
|
||||
var groupLabel = getDisplayName(groupEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = groupEntity.id;
|
||||
currentComponentLabel = groupLabel;
|
||||
|
||||
// populate the upstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon process-group-small-icon"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append($('<div class="search-result-icon"></div>').addClass(iconStyle))
|
||||
.append($('<div class="connections-component-name"></div>').text(groupLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the source for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the destination
|
||||
if (connection.destination.groupId === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.destinationGroupId === groupEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -498,7 +593,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -507,26 +601,28 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The input port selection
|
||||
*/
|
||||
showDownstreamFromInputPort: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var portEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var portLabel = getDisplayName(portEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = portEntity.id;
|
||||
currentComponentLabel = portLabel;
|
||||
|
||||
// populate the downstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon input-port-small-icon"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append('<div class="search-result-icon icon-port-in"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the destination for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the source
|
||||
if (connection.source.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.sourceId === portEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -537,7 +633,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the downstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -546,29 +641,38 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The input port selection
|
||||
*/
|
||||
showUpstreamFromInputPort: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var portEntity = selection.datum();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getParentGroupId()) + '/connections',
|
||||
url: config.urls.processGroups + encodeURIComponent(nf.Canvas.getParentGroupId()),
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var flow = response.processGroupFlow.flow;
|
||||
var connections = flow.connections;
|
||||
var processGroups = flow.processGroups;
|
||||
var remoteProcessGroups = flow.remoteProcessGroups;
|
||||
|
||||
var portLabel = getDisplayName(portEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = portEntity.id;
|
||||
currentComponentLabel = portLabel;
|
||||
|
||||
// populate the upstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon process-group-small-icon"></div>')
|
||||
.append('<div class="search-result-icon icon-group"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(nf.Canvas.getGroupName()))
|
||||
.append('<div class="clear"></div>')
|
||||
.append('<div class="search-result-icon input-port-small-icon" style="margin-left: 20px;"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append('<div class="search-result-icon icon-port-in" style="margin-left: 20px;"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the source for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the destination
|
||||
if (connection.destination.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.destinationId === portEntity.id) {
|
||||
addConnection(nf.Canvas.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -588,29 +692,38 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The output port selection
|
||||
*/
|
||||
showDownstreamFromOutputPort: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var portEntity = selection.datum();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getParentGroupId()) + '/connections',
|
||||
url: config.urls.processGroups + encodeURIComponent(nf.Canvas.getParentGroupId()),
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var flow = response.processGroupFlow.flow;
|
||||
var connections = flow.connections;
|
||||
var processGroups = flow.processGroups;
|
||||
var remoteProcessGroups = flow.remoteProcessGroups;
|
||||
|
||||
var portLabel = getDisplayName(portEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = portEntity.id;
|
||||
currentComponentLabel = portLabel;
|
||||
|
||||
// populate the downstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon process-group-small-icon"></div>')
|
||||
.append('<div class="search-result-icon icon-group"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(nf.Canvas.getGroupName()))
|
||||
.append('<div class="clear"></div>')
|
||||
.append('<div class="search-result-icon output-port-small-icon" style="margin-left: 20px;"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append('<div class="search-result-icon icon-port-out" style="margin-left: 20px;"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the destination for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the source
|
||||
if (connection.source.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.sourceId === portEntity.id) {
|
||||
addConnection(nf.Canvas.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -630,26 +743,28 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The output port selection
|
||||
*/
|
||||
showUpstreamFromOutputPort: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var portEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
var portLabel = getDisplayName(portEntity);
|
||||
|
||||
// record details of the current component
|
||||
currentComponentId = portEntity.id;
|
||||
currentComponentLabel = portLabel;
|
||||
|
||||
// populate the upstream dialog
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon input-port-small-icon"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(selectionData.component.name))
|
||||
.append('<div class="search-result-icon icon-port-out"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the source for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the destination
|
||||
if (connection.destination.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.destinationId === portEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -660,7 +775,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the upstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -669,23 +783,26 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The funnel selection
|
||||
*/
|
||||
showDownstreamFromFunnel: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var funnelEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
// record details of the current component
|
||||
currentComponentId = funnelEntity.id;
|
||||
currentComponentLabel = 'Funnel';
|
||||
|
||||
// populate the downstream dialog
|
||||
$('#connections-context').append($('<div class="connections-component-name"></div>').text('Funnel'));
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon icon-funnel"></div>')
|
||||
.append($('<div class="connections-component-name"></div>').text('Funnel'))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the destination for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the source
|
||||
if (connection.source.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.sourceId === funnelEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -696,7 +813,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the downstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -705,23 +821,26 @@ nf.GoTo = (function () {
|
|||
* @param {selection} selection The funnel selection
|
||||
*/
|
||||
showUpstreamFromFunnel: function (selection) {
|
||||
var selectionData = selection.datum();
|
||||
var funnelEntity = selection.datum();
|
||||
var connections = nf.Connection.get();
|
||||
var processGroups = nf.ProcessGroup.get();
|
||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(selectionData.component.parentGroupId) + '/connections',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
var connections = response.connections;
|
||||
// record details of the current component
|
||||
currentComponentId = funnelEntity.id;
|
||||
currentComponentLabel = 'Funnel';
|
||||
|
||||
// populate the upstream dialog
|
||||
$('#connections-context').append($('<div class="upstream-destination-name"></div>').text('Funnel'));
|
||||
$('#connections-context')
|
||||
.append('<div class="search-result-icon icon-funnel"></div>')
|
||||
.append($('<div class="upstream-destination-name"></div>').text('Funnel'))
|
||||
.append('<div class="clear"></div>');
|
||||
|
||||
// add the source for each connection
|
||||
$.each(connections, function (_, connection) {
|
||||
$.each(connections, function (_, connectionEntity) {
|
||||
// only show connections for which this selection is the destination
|
||||
if (connection.destination.id === selectionData.id) {
|
||||
addConnection(connection);
|
||||
if (connectionEntity.destinationId === funnelEntity.id) {
|
||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -732,7 +851,6 @@ nf.GoTo = (function () {
|
|||
|
||||
// show the upstream dialog
|
||||
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
||||
}).fail(nf.Common.handleAjaxError);
|
||||
}
|
||||
};
|
||||
}());
|
Loading…
Reference in New Issue