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-canvas-utils.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js index 3e09a0e..8e96dfa 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-utils.js @@ -24,8 +24,8 @@ 'nf.Dialog', 'nf.Clipboard', 'nf.Storage'], - function (d3, $, common, dialog, clipboard, storage) { - return (nf.CanvasUtils = factory(d3, $, common, dialog, clipboard, storage)); + function (d3, $, nfCommon, nfDialog, nfClipboard, nfStorage) { + return (nf.CanvasUtils = factory(d3, $, nfCommon, nfDialog, nfClipboard, nfStorage)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.CanvasUtils = factory( @@ -44,7 +44,7 @@ root.nf.Clipboard, root.nf.Storage); } -}(this, function (d3, $, common, dialog, clipboard, storage) { +}(this, function (d3, $, nfCommon, nfDialog, nfClipboard, nfStorage) { 'use strict'; var nfCanvas; @@ -116,10 +116,10 @@ nfBirdseye.refresh(); deferred.resolve(); - }).fail(common.handleAjaxError).fail(function () { + }).fail(nfCommon.handleAjaxError).fail(function () { deferred.reject(); }); - }).fail(common.handleAjaxError).fail(function () { + }).fail(nfCommon.handleAjaxError).fail(function () { deferred.reject(); }); }).promise(); @@ -130,18 +130,18 @@ /** * Initialize the canvas utils. * - * @param canvas The reference to the canvas controller. - * @param actions The reference to the actions controller. - * @param snippet The reference to the snippet controller. - * @param birdseye The reference to the birdseye controller. - * @param graph The reference to the graph controller. + * @param nfCanvasRef The nfCanvas module. + * @param nfActionsRef The nfActions module. + * @param nfSnippetRef The nfSnippet module. + * @param nfBirdseyeRef The nfBirdseye module. + * @param nfGraphRef The nfGraph module. */ - init: function(canvas, actions, snippet, birdseye, graph){ - nfCanvas = canvas; - nfActions = actions; - nfSnippet = snippet; - nfBirdseye = birdseye; - nfGraph = graph; + init: function(nfCanvasRef, nfActionsRef, nfSnippetRef, nfBirdseyeRef, nfGraphRef){ + nfCanvas = nfCanvasRef; + nfActions = nfActionsRef; + nfSnippet = nfSnippetRef; + nfBirdseye = nfBirdseyeRef; + nfGraph = nfGraphRef; }, config: { @@ -241,7 +241,7 @@ */ showComponent: function (groupId, componentId) { // ensure the group id is specified - if (common.isDefinedAndNotNull(groupId)) { + if (nfCommon.isDefinedAndNotNull(groupId)) { // initiate a graph refresh var refreshGraph = $.Deferred(function (deferred) { // load a different group if necessary @@ -253,7 +253,7 @@ nfCanvas.reload().done(function () { deferred.resolve(); }).fail(function () { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Process Group', dialogContent: 'Unable to load the group for the specified component.' }); @@ -271,7 +271,7 @@ if (!component.empty()) { nfActions.show(component); } else { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Process Group', dialogContent: 'Unable to find the specified component.' }); @@ -313,21 +313,23 @@ * Enables/disables the editable behavior for the specified selection based on their access policies. * * @param selection selection + * @param nfConnectableRef The nfConnectable module. + * @param nfDraggableRef The nfDraggable module. */ - editable: function (selection, connectable, draggable) { + editable: function (selection, nfConnectableRef, nfDraggableRef) { if (nfCanvasUtils.canModify(selection)) { if (!selection.classed('connectable')) { - selection.call(connectable.activate); + selection.call(nfConnectableRef.activate); } if (!selection.classed('moveable')) { - selection.call(draggable.activate); + selection.call(nfDraggableRef.activate); } } else { if (selection.classed('connectable')) { - selection.call(connectable.deactivate); + selection.call(nfConnectableRef.deactivate); } if (selection.classed('moveable')) { - selection.call(draggable.deactivate); + selection.call(nfDraggableRef.deactivate); } } }, @@ -425,7 +427,7 @@ // go through each word var word = words.pop(); - while (common.isDefinedAndNotNull(word)) { + while (nfCommon.isDefinedAndNotNull(word)) { // add the current word line.push(word); @@ -536,20 +538,20 @@ * @param {function} offset Optional offset */ bulletins: function (selection, d, getTooltipContainer, offset) { - offset = common.isDefinedAndNotNull(offset) ? offset : 0; + offset = nfCommon.isDefinedAndNotNull(offset) ? offset : 0; // get the tip var tip = d3.select('#bulletin-tip-' + d.id); var hasBulletins = false; - if (!common.isEmpty(d.bulletins)) { + if (!nfCommon.isEmpty(d.bulletins)) { // format the bulletins - var bulletins = common.getFormattedBulletins(d.bulletins); + var bulletins = nfCommon.getFormattedBulletins(d.bulletins); hasBulletins = bulletins.length > 0; if (hasBulletins) { // create the unordered list based off the formatted bulletins - var list = common.formatUnorderedList(bulletins); + var list = nfCommon.formatUnorderedList(bulletins); } } @@ -1094,7 +1096,7 @@ } // ensure access to read tenants - return common.canAccessTenants(); + return nfCommon.canAccessTenants(); } return false; @@ -1266,7 +1268,7 @@ * Determines if something is currently pastable. */ isPastable: function () { - return nfCanvas.canWrite() && clipboard.isCopied(); + return nfCanvas.canWrite() && nfClipboard.isCopied(); }, /** @@ -1284,7 +1286,7 @@ }; // store the item - storage.setItem(name, item); + nfStorage.setItem(name, item); }, /** @@ -1293,9 +1295,9 @@ * @param {object} connection */ formatConnectionName: function (connection) { - if (!common.isBlank(connection.name)) { + if (!nfCommon.isBlank(connection.name)) { return connection.name; - } else if (common.isDefinedAndNotNull(connection.selectedRelationships)) { + } else if (nfCommon.isDefinedAndNotNull(connection.selectedRelationships)) { return connection.selectedRelationships.join(', '); } return ''; @@ -1308,13 +1310,13 @@ * @param {string} destinationComponentId The connection destination id */ reloadConnectionSourceAndDestination: function (sourceComponentId, destinationComponentId) { - if (common.isBlank(sourceComponentId) === false) { + if (nfCommon.isBlank(sourceComponentId) === false) { var source = d3.select('#id-' + sourceComponentId); if (source.empty() === false) { nfGraph.reload(source); } } - if (common.isBlank(destinationComponentId) === false) { + if (nfCommon.isBlank(destinationComponentId) === false) { var destination = d3.select('#id-' + destinationComponentId); if (destination.empty() === false) { nfGraph.reload(destination); @@ -1362,10 +1364,10 @@ try { // see if we can restore the view position from storage var name = config.storage.namePrefix + nfCanvas.getGroupId(); - var item = storage.getItem(name); + var item = nfStorage.getItem(name); // ensure the item is valid - if (common.isDefinedAndNotNull(item)) { + if (nfCommon.isDefinedAndNotNull(item)) { if (isFinite(item.scale) && isFinite(item.translateX) && isFinite(item.translateY)) { // restore previous view nfCanvas.View.translate([item.translateX, item.translateY]); @@ -1398,10 +1400,10 @@ selection.each(function (d) { var selected = d3.select(this); if (!nfCanvasUtils.isConnection(selected)) { - if (common.isUndefined(origin.x) || d.position.x < origin.x) { + if (nfCommon.isUndefined(origin.x) || d.position.x < origin.x) { origin.x = d.position.x; } - if (common.isUndefined(origin.y) || d.position.y < origin.y) { + if (nfCommon.isUndefined(origin.y) || d.position.y < origin.y) { origin.y = d.position.y; } } @@ -1420,7 +1422,7 @@ // if the group id is null, we're already in the top most group if (groupId === null) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Process Group', dialogContent: 'Components are already in the topmost group.' });
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-canvas.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js index 97be460..74b43d8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js @@ -33,8 +33,8 @@ 'nf.ContextMenu', 'nf.Actions', 'nf.ProcessGroup'], - function ($, d3, common, nfGraph, nfShell, angularBridge, nfClusterSummary, errorHandler, storage, canvasUtils, birdseye, contextMenu, actions, processGroup) { - return (nf.Canvas = factory($, d3, common, nfGraph, nfShell, angularBridge, nfClusterSummary, errorHandler, storage, canvasUtils, birdseye, contextMenu, actions, processGroup)); + function ($, d3, nfCommon, nfGraph, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils, nfBirdseye, nfContextMenu, nfActions, nfProcessGroup) { + return (nf.Canvas = factory($, d3, nfCommon, nfGraph, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils, nfBirdseye, nfContextMenu, nfActions, nfProcessGroup)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Canvas = @@ -68,7 +68,7 @@ root.nf.Actions, root.nf.ProcessGroup); } -}(this, function ($, d3, common, nfGraph, nfShell, angularBridge, nfClusterSummary, errorHandler, storage, canvasUtils, birdseye, contextMenu, actions, processGroup) { +}(this, function ($, d3, nfCommon, nfGraph, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils, nfBirdseye, nfContextMenu, nfActions, nfProcessGroup) { 'use strict'; var SCALE = 1; @@ -155,17 +155,17 @@ permissions = flowResponse.permissions; // update the breadcrumbs - angularBridge.injector.get('breadcrumbsCtrl').resetBreadcrumbs(); + nfNgBridge.injector.get('breadcrumbsCtrl').resetBreadcrumbs(); // inform Angular app values have changed - angularBridge.digest(); - angularBridge.injector.get('breadcrumbsCtrl').generateBreadcrumbs(breadcrumb); - angularBridge.injector.get('breadcrumbsCtrl').resetScrollPosition(); + nfNgBridge.digest(); + nfNgBridge.injector.get('breadcrumbsCtrl').generateBreadcrumbs(breadcrumb); + nfNgBridge.injector.get('breadcrumbsCtrl').resetScrollPosition(); // update the timestamp $('#stats-last-refreshed').text(processGroupFlow.lastRefreshed); // set the parent id if applicable - if (common.isDefinedAndNotNull(processGroupFlow.parentGroupId)) { + if (nfCommon.isDefinedAndNotNull(processGroupFlow.parentGroupId)) { nfCanvas.setParentGroupId(processGroupFlow.parentGroupId); } else { nfCanvas.setParentGroupId(null); @@ -181,8 +181,8 @@ nfCanvas.View.updateVisibility(); // update the birdseye - birdseye.refresh(); - }).fail(errorHandler.handleAjaxError); + nfBirdseye.refresh(); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -198,7 +198,7 @@ dataType: 'json' }).done(function (currentUser) { // set the current user - common.setCurrentUser(currentUser); + nfCommon.setCurrentUser(currentUser); }); }; @@ -240,26 +240,26 @@ return $.Deferred(function (deferred) { // issue the requests var processGroupXhr = reloadProcessGroup(nfCanvas.getGroupId(), options); - var statusXhr = angularBridge.injector.get('flowStatusCtrl').reloadFlowStatus(); + var statusXhr = nfNgBridge.injector.get('flowStatusCtrl').reloadFlowStatus(); var currentUserXhr = loadCurrentUser(); var controllerBulletins = $.ajax({ type: 'GET', url: config.urls.controllerBulletins, dataType: 'json' }).done(function (response) { - angularBridge.injector.get('flowStatusCtrl').updateBulletins(response); + nfNgBridge.injector.get('flowStatusCtrl').updateBulletins(response); }); var clusterSummary = nfClusterSummary.loadClusterSummary().done(function (response) { var clusterSummary = response.clusterSummary; // update the cluster summary - angularBridge.injector.get('flowStatusCtrl').updateClusterSummary(clusterSummary); + nfNgBridge.injector.get('flowStatusCtrl').updateClusterSummary(clusterSummary); }); // wait for all requests to complete $.when(processGroupXhr, statusXhr, currentUserXhr, controllerBulletins, clusterSummary).done(function (processGroupResult) { // inform Angular app values have changed - angularBridge.digest(); + nfNgBridge.digest(); // resolve the deferred deferred.resolve(processGroupResult); @@ -282,10 +282,10 @@ canvasClicked = false; // since the context menu event propagated back to the canvas, clear the selection - canvasUtils.getSelection().classed('selected', false); + nfCanvasUtils.getSelection().classed('selected', false); // show the context menu on the canvas - contextMenu.show(); + nfContextMenu.show(); // prevent default browser behavior d3.event.preventDefault(); @@ -555,11 +555,11 @@ selectionBox.remove(); } else if (panning === false) { // deselect as necessary if we are not panning - canvasUtils.getSelection().classed('selected', false); + nfCanvasUtils.getSelection().classed('selected', false); } // inform Angular app values have changed - angularBridge.digest(); + nfNgBridge.digest(); }); // define a function for update the graph dimensions @@ -587,7 +587,7 @@ }); //breadcrumbs - angularBridge.injector.get('breadcrumbsCtrl').updateBreadcrumbsCss({'bottom': bottom + 'px'}); + nfNgBridge.injector.get('breadcrumbsCtrl').updateBreadcrumbsCss({'bottom': bottom + 'px'}); // body $('#canvas-body').css({ @@ -606,16 +606,16 @@ // listen for events to go to components $('body').on('GoTo:Component', function (e, item) { - canvasUtils.showComponent(item.parentGroupId, item.id); + nfCanvasUtils.showComponent(item.parentGroupId, item.id); }); // listen for events to go to process groups $('body').on('GoTo:ProcessGroup', function (e, item) { - processGroup.enterGroup(item.id).done(function () { - canvasUtils.getSelection().classed('selected', false); + nfProcessGroup.enterGroup(item.id).done(function () { + nfCanvasUtils.getSelection().classed('selected', false); // inform Angular app that values have changed - angularBridge.digest(); + nfNgBridge.digest(); }); }); @@ -670,7 +670,7 @@ } } $.each(tabsContents, function (index, tabsContent) { - common.toggleScrollable(tabsContent.get(0)); + nfCommon.toggleScrollable(tabsContent.get(0)); }); } }).on('keydown', function (evt) { @@ -680,7 +680,7 @@ } // get the current selection - var selection = canvasUtils.getSelection(); + var selection = nfCanvasUtils.getSelection(); // handle shortcuts var isCtrl = evt.ctrlKey || evt.metaKey; @@ -691,25 +691,25 @@ return; } // ctrl-r - actions.reload(); + nfActions.reload(); // default prevented in nf-universal-capture.js } else if (evt.keyCode === 65) { // ctrl-a - actions.selectAll(); - angularBridge.digest(); + nfActions.selectAll(); + nfNgBridge.digest(); // only want to prevent default if the action was performed, otherwise default select all would be overridden evt.preventDefault(); } else if (evt.keyCode === 67) { // ctrl-c - if (nfCanvas.canWrite() && canvasUtils.isCopyable(selection)) { - actions.copy(selection); + if (nfCanvas.canWrite() && nfCanvasUtils.isCopyable(selection)) { + nfActions.copy(selection); } } else if (evt.keyCode === 86) { // ctrl-v - if (nfCanvas.canWrite() && canvasUtils.isPastable()) { - actions.paste(selection); + if (nfCanvas.canWrite() && nfCanvasUtils.isPastable()) { + nfActions.paste(selection); // only want to prevent default if the action was performed, otherwise default paste would be overridden evt.preventDefault(); @@ -718,8 +718,8 @@ } else { if (evt.keyCode === 8 || evt.keyCode === 46) { // backspace or delete - if (nfCanvas.canWrite() && canvasUtils.areDeletable(selection)) { - actions['delete'](selection); + if (nfCanvas.canWrite() && nfCanvasUtils.areDeletable(selection)) { + nfActions['delete'](selection); } // default prevented in nf-universal-capture.js @@ -734,14 +734,14 @@ dataType: 'json' }).done(function (response) { // ensure the banners response is specified - if (common.isDefinedAndNotNull(response.banners)) { - if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { + if (nfCommon.isDefinedAndNotNull(response.banners)) { + if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { // update the header text and show it $('#banner-header').addClass('banner-header-background').text(response.banners.headerText).show(); $('#canvas-container').css('top', '98px'); } - if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { + if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { // update the footer text and show it var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); @@ -757,7 +757,7 @@ // update the graph dimensions updateGraphSize(); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }, /** @@ -766,7 +766,7 @@ init: function () { // attempt kerberos authentication var ticketExchange = $.Deferred(function (deferred) { - if (storage.hasItem('jwt')) { + if (nfStorage.hasItem('jwt')) { deferred.resolve(); } else { $.ajax({ @@ -775,9 +775,9 @@ dataType: 'text' }).done(function (jwt) { // get the payload and store the token with the appropriate expiration - var token = common.getJwtPayload(jwt); - var expiration = parseInt(token['exp'], 10) * common.MILLIS_PER_SECOND; - storage.setItem('jwt', jwt, expiration); + var token = nfCommon.getJwtPayload(jwt); + var expiration = parseInt(token['exp'], 10) * nfCommon.MILLIS_PER_SECOND; + nfStorage.setItem('jwt', jwt, expiration); deferred.resolve(); }).fail(function () { deferred.reject(); @@ -795,12 +795,12 @@ $('#current-user').text(currentUser.identity).show(); // render the logout button if there is a token locally - if (storage.getItem('jwt') !== null) { + if (nfStorage.getItem('jwt') !== null) { $('#logout-link-container').show(); } } else { // set the anonymous user label - common.setAnonymousUserLabel(); + nfCommon.setAnonymousUserLabel(); } deferred.resolve(); }).fail(function (xhr, status, error) { @@ -1024,7 +1024,7 @@ .scale(SCALE) .on('zoomstart', function () { // hide the context menu - contextMenu.hide(); + nfContextMenu.hide(); }) .on('zoom', function () { // if we have zoomed, indicate that we are panning @@ -1050,16 +1050,16 @@ }) .on('zoomend', function () { // ensure the canvas was actually refreshed - if (common.isDefinedAndNotNull(refreshed)) { + if (nfCommon.isDefinedAndNotNull(refreshed)) { nfCanvas.View.updateVisibility(); // refresh the birdseye refreshed.done(function () { - birdseye.refresh(); + nfBirdseye.refresh(); }); // persist the users view - canvasUtils.persistUserView(); + nfCanvasUtils.persistUserView(); // reset the refreshed deferred refreshed = null; @@ -1096,7 +1096,7 @@ * @param {array} translate [x, y] */ translate: function (translate) { - if (common.isUndefined(translate)) { + if (nfCommon.isUndefined(translate)) { return behavior.translate(); } else { behavior.translate(translate); @@ -1109,7 +1109,7 @@ * @param {number} scale The new scale */ scale: function (scale) { - if (common.isUndefined(scale)) { + if (nfCommon.isUndefined(scale)) { return behavior.scale(); } else { behavior.scale(scale); @@ -1133,7 +1133,7 @@ nfCanvas.View.scale(newScale); // center around the center of the screen accounting for the translation accordingly - canvasUtils.centerBoundingBox({ + nfCanvasUtils.centerBoundingBox({ x: (screenWidth / 2) - (translate[0] / scale), y: (screenHeight / 2) - (translate[1] / scale), width: 1, @@ -1158,7 +1158,7 @@ nfCanvas.View.scale(newScale); // center around the center of the screen accounting for the translation accordingly - canvasUtils.centerBoundingBox({ + nfCanvasUtils.centerBoundingBox({ x: (screenWidth / 2) - (translate[0] / scale), y: (screenHeight / 2) - (translate[1] / scale), width: 1, @@ -1205,7 +1205,7 @@ nfCanvas.View.scale(newScale); // center as appropriate - canvasUtils.centerBoundingBox({ + nfCanvasUtils.centerBoundingBox({ x: graphLeft - (translate[0] / scale), y: graphTop - (translate[1] / scale), width: canvasWidth / newScale, @@ -1221,7 +1221,7 @@ var scale = nfCanvas.View.scale(); // get the first selected component - var selection = canvasUtils.getSelection(); + var selection = nfCanvasUtils.getSelection(); // set the updated scale nfCanvas.View.scale(1); @@ -1259,7 +1259,7 @@ } // center as appropriate - canvasUtils.centerBoundingBox(box); + nfCanvasUtils.centerBoundingBox(box); }, /** @@ -1276,11 +1276,11 @@ var refreshBirdseye = true; // extract the options if specified - if (common.isDefinedAndNotNull(options)) { - persist = common.isDefinedAndNotNull(options.persist) ? options.persist : persist; - transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; - refreshComponents = common.isDefinedAndNotNull(options.refreshComponents) ? options.refreshComponents : refreshComponents; - refreshBirdseye = common.isDefinedAndNotNull(options.refreshBirdseye) ? options.refreshBirdseye : refreshBirdseye; + if (nfCommon.isDefinedAndNotNull(options)) { + persist = nfCommon.isDefinedAndNotNull(options.persist) ? options.persist : persist; + transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition; + refreshComponents = nfCommon.isDefinedAndNotNull(options.refreshComponents) ? options.refreshComponents : refreshComponents; + refreshBirdseye = nfCommon.isDefinedAndNotNull(options.refreshBirdseye) ? options.refreshBirdseye : refreshBirdseye; } // update component visibility @@ -1290,7 +1290,7 @@ // persist if appropriate if (persist === true) { - canvasUtils.persistUserView(); + nfCanvasUtils.persistUserView(); } // update the canvas @@ -1303,7 +1303,7 @@ .each('end', function () { // refresh birdseye if appropriate if (refreshBirdseye === true) { - birdseye.refresh(); + nfBirdseye.refresh(); } deferred.resolve(); @@ -1315,7 +1315,7 @@ // refresh birdseye if appropriate if (refreshBirdseye === true) { - birdseye.refresh(); + nfBirdseye.refresh(); } deferred.resolve(); 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-clipboard.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-clipboard.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-clipboard.js index d5dd80c..c6fdadc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-clipboard.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-clipboard.js @@ -24,8 +24,8 @@ if (typeof define === 'function' && define.amd) { define(['jquery', 'nf.Common'], - function ($, common) { - return (nf.Clipboard = factory($, common)); + function ($, nfCommon) { + return (nf.Clipboard = factory($, nfCommon)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Clipboard = @@ -35,7 +35,7 @@ nf.Clipboard = factory(root.$, root.nf.Common); } -}(this, function ($, common) { +}(this, function ($, nfCommon) { 'use strict'; var COPY = 'copy'; @@ -60,7 +60,7 @@ * @argument {object} listener A clipboard listener */ removeListener: function (listener) { - if (common.isDefinedAndNotNull(listeners[listener])) { + if (nfCommon.isDefinedAndNotNull(listeners[listener])) { delete listeners[listener]; } }, @@ -83,7 +83,7 @@ * Checks to see if any data has been copied. */ isCopied: function () { - return common.isDefinedAndNotNull(data); + return nfCommon.isDefinedAndNotNull(data); }, /** @@ -93,7 +93,7 @@ paste: function () { return $.Deferred(function (deferred) { // ensure there was data - if (common.isDefinedAndNotNull(data)) { + if (nfCommon.isDefinedAndNotNull(data)) { var clipboardData = data; // resolve the deferred 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-component-state.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js index e362b46..ae9ebdc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-component-state.js @@ -28,8 +28,8 @@ 'nf.ErrorHandler', 'nf.Dialog', 'nf.Common'], - function ($, Slick, clusterSummary, errorHandler, dialog, common) { - return (nf.ComponentState = factory($, Slick, clusterSummary, errorHandler, dialog, common)); + function ($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon) { + return (nf.ComponentState = factory($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ComponentState = @@ -47,7 +47,7 @@ root.nf.Dialog, root.nf.Common); } -}(this, function ($, Slick, clusterSummary, errorHandler, dialog, common) { +}(this, function ($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon) { 'use strict'; /** @@ -58,7 +58,7 @@ var componentStateTable = $('#component-state-table').data('gridInstance'); // ensure the grid has been initialized - if (common.isDefinedAndNotNull(componentStateTable)) { + if (nfCommon.isDefinedAndNotNull(componentStateTable)) { var componentStateData = componentStateTable.getData(); // update the search criteria @@ -95,7 +95,7 @@ // conditionally consider the scope var matchesScope = false; - if (common.isDefinedAndNotNull(item['scope'])) { + if (nfCommon.isDefinedAndNotNull(item['scope'])) { matchesScope = item['scope'].search(filterExp) >= 0; } @@ -111,8 +111,8 @@ var sort = function (sortDetails, data) { // defines a function for sorting var comparer = function (a, b) { - var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; - var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; + var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; + var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; }; @@ -162,7 +162,7 @@ componentStateData.beginUpdate(); // local state - if (common.isDefinedAndNotNull(localState)) { + if (nfCommon.isDefinedAndNotNull(localState)) { $.each(localState.state, function (i, stateEntry) { componentStateData.addItem($.extend({ id: count++, @@ -171,12 +171,12 @@ }); totalEntries += localState.totalEntryCount; - if (common.isDefinedAndNotNull(localState.state) && localState.totalEntryCount !== localState.state.length) { + if (nfCommon.isDefinedAndNotNull(localState.state) && localState.totalEntryCount !== localState.state.length) { showPartialDetails = true; } } - if (common.isDefinedAndNotNull(clusterState)) { + if (nfCommon.isDefinedAndNotNull(clusterState)) { $.each(clusterState.state, function (i, stateEntry) { componentStateData.addItem($.extend({ id: count++, @@ -185,7 +185,7 @@ }); totalEntries += clusterState.totalEntryCount; - if (common.isDefinedAndNotNull(clusterState.state) && clusterState.totalEntryCount !== clusterState.state.length) { + if (nfCommon.isDefinedAndNotNull(clusterState.state) && clusterState.totalEntryCount !== clusterState.state.length) { showPartialDetails = true; } } @@ -199,7 +199,7 @@ } // update the total number of state entries - $('#total-component-state-entries').text(common.formatInteger(totalEntries)); + $('#total-component-state-entries').text(nfCommon.formatInteger(totalEntries)); }; /** @@ -281,9 +281,9 @@ // reload the table with no state loadComponentState() - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); } else { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Component State', dialogContent: 'This component has no state to clear.' }); @@ -310,7 +310,7 @@ ]; // conditionally show the cluster node identifier - if (clusterSummary.isClustered()) { + if (nfClusterSummary.isClustered()) { componentStateColumns.push({ id: 'scope', field: 'scope', @@ -418,7 +418,7 @@ // reset the grid size var componentStateGrid = componentStateTable.data('gridInstance'); componentStateGrid.resizeCanvas(); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); } }; })); \ No newline at end of file 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-connectable.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js index 3da81e3..91d29f6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connectable.js @@ -23,8 +23,8 @@ 'nf.Connection', 'nf.ConnectionConfiguration', 'nf.CanvasUtils'], - function (d3, connection, connectionConfiguration, canvasUtils) { - return (nf.Connectable = factory(d3, connection, connectionConfiguration, canvasUtils)); + function (d3, nfConnection, nfConnectionConfiguration, nfCanvasUtils) { + return (nf.Connectable = factory(d3, nfConnection, nfConnectionConfiguration, nfCanvasUtils)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Connectable = @@ -38,7 +38,7 @@ root.nf.ConnectionConfiguration, root.nf.CanvasUtils); } -}(this, function (d3, connection, connectionConfiguration, canvasUtils) { +}(this, function (d3, nfConnection, nfConnectionConfiguration, nfCanvasUtils) { 'use strict'; var connect; @@ -78,7 +78,7 @@ d3.event.sourceEvent.stopPropagation(); // unselect the previous components - canvasUtils.getSelection().classed('selected', false); + nfCanvasUtils.getSelection().classed('selected', false); // mark the source component has selected var source = d3.select(this.parentNode).classed('selected', true); @@ -128,7 +128,7 @@ // component to itself. requiring the mouse to have actually moved before // checking the eligiblity of the destination addresses the issue return (Math.abs(origin[0] - d3.event.x) > 10 || Math.abs(origin[1] - d3.event.y) > 10) && - canvasUtils.isValidConnectionDestination(d3.select(this)); + nfCanvasUtils.isValidConnectionDestination(d3.select(this)); }); // update the drag line @@ -148,12 +148,12 @@ var x = pathDatum.x; var y = pathDatum.y; var componentOffset = pathDatum.sourceWidth / 2; - var xOffset = connection.config.selfLoopXOffset; - var yOffset = connection.config.selfLoopYOffset; + var xOffset = nfConnection.config.selfLoopXOffset; + var yOffset = nfConnection.config.selfLoopYOffset; return 'M' + x + ' ' + y + 'L' + (x + componentOffset + xOffset) + ' ' + (y - yOffset) + 'L' + (x + componentOffset + xOffset) + ' ' + (y + yOffset) + 'Z'; } else { // get the position on the destination perimeter - var end = canvasUtils.getPerimeterPoint(pathDatum, { + var end = nfCanvasUtils.getPerimeterPoint(pathDatum, { 'x': destinationData.position.x, 'y': destinationData.position.y, 'width': destinationData.dimensions.width, @@ -212,7 +212,7 @@ // create the connection var destinationData = destination.datum(); - connectionConfiguration.createConnection(connectorData.sourceId, destinationData.id); + nfConnectionConfiguration.createConnection(connectorData.sourceId, destinationData.id); } }); }, @@ -230,7 +230,7 @@ var selection = d3.select(this); // ensure the current component supports connection source - if (canvasUtils.isValidConnectionSource(selection)) { + if (nfCanvasUtils.isValidConnectionSource(selection)) { // see if theres already a connector rendered var addConnect = d3.select('text.add-connect'); if (addConnect.empty()) { 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-configuration.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js index 5f0dfc2..a404e5f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js @@ -27,8 +27,8 @@ 'nf.Client', 'nf.CanvasUtils', 'nf.Connection'], - function ($, d3, errorHandler, common, dialog, client, canvasUtils, connection) { - return (nf.ConnectionConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, connection)); + function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfConnection) { + return (nf.ConnectionConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfConnection)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ConnectionConfiguration = @@ -50,7 +50,7 @@ root.nf.CanvasUtils, root.nf.Connection); } -}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, connection) { +}(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfConnection) { 'use strict'; var nfBirdseye; @@ -80,11 +80,11 @@ */ var initializeSourceNewConnectionDialog = function (source) { // handle the selected source - if (canvasUtils.isProcessor(source)) { + if (nfCanvasUtils.isProcessor(source)) { return $.Deferred(function (deferred) { // initialize the source processor initializeSourceProcessor(source).done(function (processor) { - if (!common.isEmpty(processor.relationships)) { + if (!nfCommon.isEmpty(processor.relationships)) { // populate the available connections $.each(processor.relationships, function (i, relationship) { createRelationshipOption(relationship.name); @@ -114,7 +114,7 @@ addConnection(selectedRelationships); } else { // inform users that no relationships were selected - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', dialogContent: 'The connection must have at least one relationship selected.' }); @@ -143,9 +143,9 @@ deferred.resolve(); } else { // there are no relationships for this processor - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', - dialogContent: '\'' + common.escapeHtml(processor.name) + '\' does not support any relationships.' + dialogContent: '\'' + nfCommon.escapeHtml(processor.name) + '\' does not support any relationships.' }); // reset the dialog @@ -161,11 +161,11 @@ return $.Deferred(function (deferred) { // determine how to initialize the source var connectionSourceDeferred; - if (canvasUtils.isInputPort(source)) { + if (nfCanvasUtils.isInputPort(source)) { connectionSourceDeferred = initializeSourceInputPort(source); - } else if (canvasUtils.isRemoteProcessGroup(source)) { + } else if (nfCanvasUtils.isRemoteProcessGroup(source)) { connectionSourceDeferred = initializeSourceRemoteProcessGroup(source); - } else if (canvasUtils.isProcessGroup(source)) { + } else if (nfCanvasUtils.isProcessGroup(source)) { connectionSourceDeferred = initializeSourceProcessGroup(source); } else { connectionSourceDeferred = initializeSourceFunnel(source); @@ -233,8 +233,8 @@ $('#connection-source-component-id').val(inputPortData.id); // populate the group details - $('#connection-source-group-id').val(canvasUtils.getGroupId()); - $('#connection-source-group-name').text(canvasUtils.getGroupName()); + $('#connection-source-group-id').val(nfCanvasUtils.getGroupId()); + $('#connection-source-group-name').text(nfCanvasUtils.getGroupName()); // resolve the deferred deferred.resolve(); @@ -259,8 +259,8 @@ $('#connection-source-component-id').val(funnelData.id); // populate the group details - $('#connection-source-group-id').val(canvasUtils.getGroupId()); - $('#connection-source-group-name').text(canvasUtils.getGroupName()); + $('#connection-source-group-id').val(nfCanvasUtils.getGroupId()); + $('#connection-source-group-name').text(nfCanvasUtils.getGroupName()); // resolve the deferred deferred.resolve(); @@ -277,7 +277,7 @@ // get the processor data var processorData = source.datum(); var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id; - var processorType = processorData.permissions.canRead ? common.substringAfterLast(processorData.component.type, '.') : 'Processor'; + var processorType = processorData.permissions.canRead ? nfCommon.substringAfterLast(processorData.component.type, '.') : 'Processor'; // populate the source processor information $('#processor-source').show(); @@ -289,8 +289,8 @@ $('#connection-source-component-id').val(processorData.id); // populate the group details - $('#connection-source-group-id').val(canvasUtils.getGroupId()); - $('#connection-source-group-name').text(canvasUtils.getGroupName()); + $('#connection-source-group-id').val(nfCanvasUtils.getGroupId()); + $('#connection-source-group-name').text(nfCanvasUtils.getGroupName()); // show the available relationships $('#relationship-names-container').show(); @@ -327,13 +327,13 @@ options.push({ text: component.name, value: component.id, - description: common.escapeHtml(component.comments) + description: nfCommon.escapeHtml(component.comments) }); } }); // only proceed if there are output ports - if (!common.isEmpty(options)) { + if (!nfCommon.isEmpty(options)) { $('#output-port-source').show(); // sort the options @@ -359,13 +359,13 @@ deferred.resolve(); } else { - var message = '\'' + common.escapeHtml(processGroupName) + '\' does not have any output ports.'; - if (common.isEmpty(processGroupContents.outputPorts) === false) { - message = 'Not authorized for any output ports in \'' + common.escapeHtml(processGroupName) + '\'.'; + var message = '\'' + nfCommon.escapeHtml(processGroupName) + '\' does not have any output ports.'; + if (nfCommon.isEmpty(processGroupContents.outputPorts) === false) { + message = 'Not authorized for any output ports in \'' + nfCommon.escapeHtml(processGroupName) + '\'.'; } // there are no output ports for this process group - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', dialogContent: message }); @@ -377,7 +377,7 @@ } }).fail(function (xhr, status, error) { // handle the error - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); @@ -403,7 +403,7 @@ var remoteProcessGroupContents = remoteProcessGroup.contents; // only proceed if there are output ports - if (!common.isEmpty(remoteProcessGroupContents.outputPorts)) { + if (!nfCommon.isEmpty(remoteProcessGroupContents.outputPorts)) { $('#output-port-source').show(); // show the output port options @@ -413,7 +413,7 @@ text: outputPort.name, value: outputPort.id, disabled: outputPort.exists === false, - description: common.escapeHtml(outputPort.comments) + description: nfCommon.escapeHtml(outputPort.comments) }); }); @@ -441,9 +441,9 @@ deferred.resolve(); } else { // there are no relationships for this processor - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', - dialogContent: '\'' + common.escapeHtml(remoteProcessGroup.name) + '\' does not have any output ports.' + dialogContent: '\'' + nfCommon.escapeHtml(remoteProcessGroup.name) + '\' does not have any output ports.' }); // reset the dialog @@ -453,7 +453,7 @@ } }).fail(function (xhr, status, error) { // handle the error - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); @@ -461,13 +461,13 @@ }; var initializeDestinationNewConnectionDialog = function (destination) { - if (canvasUtils.isOutputPort(destination)) { + if (nfCanvasUtils.isOutputPort(destination)) { return initializeDestinationOutputPort(destination); - } else if (canvasUtils.isProcessor(destination)) { + } else if (nfCanvasUtils.isProcessor(destination)) { return initializeDestinationProcessor(destination); - } else if (canvasUtils.isRemoteProcessGroup(destination)) { + } else if (nfCanvasUtils.isRemoteProcessGroup(destination)) { return initializeDestinationRemoteProcessGroup(destination); - } else if (canvasUtils.isFunnel(destination)) { + } else if (nfCanvasUtils.isFunnel(destination)) { return initializeDestinationFunnel(destination); } else { return initializeDestinationProcessGroup(destination); @@ -487,8 +487,8 @@ $('#connection-destination-component-id').val(outputPortData.id); // populate the group details - $('#connection-destination-group-id').val(canvasUtils.getGroupId()); - $('#connection-destination-group-name').text(canvasUtils.getGroupName()); + $('#connection-destination-group-id').val(nfCanvasUtils.getGroupId()); + $('#connection-destination-group-name').text(nfCanvasUtils.getGroupName()); deferred.resolve(); }).promise(); @@ -505,8 +505,8 @@ $('#connection-destination-component-id').val(funnelData.id); // populate the group details - $('#connection-destination-group-id').val(canvasUtils.getGroupId()); - $('#connection-destination-group-name').text(canvasUtils.getGroupName()); + $('#connection-destination-group-id').val(nfCanvasUtils.getGroupId()); + $('#connection-destination-group-name').text(nfCanvasUtils.getGroupName()); deferred.resolve(); }).promise(); @@ -516,7 +516,7 @@ return $.Deferred(function (deferred) { var processorData = destination.datum(); var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id; - var processorType = processorData.permissions.canRead ? common.substringAfterLast(processorData.component.type, '.') : 'Processor'; + var processorType = processorData.permissions.canRead ? nfCommon.substringAfterLast(processorData.component.type, '.') : 'Processor'; $('#processor-destination').show(); $('#processor-destination-name').text(processorName).attr('title', processorName); @@ -527,8 +527,8 @@ $('#connection-destination-component-id').val(processorData.id); // populate the group details - $('#connection-destination-group-id').val(canvasUtils.getGroupId()); - $('#connection-destination-group-name').text(canvasUtils.getGroupName()); + $('#connection-destination-group-id').val(nfCanvasUtils.getGroupId()); + $('#connection-destination-group-name').text(nfCanvasUtils.getGroupName()); deferred.resolve(); }).promise(); @@ -558,12 +558,12 @@ options.push({ text: inputPort.permissions.canRead ? inputPort.component.name : inputPort.id, value: inputPort.id, - description: inputPort.permissions.canRead ? common.escapeHtml(inputPort.component.comments) : null + description: inputPort.permissions.canRead ? nfCommon.escapeHtml(inputPort.component.comments) : null }); }); // only proceed if there are output ports - if (!common.isEmpty(options)) { + if (!nfCommon.isEmpty(options)) { $('#input-port-destination').show(); // sort the options @@ -590,9 +590,9 @@ deferred.resolve(); } else { // there are no relationships for this processor - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', - dialogContent: '\'' + common.escapeHtml(processGroupName) + '\' does not have any input ports.' + dialogContent: '\'' + nfCommon.escapeHtml(processGroupName) + '\' does not have any input ports.' }); // reset the dialog @@ -602,7 +602,7 @@ } }).fail(function (xhr, status, error) { // handle the error - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); @@ -628,7 +628,7 @@ var remoteProcessGroupContents = remoteProcessGroup.contents; // only proceed if there are output ports - if (!common.isEmpty(remoteProcessGroupContents.inputPorts)) { + if (!nfCommon.isEmpty(remoteProcessGroupContents.inputPorts)) { $('#input-port-destination').show(); // show the input port options @@ -638,7 +638,7 @@ text: inputPort.name, value: inputPort.id, disabled: inputPort.exists === false, - description: common.escapeHtml(inputPort.comments) + description: nfCommon.escapeHtml(inputPort.comments) }); }); @@ -666,9 +666,9 @@ deferred.resolve(); } else { // there are no relationships for this processor - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', - dialogContent: '\'' + common.escapeHtml(remoteProcessGroup.name) + '\' does not have any input ports.' + dialogContent: '\'' + nfCommon.escapeHtml(remoteProcessGroup.name) + '\' does not have any input ports.' }); // reset the dialog @@ -678,7 +678,7 @@ } }).fail(function (xhr, status, error) { // handle the error - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); @@ -716,11 +716,11 @@ * @argument {selection} source The source */ var initializeSourceEditConnectionDialog = function (source) { - if (canvasUtils.isProcessor(source)) { + if (nfCanvasUtils.isProcessor(source)) { return initializeSourceProcessor(source); - } else if (canvasUtils.isInputPort(source)) { + } else if (nfCanvasUtils.isInputPort(source)) { return initializeSourceInputPort(source); - } else if (canvasUtils.isFunnel(source)) { + } else if (nfCanvasUtils.isFunnel(source)) { return initializeSourceFunnel(source); } else { return initializeSourceReadOnlyGroup(source); @@ -734,13 +734,13 @@ * @argument {object} connectionDestination The connection destination object */ var initializeDestinationEditConnectionDialog = function (destination, connectionDestination) { - if (canvasUtils.isProcessor(destination)) { + if (nfCanvasUtils.isProcessor(destination)) { return initializeDestinationProcessor(destination); - } else if (canvasUtils.isOutputPort(destination)) { + } else if (nfCanvasUtils.isOutputPort(destination)) { return initializeDestinationOutputPort(destination); - } else if (canvasUtils.isRemoteProcessGroup(destination)) { + } else if (nfCanvasUtils.isRemoteProcessGroup(destination)) { return initializeDestinationRemoteProcessGroup(destination, connectionDestination); - } else if (canvasUtils.isFunnel(destination)) { + } else if (nfCanvasUtils.isFunnel(destination)) { return initializeDestinationFunnel(destination); } else { return initializeDestinationProcessGroup(destination); @@ -787,8 +787,8 @@ y: sourceData.position.y + (sourceData.dimensions.height / 2) }; - var xOffset = connection.config.selfLoopXOffset; - var yOffset = connection.config.selfLoopYOffset; + var xOffset = nfConnection.config.selfLoopXOffset; + var yOffset = nfConnection.config.selfLoopYOffset; bends.push({ 'x': (rightCenter.x + xOffset), 'y': (rightCenter.y - yOffset) @@ -801,11 +801,11 @@ var existingConnections = []; // get all connections for the source component - var connectionsForSourceComponent = connection.getComponentConnections(sourceComponentId); + var connectionsForSourceComponent = nfConnection.getComponentConnections(sourceComponentId); $.each(connectionsForSourceComponent, function (_, connectionForSourceComponent) { // get the id for the source/destination component - var connectionSourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionForSourceComponent); - var connectionDestinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionForSourceComponent); + var connectionSourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(connectionForSourceComponent); + var connectionDestinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(connectionForSourceComponent); // if the connection is between these same components, consider it for collisions if ((connectionSourceComponentId === sourceComponentId && connectionDestinationComponentId === destinationComponentId) || @@ -822,7 +822,7 @@ $.each(existingConnections, function (_, existingConnection) { // only consider multiple connections with no bend points a collision, the existance of // bend points suggests that the user has placed the connection into a desired location - if (common.isEmpty(existingConnection.bends)) { + if (nfCommon.isEmpty(existingConnection.bends)) { avoidCollision = true; return false; } @@ -842,7 +842,7 @@ var collides = function (x, y) { var collides = false; $.each(existingConnections, function (_, existingConnection) { - if (!common.isEmpty(existingConnection.bends)) { + if (!nfCommon.isEmpty(existingConnection.bends)) { if (isMoreHorizontal) { // horizontal lines are adjusted in the y space if (existingConnection.bends[0].y === y) { @@ -900,8 +900,8 @@ var destinationGroupId = $('#connection-destination-group-id').val(); // determine the source and destination types - var sourceType = canvasUtils.getConnectableTypeForSource(source); - var destinationType = canvasUtils.getConnectableTypeForDestination(destination); + var sourceType = nfCanvasUtils.getConnectableTypeForSource(source); + var destinationType = nfCanvasUtils.getConnectableTypeForDestination(destination); // get the settings var connectionName = $('#connection-name').val(); @@ -912,7 +912,7 @@ if (validateSettings()) { var connectionEntity = { - 'revision': client.getRevision({ + 'revision': nfClient.getRevision({ 'revision': { 'version': 0 } @@ -941,7 +941,7 @@ // create the new connection $.ajax({ type: 'POST', - url: config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/connections', + url: config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/connections', data: JSON.stringify(connectionEntity), dataType: 'json', contentType: 'application/json' @@ -954,7 +954,7 @@ }); // reload the connections source/destination components - canvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId); + nfCanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId); // update component visibility nfGraph.updateVisibility(); @@ -963,7 +963,7 @@ nfBirdseye.refresh(); }).fail(function (xhr, status, error) { // handle the error - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); }); } }; @@ -984,7 +984,7 @@ // get the destination details var destinationComponentId = $('#connection-destination-component-id').val(); var destination = d3.select('#id-' + destinationComponentId); - var destinationType = canvasUtils.getConnectableTypeForDestination(destination); + var destinationType = nfCanvasUtils.getConnectableTypeForDestination(destination); // get the destination details var destinationId = $('#connection-destination-id').val(); @@ -998,9 +998,9 @@ var prioritizers = $('#prioritizer-selected').sortable('toArray'); if (validateSettings()) { - var d = connection.get(connectionId); + var d = nfConnection.get(connectionId); var connectionEntity = { - 'revision': client.getRevision(d), + 'revision': nfClient.getRevision(d), 'component': { 'id': connectionId, 'name': connectionName, @@ -1026,18 +1026,18 @@ contentType: 'application/json' }).done(function (response) { // update this connection - connection.set(response); + nfConnection.set(response); // reload the connections source/destination components - canvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId); + nfCanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId); }).fail(function (xhr, status, error) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', - dialogContent: common.escapeHtml(xhr.responseText), + dialogContent: nfCommon.escapeHtml(xhr.responseText), }); } else { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }); } else { @@ -1078,20 +1078,20 @@ var errors = []; // validate the settings - if (common.isBlank($('#flow-file-expiration').val())) { + if (nfCommon.isBlank($('#flow-file-expiration').val())) { errors.push('File expiration must be specified'); } if (!$.isNumeric($('#back-pressure-object-threshold').val())) { errors.push('Back pressure object threshold must be an integer value'); } - if (common.isBlank($('#back-pressure-data-size-threshold').val())) { + if (nfCommon.isBlank($('#back-pressure-data-size-threshold').val())) { errors.push('Back pressure data size threshold must be specified'); } if (errors.length > 0) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', - dialogContent: common.formatUnorderedList(errors) + dialogContent: nfCommon.formatUnorderedList(errors) }); return false; } else { @@ -1130,7 +1130,7 @@ $('#relationship-names-container').hide(); // clear the id field - common.clearField('connection-id'); + nfCommon.clearField('connection-id'); // hide all the connection source panels $('#processor-source').hide(); @@ -1168,12 +1168,12 @@ /** * Initialize the connection configuration. * - * @param birdseye The reference to the birdseye controller. - * @param graph The reference to the graph controller. + * @param nfBirdseyeRef The nfBirdseye module. + * @param nfGraphRef The nfGraph module. */ - init: function (birdseye, graph) { - nfBirdseye = birdseye; - nfGraph = graph; + init: function (nfBirdseyeRef, nfGraphRef) { + nfBirdseye = nfBirdseyeRef; + nfGraph = nfGraphRef; // initially hide the relationship names container $('#relationship-names-container').hide(); @@ -1188,7 +1188,7 @@ resetDialog(); }, open: function () { - common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); + nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); } } }); @@ -1226,7 +1226,7 @@ opacity: 0.6 }); $('#prioritizer-available, #prioritizer-selected').disableSelection(); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }, /** @@ -1237,17 +1237,17 @@ */ addAvailablePrioritizer: function (prioritizerContainer, prioritizerType) { var type = prioritizerType.type; - var name = common.substringAfterLast(type, '.'); + var name = nfCommon.substringAfterLast(type, '.'); // add the prioritizers to the available list var prioritizerList = $(prioritizerContainer); var prioritizer = $('<li></li>').append($('<span style="float: left;"></span>').text(name)).attr('id', type).addClass('ui-state-default').appendTo(prioritizerList); // add the description if applicable - if (common.isDefinedAndNotNull(prioritizerType.description)) { + if (nfCommon.isDefinedAndNotNull(prioritizerType.description)) { $('<div class="fa fa-question-circle" style="float: right; margin-right: 5px;""></div>').appendTo(prioritizer).qtip($.extend({ - content: common.escapeHtml(prioritizerType.description) - }, common.config.tooltipConfig)); + content: nfCommon.escapeHtml(prioritizerType.description) + }, nfCommon.config.tooltipConfig)); } }, @@ -1283,7 +1283,7 @@ $('#connection-configuration div.relationship-name').ellipsis(); // fill in the connection id - common.populateField('connection-id', null); + nfCommon.populateField('connection-id', null); // show the border if necessary var relationshipNames = $('#relationship-names'); @@ -1309,12 +1309,12 @@ var connection = connectionEntry.component; // identify the source component - var sourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionEntry); + var sourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(connectionEntry); var source = d3.select('#id-' + sourceComponentId); // identify the destination component - if (common.isUndefinedOrNull(destination)) { - var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionEntry); + if (nfCommon.isUndefinedOrNull(destination)) { + var destinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(connectionEntry); destination = d3.select('#id-' + destinationComponentId); } @@ -1324,7 +1324,7 @@ var selectedRelationships = connection.selectedRelationships; // show the available relationship if applicable - if (common.isDefinedAndNotNull(availableRelationships) || common.isDefinedAndNotNull(selectedRelationships)) { + if (nfCommon.isDefinedAndNotNull(availableRelationships) || nfCommon.isDefinedAndNotNull(selectedRelationships)) { // populate the available connections $.each(availableRelationships, function (i, name) { createRelationshipOption(name); @@ -1351,14 +1351,14 @@ } // if the source is a process group or remote process group, select the appropriate port if applicable - if (canvasUtils.isProcessGroup(source) || canvasUtils.isRemoteProcessGroup(source)) { + if (nfCanvasUtils.isProcessGroup(source) || nfCanvasUtils.isRemoteProcessGroup(source)) { // populate the connection source details $('#connection-source-id').val(connection.source.id); $('#read-only-output-port-name').text(connection.source.name).attr('title', connection.source.name); } // if the destination is a process gorup or remote process group, select the appropriate port if applicable - if (canvasUtils.isProcessGroup(destination) || canvasUtils.isRemoteProcessGroup(destination)) { + if (nfCanvasUtils.isProcessGroup(destination) || nfCanvasUtils.isRemoteProcessGroup(destination)) { var destinationData = destination.datum(); // when the group ids differ, its a new destination component so we don't want to preselect any port @@ -1376,7 +1376,7 @@ $('#back-pressure-data-size-threshold').val(connection.backPressureDataSizeThreshold); // format the connection id - common.populateField('connection-id', connection.id); + nfCommon.populateField('connection-id', connection.id); // handle each prioritizer $.each(connection.prioritizers, function (i, type) { @@ -1400,7 +1400,7 @@ var selectedRelationships = getSelectedRelationships(); // see if we're working with a processor as the source - if (canvasUtils.isProcessor(source)) { + if (nfCanvasUtils.isProcessor(source)) { if (selectedRelationships.length > 0) { // if there are relationships selected update updateConnection(selectedRelationships).done(function () { @@ -1410,7 +1410,7 @@ }); } else { // inform users that no relationships were selected and the source is a processor - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Connection Configuration', dialogContent: 'The connection must have at least one relationship selected.' });
