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-policy-management.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js index acc499a..1fdf181 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js @@ -28,8 +28,8 @@ 'nf.ng.Bridge', 'nf.Dialog', 'nf.Shell'], - function ($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell) { - return (nf.PolicyManagement = factory($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell)); + function ($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell) { + return (nf.PolicyManagement = factory($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.PolicyManagement = @@ -53,7 +53,7 @@ root.nf.Dialog, root.nf.Shell); } -}(this, function ($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell) { +}(this, function ($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell) { 'use strict'; var config = { @@ -277,7 +277,7 @@ // also consider groups already selected in the search users dialog container.children('li').each(function (_, allowedTenant) { var tenant = $(allowedTenant).data('tenant'); - if (common.isDefinedAndNotNull(tenant)) { + if (nfCommon.isDefinedAndNotNull(tenant)) { tenants.push(tenant); } }); @@ -381,16 +381,16 @@ // policy type listing $('#policy-type-list').combo({ options: [ - common.getPolicyTypeListing('flow'), - common.getPolicyTypeListing('controller'), - common.getPolicyTypeListing('provenance'), - common.getPolicyTypeListing('restricted-components'), - common.getPolicyTypeListing('policies'), - common.getPolicyTypeListing('tenants'), - common.getPolicyTypeListing('site-to-site'), - common.getPolicyTypeListing('system'), - common.getPolicyTypeListing('proxy'), - common.getPolicyTypeListing('counters')], + nfCommon.getPolicyTypeListing('flow'), + nfCommon.getPolicyTypeListing('controller'), + nfCommon.getPolicyTypeListing('provenance'), + nfCommon.getPolicyTypeListing('restricted-components'), + nfCommon.getPolicyTypeListing('policies'), + nfCommon.getPolicyTypeListing('tenants'), + nfCommon.getPolicyTypeListing('site-to-site'), + nfCommon.getPolicyTypeListing('system'), + nfCommon.getPolicyTypeListing('proxy'), + nfCommon.getPolicyTypeListing('counters')], select: function (option) { if (initialized) { // record the policy type @@ -636,8 +636,8 @@ // defines a function for sorting var comparer = function (a, b) { if(a.permissions.canRead && b.permissions.canRead) { - var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; - var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; + var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; + var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; } else { if (!a.permissions.canRead && !b.permissions.canRead){ @@ -661,9 +661,9 @@ * @param item */ var promptToRemoveUserFromPolicy = function (item) { - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Update Policy', - dialogContent: 'Remove \'' + common.escapeHtml(item.component.identity) + '\' from this policy?', + dialogContent: 'Remove \'' + nfCommon.escapeHtml(item.component.identity) + '\' from this policy?', yesHandler: function () { removeUserFromPolicy(item); } @@ -696,7 +696,7 @@ * Prompts for the deletion of the selected policy. */ var promptToDeletePolicy = function () { - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Delete Policy', dialogContent: 'By deleting this policy, the permissions for this component will revert to the inherited policy if applicable.', yesText: 'Delete', @@ -713,20 +713,20 @@ var deletePolicy = function () { var currentEntity = $('#policy-table').data('policy'); - if (common.isDefinedAndNotNull(currentEntity)) { + if (nfCommon.isDefinedAndNotNull(currentEntity)) { $.ajax({ type: 'DELETE', - url: currentEntity.uri + '?' + $.param(client.getRevision(currentEntity)), + url: currentEntity.uri + '?' + $.param(nfClient.getRevision(currentEntity)), dataType: 'json' }).done(function () { loadPolicy(); }).fail(function (xhr, status, error) { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); resetPolicy(); loadPolicy(); }); } else { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Delete Policy', dialogContent: 'No policy selected' }); @@ -802,11 +802,11 @@ return $('<span>Showing effective policy inherited from the controller.</span>'); } else { // extract the group id - var processGroupId = common.substringAfterLast(resource, '/'); + var processGroupId = nfCommon.substringAfterLast(resource, '/'); var processGroupName = processGroupId; // attempt to resolve the group name - var breadcrumbs = angularBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs(); + var breadcrumbs = nfNgBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs(); $.each(breadcrumbs, function (_, breadcrumbEntity) { if (breadcrumbEntity.id === processGroupId) { processGroupName = breadcrumbEntity.label; @@ -824,11 +824,11 @@ $('#shell-close-button').click(); // load the correct group and unselect everything if necessary - canvasUtils.getComponentByType('ProcessGroup').enterGroup(processGroupId).done(function () { - canvasUtils.getSelection().classed('selected', false); + nfCanvasUtils.getComponentByType('ProcessGroup').enterGroup(processGroupId).done(function () { + nfCanvasUtils.getSelection().classed('selected', false); // inform Angular app that values have changed - angularBridge.digest(); + nfNgBridge.digest(); }); }) ).append('<span>.</span>'); @@ -948,7 +948,7 @@ resetPolicy(); deferred.reject(); - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }); }).promise(); @@ -1006,7 +1006,7 @@ resetPolicy(); deferred.reject(); - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }); }).promise(); @@ -1045,7 +1045,7 @@ } var entity = { - 'revision': client.getRevision({ + 'revision': nfClient.getRevision({ 'revision': { 'version': 0 } @@ -1074,7 +1074,7 @@ resetPolicy(); loadPolicy(); } - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -1102,9 +1102,9 @@ }); var currentEntity = $('#policy-table').data('policy'); - if (common.isDefinedAndNotNull(currentEntity)) { + if (nfCommon.isDefinedAndNotNull(currentEntity)) { var entity = { - 'revision': client.getRevision(currentEntity), + 'revision': nfClient.getRevision(currentEntity), 'component': { 'id': currentEntity.id, 'users': users, @@ -1129,16 +1129,16 @@ loadPolicy(); } }).fail(function (xhr, status, error) { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); resetPolicy(); loadPolicy(); }).always(function () { - canvasUtils.reload({ + nfCanvasUtils.reload({ 'transition': true }); }); } else { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Update Policy', dialogContent: 'No policy selected' }); @@ -1150,7 +1150,7 @@ */ var showPolicy = function () { // show the configuration dialog - shell.showContent('#policy-management').always(function () { + nfShell.showContent('#policy-management').always(function () { reset(); }); @@ -1227,7 +1227,7 @@ var policyTable = $('#policy-table'); if (policyTable.is(':visible')) { var policyGrid = policyTable.data('gridInstance'); - if (common.isDefinedAndNotNull(policyGrid)) { + if (nfCommon.isDefinedAndNotNull(policyGrid)) { policyGrid.resizeCanvas(); } } @@ -1381,7 +1381,7 @@ var resource; if (selection.empty()) { - $('#selected-policy-component-id').text(canvasUtils.getGroupId()); + $('#selected-policy-component-id').text(nfCanvasUtils.getGroupId()); resource = 'process-groups'; // disable site to site option @@ -1402,19 +1402,19 @@ var d = selection.datum(); $('#selected-policy-component-id').text(d.id); - if (canvasUtils.isProcessor(selection)) { + if (nfCanvasUtils.isProcessor(selection)) { resource = 'processors'; - } else if (canvasUtils.isProcessGroup(selection)) { + } else if (nfCanvasUtils.isProcessGroup(selection)) { resource = 'process-groups'; - } else if (canvasUtils.isInputPort(selection)) { + } else if (nfCanvasUtils.isInputPort(selection)) { resource = 'input-ports'; - } else if (canvasUtils.isOutputPort(selection)) { + } else if (nfCanvasUtils.isOutputPort(selection)) { resource = 'output-ports'; - } else if (canvasUtils.isRemoteProcessGroup(selection)) { + } else if (nfCanvasUtils.isRemoteProcessGroup(selection)) { resource = 'remote-process-groups'; - } else if (canvasUtils.isLabel(selection)) { + } else if (nfCanvasUtils.isLabel(selection)) { resource = 'labels'; - } else if (canvasUtils.isFunnel(selection)) { + } else if (nfCanvasUtils.isFunnel(selection)) { resource = 'funnels'; } @@ -1422,16 +1422,16 @@ $('#component-policy-target') .combo('setOptionEnabled', { value: 'write-receive-data' - }, canvasUtils.isInputPort(selection) && canvasUtils.getParentGroupId() === null) + }, nfCanvasUtils.isInputPort(selection) && nfCanvasUtils.getParentGroupId() === null) .combo('setOptionEnabled', { value: 'write-send-data' - }, canvasUtils.isOutputPort(selection) && canvasUtils.getParentGroupId() === null) + }, nfCanvasUtils.isOutputPort(selection) && nfCanvasUtils.getParentGroupId() === null) .combo('setOptionEnabled', { value: 'read-data' - }, !canvasUtils.isLabel(selection)) + }, !nfCanvasUtils.isLabel(selection)) .combo('setOptionEnabled', { value: 'write-data' - }, !canvasUtils.isLabel(selection)); + }, !nfCanvasUtils.isLabel(selection)); } // populate the initial resource
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-port-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-port-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-configuration.js index 25d99be..083b8cd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-configuration.js @@ -28,8 +28,8 @@ 'nf.CanvasUtils', 'nf.ng.Bridge', 'nf.Port'], - function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port) { - return (nf.PortConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port)); + function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfPort) { + return (nf.PortConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfPort)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.PortConfiguration = @@ -53,7 +53,7 @@ root.nf.ng.Bridge, root.nf.Port); } -}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port) { +}(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfPort) { 'use strict'; /** @@ -97,7 +97,7 @@ // build the port entity var portEntity = { - 'revision': client.getRevision(portData), + 'revision': nfClient.getRevision(portData), 'component': port }; @@ -110,10 +110,10 @@ contentType: 'application/json' }).done(function (response) { // refresh the port component - port.set(response); + nfPort.set(response); // inform Angular app values have changed - angularBridge.digest(); + nfNgBridge.digest(); // close the details panel $('#port-configuration').modal('hide'); @@ -128,10 +128,10 @@ 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: 'Port Configuration' }); @@ -140,7 +140,7 @@ $('#port-configuration').modal('hide'); // handle the error - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }); } @@ -184,7 +184,7 @@ */ showConfiguration: function (selection) { // if the specified component is a port, load its properties - if (canvasUtils.isInputPort(selection) || canvasUtils.isOutputPort(selection)) { + if (nfCanvasUtils.isInputPort(selection) || nfCanvasUtils.isOutputPort(selection)) { var selectionData = selection.datum(); // determine if the enabled checkbox is checked or not @@ -194,7 +194,7 @@ } // show concurrent tasks for root groups only - if (canvasUtils.getParentGroupId() === null) { + if (nfCanvasUtils.getParentGroupId() === null) { $('#port-concurrent-task-container').show(); } else { $('#port-concurrent-task-container').hide(); 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-port-details.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-details.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-details.js index ac60e7e..9c3c452 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-details.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port-details.js @@ -22,8 +22,8 @@ define(['jquery', 'nf.Common', 'nf.CanvasUtils'], - function ($, common, canvasUtils) { - return (nf.PortDetails = factory($, common, canvasUtils)); + function ($, nfCommon, nfCanvasUtils) { + return (nf.PortDetails = factory($, nfCommon, nfCanvasUtils)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.PortDetails = @@ -35,7 +35,7 @@ root.nf.Common, root.nf.CanvasUtils); } -}(this, function ($, common, canvasUtils) { +}(this, function ($, nfCommon, nfCanvasUtils) { 'use strict'; return { @@ -61,9 +61,9 @@ handler: { close: function () { // clear the processor details - common.clearField('read-only-port-name'); - common.clearField('read-only-port-id'); - common.clearField('read-only-port-comments'); + nfCommon.clearField('read-only-port-name'); + nfCommon.clearField('read-only-port-id'); + nfCommon.clearField('read-only-port-comments'); } } }); @@ -71,13 +71,13 @@ showDetails: function (selection) { // if the specified component is a processor, load its properties - if (canvasUtils.isInputPort(selection) || canvasUtils.isOutputPort(selection)) { + if (nfCanvasUtils.isInputPort(selection) || nfCanvasUtils.isOutputPort(selection)) { var selectionData = selection.datum(); // populate the port settings - common.populateField('read-only-port-name', selectionData.component.name); - common.populateField('read-only-port-id', selectionData.id); - common.populateField('read-only-port-comments', selectionData.component.comments); + nfCommon.populateField('read-only-port-name', selectionData.component.name); + nfCommon.populateField('read-only-port-id', selectionData.id); + nfCommon.populateField('read-only-port-comments', selectionData.component.comments); // show the details $('#port-details').modal('show'); 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-port.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js index 129033b..06820bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-port.js @@ -24,8 +24,8 @@ 'nf.Common', 'nf.Client', 'nf.CanvasUtils'], - function ($, d3, common, client, canvasUtils) { - return (nf.Port = factory($, d3, common, client, canvasUtils)); + function ($, d3, nfCommon, nfClient, nfCanvasUtils) { + return (nf.Port = factory($, d3, nfCommon, nfClient, nfCanvasUtils)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Port = @@ -41,7 +41,7 @@ root.nf.Client, root.nf.CanvasUtils); } -}(this, function ($, d3, common, client, canvasUtils) { +}(this, function ($, d3, nfCommon, nfClient, nfCanvasUtils) { 'use strict'; var nfConnectable; @@ -118,7 +118,7 @@ } }) .classed('selected', selected) - .call(canvasUtils.position); + .call(nfCanvasUtils.position); // port border port.append('rect') @@ -151,7 +151,7 @@ var offset = 0; // conditionally render the remote banner - if (canvasUtils.getParentGroupId() === null) { + if (nfCanvasUtils.getParentGroupId() === null) { offset = OFFSET_VALUE; // port remote banner @@ -227,7 +227,7 @@ var details = port.select('g.port-details'); // update the component behavior as appropriate - canvasUtils.editable(port, nfConnectable, nfDraggable); + nfCanvasUtils.editable(port, nfConnectable, nfDraggable); // if this process group is visible, render everything if (port.classed('visible')) { @@ -235,7 +235,7 @@ details = port.append('g').attr('class', 'port-details'); var offset = 0; - if (canvasUtils.getParentGroupId() === null) { + if (nfCanvasUtils.getParentGroupId() === null) { offset = OFFSET_VALUE; // port transmitting icon @@ -313,9 +313,9 @@ // handle based on the number of tokens in the port name if (words.length === 1) { // apply ellipsis to the port name as necessary - canvasUtils.ellipsis(portName, name); + nfCanvasUtils.ellipsis(portName, name); } else { - canvasUtils.multilineEllipsis(portName, 2, name); + nfCanvasUtils.multilineEllipsis(portName, 2, name); } }).append('title').text(function (d) { return d.component.name; @@ -407,7 +407,7 @@ var tip = d3.select('#run-status-tip-' + d.id); // if there are validation errors generate a tooltip - if (d.permissions.canRead && !common.isEmpty(d.component.validationErrors)) { + if (d.permissions.canRead && !nfCommon.isEmpty(d.component.validationErrors)) { // create the tip if necessary if (tip.empty()) { tip = d3.select('#port-tooltips').append('div') @@ -419,7 +419,7 @@ // update the tip tip.html(function () { - var list = common.formatUnorderedList(d.component.validationErrors); + var list = nfCommon.formatUnorderedList(d.component.validationErrors); if (list === null || list.length === 0) { return ''; } else { @@ -428,7 +428,7 @@ }); // add the tooltip - canvasUtils.canvasTooltip(tip, d3.select(this)); + nfCanvasUtils.canvasTooltip(tip, d3.select(this)); } else { // remove if necessary if (!tip.empty()) { @@ -477,7 +477,7 @@ // active thread count // ------------------- - canvasUtils.activeThreadCount(port, d, function (off) { + nfCanvasUtils.activeThreadCount(port, d, function (off) { offset = off; }); @@ -486,10 +486,10 @@ // --------- port.select('rect.bulletin-background').classed('has-bulletins', function () { - return !common.isEmpty(d.status.aggregateSnapshot.bulletins); + return !nfCommon.isEmpty(d.status.aggregateSnapshot.bulletins); }); - canvasUtils.bulletins(port, d, function () { + nfCanvasUtils.bulletins(port, d, function () { return d3.select('#port-tooltips'); }, offset); }); @@ -524,12 +524,17 @@ var nfPort = { /** * Initializes of the Port handler. + * + * @param nfConnectableRef The nfConnectable module. + * @param nfDraggableRef The nfDraggable module. + * @param nfSelectableRef The nfSelectable module. + * @param nfContextMenuRef The nfContextMenu module. */ - init: function (connectable, draggable, selectable, contextMenu) { - nfConnectable = connectable; - nfDraggable = draggable; - nfSelectable = selectable; - nfContextMenu = contextMenu; + init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) { + nfConnectable = nfConnectableRef; + nfDraggable = nfDraggableRef; + nfSelectable = nfSelectableRef; + nfContextMenu = nfContextMenuRef; portMap = d3.map(); removedCache = d3.map(); @@ -551,13 +556,13 @@ */ add: function (portEntities, 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; } // determine the appropriate dimensions for this port var dimensions = portDimensions; - if (canvasUtils.getParentGroupId() === null) { + if (nfCanvasUtils.getParentGroupId() === null) { dimensions = remotePortDimensions; } @@ -582,7 +587,7 @@ $.each(portEntities, function (_, portNode) { add(portNode); }); - } else if (common.isDefinedAndNotNull(portEntities)) { + } else if (nfCommon.isDefinedAndNotNull(portEntities)) { add(portEntities); } @@ -601,14 +606,14 @@ set: function (portEntities, 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; } // determine the appropriate dimensions for this port var dimensions = portDimensions; - if (canvasUtils.getParentGroupId() === null) { + if (nfCanvasUtils.getParentGroupId() === null) { dimensions = remotePortDimensions; } @@ -616,7 +621,7 @@ var currentPortEntity = portMap.get(proposedPortEntity.id); // set the port if appropriate due to revision and wasn't previously removed - if (client.isNewerRevision(currentPortEntity, proposedPortEntity) && !removedCache.has(proposedPortEntity.id)) { + if (nfClient.isNewerRevision(currentPortEntity, proposedPortEntity) && !removedCache.has(proposedPortEntity.id)) { // add the port portMap.set(proposedPortEntity.id, $.extend({ type: 'Port', @@ -644,14 +649,14 @@ $.each(portEntities, function (_, portNode) { set(portNode); }); - } else if (common.isDefinedAndNotNull(portEntities)) { + } else if (nfCommon.isDefinedAndNotNull(portEntities)) { set(portEntities); } // apply the selection and handle all new ports var selection = select(); selection.enter().call(renderPorts, selectAll); - selection.call(updatePorts).call(canvasUtils.position, transition); + selection.call(updatePorts).call(nfCanvasUtils.position, transition); selection.exit().call(removePorts); }, @@ -662,7 +667,7 @@ * @param {string} id */ get: function (id) { - if (common.isUndefined(id)) { + if (nfCommon.isUndefined(id)) { return portMap.values(); } else { return portMap.get(id); @@ -676,7 +681,7 @@ * @param {string} id Optional */ refresh: function (id) { - if (common.isDefinedAndNotNull(id)) { + if (nfCommon.isDefinedAndNotNull(id)) { d3.select('#id-' + id).call(updatePorts); } else { d3.selectAll('g.input-port, g.output-port').call(updatePorts); @@ -715,7 +720,7 @@ * @param {string} id The id */ position: function (id) { - d3.select('#id-' + id).call(canvasUtils.position); + d3.select('#id-' + id).call(nfCanvasUtils.position); }, /** 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-process-group-configuration.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js index 8658a02..157bfe3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js @@ -28,8 +28,8 @@ 'nf.ProcessGroup', 'nf.Shell', 'nf.CanvasUtils'], - function ($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils) { - return (nf.ProcessGroupConfiguration = factory($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils)); + function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfProcessGroup, nfShell, nfCanvasUtils) { + return (nf.ProcessGroupConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfProcessGroup, nfShell, nfCanvasUtils)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ProcessGroupConfiguration = @@ -53,7 +53,7 @@ root.nf.Shell, root.nf.CanvasUtils); } -}(this, function ($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils) { +}(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfProcessGroup, nfShell, nfCanvasUtils) { 'use strict'; var nfControllerServices; @@ -88,7 +88,7 @@ var saveConfiguration = function (version, groupId) { // build the entity var entity = { - 'revision': client.getRevision({ + 'revision': nfClient.getRevision({ 'revision': { 'version': version } @@ -109,12 +109,12 @@ contentType: 'application/json' }).done(function (response) { // refresh the process group if necessary - if (response.permissions.canRead && response.component.parentGroupId === canvasUtils.getGroupId()) { - processGroup.set(response); + if (response.permissions.canRead && response.component.parentGroupId === nfCanvasUtils.getGroupId()) { + nfProcessGroup.set(response); } // show the result dialog - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Process Group Configuration', dialogContent: 'Process group configuration successfully saved.' }); @@ -124,8 +124,8 @@ saveConfiguration(response.revision.version, groupId); }); - canvasUtils.reload(); - }).fail(errorHandler.handleAjaxError); + nfCanvasUtils.reload(); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -188,15 +188,15 @@ deferred.resolve(); }).fail(function (xhr, status, error) { if (xhr.status === 403) { - if (groupId === canvasUtils.getGroupId()) { + if (groupId === nfCanvasUtils.getGroupId()) { $('#process-group-configuration').data('process-group', { 'permissions': { canRead: false, - canWrite: canvasUtils.canWrite() + canWrite: nfCanvasUtils.canWrite() } }); } else { - $('#process-group-configuration').data('process-group', processGroup.get(groupId)); + $('#process-group-configuration').data('process-group', nfProcessGroup.get(groupId)); } setUnauthorizedText(); @@ -218,7 +218,7 @@ // update the current time $('#process-group-configuration-last-refreshed').text(controllerServicesResponse.currentTime); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -226,7 +226,7 @@ */ var showConfiguration = function () { // show the configuration dialog - shell.showContent('#process-group-configuration').done(function () { + nfShell.showContent('#process-group-configuration').done(function () { reset(); }); @@ -256,10 +256,10 @@ /** * Initialize the process group configuration. * - * @param controllerServices The reference to the controllerServices controller. + * @param nfControllerServicesRef The nfControllerServices module. */ - init: function (controllerServices) { - nfControllerServices = controllerServices; + init: function (nfControllerServicesRef) { + nfControllerServices = nfControllerServicesRef; // initialize the process group configuration tabs $('#process-group-configuration-tabs').tabbs({ @@ -275,7 +275,7 @@ }], select: function () { var processGroup = $('#process-group-configuration').data('process-group'); - var canWrite = common.isDefinedAndNotNull(processGroup) ? processGroup.permissions.canWrite : false; + var canWrite = nfCommon.isDefinedAndNotNull(processGroup) ? processGroup.permissions.canWrite : false; var tab = $(this).text(); if (tab === 'General') { 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-process-group.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js index 38175d5..75f1916 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group.js @@ -26,8 +26,8 @@ 'nf.Client', 'nf.CanvasUtils', 'nf.Dialog'], - function ($, d3, connection, common, client, canvasUtils, dialog) { - return (nf.ProcessGroup = factory($, d3, connection, common, client, canvasUtils, dialog)); + function ($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils, nfDialog) { + return (nf.ProcessGroup = factory($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils, nfDialog)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ProcessGroup = @@ -47,7 +47,7 @@ root.nf.CanvasUtils, root.nf.Dialog); } -}(this, function ($, d3, connection, common, client, canvasUtils, dialog) { +}(this, function ($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils, nfDialog) { 'use strict'; var nfConnectable; @@ -91,7 +91,7 @@ * @param {object} d */ var getProcessGroupComments = function (d) { - if (common.isBlank(d.component.comments)) { + if (nfCommon.isBlank(d.component.comments)) { return 'No comments specified'; } else { return d.component.comments; @@ -126,7 +126,7 @@ 'class': 'process-group component' }) .classed('selected', selected) - .call(canvasUtils.position); + .call(nfCanvasUtils.position); // ---- // body @@ -203,7 +203,7 @@ var drag = d3.select('rect.drag-selection'); if (!drag.empty()) { // filter the current selection by this group - var selection = canvasUtils.getSelection().filter(function (d) { + var selection = nfCanvasUtils.getSelection().filter(function (d) { return targetData.id === d.id; }); @@ -212,7 +212,7 @@ // mark that we are hovering over a drop area if appropriate target.classed('drop', function () { // get the current selection and ensure its disconnected - return connection.isDisconnected(canvasUtils.getSelection()); + return nfConnection.isDisconnected(nfCanvasUtils.getSelection()); }); } } @@ -257,7 +257,7 @@ var details = processGroup.select('g.process-group-details'); // update the component behavior as appropriate - canvasUtils.editable(processGroup, nfConnectable, nfDraggable); + nfCanvasUtils.editable(processGroup, nfConnectable, nfDraggable); // if this processor is visible, render everything if (processGroup.classed('visible')) { @@ -848,9 +848,9 @@ processGroupComments.text(null).selectAll('tspan, title').remove(); // apply ellipsis to the port name as necessary - canvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d)); + nfCanvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d)); }).classed('unset', function (d) { - return common.isBlank(d.component.comments); + return nfCommon.isBlank(d.component.comments); }).append('title').text(function (d) { return getProcessGroupComments(d); }); @@ -864,7 +864,7 @@ processGroupName.text(null).selectAll('title').remove(); // apply ellipsis to the process group name as necessary - canvasUtils.ellipsis(processGroupName, d.component.name); + nfCanvasUtils.ellipsis(processGroupName, d.component.name); }).append('title').text(function (d) { return d.component.name; }); @@ -919,25 +919,25 @@ // queued count value updated.select('text.process-group-queued tspan.count') .text(function (d) { - return common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' '); + return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' '); }); // queued size value updated.select('text.process-group-queued tspan.size') .text(function (d) { - return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' '); + return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.queued, ' '); }); // in count value updated.select('text.process-group-in tspan.count') .text(function (d) { - return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); + return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); }); // in size value updated.select('text.process-group-in tspan.size') .text(function (d) { - return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); + return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); }); // in ports value @@ -961,13 +961,13 @@ // out count value updated.select('text.process-group-out tspan.count') .text(function (d) { - return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); + return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); }); // out size value updated.select('text.process-group-out tspan.size') .text(function (d) { - return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); + return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); }); updated.each(function (d) { @@ -978,7 +978,7 @@ // active thread count // ------------------- - canvasUtils.activeThreadCount(processGroup, d, function (off) { + nfCanvasUtils.activeThreadCount(processGroup, d, function (off) { offset = off; }); @@ -987,10 +987,10 @@ // --------- processGroup.select('rect.bulletin-background').classed('has-bulletins', function () { - return !common.isEmpty(d.status.aggregateSnapshot.bulletins); + return !nfCommon.isEmpty(d.status.aggregateSnapshot.bulletins); }); - canvasUtils.bulletins(processGroup, d, function () { + nfCanvasUtils.bulletins(processGroup, d, function () { return d3.select('#process-group-tooltips'); }, offset); }); @@ -1024,12 +1024,17 @@ var nfProcessGroup = { /** * Initializes of the Process Group handler. + * + * @param nfConnectableRef The nfConnectable module. + * @param nfDraggableRef The nfDraggable module. + * @param nfSelectableRef The nfSelectable module. + * @param nfContextMenuRef The nfContextMenu module. */ - init: function (connectable, draggable, selectable, contextMenu) { - nfConnectable = connectable; - nfDraggable = draggable; - nfSelectable = selectable; - nfContextMenu = contextMenu; + init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) { + nfConnectable = nfConnectableRef; + nfDraggable = nfDraggableRef; + nfSelectable = nfSelectableRef; + nfContextMenu = nfContextMenuRef; processGroupMap = d3.map(); removedCache = d3.map(); @@ -1051,8 +1056,8 @@ */ add: function (processGroupEntities, 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 @@ -1073,7 +1078,7 @@ $.each(processGroupEntities, function (_, processGroupEntity) { add(processGroupEntity); }); - } else if (common.isDefinedAndNotNull(processGroupEntities)) { + } else if (nfCommon.isDefinedAndNotNull(processGroupEntities)) { add(processGroupEntities); } @@ -1092,16 +1097,16 @@ set: function (processGroupEntities, 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 (proposedProcessGroupEntity) { var currentProcessGroupEntity = processGroupMap.get(proposedProcessGroupEntity.id); // set the process group if appropriate due to revision and wasn't previously removed - if (client.isNewerRevision(currentProcessGroupEntity, proposedProcessGroupEntity) && !removedCache.has(proposedProcessGroupEntity.id)) { + if (nfClient.isNewerRevision(currentProcessGroupEntity, proposedProcessGroupEntity) && !removedCache.has(proposedProcessGroupEntity.id)) { processGroupMap.set(proposedProcessGroupEntity.id, $.extend({ type: 'ProcessGroup', dimensions: dimensions @@ -1125,14 +1130,14 @@ $.each(processGroupEntities, function (_, processGroupEntity) { set(processGroupEntity); }); - } else if (common.isDefinedAndNotNull(processGroupEntities)) { + } else if (nfCommon.isDefinedAndNotNull(processGroupEntities)) { set(processGroupEntities); } // apply the selection and handle all new process group var selection = select(); selection.enter().call(renderProcessGroups, selectAll); - selection.call(updateProcessGroups).call(canvasUtils.position, transition); + selection.call(updateProcessGroups).call(nfCanvasUtils.position, transition); selection.exit().call(removeProcessGroups); }, @@ -1143,7 +1148,7 @@ * @param {string} id */ get: function (id) { - if (common.isUndefined(id)) { + if (nfCommon.isUndefined(id)) { return processGroupMap.values(); } else { return processGroupMap.get(id); @@ -1157,7 +1162,7 @@ * @param {string} id Optional */ refresh: function (id) { - if (common.isDefinedAndNotNull(id)) { + if (nfCommon.isDefinedAndNotNull(id)) { d3.select('#id-' + id).call(updateProcessGroups); } else { d3.selectAll('g.process-group').call(updateProcessGroups); @@ -1196,7 +1201,7 @@ * @param {string} id The id */ position: function (id) { - d3.select('#id-' + id).call(canvasUtils.position); + d3.select('#id-' + id).call(nfCanvasUtils.position); }, /** @@ -1257,25 +1262,25 @@ nfContextMenu.hide();â¨â¨ // set the new group id - canvasUtils.setGroupId(groupId);â¨â¨ + nfCanvasUtils.setGroupId(groupId);â¨â¨ // reload the graph - return canvasUtils.reload().done(function () {⨠+ return nfCanvasUtils.reload().done(function () {⨠// attempt to restore the view - var viewRestored = canvasUtils.restoreUserView();â¨â¨ + var viewRestored = nfCanvasUtils.restoreUserView();â¨â¨ // if the view was not restore attempt to fit if (viewRestored === false) { - canvasUtils.fitCanvasView();â¨â¨ + nfCanvasUtils.fitCanvasView();â¨â¨ // refresh the canvas - canvasUtils.refreshCanvasView({ + nfCanvasUtils.refreshCanvasView({ transition: true }); } }).fail(function () { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Process Group', dialogContent: 'Unable to enter the selected 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-processor-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-processor-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js index 157f803..7236da3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js @@ -31,8 +31,8 @@ 'nf.CustomUi', 'nf.UniversalCapture', 'nf.Connection'], - function ($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection) { - return (nf.ProcessorConfiguration = factory($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection)); + function ($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfProcessor, nfClusterSummary, nfCustomUi, nfUniversalCapture, nfConnection) { + return (nf.ProcessorConfiguration = factory($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfProcessor, nfClusterSummary, nfCustomUi, nfUniversalCapture, nfConnection)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ProcessorConfiguration = @@ -62,7 +62,7 @@ root.nf.UniversalCapture, root.nf.Connection); } -}(this, function ($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection) { +}(this, function ($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfProcessor, nfClusterSummary, nfCustomUi, nfUniversalCapture, nfConnection) { 'use strict'; // possible values for a processor's run duration (in millis) @@ -133,7 +133,7 @@ text: 'Primary node', value: 'PRIMARY', description: 'Processor will be scheduled to run only on the primary node', - disabled: !clusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY' + disabled: !nfClusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY' }]; }; @@ -152,15 +152,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: 'Processor Configuration' }); } else { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); } }; @@ -183,7 +183,7 @@ // build the relationship container element var relationshipContainerElement = $('<div class="processor-relationship-container"></div>').append(relationshipCheckbox).append(relationshipLabel).append(relationshipValue).appendTo('#auto-terminate-relationship-names'); - if (!common.isBlank(relationship.description)) { + if (!nfCommon.isBlank(relationship.description)) { var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description); relationshipContainerElement.append(relationshipDescription); } @@ -255,7 +255,7 @@ } // check the scheduling period - if (common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) { + if (nfCommon.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) { return true; } @@ -321,7 +321,7 @@ } // get the scheduling period if appropriate - if (common.isDefinedAndNotNull(schedulingPeriod)) { + if (nfCommon.isDefinedAndNotNull(schedulingPeriod)) { processorConfigDto['schedulingPeriod'] = schedulingPeriod.val(); } @@ -405,22 +405,22 @@ var config = processor['config']; // ensure numeric fields are specified correctly - if (common.isDefinedAndNotNull(config['concurrentlySchedulableTaskCount']) && !$.isNumeric(config['concurrentlySchedulableTaskCount'])) { + if (nfCommon.isDefinedAndNotNull(config['concurrentlySchedulableTaskCount']) && !$.isNumeric(config['concurrentlySchedulableTaskCount'])) { errors.push('Concurrent tasks must be an integer value'); } - if (common.isDefinedAndNotNull(config['schedulingPeriod']) && common.isBlank(config['schedulingPeriod'])) { + if (nfCommon.isDefinedAndNotNull(config['schedulingPeriod']) && nfCommon.isBlank(config['schedulingPeriod'])) { errors.push('Run schedule must be specified'); } - if (common.isBlank(config['penaltyDuration'])) { + if (nfCommon.isBlank(config['penaltyDuration'])) { errors.push('Penalty duration must be specified'); } - if (common.isBlank(config['yieldDuration'])) { + if (nfCommon.isBlank(config['yieldDuration'])) { errors.push('Yield duration must be specified'); } if (errors.length > 0) { - dialog.showOkDialog({ - dialogContent: common.formatUnorderedList(errors), + nfDialog.showOkDialog({ + dialogContent: nfCommon.formatUnorderedList(errors), headerText: 'Processor Configuration' }); return false; @@ -456,7 +456,7 @@ // determine if changes have been made if (isSaveRequired()) { // see if those changes should be saved - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Processor Configuration', dialogContent: 'Save changes before going to this Controller Service?', noHandler: function () { @@ -490,7 +490,7 @@ if (validateDetails(updatedProcessor)) { // set the revision var d = nfProcessor.get(processor.id); - updatedProcessor['revision'] = client.getRevision(d); + updatedProcessor['revision'] = nfClient.getRevision(d); // update the selected component return $.ajax({ @@ -535,7 +535,7 @@ }], select: function () { // remove all property detail dialogs - universalCapture.removeAllPropertyDetailDialogs(); + nfUniversalCapture.removeAllPropertyDetailDialogs(); // update the processor property table size in case this is the first time its rendered if ($(this).text() === 'Properties') { @@ -569,7 +569,7 @@ $('#processor-configuration').removeData('processorDetails'); }, open: function () { - common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); + nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); } } }); @@ -620,7 +620,7 @@ propertyName: propertyName }, dataType: 'json' - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }, goToServiceDeferred: goToServiceFromProperty }); @@ -632,7 +632,7 @@ * @argument {selection} selection The selection */ showConfiguration: function (selection) { - if (canvasUtils.isProcessor(selection)) { + if (nfCanvasUtils.isProcessor(selection)) { var selectionData = selection.datum(); // get the processor details @@ -670,7 +670,7 @@ // populate the processor settings $('#processor-id').text(processor['id']); - $('#processor-type').text(common.substringAfterLast(processor['type'], '.')); + $('#processor-type').text(nfCommon.substringAfterLast(processor['type'], '.')); $('#processor-name').val(processor['name']); $('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle); $('#penalty-duration').val(processor.config['penaltyDuration']); @@ -736,7 +736,7 @@ }); // show the execution node option if we're cluster or we're currently configured to run on the primary node only - if (clusterSummary.isClustered() || executionNode === 'PRIMARY') { + if (nfClusterSummary.isClustered() || executionNode === 'PRIMARY') { $('#execution-node-options').show(); } else { $('#execution-node-options').hide(); @@ -759,7 +759,7 @@ } // conditionally allow the user to specify the concurrent tasks - if (common.isDefinedAndNotNull(concurrentTasks)) { + if (nfCommon.isDefinedAndNotNull(concurrentTasks)) { if (processor.supportsParallelProcessing === true) { concurrentTasks.prop('disabled', false); } else { @@ -780,7 +780,7 @@ } // load the relationship list - if (!common.isEmpty(processor.relationships)) { + if (!nfCommon.isEmpty(processor.relationships)) { $.each(processor.relationships, function (i, relationship) { createRelationshipOption(relationship); }); @@ -809,7 +809,7 @@ $('#processor-configuration').modal('hide'); // inform Angular app values have changed - angularBridge.digest(); + nfNgBridge.digest(); }); } } @@ -829,7 +829,7 @@ }]; // determine if we should show the advanced button - if (common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') { + if (nfCommon.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') { buttons.push({ buttonText: 'Advanced', clazz: 'fa fa-cog button-icon', @@ -845,7 +845,7 @@ $('#processor-configuration').modal('hide'); // show the custom ui - customUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () { + nfCustomUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () { // once the custom ui is closed, reload the processor nfProcessor.reload(processor.id); @@ -860,7 +860,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, @@ -899,7 +899,7 @@ if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > Math.round(processorRelationships.innerHeight())) { processorRelationships.css('border-width', '1px'); } - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); } } }; 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-processor.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js index 63fb2af..4f25699 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor.js @@ -24,8 +24,8 @@ 'nf.Common', 'nf.Client', 'nf.CanvasUtils'], - function ($, d3, common, client, canvasUtils) { - return (nf.Processor = factory($, d3, common, client, canvasUtils)); + function ($, d3, nfCommon, nfClient, nfCanvasUtils) { + return (nf.Processor = factory($, d3, nfCommon, nfClient, nfCanvasUtils)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Processor = @@ -41,7 +41,7 @@ root.nf.Client, root.nf.CanvasUtils); } -}(this, function ($, d3, common, client, canvasUtils) { +}(this, function ($, d3, nfCommon, nfClient, nfCanvasUtils) { 'use strict'; var nfConnectable; @@ -103,7 +103,7 @@ 'class': 'processor component' }) .classed('selected', selected) - .call(canvasUtils.position); + .call(nfCanvasUtils.position); // processor border processor.append('rect') @@ -211,7 +211,7 @@ var details = processor.select('g.processor-canvas-details'); // update the component behavior as appropriate - canvasUtils.editable(processor, nfConnectable, nfDraggable); + nfCanvasUtils.editable(processor, nfConnectable, nfDraggable); // if this processor is visible, render everything if (processor.classed('visible')) { @@ -538,7 +538,7 @@ processorName.text(null).selectAll('title').remove(); // apply ellipsis to the processor name as necessary - canvasUtils.ellipsis(processorName, d.component.name); + nfCanvasUtils.ellipsis(processorName, d.component.name); }).append('title').text(function (d) { return d.component.name; }); @@ -552,9 +552,9 @@ processorType.text(null).selectAll('title').remove(); // apply ellipsis to the processor type as necessary - canvasUtils.ellipsis(processorType, common.substringAfterLast(d.component.type, '.')); + nfCanvasUtils.ellipsis(processorType, nfCommon.substringAfterLast(d.component.type, '.')); }).append('title').text(function (d) { - return common.substringAfterLast(d.component.type, '.'); + return nfCommon.substringAfterLast(d.component.type, '.'); }); } else { // clear the processor name @@ -607,7 +607,7 @@ // use the specified color if appropriate if (processorData.permissions.canRead) { - if (common.isDefinedAndNotNull(processorData.component.style['background-color'])) { + if (nfCommon.isDefinedAndNotNull(processorData.component.style['background-color'])) { var color = processorData.component.style['background-color']; //update the processor icon container @@ -636,15 +636,15 @@ } // use the specified color if appropriate - if (common.isDefinedAndNotNull(d.component.style['background-color'])) { + if (nfCommon.isDefinedAndNotNull(d.component.style['background-color'])) { color = d.component.style['background-color']; //special case #ffffff implies default fill if (color.toLowerCase() === '#ffffff') { color = nfProcessor.defaultIconColor(); } else { - color = common.determineContrastColor( - common.substringAfterLast( + color = nfCommon.determineContrastColor( + nfCommon.substringAfterLast( color, '#')); } } @@ -723,7 +723,7 @@ var tip = d3.select('#run-status-tip-' + d.id); // if there are validation errors generate a tooltip - if (d.permissions.canRead && !common.isEmpty(d.component.validationErrors)) { + if (d.permissions.canRead && !nfCommon.isEmpty(d.component.validationErrors)) { // create the tip if necessary if (tip.empty()) { tip = d3.select('#processor-tooltips').append('div') @@ -735,7 +735,7 @@ // update the tip tip.html(function () { - var list = common.formatUnorderedList(d.component.validationErrors); + var list = nfCommon.formatUnorderedList(d.component.validationErrors); if (list === null || list.length === 0) { return ''; } else { @@ -744,7 +744,7 @@ }); // add the tooltip - canvasUtils.canvasTooltip(tip, d3.select(this)); + nfCanvasUtils.canvasTooltip(tip, d3.select(this)); } else { // remove the tip if necessary if (!tip.empty()) { @@ -756,13 +756,13 @@ // in count value updated.select('text.processor-in tspan.count') .text(function (d) { - return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); + return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); }); // in size value updated.select('text.processor-in tspan.size') .text(function (d) { - return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); + return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); }); // read/write value @@ -774,13 +774,13 @@ // out count value updated.select('text.processor-out tspan.count') .text(function (d) { - return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); + return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); }); // out size value updated.select('text.processor-out tspan.size') .text(function (d) { - return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); + return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); }); // tasks/time value @@ -796,17 +796,17 @@ // active thread count // ------------------- - canvasUtils.activeThreadCount(processor, d); + nfCanvasUtils.activeThreadCount(processor, d); // --------- // bulletins // --------- processor.select('rect.bulletin-background').classed('has-bulletins', function () { - return !common.isEmpty(d.status.aggregateSnapshot.bulletins); + return !nfCommon.isEmpty(d.status.aggregateSnapshot.bulletins); }); - canvasUtils.bulletins(processor, d, function () { + nfCanvasUtils.bulletins(processor, d, function () { return d3.select('#processor-tooltips'); }, 286); }); @@ -841,12 +841,17 @@ var nfProcessor = { /** * Initializes of the Processor handler. + * + * @param nfConnectableRef The nfConnectable module. + * @param nfDraggableRef The nfDraggable module. + * @param nfSelectableRef The nfSelectable module. + * @param nfContextMenuRef The nfContextMenu module. */ - init: function (connectable, draggable, selectable, contextMenu) { - nfConnectable = connectable; - nfDraggable = draggable; - nfSelectable = selectable; - nfContextMenu = contextMenu; + init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) { + nfConnectable = nfConnectableRef; + nfDraggable = nfDraggableRef; + nfSelectable = nfSelectableRef; + nfContextMenu = nfContextMenuRef; processorMap = d3.map(); removedCache = d3.map(); @@ -868,8 +873,8 @@ */ add: function (processorEntities, 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 @@ -890,7 +895,7 @@ $.each(processorEntities, function (_, processorEntity) { add(processorEntity); }); - } else if (common.isDefinedAndNotNull(processorEntities)) { + } else if (nfCommon.isDefinedAndNotNull(processorEntities)) { add(processorEntities); } @@ -909,16 +914,16 @@ set: function (processorEntities, 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 (proposedProcessorEntity) { var currentProcessorEntity = processorMap.get(proposedProcessorEntity.id); // set the processor if appropriate due to revision and wasn't previously removed - if (client.isNewerRevision(currentProcessorEntity, proposedProcessorEntity) && !removedCache.has(proposedProcessorEntity.id)) { + if (nfClient.isNewerRevision(currentProcessorEntity, proposedProcessorEntity) && !removedCache.has(proposedProcessorEntity.id)) { processorMap.set(proposedProcessorEntity.id, $.extend({ type: 'Processor', dimensions: dimensions @@ -942,14 +947,14 @@ $.each(processorEntities, function (_, processorEntity) { set(processorEntity); }); - } else if (common.isDefinedAndNotNull(processorEntities)) { + } else if (nfCommon.isDefinedAndNotNull(processorEntities)) { set(processorEntities); } // apply the selection and handle all new processors var selection = select(); selection.enter().call(renderProcessors, selectAll); - selection.call(updateProcessors).call(canvasUtils.position, transition); + selection.call(updateProcessors).call(nfCanvasUtils.position, transition); selection.exit().call(removeProcessors); }, @@ -960,7 +965,7 @@ * @param {string} id */ get: function (id) { - if (common.isUndefined(id)) { + if (nfCommon.isUndefined(id)) { return processorMap.values(); } else { return processorMap.get(id); @@ -974,7 +979,7 @@ * @param {string} id Optional */ refresh: function (id) { - if (common.isDefinedAndNotNull(id)) { + if (nfCommon.isDefinedAndNotNull(id)) { d3.select('#id-' + id).call(updateProcessors); } else { d3.selectAll('g.processor').call(updateProcessors); @@ -987,7 +992,7 @@ * @param {string} id The id */ position: function (id) { - d3.select('#id-' + id).call(canvasUtils.position); + d3.select('#id-' + id).call(nfCanvasUtils.position); }, /**
