http://git-wip-us.apache.org/repos/asf/nifi/blob/bf3b1640/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 aae4bc5..157f803 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 @@ -15,9 +15,55 @@ * limitations under the License. */ -/* global nf */ - -nf.ProcessorConfiguration = (function () { +/* global define, module, require, exports */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', + 'nf.ErrorHandler', + 'nf.Common', + 'nf.Dialog', + 'nf.Client', + 'nf.CanvasUtils', + 'nf.ng.Bridge', + 'nf.Processor', + 'nf.ClusterSummary', + '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)); + }); + } else if (typeof exports === 'object' && typeof module === 'object') { + module.exports = (nf.ProcessorConfiguration = + factory(require('jquery'), + require('nf.ErrorHandler'), + require('nf.Common'), + require('nf.Dialog'), + require('nf.Client'), + require('nf.CanvasUtils'), + require('nf.ng.Bridge'), + require('nf.Processor'), + require('nf.ClusterSummary'), + require('nf.CustomUi'), + require('nf.UniversalCapture'), + require('nf.Connection'))); + } else { + nf.ProcessorConfiguration = factory(root.$, + root.nf.ErrorHandler, + root.nf.Common, + root.nf.Dialog, + root.nf.Client, + root.nf.CanvasUtils, + root.nf.ng.Bridge, + root.nf.Processor, + root.nf.ClusterSummary, + root.nf.CustomUi, + root.nf.UniversalCapture, + root.nf.Connection); + } +}(this, function ($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection) { + 'use strict'; // possible values for a processor's run duration (in millis) var RUN_DURATION_VALUES = [0, 25, 50, 100, 250, 500, 1000, 2000]; @@ -87,7 +133,7 @@ nf.ProcessorConfiguration = (function () { text: 'Primary node', value: 'PRIMARY', description: 'Processor will be scheduled to run only on the primary node', - disabled: !nf.ClusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY' + disabled: !clusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY' }]; }; @@ -106,15 +152,15 @@ nf.ProcessorConfiguration = (function () { if (errors.length === 1) { content = $('<span></span>').text(errors[0]); } else { - content = nf.Common.formatUnorderedList(errors); + content = common.formatUnorderedList(errors); } - nf.Dialog.showOkDialog({ + dialog.showOkDialog({ dialogContent: content, headerText: 'Processor Configuration' }); } else { - nf.ErrorHandler.handleAjaxError(xhr, status, error); + errorHandler.handleAjaxError(xhr, status, error); } }; @@ -137,7 +183,7 @@ nf.ProcessorConfiguration = (function () { // 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 (!nf.Common.isBlank(relationship.description)) { + if (!common.isBlank(relationship.description)) { var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description); relationshipContainerElement.append(relationshipDescription); } @@ -209,7 +255,7 @@ nf.ProcessorConfiguration = (function () { } // check the scheduling period - if (nf.Common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) { + if (common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) { return true; } @@ -275,7 +321,7 @@ nf.ProcessorConfiguration = (function () { } // get the scheduling period if appropriate - if (nf.Common.isDefinedAndNotNull(schedulingPeriod)) { + if (common.isDefinedAndNotNull(schedulingPeriod)) { processorConfigDto['schedulingPeriod'] = schedulingPeriod.val(); } @@ -359,22 +405,22 @@ nf.ProcessorConfiguration = (function () { var config = processor['config']; // ensure numeric fields are specified correctly - if (nf.Common.isDefinedAndNotNull(config['concurrentlySchedulableTaskCount']) && !$.isNumeric(config['concurrentlySchedulableTaskCount'])) { + if (common.isDefinedAndNotNull(config['concurrentlySchedulableTaskCount']) && !$.isNumeric(config['concurrentlySchedulableTaskCount'])) { errors.push('Concurrent tasks must be an integer value'); } - if (nf.Common.isDefinedAndNotNull(config['schedulingPeriod']) && nf.Common.isBlank(config['schedulingPeriod'])) { + if (common.isDefinedAndNotNull(config['schedulingPeriod']) && common.isBlank(config['schedulingPeriod'])) { errors.push('Run schedule must be specified'); } - if (nf.Common.isBlank(config['penaltyDuration'])) { + if (common.isBlank(config['penaltyDuration'])) { errors.push('Penalty duration must be specified'); } - if (nf.Common.isBlank(config['yieldDuration'])) { + if (common.isBlank(config['yieldDuration'])) { errors.push('Yield duration must be specified'); } if (errors.length > 0) { - nf.Dialog.showOkDialog({ - dialogContent: nf.Common.formatUnorderedList(errors), + dialog.showOkDialog({ + dialogContent: common.formatUnorderedList(errors), headerText: 'Processor Configuration' }); return false; @@ -389,11 +435,11 @@ nf.ProcessorConfiguration = (function () { * @param {object} processor */ var reloadProcessorConnections = function (processor) { - var connections = nf.Connection.getComponentConnections(processor.id); + var connections = nfConnection.getComponentConnections(processor.id); $.each(connections, function (_, connection) { if (connection.permissions.canRead) { if (connection.sourceId === processor.id) { - nf.Connection.reload(connection.id); + nfConnection.reload(connection.id); } } }); @@ -410,7 +456,7 @@ nf.ProcessorConfiguration = (function () { // determine if changes have been made if (isSaveRequired()) { // see if those changes should be saved - nf.Dialog.showYesNoDialog({ + dialog.showYesNoDialog({ headerText: 'Processor Configuration', dialogContent: 'Save changes before going to this Controller Service?', noHandler: function () { @@ -443,8 +489,8 @@ nf.ProcessorConfiguration = (function () { // ensure details are valid as far as we can tell if (validateDetails(updatedProcessor)) { // set the revision - var d = nf.Processor.get(processor.id); - updatedProcessor['revision'] = nf.Client.getRevision(d); + var d = nfProcessor.get(processor.id); + updatedProcessor['revision'] = client.getRevision(d); // update the selected component return $.ajax({ @@ -455,7 +501,7 @@ nf.ProcessorConfiguration = (function () { contentType: 'application/json' }).done(function (response) { // set the new processor state based on the response - nf.Processor.set(response); + nfProcessor.set(response); }).fail(handleProcessorConfigurationError); } else { return $.Deferred(function (deferred) { @@ -489,7 +535,7 @@ nf.ProcessorConfiguration = (function () { }], select: function () { // remove all property detail dialogs - nf.UniversalCapture.removeAllPropertyDetailDialogs(); + universalCapture.removeAllPropertyDetailDialogs(); // update the processor property table size in case this is the first time its rendered if ($(this).text() === 'Properties') { @@ -523,7 +569,7 @@ nf.ProcessorConfiguration = (function () { $('#processor-configuration').removeData('processorDetails'); }, open: function () { - nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); + common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); } } }); @@ -566,7 +612,7 @@ nf.ProcessorConfiguration = (function () { dialogContainer: '#new-processor-property-container', descriptorDeferred: function (propertyName) { var processor = $('#processor-configuration').data('processorDetails'); - var d = nf.Processor.get(processor.id); + var d = nfProcessor.get(processor.id); return $.ajax({ type: 'GET', url: d.uri + '/descriptors', @@ -574,7 +620,7 @@ nf.ProcessorConfiguration = (function () { propertyName: propertyName }, dataType: 'json' - }).fail(nf.ErrorHandler.handleAjaxError); + }).fail(errorHandler.handleAjaxError); }, goToServiceDeferred: goToServiceFromProperty }); @@ -586,7 +632,7 @@ nf.ProcessorConfiguration = (function () { * @argument {selection} selection The selection */ showConfiguration: function (selection) { - if (nf.CanvasUtils.isProcessor(selection)) { + if (canvasUtils.isProcessor(selection)) { var selectionData = selection.datum(); // get the processor details @@ -595,7 +641,7 @@ nf.ProcessorConfiguration = (function () { var requests = []; // reload the processor in case an property descriptors have updated - requests.push(nf.Processor.reload(processor.id)); + requests.push(nfProcessor.reload(processor.id)); // get the processor history requests.push($.ajax({ @@ -609,7 +655,7 @@ nf.ProcessorConfiguration = (function () { // get the updated processor' var processorResponse = processorResult[0]; processor = processorResponse.component; - + // get the processor history var processorHistory = historyResult[0].componentHistory; @@ -624,7 +670,7 @@ nf.ProcessorConfiguration = (function () { // populate the processor settings $('#processor-id').text(processor['id']); - $('#processor-type').text(nf.Common.substringAfterLast(processor['type'], '.')); + $('#processor-type').text(common.substringAfterLast(processor['type'], '.')); $('#processor-name').val(processor['name']); $('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle); $('#penalty-duration').val(processor.config['penaltyDuration']); @@ -690,7 +736,7 @@ nf.ProcessorConfiguration = (function () { }); // show the execution node option if we're cluster or we're currently configured to run on the primary node only - if (nf.ClusterSummary.isClustered() || executionNode === 'PRIMARY') { + if (clusterSummary.isClustered() || executionNode === 'PRIMARY') { $('#execution-node-options').show(); } else { $('#execution-node-options').hide(); @@ -713,7 +759,7 @@ nf.ProcessorConfiguration = (function () { } // conditionally allow the user to specify the concurrent tasks - if (nf.Common.isDefinedAndNotNull(concurrentTasks)) { + if (common.isDefinedAndNotNull(concurrentTasks)) { if (processor.supportsParallelProcessing === true) { concurrentTasks.prop('disabled', false); } else { @@ -734,7 +780,7 @@ nf.ProcessorConfiguration = (function () { } // load the relationship list - if (!nf.Common.isEmpty(processor.relationships)) { + if (!common.isEmpty(processor.relationships)) { $.each(processor.relationships, function (i, relationship) { createRelationshipOption(relationship); }); @@ -763,7 +809,7 @@ nf.ProcessorConfiguration = (function () { $('#processor-configuration').modal('hide'); // inform Angular app values have changed - nf.ng.Bridge.digest(); + angularBridge.digest(); }); } } @@ -783,7 +829,7 @@ nf.ProcessorConfiguration = (function () { }]; // determine if we should show the advanced button - if (nf.Common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') { + if (common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') { buttons.push({ buttonText: 'Advanced', clazz: 'fa fa-cog button-icon', @@ -799,9 +845,9 @@ nf.ProcessorConfiguration = (function () { $('#processor-configuration').modal('hide'); // show the custom ui - nf.CustomUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () { + customUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () { // once the custom ui is closed, reload the processor - nf.Processor.reload(processor.id); + nfProcessor.reload(processor.id); // and reload the processor's outgoing connections reloadProcessorConnections(processor); @@ -814,7 +860,7 @@ nf.ProcessorConfiguration = (function () { // determine if changes have been made if (isSaveRequired()) { // see if those changes should be saved - nf.Dialog.showYesNoDialog({ + dialog.showYesNoDialog({ headerText: 'Save', dialogContent: 'Save changes before opening the advanced configuration?', noHandler: openCustomUi, @@ -853,8 +899,8 @@ nf.ProcessorConfiguration = (function () { if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > Math.round(processorRelationships.innerHeight())) { processorRelationships.css('border-width', '1px'); } - }).fail(nf.ErrorHandler.handleAjaxError); + }).fail(errorHandler.handleAjaxError); } } }; -}()); +}));
http://git-wip-us.apache.org/repos/asf/nifi/blob/bf3b1640/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 1a02dae..63fb2af 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 @@ -15,9 +15,39 @@ * limitations under the License. */ -/* global nf, d3 */ +/* global define, module, require, exports */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', + 'd3', + 'nf.Common', + 'nf.Client', + 'nf.CanvasUtils'], + function ($, d3, common, client, canvasUtils) { + return (nf.Processor = factory($, d3, common, client, canvasUtils)); + }); + } else if (typeof exports === 'object' && typeof module === 'object') { + module.exports = (nf.Processor = + factory(require('jquery'), + require('d3'), + require('nf.Common'), + require('nf.Client'), + require('nf.CanvasUtils'))); + } else { + nf.Processor = factory(root.$, + root.d3, + root.nf.Common, + root.nf.Client, + root.nf.CanvasUtils); + } +}(this, function ($, d3, common, client, canvasUtils) { + 'use strict'; -nf.Processor = (function () { + var nfConnectable; + var nfDraggable; + var nfSelectable; + var nfContextMenu; var PREVIEW_NAME_LENGTH = 25; @@ -73,7 +103,7 @@ nf.Processor = (function () { 'class': 'processor component' }) .classed('selected', selected) - .call(nf.CanvasUtils.position); + .call(canvasUtils.position); // processor border processor.append('rect') @@ -151,7 +181,7 @@ nf.Processor = (function () { .text('\uf132'); // make processors selectable - processor.call(nf.Selectable.activate).call(nf.ContextMenu.activate); + processor.call(nfSelectable.activate).call(nfContextMenu.activate); }; /** @@ -181,7 +211,7 @@ nf.Processor = (function () { var details = processor.select('g.processor-canvas-details'); // update the component behavior as appropriate - nf.CanvasUtils.editable(processor); + canvasUtils.editable(processor, nfConnectable, nfDraggable); // if this processor is visible, render everything if (processor.classed('visible')) { @@ -508,7 +538,7 @@ nf.Processor = (function () { processorName.text(null).selectAll('title').remove(); // apply ellipsis to the processor name as necessary - nf.CanvasUtils.ellipsis(processorName, d.component.name); + canvasUtils.ellipsis(processorName, d.component.name); }).append('title').text(function (d) { return d.component.name; }); @@ -522,9 +552,9 @@ nf.Processor = (function () { processorType.text(null).selectAll('title').remove(); // apply ellipsis to the processor type as necessary - nf.CanvasUtils.ellipsis(processorType, nf.Common.substringAfterLast(d.component.type, '.')); + canvasUtils.ellipsis(processorType, common.substringAfterLast(d.component.type, '.')); }).append('title').text(function (d) { - return nf.Common.substringAfterLast(d.component.type, '.'); + return common.substringAfterLast(d.component.type, '.'); }); } else { // clear the processor name @@ -576,8 +606,8 @@ nf.Processor = (function () { processor.select('rect.border').classed('unauthorized', !processorData.permissions.canRead); // use the specified color if appropriate - if (processorData.permissions.canRead){ - if (nf.Common.isDefinedAndNotNull(processorData.component.style['background-color'])) { + if (processorData.permissions.canRead) { + if (common.isDefinedAndNotNull(processorData.component.style['background-color'])) { var color = processorData.component.style['background-color']; //update the processor icon container @@ -599,22 +629,22 @@ nf.Processor = (function () { .style('fill', function (d) { // get the default color - var color = nf.Processor.defaultIconColor(); + var color = nfProcessor.defaultIconColor(); if (!d.permissions.canRead) { return color; } // use the specified color if appropriate - if (nf.Common.isDefinedAndNotNull(d.component.style['background-color'])) { + if (common.isDefinedAndNotNull(d.component.style['background-color'])) { color = d.component.style['background-color']; //special case #ffffff implies default fill if (color.toLowerCase() === '#ffffff') { - color = nf.Processor.defaultIconColor(); + color = nfProcessor.defaultIconColor(); } else { - color = nf.Common.determineContrastColor( - nf.Common.substringAfterLast( + color = common.determineContrastColor( + common.substringAfterLast( color, '#')); } } @@ -657,7 +687,7 @@ nf.Processor = (function () { 'fill': function (d) { var fill = '#728e9b'; - if (d.status.aggregateSnapshot.runStatus === 'Invalid') { + if (d.status.aggregateSnapshot.runStatus === 'Invalid') { fill = '#cf9f5d'; } else if (d.status.aggregateSnapshot.runStatus === 'Running') { fill = '#7dc7a0'; @@ -693,7 +723,7 @@ nf.Processor = (function () { var tip = d3.select('#run-status-tip-' + d.id); // if there are validation errors generate a tooltip - if (d.permissions.canRead && !nf.Common.isEmpty(d.component.validationErrors)) { + if (d.permissions.canRead && !common.isEmpty(d.component.validationErrors)) { // create the tip if necessary if (tip.empty()) { tip = d3.select('#processor-tooltips').append('div') @@ -705,16 +735,16 @@ nf.Processor = (function () { // update the tip tip.html(function () { - var list = nf.Common.formatUnorderedList(d.component.validationErrors); - if (list === null || list.length === 0) { - return ''; - } else { - return $('<div></div>').append(list).html(); - } - }); + var list = common.formatUnorderedList(d.component.validationErrors); + if (list === null || list.length === 0) { + return ''; + } else { + return $('<div></div>').append(list).html(); + } + }); // add the tooltip - nf.CanvasUtils.canvasTooltip(tip, d3.select(this)); + canvasUtils.canvasTooltip(tip, d3.select(this)); } else { // remove the tip if necessary if (!tip.empty()) { @@ -726,13 +756,13 @@ nf.Processor = (function () { // in count value updated.select('text.processor-in tspan.count') .text(function (d) { - return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); + return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); }); // in size value updated.select('text.processor-in tspan.size') .text(function (d) { - return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); + return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); }); // read/write value @@ -744,13 +774,13 @@ nf.Processor = (function () { // out count value updated.select('text.processor-out tspan.count') .text(function (d) { - return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); + return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); }); // out size value updated.select('text.processor-out tspan.size') .text(function (d) { - return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); + return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); }); // tasks/time value @@ -766,17 +796,17 @@ nf.Processor = (function () { // active thread count // ------------------- - nf.CanvasUtils.activeThreadCount(processor, d); + canvasUtils.activeThreadCount(processor, d); // --------- // bulletins // --------- processor.select('rect.bulletin-background').classed('has-bulletins', function () { - return !nf.Common.isEmpty(d.status.aggregateSnapshot.bulletins); + return !common.isEmpty(d.status.aggregateSnapshot.bulletins); }); - nf.CanvasUtils.bulletins(processor, d, function () { + canvasUtils.bulletins(processor, d, function () { return d3.select('#processor-tooltips'); }, 286); }); @@ -808,11 +838,16 @@ nf.Processor = (function () { }); }; - return { + var nfProcessor = { /** * Initializes of the Processor handler. */ - init: function () { + init: function (connectable, draggable, selectable, contextMenu) { + nfConnectable = connectable; + nfDraggable = draggable; + nfSelectable = selectable; + nfContextMenu = contextMenu; + processorMap = d3.map(); removedCache = d3.map(); addedCache = d3.map(); @@ -833,8 +868,8 @@ nf.Processor = (function () { */ add: function (processorEntities, options) { var selectAll = false; - if (nf.Common.isDefinedAndNotNull(options)) { - selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; + if (common.isDefinedAndNotNull(options)) { + selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; } // get the current time @@ -855,7 +890,7 @@ nf.Processor = (function () { $.each(processorEntities, function (_, processorEntity) { add(processorEntity); }); - } else if (nf.Common.isDefinedAndNotNull(processorEntities)) { + } else if (common.isDefinedAndNotNull(processorEntities)) { add(processorEntities); } @@ -874,16 +909,16 @@ nf.Processor = (function () { set: function (processorEntities, options) { var selectAll = false; var transition = false; - if (nf.Common.isDefinedAndNotNull(options)) { - selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; - transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition; + if (common.isDefinedAndNotNull(options)) { + selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; + transition = common.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 (nf.Client.isNewerRevision(currentProcessorEntity, proposedProcessorEntity) && !removedCache.has(proposedProcessorEntity.id)) { + if (client.isNewerRevision(currentProcessorEntity, proposedProcessorEntity) && !removedCache.has(proposedProcessorEntity.id)) { processorMap.set(proposedProcessorEntity.id, $.extend({ type: 'Processor', dimensions: dimensions @@ -907,14 +942,14 @@ nf.Processor = (function () { $.each(processorEntities, function (_, processorEntity) { set(processorEntity); }); - } else if (nf.Common.isDefinedAndNotNull(processorEntities)) { + } else if (common.isDefinedAndNotNull(processorEntities)) { set(processorEntities); } // apply the selection and handle all new processors var selection = select(); selection.enter().call(renderProcessors, selectAll); - selection.call(updateProcessors).call(nf.CanvasUtils.position, transition); + selection.call(updateProcessors).call(canvasUtils.position, transition); selection.exit().call(removeProcessors); }, @@ -925,7 +960,7 @@ nf.Processor = (function () { * @param {string} id */ get: function (id) { - if (nf.Common.isUndefined(id)) { + if (common.isUndefined(id)) { return processorMap.values(); } else { return processorMap.get(id); @@ -939,7 +974,7 @@ nf.Processor = (function () { * @param {string} id Optional */ refresh: function (id) { - if (nf.Common.isDefinedAndNotNull(id)) { + if (common.isDefinedAndNotNull(id)) { d3.select('#id-' + id).call(updateProcessors); } else { d3.selectAll('g.processor').call(updateProcessors); @@ -952,7 +987,7 @@ nf.Processor = (function () { * @param {string} id The id */ position: function (id) { - d3.select('#id-' + id).call(nf.CanvasUtils.position); + d3.select('#id-' + id).call(canvasUtils.position); }, /** @@ -976,7 +1011,7 @@ nf.Processor = (function () { url: processorEntity.uri, dataType: 'json' }).done(function (response) { - nf.Processor.set(response); + nfProcessor.set(response); }); } }, @@ -1007,7 +1042,7 @@ nf.Processor = (function () { * Removes all processors. */ removeAll: function () { - nf.Processor.remove(processorMap.keys()); + nfProcessor.remove(processorMap.keys()); }, /** @@ -1042,4 +1077,6 @@ nf.Processor = (function () { return '#ad9897'; } }; -}()); \ No newline at end of file + + return nfProcessor; +})); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/bf3b1640/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js index 0dac31a..acf2ca5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-queue-listing.js @@ -15,12 +15,52 @@ * limitations under the License. */ -/* global nf */ +/* global define, module, require, exports */ /** * Lists FlowFiles from a given connection. */ -nf.QueueListing = (function () { +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', + 'Slick', + 'nf.Common', + 'nf.Dialog', + 'nf.Shell', + 'nf.ng.Bridge', + 'nf.ClusterSummary', + 'nf.ErrorHandler', + 'nf.Storage', + 'nf.CanvasUtils'], + function ($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils) { + return (nf.QueueListing = factory($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils)); + }); + } else if (typeof exports === 'object' && typeof module === 'object') { + module.exports = (nf.QueueListing = + factory(require('jquery'), + require('Slick'), + require('nf.Common'), + require('nf.Dialog'), + require('nf.Shell'), + require('nf.ng.Bridge'), + require('nf.ClusterSummary'), + require('nf.ErrorHandler'), + require('nf.Storage'), + require('nf.CanvasUtils'))); + } else { + nf.QueueListing = factory(root.$, + root.Slick, + root.nf.Common, + root.nf.Dialog, + root.nf.Shell, + root.nf.ng.Bridge, + root.nf.ClusterSummary, + root.nf.ErrorHandler, + root.nf.Storage, + root.nf.CanvasUtils); + } +}(this, function ($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils) { + 'use strict'; /** * Configuration object used to hold a number of configuration items. @@ -56,17 +96,17 @@ nf.QueueListing = (function () { var dataUri = $('#flowfile-uri').text() + '/content'; // perform the request once we've received a token - nf.Common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { + common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { var parameters = {}; // conditionally include the ui extension token - if (!nf.Common.isBlank(downloadToken)) { + if (!common.isBlank(downloadToken)) { parameters['access_token'] = downloadToken; } // conditionally include the cluster node id var clusterNodeId = $('#flowfile-cluster-node-id').text(); - if (!nf.Common.isBlank(clusterNodeId)) { + if (!common.isBlank(clusterNodeId)) { parameters['clusterNodeId'] = clusterNodeId; } @@ -77,7 +117,7 @@ nf.QueueListing = (function () { window.open(dataUri + '?' + $.param(parameters)); } }).fail(function () { - nf.Dialog.showOkDialog({ + dialog.showOkDialog({ headerText: 'Queue Listing', dialogContent: 'Unable to generate access token for downloading content.' }); @@ -92,7 +132,7 @@ nf.QueueListing = (function () { // generate tokens as necessary var getAccessTokens = $.Deferred(function (deferred) { - if (nf.Storage.hasItem('jwt')) { + if (storage.hasItem('jwt')) { // generate a token for the ui extension and another for the callback var uiExtensionToken = $.ajax({ type: 'POST', @@ -109,7 +149,7 @@ nf.QueueListing = (function () { var downloadToken = downloadTokenResult[0]; deferred.resolve(uiExtensionToken, downloadToken); }).fail(function () { - nf.Dialog.showOkDialog({ + dialog.showOkDialog({ headerText: 'Queue Listing', dialogContent: 'Unable to generate access token for viewing content.' }); @@ -126,12 +166,12 @@ nf.QueueListing = (function () { // conditionally include the cluster node id var clusterNodeId = $('#flowfile-cluster-node-id').text(); - if (!nf.Common.isBlank(clusterNodeId)) { + if (!common.isBlank(clusterNodeId)) { dataUriParameters['clusterNodeId'] = clusterNodeId; } // include the download token if applicable - if (!nf.Common.isBlank(downloadToken)) { + if (!common.isBlank(downloadToken)) { dataUriParameters['access_token'] = downloadToken; } @@ -157,7 +197,7 @@ nf.QueueListing = (function () { }; // include the download token if applicable - if (!nf.Common.isBlank(uiExtensionToken)) { + if (!common.isBlank(uiExtensionToken)) { contentViewerParameters['access_token'] = uiExtensionToken; } @@ -187,7 +227,7 @@ nf.QueueListing = (function () { // update the progress var label = $('<div class="progress-label"></div>').text(percentComplete + '%'); - (nf.ng.Bridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + percentComplete + '" class="md-hue-2" md-mode="determinate" aria-label="Searching Queue"></md-progress-linear>'))(nf.ng.Bridge.rootScope)).appendTo(progressBar); + (angularBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + percentComplete + '" class="md-hue-2" md-mode="determinate" aria-label="Searching Queue"></md-progress-linear>'))(angularBridge.rootScope)).appendTo(progressBar); progressBar.append(label); }; @@ -223,7 +263,7 @@ nf.QueueListing = (function () { var reject = cancelled; // ensure the listing requests are present - if (nf.Common.isDefinedAndNotNull(listingRequest)) { + if (common.isDefinedAndNotNull(listingRequest)) { $.ajax({ type: 'DELETE', url: listingRequest.uri, @@ -231,20 +271,20 @@ nf.QueueListing = (function () { }); // use the listing request from when the listing completed - if (nf.Common.isEmpty(listingRequest.flowFileSummaries)) { + if (common.isEmpty(listingRequest.flowFileSummaries)) { if (cancelled === false) { reject = true; // show the dialog - nf.Dialog.showOkDialog({ + dialog.showOkDialog({ headerText: 'Queue Listing', dialogContent: 'The queue has no FlowFiles.' }); } } else { // update the queue size - $('#total-flowfiles-count').text(nf.Common.formatInteger(listingRequest.queueSize.objectCount)); - $('#total-flowfiles-size').text(nf.Common.formatDataSize(listingRequest.queueSize.byteCount)); + $('#total-flowfiles-count').text(common.formatInteger(listingRequest.queueSize.objectCount)); + $('#total-flowfiles-size').text(common.formatDataSize(listingRequest.queueSize.byteCount)); // update the last updated time $('#queue-listing-last-refreshed').text(listingRequest.lastUpdated); @@ -316,7 +356,7 @@ nf.QueueListing = (function () { }).done(function (response) { listingRequest = response.listingRequest; processListingRequest(nextDelay); - }).fail(completeListingRequest).fail(nf.ErrorHandler.handleAjaxError); + }).fail(completeListingRequest).fail(errorHandler.handleAjaxError); }; // issue the request to list the flow files @@ -335,7 +375,7 @@ nf.QueueListing = (function () { // process the drop request listingRequest = response.listingRequest; processListingRequest(1); - }).fail(completeListingRequest).fail(nf.ErrorHandler.handleAjaxError); + }).fail(completeListingRequest).fail(errorHandler.handleAjaxError); }).promise(); }; @@ -349,13 +389,13 @@ nf.QueueListing = (function () { var formatFlowFileDetail = function (label, value) { $('<div class="flowfile-detail"></div>').append( $('<div class="detail-name"></div>').text(label)).append( - $('<div class="detail-value">' + nf.Common.formatValue(value) + '</div>').ellipsis()).append( + $('<div class="detail-value">' + common.formatValue(value) + '</div>').ellipsis()).append( $('<div class="clear"></div>')).appendTo('#additional-flowfile-details'); }; // formats the content value var formatContentValue = function (element, value) { - if (nf.Common.isDefinedAndNotNull(value)) { + if (common.isDefinedAndNotNull(value)) { element.removeClass('unset').text(value); } else { element.addClass('unset').text('No value set'); @@ -363,7 +403,7 @@ nf.QueueListing = (function () { }; var params = {}; - if (nf.Common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { + if (common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { params['clusterNodeId'] = flowFileSummary.clusterNodeId; } @@ -379,16 +419,16 @@ nf.QueueListing = (function () { $('#flowfile-uri').text(flowFile.uri); // show the flowfile details dialog - $('#flowfile-uuid').html(nf.Common.formatValue(flowFile.uuid)); - $('#flowfile-filename').html(nf.Common.formatValue(flowFile.filename)); - $('#flowfile-queue-position').html(nf.Common.formatValue(flowFile.position)); - $('#flowfile-file-size').html(nf.Common.formatValue(flowFile.contentClaimFileSize)); - $('#flowfile-queued-duration').text(nf.Common.formatDuration(flowFile.queuedDuration)); - $('#flowfile-lineage-duration').text(nf.Common.formatDuration(flowFile.lineageDuration)); + $('#flowfile-uuid').html(common.formatValue(flowFile.uuid)); + $('#flowfile-filename').html(common.formatValue(flowFile.filename)); + $('#flowfile-queue-position').html(common.formatValue(flowFile.position)); + $('#flowfile-file-size').html(common.formatValue(flowFile.contentClaimFileSize)); + $('#flowfile-queued-duration').text(common.formatDuration(flowFile.queuedDuration)); + $('#flowfile-lineage-duration').text(common.formatDuration(flowFile.lineageDuration)); $('#flowfile-penalized').text(flowFile.penalized === true ? 'Yes' : 'No'); // conditionally show the cluster node identifier - if (nf.Common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { + if (common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { // save the cluster node id $('#flowfile-cluster-node-id').text(flowFileSummary.clusterNodeId); @@ -396,7 +436,7 @@ nf.QueueListing = (function () { formatFlowFileDetail('Node Address', flowFileSummary.clusterNodeAddress); } - if (nf.Common.isDefinedAndNotNull(flowFile.contentClaimContainer)) { + if (common.isDefinedAndNotNull(flowFile.contentClaimContainer)) { // content claim formatContentValue($('#content-container'), flowFile.contentClaimContainer); formatContentValue($('#content-section'), flowFile.contentClaimSection); @@ -407,9 +447,9 @@ nf.QueueListing = (function () { // input content file size var contentSize = $('#content-size'); formatContentValue(contentSize, flowFile.contentClaimFileSize); - if (nf.Common.isDefinedAndNotNull(flowFile.contentClaimFileSize)) { + if (common.isDefinedAndNotNull(flowFile.contentClaimFileSize)) { // over the default tooltip with the actual byte count - contentSize.attr('title', nf.Common.formatInteger(flowFile.contentClaimFileSizeBytes) + ' bytes'); + contentSize.attr('title', common.formatInteger(flowFile.contentClaimFileSizeBytes) + ' bytes'); } // show the content details @@ -425,21 +465,21 @@ nf.QueueListing = (function () { $.each(flowFile.attributes, function (attributeName, attributeValue) { // create the attribute record var attributeRecord = $('<div class="attribute-detail"></div>') - .append($('<div class="attribute-name">' + nf.Common.formatValue(attributeName) + '</div>').ellipsis()) + .append($('<div class="attribute-name">' + common.formatValue(attributeName) + '</div>').ellipsis()) .appendTo(attributesContainer); // add the current value attributeRecord - .append($('<div class="attribute-value">' + nf.Common.formatValue(attributeValue) + '</div>').ellipsis()) + .append($('<div class="attribute-value">' + common.formatValue(attributeValue) + '</div>').ellipsis()) .append('<div class="clear"></div>'); }); // show the dialog $('#flowfile-details-dialog').modal('show'); - }).fail(nf.ErrorHandler.handleAjaxError); + }).fail(errorHandler.handleAjaxError); }; - return { + var nfQueueListing = { init: function () { initializeListingRequestStatusDialog(); @@ -456,12 +496,12 @@ nf.QueueListing = (function () { // function for formatting data sizes var dataSizeFormatter = function (row, cell, value, columnDef, dataContext) { - return nf.Common.formatDataSize(value); + return common.formatDataSize(value); }; // function for formatting durations var durationFormatter = function (row, cell, value, columnDef, dataContext) { - return nf.Common.formatDuration(value); + return common.formatDuration(value); }; // function for formatting penalization @@ -548,7 +588,7 @@ nf.QueueListing = (function () { ]; // conditionally show the cluster node identifier - if (nf.ClusterSummary.isClustered()) { + if (clusterSummary.isClustered()) { queueListingColumns.push({ id: 'clusterNodeAddress', name: 'Node', @@ -559,7 +599,7 @@ nf.QueueListing = (function () { } // add an actions column when the user can access provenance - if (nf.Common.canAccessProvenance()) { + if (common.canAccessProvenance()) { // function for formatting actions var actionsFormatter = function () { return '<div title="Provenance" class="pointer icon icon-provenance view-provenance"></div>'; @@ -614,7 +654,7 @@ nf.QueueListing = (function () { $('#shell-close-button').click(); // open the provenance page with the specified component - nf.Shell.showPage('provenance?' + $.param({ + shell.showPage('provenance?' + $.param({ flowFileUuid: item.uuid })); } @@ -648,7 +688,7 @@ nf.QueueListing = (function () { $('#content-download').on('click', downloadContent); // only show if content viewer is configured - if (nf.Common.isContentViewConfigured()) { + if (common.isContentViewConfigured()) { $('#content-view').show(); $('#content-view').on('click', viewContent); } @@ -690,7 +730,7 @@ nf.QueueListing = (function () { $('#additional-flowfile-details').empty(); }, open: function () { - nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); + common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); } } }); @@ -701,7 +741,7 @@ nf.QueueListing = (function () { */ resetTableSize: function () { var queueListingGrid = $('#queue-listing-table').data('gridInstance'); - if (nf.Common.isDefinedAndNotNull(queueListingGrid)) { + if (common.isDefinedAndNotNull(queueListingGrid)) { queueListingGrid.resizeCanvas(); } }, @@ -717,7 +757,7 @@ nf.QueueListing = (function () { // update the connection name var connectionName = ''; if (connection.permissions.canRead) { - connectionName = nf.CanvasUtils.formatConnectionName(connection.component); + connectionName = canvasUtils.formatConnectionName(connection.component); } if (connectionName === '') { connectionName = 'Connection'; @@ -725,7 +765,7 @@ nf.QueueListing = (function () { $('#queue-listing-header-text').text(connectionName); // show the listing container - nf.Shell.showContent('#queue-listing-container').done(function () { + shell.showContent('#queue-listing-container').done(function () { $('#queue-listing-table').removeData('connection'); // clear the table @@ -739,15 +779,17 @@ nf.QueueListing = (function () { // reset stats $('#displayed-flowfiles, #total-flowfiles-count').text('0'); - $('#total-flowfiles-size').text(nf.Common.formatDataSize(0)); + $('#total-flowfiles-size').text(common.formatDataSize(0)); }); // adjust the table size - nf.QueueListing.resetTableSize(); + nfQueueListing.resetTableSize(); // store the connection for access later $('#queue-listing-table').data('connection', connection); }); } }; -}()); \ No newline at end of file + + return nfQueueListing; +})); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/bf3b1640/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-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-remote-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-remote-process-group-configuration.js index d012be4..a8d5236 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-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-remote-process-group-configuration.js @@ -15,9 +15,47 @@ * limitations under the License. */ -/* global nf, d3 */ +/* global define, module, require, exports */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', + 'd3', + 'nf.ErrorHandler', + 'nf.Common', + 'nf.Dialog', + 'nf.Client', + 'nf.CanvasUtils', + 'nf.ng.Bridge', + 'nf.RemoteProcessGroup'], + function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) { + return (nf.RemoteProcessGroupConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup)); + }); + } else if (typeof exports === 'object' && typeof module === 'object') { + module.exports = (nf.RemoteProcessGroupConfiguration = + factory(require('jquery'), + require('d3'), + require('nf.ErrorHandler'), + require('nf.Common'), + require('nf.Dialog'), + require('nf.Client'), + require('nf.CanvasUtils'), + require('nf.ng.Bridge'), + require('nf.RemoteProcessGroup'))); + } else { + nf.RemoteProcessGroupConfiguration = factory(root.$, + root.d3, + root.nf.ErrorHandler, + root.nf.Common, + root.nf.Dialog, + root.nf.Client, + root.nf.CanvasUtils, + root.nf.ng.Bridge, + root.nf.RemoteProcessGroup); + } +}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) { + 'use strict'; -nf.RemoteProcessGroupConfiguration = (function () { return { init: function () { $('#remote-process-group-configuration').modal({ @@ -35,20 +73,20 @@ nf.RemoteProcessGroupConfiguration = (function () { var remoteProcessGroupId = $('#remote-process-group-id').text(); var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum(); - // create the remote process group details - var remoteProcessGroupEntity = { - 'revision': nf.Client.getRevision(remoteProcessGroupData), - 'component': { - id: remoteProcessGroupId, - communicationsTimeout: $('#remote-process-group-timeout').val(), - yieldDuration: $('#remote-process-group-yield-duration').val(), - transportProtocol: $('#remote-process-group-transport-protocol-combo').combo('getSelectedOption').value, - proxyHost: $('#remote-process-group-proxy-host').val(), - proxyPort: $('#remote-process-group-proxy-port').val(), - proxyUser: $('#remote-process-group-proxy-user').val(), - proxyPassword: $('#remote-process-group-proxy-password').val() - } - }; + // create the remote process group details + var remoteProcessGroupEntity = { + 'revision': client.getRevision(remoteProcessGroupData), + 'component': { + id: remoteProcessGroupId, + communicationsTimeout: $('#remote-process-group-timeout').val(), + yieldDuration: $('#remote-process-group-yield-duration').val(), + transportProtocol: $('#remote-process-group-transport-protocol-combo').combo('getSelectedOption').value, + proxyHost: $('#remote-process-group-proxy-host').val(), + proxyPort: $('#remote-process-group-proxy-port').val(), + proxyUser: $('#remote-process-group-proxy-user').val(), + proxyPassword: $('#remote-process-group-proxy-password').val() + } + }; // update the selected component $.ajax({ @@ -59,11 +97,11 @@ nf.RemoteProcessGroupConfiguration = (function () { contentType: 'application/json' }).done(function (response) { // refresh the remote process group component - nf.RemoteProcessGroup.set(response); + nfRemoteProcessGroup.set(response); // inform Angular app values have changed - nf.ng.Bridge.digest(); - + angularBridge.digest(); + // close the details panel $('#remote-process-group-configuration').modal('hide'); }).fail(function (xhr, status, error) { @@ -74,15 +112,15 @@ nf.RemoteProcessGroupConfiguration = (function () { if (errors.length === 1) { content = $('<span></span>').text(errors[0]); } else { - content = nf.Common.formatUnorderedList(errors); + content = common.formatUnorderedList(errors); } - nf.Dialog.showOkDialog({ + dialog.showOkDialog({ dialogContent: content, headerText: 'Remote Process Group Configuration' }); } else { - nf.ErrorHandler.handleAjaxError(xhr, status, error); + errorHandler.handleAjaxError(xhr, status, error); } }); } @@ -122,12 +160,12 @@ nf.RemoteProcessGroupConfiguration = (function () { // initialize the transport protocol combo $('#remote-process-group-transport-protocol-combo').combo({ options: [{ - text: 'RAW', - value: 'RAW' - }, { - text: 'HTTP', - value: 'HTTP' - }] + text: 'RAW', + value: 'RAW' + }, { + text: 'HTTP', + value: 'HTTP' + }] }); }, @@ -138,7 +176,7 @@ nf.RemoteProcessGroupConfiguration = (function () { */ showConfiguration: function (selection) { // if the specified component is a remote process group, load its properties - if (nf.CanvasUtils.isRemoteProcessGroup(selection)) { + if (canvasUtils.isRemoteProcessGroup(selection)) { var selectionData = selection.datum(); // populate the port settings @@ -164,4 +202,4 @@ nf.RemoteProcessGroupConfiguration = (function () { } } }; -}()); \ No newline at end of file +})); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/bf3b1640/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-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-remote-process-group-details.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js index ebe116c..73c44b5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-details.js @@ -15,9 +15,29 @@ * limitations under the License. */ -/* global nf */ +/* global define, module, require, exports */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define(['jquery', + 'nf.Common', + 'nf.CanvasUtils'], + function ($, common, canvasUtils) { + return (nf.RemoteProcessGroupDetails = factory($, common, canvasUtils)); + }); + } else if (typeof exports === 'object' && typeof module === 'object') { + module.exports = (nf.RemoteProcessGroupDetails = + factory(require('jquery'), + require('nf.Common'), + require('nf.CanvasUtils'))); + } else { + nf.RemoteProcessGroupDetails = factory(root.$, + root.nf.Common, + root.nf.CanvasUtils); + } +}(this, function ($, common, canvasUtils) { + 'use strict'; -nf.RemoteProcessGroupDetails = (function () { return { init: function () { $('#remote-process-group-details').modal({ @@ -39,16 +59,16 @@ nf.RemoteProcessGroupDetails = (function () { handler: { close: function () { // clear the remote process group details - nf.Common.clearField('read-only-remote-process-group-id'); - nf.Common.clearField('read-only-remote-process-group-name'); - nf.Common.clearField('read-only-remote-process-group-urls'); - nf.Common.clearField('read-only-remote-process-group-timeout'); - nf.Common.clearField('read-only-remote-process-group-yield-duration'); - nf.Common.clearField('read-only-remote-process-group-transport-protocol'); - nf.Common.clearField('read-only-remote-process-group-proxy-host'); - nf.Common.clearField('read-only-remote-process-group-proxy-port'); - nf.Common.clearField('read-only-remote-process-group-proxy-user'); - nf.Common.clearField('read-only-remote-process-group-proxy-password'); + common.clearField('read-only-remote-process-group-id'); + common.clearField('read-only-remote-process-group-name'); + common.clearField('read-only-remote-process-group-urls'); + common.clearField('read-only-remote-process-group-timeout'); + common.clearField('read-only-remote-process-group-yield-duration'); + common.clearField('read-only-remote-process-group-transport-protocol'); + common.clearField('read-only-remote-process-group-proxy-host'); + common.clearField('read-only-remote-process-group-proxy-port'); + common.clearField('read-only-remote-process-group-proxy-user'); + common.clearField('read-only-remote-process-group-proxy-password'); } } }); @@ -61,24 +81,24 @@ nf.RemoteProcessGroupDetails = (function () { */ showDetails: function (selection) { // if the specified component is a remote process group, load its properties - if (nf.CanvasUtils.isRemoteProcessGroup(selection)) { + if (canvasUtils.isRemoteProcessGroup(selection)) { var selectionData = selection.datum(); // populate the port settings - nf.Common.populateField('read-only-remote-process-group-id', selectionData.id); - nf.Common.populateField('read-only-remote-process-group-name', selectionData.component.name); - nf.Common.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris); - nf.Common.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout); - nf.Common.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration); - nf.Common.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol); - nf.Common.populateField('read-only-remote-process-group-proxy-host', selectionData.component.proxyHost); - nf.Common.populateField('read-only-remote-process-group-proxy-port', selectionData.component.proxyPort); - nf.Common.populateField('read-only-remote-process-group-proxy-user', selectionData.component.proxyUser); - nf.Common.populateField('read-only-remote-process-group-proxy-password', selectionData.component.proxyPassword); + common.populateField('read-only-remote-process-group-id', selectionData.id); + common.populateField('read-only-remote-process-group-name', selectionData.component.name); + common.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris); + common.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout); + common.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration); + common.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol); + common.populateField('read-only-remote-process-group-proxy-host', selectionData.component.proxyHost); + common.populateField('read-only-remote-process-group-proxy-port', selectionData.component.proxyPort); + common.populateField('read-only-remote-process-group-proxy-user', selectionData.component.proxyUser); + common.populateField('read-only-remote-process-group-proxy-password', selectionData.component.proxyPassword); // show the details $('#remote-process-group-details').modal('show'); } } }; -}()); \ No newline at end of file +})); \ No newline at end of file
