http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection.js index 2dbb513..759860b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection.js @@ -26,8 +26,8 @@ 'nf.ErrorHandler', 'nf.Client', 'nf.CanvasUtils'], - function ($, d3, common, dialog, errorHandler, client, canvasUtils) { - return (nf.Connection = factory($, d3, common, dialog, errorHandler, client, canvasUtils)); + function ($, d3, nfCommon, nfDialog, nfErrorHandler, nfClient, nfCanvasUtils) { + return (nf.Connection = factory($, d3, nfCommon, nfDialog, nfErrorHandler, nfClient, nfCanvasUtils)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Connection = @@ -47,7 +47,7 @@ root.nf.Client, root.nf.CanvasUtils); } -}(this, function ($, d3, common, dialog, errorHandler, client, canvasUtils) { +}(this, function ($, d3, nfCommon, nfDialog, nfErrorHandler, nfClient, nfCanvasUtils) { 'use strict'; var nfCanvas; @@ -197,7 +197,7 @@ for (var i = 0; i < line.length; i++) { if (i + 1 < line.length) { var distance = distanceToSegment(p, line[i], line[i + 1]); - if (common.isUndefined(minimumDistance) || distance < minimumDistance) { + if (nfCommon.isUndefined(minimumDistance) || distance < minimumDistance) { minimumDistance = distance; index = i; } @@ -232,7 +232,7 @@ * @param {object} terminal */ var isGroup = function (terminal) { - return terminal.groupId !== canvasUtils.getGroupId() && (isInputPortType(terminal.type) || isOutputPortType(terminal.type)); + return terminal.groupId !== nfCanvasUtils.getGroupId() && (isInputPortType(terminal.type) || isOutputPortType(terminal.type)); }; /** @@ -242,7 +242,7 @@ * @return {boolean} Whether expiration is configured */ var isExpirationConfigured = function (connection) { - if (common.isDefinedAndNotNull(connection.flowFileExpiration)) { + if (nfCommon.isDefinedAndNotNull(connection.flowFileExpiration)) { var match = connection.flowFileExpiration.match(/^(\d+).*/); if (match !== null && match.length > 0) { if (parseInt(match[0], 10) > 0) { @@ -319,7 +319,7 @@ var unavailable = false; // verify each selected relationship is still available - if (common.isDefinedAndNotNull(d.component.selectedRelationships) && common.isDefinedAndNotNull(d.component.availableRelationships)) { + if (nfCommon.isDefinedAndNotNull(d.component.selectedRelationships) && nfCommon.isDefinedAndNotNull(d.component.availableRelationships)) { $.each(d.component.selectedRelationships, function (_, selectedRelationship) { if ($.inArray(selectedRelationship, d.component.availableRelationships) === -1) { unavailable = true; @@ -366,7 +366,7 @@ // determines whether the connection is in warning based on the object count threshold var isWarningCount = function (d) { var percentUseCount = d.status.aggregateSnapshot.percentUseCount; - if (common.isDefinedAndNotNull(percentUseCount)) { + if (nfCommon.isDefinedAndNotNull(percentUseCount)) { return percentUseCount >= 61 && percentUseCount <= 85; } @@ -376,7 +376,7 @@ // determines whether the connection is in error based on the object count threshold var isErrorCount = function (d) { var percentUseCount = d.status.aggregateSnapshot.percentUseCount; - if (common.isDefinedAndNotNull(percentUseCount)) { + if (nfCommon.isDefinedAndNotNull(percentUseCount)) { return percentUseCount > 85; } @@ -391,7 +391,7 @@ // determines whether the connection is in warning based on the data size threshold var isWarningBytes = function (d) { var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes; - if (common.isDefinedAndNotNull(percentUseBytes)) { + if (nfCommon.isDefinedAndNotNull(percentUseBytes)) { return percentUseBytes >= 61 && percentUseBytes <= 85; } @@ -401,7 +401,7 @@ // determines whether the connection is in error based on the data size threshold var isErrorBytes = function (d) { var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes; - if (common.isDefinedAndNotNull(percentUseBytes)) { + if (nfCommon.isDefinedAndNotNull(percentUseBytes)) { return percentUseBytes > 85; } @@ -419,10 +419,10 @@ var transition = false; // extract the options if specified - if (common.isDefinedAndNotNull(options)) { - updatePath = common.isDefinedAndNotNull(options.updatePath) ? options.updatePath : updatePath; - updateLabel = common.isDefinedAndNotNull(options.updateLabel) ? options.updateLabel : updateLabel; - transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; + if (nfCommon.isDefinedAndNotNull(options)) { + updatePath = nfCommon.isDefinedAndNotNull(options.updatePath) ? options.updatePath : updatePath; + updateLabel = nfCommon.isDefinedAndNotNull(options.updateLabel) ? options.updateLabel : updateLabel; + transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition; } if (updatePath === true) { @@ -432,7 +432,7 @@ if (d.permissions.canRead) { // if there are more than one selected relationship, mark this as grouped - if (common.isDefinedAndNotNull(d.component.selectedRelationships) && d.component.selectedRelationships.length > 1) { + if (nfCommon.isDefinedAndNotNull(d.component.selectedRelationships) && d.component.selectedRelationships.length > 1) { grouped = true; } } @@ -507,7 +507,7 @@ if (updatePath === true) { // calculate the start and end points - var sourceComponentId = canvasUtils.getConnectionSourceComponentId(d); + var sourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(d); var sourceData = d3.select('#id-' + sourceComponentId).datum(); var end; @@ -524,7 +524,7 @@ // if we are currently dragging the endpoint to a new target, use that // position, otherwise we need to calculate it for the current target - if (common.isDefinedAndNotNull(d.end) && d.end.dragging === true) { + if (nfCommon.isDefinedAndNotNull(d.end) && d.end.dragging === true) { // since we're dragging, use the same object thats bound to the endpoint drag event end = d.end; @@ -534,7 +534,7 @@ var newDestinationData = newDestination.datum(); // get the position on the new destination perimeter - var newEnd = canvasUtils.getPerimeterPoint(endAnchor, { + var newEnd = nfCanvasUtils.getPerimeterPoint(endAnchor, { 'x': newDestinationData.position.x, 'y': newDestinationData.position.y, 'width': newDestinationData.dimensions.width, @@ -546,11 +546,11 @@ end.y = newEnd.y; } } else { - var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(d); + var destinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(d); var destinationData = d3.select('#id-' + destinationComponentId).datum(); // get the position on the destination perimeter - end = canvasUtils.getPerimeterPoint(endAnchor, { + end = nfCanvasUtils.getPerimeterPoint(endAnchor, { 'x': destinationData.position.x, 'y': destinationData.position.y, 'width': destinationData.dimensions.width, @@ -567,7 +567,7 @@ } // get the position on the source perimeter - var start = canvasUtils.getPerimeterPoint(startAnchor, { + var start = nfCanvasUtils.getPerimeterPoint(startAnchor, { 'x': sourceData.position.x, 'y': sourceData.position.y, 'width': sourceData.dimensions.width, @@ -579,21 +579,21 @@ d.end = end; // update the connection paths - canvasUtils.transition(connection.select('path.connection-path'), transition) + nfCanvasUtils.transition(connection.select('path.connection-path'), transition) .attr({ 'd': function () { var datum = [d.start].concat(d.bends, [d.end]); return lineGenerator(datum); } }); - canvasUtils.transition(connection.select('path.connection-selection-path'), transition) + nfCanvasUtils.transition(connection.select('path.connection-selection-path'), transition) .attr({ 'd': function () { var datum = [d.start].concat(d.bends, [d.end]); return lineGenerator(datum); } }); - canvasUtils.transition(connection.select('path.connection-path-selectable'), transition) + nfCanvasUtils.transition(connection.select('path.connection-path-selectable'), transition) .attr({ 'd': function () { var datum = [d.start].concat(d.bends, [d.end]); @@ -634,7 +634,7 @@ .call(nfContextMenu.activate); // update the start point - canvasUtils.transition(startpoints, transition) + nfCanvasUtils.transition(startpoints, transition) .attr('transform', function (p) { return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')'; }); @@ -664,7 +664,7 @@ .call(nfContextMenu.activate); // update the end point - canvasUtils.transition(endpoints, transition) + nfCanvasUtils.transition(endpoints, transition) .attr('transform', function (p) { return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')'; }); @@ -695,10 +695,10 @@ var connectionData = connection.datum(); // if this is a self loop prevent removing the last two bends - var sourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionData); - var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionData); + var sourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(connectionData); + var destinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(connectionData); if (sourceComponentId === destinationComponentId && d.component.bends.length <= 2) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection', dialogContent: 'Looping connections must have at least two bend points.' }); @@ -744,7 +744,7 @@ .call(nfContextMenu.activate); // update the midpoints - canvasUtils.transition(midpoints, transition) + nfCanvasUtils.transition(midpoints, transition) .attr('transform', function (p) { return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')'; }); @@ -881,7 +881,7 @@ connectionFromLabel.text(null).selectAll('title').remove(); // apply ellipsis to the label as necessary - canvasUtils.ellipsis(connectionFromLabel, d.component.source.name); + nfCanvasUtils.ellipsis(connectionFromLabel, d.component.source.name); }).append('title').text(function () { return d.component.source.name; }); @@ -990,7 +990,7 @@ connectionToLabel.text(null).selectAll('title').remove(); // apply ellipsis to the label as necessary - canvasUtils.ellipsis(connectionToLabel, d.component.destination.name); + nfCanvasUtils.ellipsis(connectionToLabel, d.component.destination.name); }).append('title').text(function (d) { return d.component.destination.name; }); @@ -1033,10 +1033,10 @@ // ----------------------- // get the connection name - var connectionNameValue = canvasUtils.formatConnectionName(d.component); + var connectionNameValue = nfCanvasUtils.formatConnectionName(d.component); // is there a name to render - if (!common.isBlank(connectionNameValue)) { + if (!nfCommon.isBlank(connectionNameValue)) { // see if the connection name label is already rendered if (connectionName.empty()) { connectionName = connectionLabelContainer.append('g') @@ -1095,7 +1095,7 @@ connectionToLabel.text(null).selectAll('title').remove(); // apply ellipsis to the label as necessary - canvasUtils.ellipsis(connectionToLabel, connectionNameValue); + nfCanvasUtils.ellipsis(connectionToLabel, connectionNameValue); }).append('title').text(function () { return connectionNameValue; }); @@ -1333,21 +1333,21 @@ // update backpressure object fill connectionLabelContainer.select('rect.backpressure-object') .classed('not-configured', function () { - return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount); + return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount); }); connectionLabelContainer.selectAll('rect.backpressure-tick.object') .classed('not-configured', function () { - return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount); + return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount); }); // update backpressure data size fill connectionLabelContainer.select('rect.backpressure-data-size') .classed('not-configured', function () { - return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes); + return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes); }); connectionLabelContainer.selectAll('rect.backpressure-tick.data-size') .classed('not-configured', function () { - return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes); + return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes); }); if (d.permissions.canWrite) { @@ -1365,7 +1365,7 @@ } // update the position of the label if possible - canvasUtils.transition(connection.select('g.connection-label-container'), transition) + nfCanvasUtils.transition(connection.select('g.connection-label-container'), transition) .attr('transform', function () { var label = d3.select(this).select('rect.body'); var position = getLabelPosition(label); @@ -1389,7 +1389,7 @@ // queued count value updated.select('text.queued tspan.count') .text(function (d) { - return common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' '); + return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' '); }); var backpressurePercentDataSize = updated.select('rect.backpressure-percent.data-size'); @@ -1397,7 +1397,7 @@ .duration(400) .attr({ 'width': function (d) { - if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) { + if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) { return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseBytes) / 100; } else { return 0; @@ -1416,7 +1416,7 @@ }); updated.select('rect.backpressure-data-size').select('title').text(function (d) { - if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) { + if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) { return 'Queue is ' + d.status.aggregateSnapshot.percentUseBytes + '% full based on Back Pressure Data Size Threshold'; } else { return 'Back Pressure Data Size Threshold is not configured'; @@ -1429,7 +1429,7 @@ // queued size value updated.select('text.queued tspan.size') .text(function (d) { - return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' '); + return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.queued, ' '); }); var backpressurePercentObject = updated.select('rect.backpressure-percent.object'); @@ -1437,7 +1437,7 @@ .duration(400) .attr({ 'width': function (d) { - if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) { + if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) { return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseCount) / 100; } else { return 0; @@ -1456,7 +1456,7 @@ }); updated.select('rect.backpressure-object').select('title').text(function (d) { - if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) { + if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) { return 'Queue is ' + d.status.aggregateSnapshot.percentUseCount + '% full based on Back Pressure Object Threshold'; } else { return 'Back Pressure Object Threshold is not configured'; @@ -1498,7 +1498,7 @@ */ var save = function (d, connection) { var entity = { - 'revision': client.getRevision(d), + 'revision': nfClient.getRevision(d), 'component': connection }; @@ -1513,12 +1513,12 @@ nfConnection.set(response); }).fail(function (xhr, status, error) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection', - dialogContent: common.escapeHtml(xhr.responseText) + dialogContent: nfCommon.escapeHtml(xhr.responseText) }); } else { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }); }; @@ -1527,7 +1527,7 @@ var removeConnections = function (removed) { // consider reloading source/destination of connection being removed removed.each(function (d) { - canvasUtils.reloadConnectionSourceAndDestination(d.sourceId, d.destinationId); + nfCanvasUtils.reloadConnectionSourceAndDestination(d.sourceId, d.destinationId); }); // remove the connection @@ -1540,9 +1540,15 @@ selfLoopYOffset: 25 }, - init: function (selectable, contextMenu) { - nfSelectable = selectable; - nfContextMenu = contextMenu; + /** + * Initializes the connection. + * + * @param nfSelectableRef The nfSelectable module. + * @param nfContextMenuRef The nfContextMenu module. + */ + init: function (nfSelectableRef, nfContextMenuRef) { + nfSelectable = nfSelectableRef; + nfContextMenu = nfContextMenuRef; connectionMap = d3.map(); removedCache = d3.map(); @@ -1638,7 +1644,7 @@ // ensure the new destination is valid d3.select('g.hover').classed('connectable-destination', function () { - return canvasUtils.isValidConnectionDestination(d3.select(this)); + return nfCanvasUtils.isValidConnectionDestination(d3.select(this)); }); // redraw this connection @@ -1667,11 +1673,11 @@ }); } else { // prompt for the new port if appropriate - if (canvasUtils.isProcessGroup(destination) || canvasUtils.isRemoteProcessGroup(destination)) { + if (nfCanvasUtils.isProcessGroup(destination) || nfCanvasUtils.isRemoteProcessGroup(destination)) { // user will select new port and updated connect details will be set accordingly nfConnectionConfiguration.showConfiguration(connection, destination).done(function () { // reload the previous destination - canvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId); + nfCanvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId); }).fail(function () { // reset the connection connection.call(updateConnections, { @@ -1682,15 +1688,15 @@ } else { // get the destination details var destinationData = destination.datum(); - var destinationType = canvasUtils.getConnectableTypeForDestination(destination); + var destinationType = nfCanvasUtils.getConnectableTypeForDestination(destination); var connectionEntity = { - 'revision': client.getRevision(connectionData), + 'revision': nfClient.getRevision(connectionData), 'component': { 'id': connectionData.id, 'destination': { 'id': destinationData.id, - 'groupId': canvasUtils.getGroupId(), + 'groupId': nfCanvasUtils.getGroupId(), 'type': destinationType } } @@ -1729,13 +1735,13 @@ nfConnection.set(response); // reload the previous destination and the new source/destination - canvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId); - canvasUtils.reloadConnectionSourceAndDestination(response.sourceId, response.destinationId); + nfCanvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId); + nfCanvasUtils.reloadConnectionSourceAndDestination(response.sourceId, response.destinationId); }).fail(function (xhr, status, error) { if (xhr.status === 400 || xhr.status === 401 || xhr.status === 403 || xhr.status === 404 || xhr.status === 409) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection', - dialogContent: common.escapeHtml(xhr.responseText) + dialogContent: nfCommon.escapeHtml(xhr.responseText) }); // reset the connection @@ -1744,7 +1750,7 @@ 'updateLabel': false }); } else { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }); } @@ -1781,10 +1787,10 @@ .attr('width', width) .attr('height', height) .attr('stroke-width', function () { - return 1 / canvasUtils.scaleCanvasView(); + return 1 / nfCanvasUtils.scaleCanvasView(); }) .attr('stroke-dasharray', function () { - return 4 / canvasUtils.scaleCanvasView(); + return 4 / nfCanvasUtils.scaleCanvasView(); }) .datum({ x: position.x, @@ -1885,8 +1891,8 @@ */ add: function (connectionEntities, options) { var selectAll = false; - if (common.isDefinedAndNotNull(options)) { - selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; + if (nfCommon.isDefinedAndNotNull(options)) { + selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; } // get the current time @@ -1906,7 +1912,7 @@ $.each(connectionEntities, function (_, connectionEntity) { add(connectionEntity); }); - } else if (common.isDefinedAndNotNull(connectionEntities)) { + } else if (nfCommon.isDefinedAndNotNull(connectionEntities)) { add(connectionEntities); } @@ -1962,7 +1968,7 @@ if (isDisconnected) {⨠// determine whether this connection and its components are included within the selection - isDisconnected = components.has(canvasUtils.getConnectionSourceComponentId(connection)) && components.has(canvasUtils.getConnectionDestinationComponentId(connection)); + isDisconnected = components.has(nfCanvasUtils.getConnectionSourceComponentId(connection)) && components.has(nfCanvasUtils.getConnectionDestinationComponentId(connection)); } }); } @@ -1978,16 +1984,16 @@ set: function (connectionEntities, options) { var selectAll = false; var transition = false; - if (common.isDefinedAndNotNull(options)) { - selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; - transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; + if (nfCommon.isDefinedAndNotNull(options)) { + selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; + transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition; } var set = function (proposedConnectionEntity) { var currentConnectionEntity = connectionMap.get(proposedConnectionEntity.id); // set the connection if appropriate due to revision and wasn't previously removed - if (client.isNewerRevision(currentConnectionEntity, proposedConnectionEntity) && !removedCache.has(proposedConnectionEntity.id)) { + if (nfClient.isNewerRevision(currentConnectionEntity, proposedConnectionEntity) && !removedCache.has(proposedConnectionEntity.id)) { connectionMap.set(proposedConnectionEntity.id, $.extend({ type: 'Connection' }, proposedConnectionEntity)); @@ -2010,7 +2016,7 @@ $.each(connectionEntities, function (_, connectionEntity) { set(connectionEntity); }); - } else if (common.isDefinedAndNotNull(connectionEntities)) { + } else if (nfCommon.isDefinedAndNotNull(connectionEntities)) { set(connectionEntities); } @@ -2031,7 +2037,7 @@ * @param {string} connectionId */ refresh: function (connectionId) { - if (common.isDefinedAndNotNull(connectionId)) { + if (nfCommon.isDefinedAndNotNull(connectionId)) { d3.select('#id-' + connectionId).call(updateConnections, { 'updatePath': true, 'updateLabel': true @@ -2134,7 +2140,7 @@ var connections = []; connectionMap.forEach(function (_, entry) { // see if this component is the source or destination of this connection - if (canvasUtils.getConnectionSourceComponentId(entry) === id || canvasUtils.getConnectionDestinationComponentId(entry) === id) { + if (nfCanvasUtils.getConnectionSourceComponentId(entry) === id || nfCanvasUtils.getConnectionDestinationComponentId(entry) === id) { connections.push(entry); } }); @@ -2148,7 +2154,7 @@ * @param {string} id */ get: function (id) { - if (common.isUndefined(id)) { + if (nfCommon.isUndefined(id)) { return connectionMap.values(); } else { return connectionMap.get(id);
http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js index 092297f..4013167 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js @@ -21,30 +21,27 @@ if (typeof define === 'function' && define.amd) { define(['jquery', 'd3', - 'nf.ErrorHandler', 'nf.Common', 'nf.CanvasUtils', 'nf.ng.Bridge'], - function ($, d3, errorHandler, common, canvasUtils, angularBridge) { - return (nf.ContextMenu = factory($, d3, errorHandler, common, canvasUtils, angularBridge)); + function ($, d3, nfCommon, nfCanvasUtils, nfNgBridge) { + return (nf.ContextMenu = factory($, d3, nfCommon, nfCanvasUtils, nfNgBridge)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ContextMenu = factory(require('jquery'), require('d3'), - require('nf.ErrorHandler'), require('nf.Common'), require('nf.CanvasUtils'), require('nf.ng.Bridge'))); } else { nf.ContextMenu = factory(root.$, root.d3, - root.nf.ErrorHandler, root.nf.Common, root.nf.CanvasUtils, root.nf.ng.Bridge); } -}(this, function ($, d3, errorHandler, common, canvasUtils, angularBridge) { +}(this, function ($, d3, nfCommon, nfCanvasUtils, nfNgBridge) { 'use strict'; var nfActions; @@ -55,7 +52,7 @@ * @param {selection} selection The selection of currently selected components */ var isNotRootGroup = function (selection) { - return canvasUtils.getParentGroupId() !== null && selection.empty(); + return nfCanvasUtils.getParentGroupId() !== null && selection.empty(); }; /** @@ -64,7 +61,7 @@ * @param {selection} selection The selection of currently selected components */ var isConfigurable = function (selection) { - return canvasUtils.isConfigurable(selection); + return nfCanvasUtils.isConfigurable(selection); }; /** @@ -73,7 +70,7 @@ * @param {selection} selection The selection of currently selected components */ var hasDetails = function (selection) { - return canvasUtils.hasDetails(selection); + return nfCanvasUtils.hasDetails(selection); }; /** @@ -82,7 +79,7 @@ * @param {selection} selection The selection of currently selected components */ var isDeletable = function (selection) { - return canvasUtils.areDeletable(selection); + return nfCanvasUtils.areDeletable(selection); }; /** @@ -91,7 +88,7 @@ * @param {selection} selection The selection of currently selected components */ var canCreateTemplate = function (selection) { - return canvasUtils.canWrite() && (selection.empty() && canvasUtils.canRead(selection)); + return nfCanvasUtils.canWrite() && (selection.empty() && nfCanvasUtils.canRead(selection)); }; /** @@ -100,7 +97,7 @@ * @param {selection} selection The selection of currently selected components */ var canUploadTemplate = function (selection) { - return canvasUtils.canWrite() && selection.empty(); + return nfCanvasUtils.canWrite() && selection.empty(); }; /** @@ -109,7 +106,7 @@ * @param {selection} selection The selection of currently selected components */ var canGroup = function (selection) { - return canvasUtils.getComponentByType('Connection').isDisconnected(selection) && canvasUtils.canModify(selection); + return nfCanvasUtils.getComponentByType('Connection').isDisconnected(selection) && nfCanvasUtils.canModify(selection); }; /** @@ -118,7 +115,7 @@ * @param {selection} selection The selection of currently selected components */ var canEnable = function (selection) { - return canvasUtils.canEnable(selection); + return nfCanvasUtils.canEnable(selection); }; /** @@ -127,7 +124,7 @@ * @param {selection} selection The selection of currently selected components */ var canDisable = function (selection) { - return canvasUtils.canDisable(selection); + return nfCanvasUtils.canDisable(selection); }; /** @@ -136,7 +133,7 @@ * @param {selection} selection The selection of currently selected components */ var canManagePolicies = function (selection) { - return canvasUtils.isConfigurableAuthorizer() && canvasUtils.canManagePolicies(selection); + return nfCanvasUtils.isConfigurableAuthorizer() && nfCanvasUtils.canManagePolicies(selection); }; /** @@ -145,7 +142,7 @@ * @param {selection} selection The selection of currently selected components */ var isRunnable = function (selection) { - return canvasUtils.areRunnable(selection); + return nfCanvasUtils.areRunnable(selection); }; /** @@ -154,7 +151,7 @@ * @param {selection} selection The selection of currently selected components */ var isStoppable = function (selection) { - return canvasUtils.areStoppable(selection); + return nfCanvasUtils.areStoppable(selection); }; /** @@ -168,7 +165,7 @@ return false; } - return canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isConnection(selection); + return nfCanvasUtils.isProcessor(selection) || nfCanvasUtils.isProcessGroup(selection) || nfCanvasUtils.isRemoteProcessGroup(selection) || nfCanvasUtils.isConnection(selection); }; /** @@ -181,11 +178,11 @@ if (selection.size() !== 1) { return false; } - if (canvasUtils.canRead(selection) === false) { + if (nfCanvasUtils.canRead(selection) === false) { return false; } - return canvasUtils.isProcessor(selection); + return nfCanvasUtils.isProcessor(selection); }; /** @@ -194,7 +191,7 @@ * @param {selection} selection The selection of currently selected components */ var isNotConnection = function (selection) { - return selection.size() === 1 && !canvasUtils.isConnection(selection); + return selection.size() === 1 && !nfCanvasUtils.isConnection(selection); }; /** @@ -203,7 +200,7 @@ * @param {selection} selection The selection of currently selected components */ var isCopyable = function (selection) { - return canvasUtils.isCopyable(selection); + return nfCanvasUtils.isCopyable(selection); }; /** @@ -212,7 +209,7 @@ * @param {selection} selection The selection of currently selected components */ var isPastable = function (selection) { - return canvasUtils.isPastable(); + return nfCanvasUtils.isPastable(); }; /** @@ -234,11 +231,11 @@ if (selection.size() !== 1) { return false; } - if (canvasUtils.canModify(selection) === false) { + if (nfCanvasUtils.canModify(selection) === false) { return false; } - return canvasUtils.isConnection(selection); + return nfCanvasUtils.isConnection(selection); }; /** @@ -247,7 +244,7 @@ * @param {selection} selection The selection */ var canAlign = function (selection) { - return canvasUtils.canAlign(selection); + return nfCanvasUtils.canAlign(selection); }; /** @@ -256,7 +253,7 @@ * @param {selection} selection The selection */ var isColorable = function (selection) { - return canvasUtils.isColorable(selection); + return nfCanvasUtils.isColorable(selection); }; /** @@ -270,7 +267,7 @@ return false; } - return canvasUtils.isConnection(selection); + return nfCanvasUtils.isConnection(selection); }; /** @@ -284,9 +281,9 @@ return false; } - return canvasUtils.isFunnel(selection) || canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || - canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isInputPort(selection) || - (canvasUtils.isOutputPort(selection) && canvasUtils.getParentGroupId() !== null); + return nfCanvasUtils.isFunnel(selection) || nfCanvasUtils.isProcessor(selection) || nfCanvasUtils.isProcessGroup(selection) || + nfCanvasUtils.isRemoteProcessGroup(selection) || nfCanvasUtils.isInputPort(selection) || + (nfCanvasUtils.isOutputPort(selection) && nfCanvasUtils.getParentGroupId() !== null); }; /** @@ -300,9 +297,9 @@ return false; } - return canvasUtils.isFunnel(selection) || canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || - canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isOutputPort(selection) || - (canvasUtils.isInputPort(selection) && canvasUtils.getParentGroupId() !== null); + return nfCanvasUtils.isFunnel(selection) || nfCanvasUtils.isProcessor(selection) || nfCanvasUtils.isProcessGroup(selection) || + nfCanvasUtils.isRemoteProcessGroup(selection) || nfCanvasUtils.isOutputPort(selection) || + (nfCanvasUtils.isInputPort(selection) && nfCanvasUtils.getParentGroupId() !== null); }; /** @@ -315,11 +312,11 @@ if (selection.size() !== 1) { return false; } - if (canvasUtils.canRead(selection) === false || canvasUtils.canModify(selection) === false) { + if (nfCanvasUtils.canRead(selection) === false || nfCanvasUtils.canModify(selection) === false) { return false; } - if (canvasUtils.isProcessor(selection)) { + if (nfCanvasUtils.isProcessor(selection)) { var processorData = selection.datum(); return processorData.component.persistsState === true; } else { @@ -338,7 +335,7 @@ return false; } - return canvasUtils.isProcessGroup(selection); + return nfCanvasUtils.isProcessGroup(selection); }; /** @@ -352,8 +349,8 @@ return false; } - return !canvasUtils.isLabel(selection) && !canvasUtils.isConnection(selection) && !canvasUtils.isProcessGroup(selection) - && !canvasUtils.isRemoteProcessGroup(selection) && common.canAccessProvenance(); + return !nfCanvasUtils.isLabel(selection) && !nfCanvasUtils.isConnection(selection) && !nfCanvasUtils.isProcessGroup(selection) + && !nfCanvasUtils.isRemoteProcessGroup(selection) && nfCommon.canAccessProvenance(); }; /** @@ -366,11 +363,11 @@ if (selection.size() !== 1) { return false; } - if (canvasUtils.canRead(selection) === false) { + if (nfCanvasUtils.canRead(selection) === false) { return false; } - return canvasUtils.isRemoteProcessGroup(selection); + return nfCanvasUtils.isRemoteProcessGroup(selection); }; /** @@ -379,11 +376,11 @@ * @param {selection} selection */ var canStartTransmission = function (selection) { - if (canvasUtils.canModify(selection) === false) { + if (nfCanvasUtils.canModify(selection) === false) { return false; } - return canvasUtils.canAllStartTransmitting(selection); + return nfCanvasUtils.canAllStartTransmitting(selection); }; /** @@ -392,11 +389,11 @@ * @param {selection} selection */ var canStopTransmission = function (selection) { - if (canvasUtils.canModify(selection) === false) { + if (nfCanvasUtils.canModify(selection) === false) { return false; } - return canvasUtils.canAllStopTransmitting(selection); + return nfCanvasUtils.canAllStopTransmitting(selection); }; /** @@ -423,13 +420,13 @@ * @param {type} selection */ var canMoveToParent = function (selection) { - if (canvasUtils.canModify(selection) === false) { + if (nfCanvasUtils.canModify(selection) === false) { return false; } // TODO - also check can modify in parent - return !selection.empty() && canvasUtils.getComponentByType('Connection').isDisconnected(selection) && canvasUtils.getParentGroupId() !== null; + return !selection.empty() && nfCanvasUtils.getComponentByType('Connection').isDisconnected(selection) && nfCanvasUtils.getParentGroupId() !== null; }; /** @@ -461,7 +458,7 @@ // create the img and conditionally add the style var img = $('<div class="context-menu-item-img"></div>').addClass(item['clazz']).appendTo(menuItem); - if (common.isDefinedAndNotNull(item['imgStyle'])) { + if (nfCommon.isDefinedAndNotNull(item['imgStyle'])) { img.addClass(item['imgStyle']); } @@ -544,10 +541,10 @@ /** * Initialize the context menu. * - * @param actions The reference to the actions controller. + * @param nfActionsRef The nfActions module. */ - init: function (actions) { - nfActions = actions; + init: function (nfActionsRef) { + nfActions = nfActionsRef; $('#context-menu').on('contextmenu', function (evt) { // stop propagation and prevent default @@ -566,12 +563,12 @@ var breadCrumb = $('#breadcrumbs').get(0); // get the current selection - var selection = canvasUtils.getSelection(); + var selection = nfCanvasUtils.getSelection(); // consider each component action for the current selection $.each(actions, function (_, action) { // determine if this action is application for this selection - if (action.condition(selection, canvasUtils.getComponentByType('Connection'))) { + if (action.condition(selection, nfCanvasUtils.getComponentByType('Connection'))) { var menuItem = action.menuItem; addMenuItem(contextMenu, { @@ -603,7 +600,7 @@ }); // inform Angular app incase we've click on the canvas - angularBridge.digest(); + nfNgBridge.digest(); }, /** http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js index 45ddec5..2bbc8c2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js @@ -32,8 +32,8 @@ 'nf.CanvasUtils', 'nf.ReportingTask', 'nf.Processor'], - function ($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor) { - return (nf.ControllerService = factory($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor)); + function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerServices, nfSettings, nfUniversalCapture, nfCustomUi, nfCanvasUtils, nfReportingTask, nfProcessor) { + return (nf.ControllerService = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerServices, nfSettings, nfUniversalCapture, nfCustomUi, nfCanvasUtils, nfReportingTask, nfProcessor)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ControllerService = @@ -65,7 +65,7 @@ root.nf.ReportingTask, root.nf.Processor); } -}(this, function ($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor) { +}(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerServices, nfSettings, nfUniversalCapture, nfCustomUi, nfCanvasUtils, nfReportingTask, nfProcessor) { 'use strict'; var config = { @@ -93,15 +93,15 @@ if (errors.length === 1) { content = $('<span></span>').text(errors[0]); } else { - content = common.formatUnorderedList(errors); + content = nfCommon.formatUnorderedList(errors); } - dialog.showOkDialog({ + nfDialog.showOkDialog({ dialogContent: content, headerText: 'Controller Service' }); } else { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }; @@ -177,7 +177,7 @@ // service B that has been removed. attempting to enable/disable/remove A // will attempt to reload B which is no longer a known service. also ensure // we have permissions to reload the service - if (common.isUndefined(controllerServiceEntity) || controllerServiceEntity.permissions.canRead === false) { + if (nfCommon.isUndefined(controllerServiceEntity) || controllerServiceEntity.permissions.canRead === false) { return $.Deferred(function (deferred) { deferred.reject(); }).promise(); @@ -189,7 +189,7 @@ dataType: 'json' }).done(function (response) { renderControllerService(serviceTable, response); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -239,8 +239,8 @@ var reference = referencingComponentEntity.component; if (reference.referenceType === 'Processor') { // reload the processor on the canvas if appropriate - if (canvasUtils.getGroupId() === reference.groupId) { - processor.reload(reference.id); + if (nfCanvasUtils.getGroupId() === reference.groupId) { + nfProcessor.reload(reference.id); } // update the current active thread count @@ -253,7 +253,7 @@ } } else if (reference.referenceType === 'ReportingTask') { // reload the referencing reporting tasks - reportingTask.reload(reference.id); + nfReportingTask.reload(reference.id); // update the current active thread count $('div.' + reference.id + '-active-threads').text(reference.activeThreadCount); @@ -313,22 +313,22 @@ var currentBulletins = bulletinIcon.data('bulletins'); // update the bulletins if necessary - if (common.doBulletinsDiffer(currentBulletins, bulletins)) { + if (nfCommon.doBulletinsDiffer(currentBulletins, bulletins)) { bulletinIcon.data('bulletins', bulletins); // format the new bulletins - var formattedBulletins = common.getFormattedBulletins(bulletins); + var formattedBulletins = nfCommon.getFormattedBulletins(bulletins); // if there are bulletins update them if (bulletins.length > 0) { - var list = common.formatUnorderedList(formattedBulletins); + var list = nfCommon.formatUnorderedList(formattedBulletins); // update existing tooltip or initialize a new one if appropriate if (bulletinIcon.data('qtip')) { bulletinIcon.qtip('option', 'content.text', list); } else { bulletinIcon.addClass('has-bulletins').show().qtip($.extend({}, - canvasUtils.config.systemTooltipConfig, + nfCanvasUtils.config.systemTooltipConfig, { content: list })); @@ -350,16 +350,16 @@ var icon = $(this); var state = referencingComponent.state.toLowerCase(); - if (state === 'stopped' && !common.isEmpty(referencingComponent.validationErrors)) { + if (state === 'stopped' && !nfCommon.isEmpty(referencingComponent.validationErrors)) { state = 'invalid'; // add tooltip for the warnings - var list = common.formatUnorderedList(referencingComponent.validationErrors); + var list = nfCommon.formatUnorderedList(referencingComponent.validationErrors); if (icon.data('qtip')) { icon.qtip('option', 'content.text', list); } else { icon.qtip($.extend({}, - canvasUtils.config.systemTooltipConfig, + nfCanvasUtils.config.systemTooltipConfig, { content: list })); @@ -382,16 +382,16 @@ var icon = $(this); var state = referencingService.state === 'ENABLED' ? 'enabled' : 'disabled'; - if (state === 'disabled' && !common.isEmpty(referencingService.validationErrors)) { + if (state === 'disabled' && !nfCommon.isEmpty(referencingService.validationErrors)) { state = 'invalid'; // add tooltip for the warnings - var list = common.formatUnorderedList(referencingService.validationErrors); + var list = nfCommon.formatUnorderedList(referencingService.validationErrors); if (icon.data('qtip')) { icon.qtip('option', 'content.text', list); } else { icon.qtip($.extend({}, - canvasUtils.config.systemTooltipConfig, + nfCanvasUtils.config.systemTooltipConfig, { content: list })); @@ -430,7 +430,7 @@ * @param {array} referencingComponents */ var createReferencingComponents = function (serviceTable, referenceContainer, referencingComponents) { - if (common.isEmpty(referencingComponents)) { + if (nfCommon.isEmpty(referencingComponents)) { referenceContainer.append('<div class="unset">No referencing components.</div>'); return; } @@ -463,7 +463,7 @@ if (referencingComponent.referenceType === 'Processor') { var processorLink = $('<span class="referencing-component-name link"></span>').text(referencingComponent.name).on('click', function () { // show the component - canvasUtils.showComponent(referencingComponent.groupId, referencingComponent.id); + nfCanvasUtils.showComponent(referencingComponent.groupId, referencingComponent.id); // close the dialog and shell referenceContainer.closest('.dialog').modal('hide'); @@ -478,11 +478,11 @@ var processorBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins'); // type - var processorType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.')); + var processorType = $('<span class="referencing-component-type"></span>').text(nfCommon.substringAfterLast(referencingComponent.type, '.')); // active thread count var processorActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads'); - if (common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) { + if (nfCommon.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) { processorActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')'); } @@ -533,7 +533,7 @@ var serviceBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins'); // type - var serviceType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.')); + var serviceType = $('<span class="referencing-component-type"></span>').text(nfCommon.substringAfterLast(referencingComponent.type, '.')); // service var serviceItem = $('<li></li>').append(serviceTwist).append(serviceState).append(serviceBulletins).append(serviceLink).append(serviceType).append(referencingServiceReferencesContainer); @@ -564,11 +564,11 @@ var reportingTaskBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins'); // type - var reportingTaskType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.')); + var reportingTaskType = $('<span class="referencing-component-type"></span>').text(nfCommon.substringAfterLast(referencingComponent.type, '.')); // active thread count var reportingTaskActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads'); - if (common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) { + if (nfCommon.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) { reportingTaskActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')'); } @@ -632,7 +632,7 @@ sourceId: ids }, dataType: 'json' - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -646,7 +646,7 @@ var setEnabled = function (serviceTable, controllerServiceEntity, enabled, pollCondition) { // build the request entity var updateControllerServiceEntity = { - 'revision': client.getRevision(controllerServiceEntity), + 'revision': nfClient.getRevision(controllerServiceEntity), 'component': { 'id': controllerServiceEntity.id, 'state': enabled ? 'ENABLED' : 'DISABLED' @@ -661,7 +661,7 @@ contentType: 'application/json' }).done(function (response) { renderControllerService(serviceTable, response); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); // wait until the polling of each service finished return $.Deferred(function (deferred) { @@ -740,11 +740,11 @@ if (serviceOnly) { if (referencingComponent.referenceType === 'ControllerService') { - referencingComponentRevisions[referencingComponentEntity.id] = client.getRevision(referencingComponentEntity); + referencingComponentRevisions[referencingComponentEntity.id] = nfClient.getRevision(referencingComponentEntity); } } else { if (referencingComponent.referenceType !== 'ControllerService') { - referencingComponentRevisions[referencingComponentEntity.id] = client.getRevision(referencingComponentEntity); + referencingComponentRevisions[referencingComponentEntity.id] = nfClient.getRevision(referencingComponentEntity); } } @@ -779,7 +779,7 @@ data: JSON.stringify(referenceEntity), dataType: 'json', contentType: 'application/json' - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); // Note: updated revisions will be retrieved after updateReferencingSchedulableComponents is invoked @@ -859,7 +859,7 @@ conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins); }).fail(function (xhr, status, error) { deferred.reject(); - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); }); }; @@ -881,7 +881,7 @@ conditionMet(controllerService, response.bulletinBoard.bulletins); }).fail(function (xhr, status, error) { deferred.reject(); - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); }); }).promise(); }; @@ -1051,7 +1051,7 @@ data: JSON.stringify(referenceEntity), dataType: 'json', contentType: 'application/json' - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); // Note: updated revisions will be retrieved after updateReferencingServices is invoked @@ -1263,7 +1263,7 @@ if (hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) { setCloseButton(); - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Controller Service', dialogContent: 'Unable to disable due to unauthorized referencing components.' }); @@ -1312,7 +1312,7 @@ // inform the user if the action was canceled if (canceled === true && $('#nf-ok-dialog').not(':visible')) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Controller Service', dialogContent: 'The request to disable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.' }); @@ -1416,7 +1416,7 @@ if (scope === config.serviceAndReferencingComponents && hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) { setCloseButton(); - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Controller Service', dialogContent: 'Unable to enable due to unauthorized referencing components.' }); @@ -1475,7 +1475,7 @@ // inform the user if the action was canceled if (canceled === true && $('#nf-ok-dialog').not(':visible')) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Controller Service', dialogContent: 'The request to enable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.' }); @@ -1497,7 +1497,7 @@ propertyName: propertyName }, dataType: 'json' - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -1513,7 +1513,7 @@ // determine if changes have been made if (isSaveRequired()) { // see if those changes should be saved - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Save', dialogContent: 'Save changes before going to this Controller Service?', noHandler: function () { @@ -1540,12 +1540,12 @@ // ensure details are valid as far as we can tell if (validateDetails(updatedControllerService)) { - updatedControllerService['revision'] = client.getRevision(controllerServiceEntity); + updatedControllerService['revision'] = nfClient.getRevision(controllerServiceEntity); var previouslyReferencedServiceIds = []; $.each(identifyReferencedServiceDescriptors(controllerServiceEntity.component), function (_, descriptor) { - var modifyingService = !common.isUndefined(updatedControllerService.component.properties) && !common.isUndefined(updatedControllerService.component.properties[descriptor.name]); - var isCurrentlyConfigured = common.isDefinedAndNotNull(controllerServiceEntity.component.properties[descriptor.name]); + var modifyingService = !nfCommon.isUndefined(updatedControllerService.component.properties) && !nfCommon.isUndefined(updatedControllerService.component.properties[descriptor.name]); + var isCurrentlyConfigured = nfCommon.isDefinedAndNotNull(controllerServiceEntity.component.properties[descriptor.name]); // if we are attempting to update a controller service reference if (modifyingService && isCurrentlyConfigured) { @@ -1587,7 +1587,7 @@ var referencedServiceDescriptors = []; $.each(component.descriptors, function (_, descriptor) { - if (common.isDefinedAndNotNull(descriptor.identifiesControllerService)) { + if (nfCommon.isDefinedAndNotNull(descriptor.identifiesControllerService)) { referencedServiceDescriptors.push(descriptor); } }); @@ -1607,7 +1607,7 @@ var referencedServiceId = component.properties[descriptor.name]; // ensure the property is configured - if (common.isDefinedAndNotNull(referencedServiceId) && $.trim(referencedServiceId).length > 0) { + if (nfCommon.isDefinedAndNotNull(referencedServiceId) && $.trim(referencedServiceId).length > 0) { referencedServices.push(referencedServiceId); } }); @@ -1642,7 +1642,7 @@ }], select: function () { // remove all property detail dialogs - universalCapture.removeAllPropertyDetailDialogs(); + nfUniversalCapture.removeAllPropertyDetailDialogs(); // update the property table size in case this is the first time its rendered if ($(this).text() === 'Properties') { @@ -1666,8 +1666,8 @@ close: function () { // empty the referencing components list var referencingComponents = $('#controller-service-referencing-components'); - common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); - common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); + nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); + nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); referencingComponents.css('border-width', '0').empty(); // cancel any active edits @@ -1677,13 +1677,13 @@ $('#controller-service-properties').propertytable('clear'); // clear the comments - common.clearField('read-only-controller-service-comments'); + nfCommon.clearField('read-only-controller-service-comments'); // removed the cached controller service details $('#controller-service-configuration').removeData('controllerServiceDetails'); }, open: function () { - common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); + nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); } } }); @@ -1706,15 +1706,15 @@ // bulletins $('#disable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide(); - common.cleanUpTooltips($('#disable-controller-service-service-container'), '#disable-controller-service-bulletins'); + nfCommon.cleanUpTooltips($('#disable-controller-service-service-container'), '#disable-controller-service-bulletins'); // reset progress $('div.disable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error'); // referencing components var referencingComponents = $('#disable-controller-service-referencing-components'); - common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); - common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); + nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); + nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); referencingComponents.css('border-width', '0').empty(); } } @@ -1752,15 +1752,15 @@ // bulletins $('#enable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide(); - common.cleanUpTooltips($('#enable-controller-service-service-container'), '#enable-controller-service-bulletins'); + nfCommon.cleanUpTooltips($('#enable-controller-service-service-container'), '#enable-controller-service-bulletins'); // reset progress $('div.enable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error'); // referencing components var referencingComponents = $('#enable-controller-service-referencing-components'); - common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); - common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); + nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); + nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); referencingComponents.css('border-width', '0').empty(); } } @@ -1774,7 +1774,7 @@ * @argument {object} controllerServiceEntity The controller service */ showConfiguration: function (serviceTable, controllerServiceEntity) { - if (common.isUndefined(currentTable)) { + if (nfCommon.isUndefined(currentTable)) { currentTable = serviceTable; } var controllerServiceDialog = $('#controller-service-configuration'); @@ -1795,14 +1795,14 @@ // calculate the correct uri var createdControllerService = response.component; - if (common.isDefinedAndNotNull(createdControllerService.parentGroupId)) { + if (nfCommon.isDefinedAndNotNull(createdControllerService.parentGroupId)) { controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(createdControllerService.parentGroupId) + '/controller-services'; } else { controllerServicesUri = config.urls.api + '/flow/controller/controller-services'; } // load the controller services accordingly - return controllerServices.loadControllerServices(controllerServicesUri, serviceTable); + return nfControllerServices.loadControllerServices(controllerServicesUri, serviceTable); }, goToServiceDeferred: function () { return goToServiceFromProperty(serviceTable); @@ -1843,8 +1843,8 @@ controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity); // populate the controller service settings - common.populateField('controller-service-id', controllerService['id']); - common.populateField('controller-service-type', common.substringAfterLast(controllerService['type'], '.')); + nfCommon.populateField('controller-service-id', controllerService['id']); + nfCommon.populateField('controller-service-type', nfCommon.substringAfterLast(controllerService['type'], '.')); $('#controller-service-name').val(controllerService['name']); $('#controller-service-comments').val(controllerService['comments']); @@ -1890,7 +1890,7 @@ }]; // determine if we should show the advanced button - if (common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') { + if (nfCommon.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') { buttons.push({ buttonText: 'Advanced', clazz: 'fa fa-cog button-icon', @@ -1909,12 +1909,12 @@ $('#shell-close-button').click(); // show the custom ui - customUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, true).done(function () { + nfCustomUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, true).done(function () { // once the custom ui is closed, reload the controller service reloadControllerServiceAndReferencingComponents(serviceTable, controllerService); // show the settings - settings.showSettings(); + nfSettings.showSettings(); }); }; @@ -1924,7 +1924,7 @@ // determine if changes have been made if (isSaveRequired()) { // see if those changes should be saved - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Save', dialogContent: 'Save changes before opening the advanced configuration?', noHandler: openCustomUi, @@ -1959,7 +1959,7 @@ updateReferencingComponentsBorder(referenceContainer); $('#controller-service-properties').propertytable('resetTableSize'); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }, /** @@ -2012,10 +2012,10 @@ controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity); // populate the controller service settings - common.populateField('controller-service-id', controllerService['id']); - common.populateField('controller-service-type', common.substringAfterLast(controllerService['type'], '.')); - common.populateField('read-only-controller-service-name', controllerService['name']); - common.populateField('read-only-controller-service-comments', controllerService['comments']); + nfCommon.populateField('controller-service-id', controllerService['id']); + nfCommon.populateField('controller-service-type', nfCommon.substringAfterLast(controllerService['type'], '.')); + nfCommon.populateField('read-only-controller-service-name', controllerService['name']); + nfCommon.populateField('read-only-controller-service-comments', controllerService['comments']); // get the reference container var referenceContainer = $('#controller-service-referencing-components'); @@ -2039,7 +2039,7 @@ }]; // determine if we should show the advanced button - if (common.isDefinedAndNotNull(customUi) && common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') { + if (nfCommon.isDefinedAndNotNull(nfCustomUi) && nfCommon.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') { buttons.push({ buttonText: 'Advanced', clazz: 'fa fa-cog button-icon', @@ -2057,8 +2057,8 @@ $('#shell-close-button').click(); // show the custom ui - customUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, false).done(function () { - settings.showSettings(); + nfCustomUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, false).done(function () { + nfSettings.showSettings(); }); } } @@ -2123,9 +2123,9 @@ */ promptToDeleteController: function (serviceTable, controllerServiceEntity) { // prompt for deletion - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Delete Controller Service', - dialogContent: 'Delete controller service \'' + common.escapeHtml(controllerServiceEntity.component.name) + '\'?', + dialogContent: 'Delete controller service \'' + nfCommon.escapeHtml(controllerServiceEntity.component.name) + '\'?', yesHandler: function () { nfControllerService.remove(serviceTable, controllerServiceEntity); } @@ -2141,7 +2141,7 @@ remove: function (serviceTable, controllerServiceEntity) { // prompt for removal? - var revision = client.getRevision(controllerServiceEntity); + var revision = nfClient.getRevision(controllerServiceEntity); $.ajax({ type: 'DELETE', url: controllerServiceEntity.uri + '?' + $.param({ @@ -2159,7 +2159,7 @@ if (controllerServiceEntity.permissions.canRead) { reloadControllerServiceReferences(serviceTable, controllerServiceEntity.component); } - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); } };
