[NIFI-3358] update naming conventions to avoid conflicts. This closes #1533

This commit is contained in:
Scott Aslan 2017-02-22 15:37:45 -05:00 committed by Matt Gilman
parent 64379d2007
commit 2c374bafaa
No known key found for this signature in database
GPG Key ID: DF61EC19432AEE37
85 changed files with 2738 additions and 2700 deletions

View File

@ -167,37 +167,37 @@
var dialog = $(this).addClass('dialog cancellable modal'); var dialog = $(this).addClass('dialog cancellable modal');
dialog.css('display', 'none'); dialog.css('display', 'none');
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull(dialog.data('nf-dialog'))) { if (isDefinedAndNotNull(dialog.data('nf-dialog'))) {
nfDialog = dialog.data('nf-dialog'); nfDialogData = dialog.data('nf-dialog');
} }
// ensure the options have been properly specified // ensure the options have been properly specified
if (isDefinedAndNotNull(options)) { if (isDefinedAndNotNull(options)) {
$.extend(nfDialog, options); $.extend(nfDialogData, options);
//persist data attribute //persist data attribute
dialog.data('nfDialog', nfDialog); dialog.data('nfDialog', nfDialogData);
} }
// determine if dialog needs a header // determine if dialog needs a header
if (!isDefinedAndNotNull(nfDialog.header) || nfDialog.header) { if (!isDefinedAndNotNull(nfDialogData.header) || nfDialogData.header) {
var dialogHeaderText = $('<span class="dialog-header-text"></span>'); var dialogHeaderText = $('<span class="dialog-header-text"></span>');
var dialogHeader = $('<div class="dialog-header"></div>').prepend(dialogHeaderText); var dialogHeader = $('<div class="dialog-header"></div>').prepend(dialogHeaderText);
// determine if the specified header text is null // determine if the specified header text is null
if (!isBlank(nfDialog.headerText)) { if (!isBlank(nfDialogData.headerText)) {
dialogHeaderText.text(nfDialog.headerText); dialogHeaderText.text(nfDialogData.headerText);
} }
dialog.prepend(dialogHeader); dialog.prepend(dialogHeader);
} }
// determine if dialog needs footer/buttons // determine if dialog needs footer/buttons
if (!isDefinedAndNotNull(nfDialog.footer) || nfDialog.footer) { if (!isDefinedAndNotNull(nfDialogData.footer) || nfDialogData.footer) {
// add the buttons // add the buttons
addButtons(dialog, nfDialog.buttons); addButtons(dialog, nfDialogData.buttons);
} }
}); });
}, },
@ -210,17 +210,17 @@
setCloseHandler: function (handler) { setCloseHandler: function (handler) {
return this.each(function (index, dialog) { return this.each(function (index, dialog) {
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull($(this).data('nf-dialog'))) { if (isDefinedAndNotNull($(this).data('nf-dialog'))) {
nfDialog = $(dialog).data('nf-dialog'); nfDialogData = $(dialog).data('nf-dialog');
} }
if (!isDefinedAndNotNull(nfDialog.handler)){ if (!isDefinedAndNotNull(nfDialogData.handler)){
nfDialog.handler = {}; nfDialogData.handler = {};
} }
nfDialog.handler.close = handler; nfDialogData.handler.close = handler;
//persist data attribute //persist data attribute
$(dialog).data('nfDialog', nfDialog); $(dialog).data('nfDialog', nfDialogData);
}); });
}, },
@ -232,17 +232,17 @@
setOpenHandler: function (handler) { setOpenHandler: function (handler) {
return this.each(function (index, dialog) { return this.each(function (index, dialog) {
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull($(this).data('nf-dialog'))) { if (isDefinedAndNotNull($(this).data('nf-dialog'))) {
nfDialog = $(dialog).data('nf-dialog'); nfDialogData = $(dialog).data('nf-dialog');
} }
if (!isDefinedAndNotNull(nfDialog.handler)){ if (!isDefinedAndNotNull(nfDialogData.handler)){
nfDialog.handler = {}; nfDialogData.handler = {};
} }
nfDialog.handler.open = handler; nfDialogData.handler.open = handler;
//persist data attribute //persist data attribute
$(dialog).data('nfDialog', nfDialog); $(dialog).data('nfDialog', nfDialogData);
}); });
}, },
@ -254,17 +254,17 @@
setResizeHandler: function (handler) { setResizeHandler: function (handler) {
return this.each(function (index, dialog) { return this.each(function (index, dialog) {
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull($(this).data('nf-dialog'))) { if (isDefinedAndNotNull($(this).data('nf-dialog'))) {
nfDialog = $(dialog).data('nf-dialog'); nfDialogData = $(dialog).data('nf-dialog');
} }
if (!isDefinedAndNotNull(nfDialog.handler)){ if (!isDefinedAndNotNull(nfDialogData.handler)){
nfDialog.handler = {}; nfDialogData.handler = {};
} }
nfDialog.handler.resize = handler; nfDialogData.handler.resize = handler;
//persist data attribute //persist data attribute
$(dialog).data('nfDialog', nfDialog); $(dialog).data('nfDialog', nfDialogData);
}); });
}, },
@ -318,147 +318,147 @@
var dialog = $(this); var dialog = $(this);
var dialogContent = dialog.find('.dialog-content'); var dialogContent = dialog.find('.dialog-content');
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull(dialog.data('nf-dialog'))) { if (isDefinedAndNotNull(dialog.data('nf-dialog'))) {
nfDialog = dialog.data('nf-dialog'); nfDialogData = dialog.data('nf-dialog');
} }
//initialize responsive properties //initialize responsive properties
if (!isDefinedAndNotNull(nfDialog.responsive)) { if (!isDefinedAndNotNull(nfDialogData.responsive)) {
nfDialog.responsive = {}; nfDialogData.responsive = {};
if (!isDefinedAndNotNull(nfDialog.responsive.x)) { if (!isDefinedAndNotNull(nfDialogData.responsive.x)) {
nfDialog.responsive.x = true; nfDialogData.responsive.x = true;
} }
if (!isDefinedAndNotNull(nfDialog.responsive.y)) { if (!isDefinedAndNotNull(nfDialogData.responsive.y)) {
nfDialog.responsive.y = true; nfDialogData.responsive.y = true;
} }
} else { } else {
if (!isDefinedAndNotNull(nfDialog.responsive.x)) { if (!isDefinedAndNotNull(nfDialogData.responsive.x)) {
nfDialog.responsive.x = true; nfDialogData.responsive.x = true;
} else { } else {
nfDialog.responsive.x = (nfDialog.responsive.x == "true" || nfDialog.responsive.x == true) ? true : false; nfDialogData.responsive.x = (nfDialogData.responsive.x == "true" || nfDialogData.responsive.x == true) ? true : false;
} }
if (!isDefinedAndNotNull(nfDialog.responsive.y)) { if (!isDefinedAndNotNull(nfDialogData.responsive.y)) {
nfDialog.responsive.y = true; nfDialogData.responsive.y = true;
} else { } else {
nfDialog.responsive.y = (nfDialog.responsive.y == "true" || nfDialog.responsive.y == true) ? true : false; nfDialogData.responsive.y = (nfDialogData.responsive.y == "true" || nfDialogData.responsive.y == true) ? true : false;
} }
} }
if (nfDialog.responsive.y || nfDialog.responsive.x) { if (nfDialogData.responsive.y || nfDialogData.responsive.x) {
var fullscreenHeight; var fullscreenHeight;
var fullscreenWidth; var fullscreenWidth;
if (isDefinedAndNotNull(nfDialog.responsive['fullscreen-height'])) { if (isDefinedAndNotNull(nfDialogData.responsive['fullscreen-height'])) {
fullscreenHeight = parseInt(nfDialog.responsive['fullscreen-height'], 10); fullscreenHeight = parseInt(nfDialogData.responsive['fullscreen-height'], 10);
} else { } else {
nfDialog.responsive['fullscreen-height'] = dialog.height() + 'px'; nfDialogData.responsive['fullscreen-height'] = dialog.height() + 'px';
fullscreenHeight = parseInt(nfDialog.responsive['fullscreen-height'], 10); fullscreenHeight = parseInt(nfDialogData.responsive['fullscreen-height'], 10);
} }
if (isDefinedAndNotNull(nfDialog.responsive['fullscreen-width'])) { if (isDefinedAndNotNull(nfDialogData.responsive['fullscreen-width'])) {
fullscreenWidth = parseInt(nfDialog.responsive['fullscreen-width'], 10); fullscreenWidth = parseInt(nfDialogData.responsive['fullscreen-width'], 10);
} else { } else {
nfDialog.responsive['fullscreen-width'] = dialog.width() + 'px'; nfDialogData.responsive['fullscreen-width'] = dialog.width() + 'px';
fullscreenWidth = parseInt(nfDialog.responsive['fullscreen-width'], 10); fullscreenWidth = parseInt(nfDialogData.responsive['fullscreen-width'], 10);
} }
if (!isDefinedAndNotNull(nfDialog.width)) { if (!isDefinedAndNotNull(nfDialogData.width)) {
nfDialog.width = dialog.css('width'); nfDialogData.width = dialog.css('width');
} }
if (!isDefinedAndNotNull(nfDialog['min-width'])) { if (!isDefinedAndNotNull(nfDialogData['min-width'])) {
if (parseInt(dialog.css('min-width'), 10) > 0) { if (parseInt(dialog.css('min-width'), 10) > 0) {
nfDialog['min-width'] = dialog.css('min-width'); nfDialogData['min-width'] = dialog.css('min-width');
} else { } else {
nfDialog['min-width'] = nfDialog.width; nfDialogData['min-width'] = nfDialogData.width;
} }
} }
//min-width should always be set in terms of px //min-width should always be set in terms of px
if (nfDialog['min-width'].indexOf("%") > 0) { if (nfDialogData['min-width'].indexOf("%") > 0) {
nfDialog['min-width'] = ($(window).width() * (parseInt(nfDialog['min-width'], 10) / 100)) + 'px'; nfDialogData['min-width'] = ($(window).width() * (parseInt(nfDialogData['min-width'], 10) / 100)) + 'px';
} }
if (!isDefinedAndNotNull(nfDialog.height)) { if (!isDefinedAndNotNull(nfDialogData.height)) {
nfDialog.height = dialog.css('height'); nfDialogData.height = dialog.css('height');
} }
if (!isDefinedAndNotNull(nfDialog['min-height'])) { if (!isDefinedAndNotNull(nfDialogData['min-height'])) {
if (parseInt(dialog.css('min-height'), 10) > 0) { if (parseInt(dialog.css('min-height'), 10) > 0) {
nfDialog['min-height'] = dialog.css('min-height'); nfDialogData['min-height'] = dialog.css('min-height');
} else { } else {
nfDialog['min-height'] = nfDialog.height; nfDialogData['min-height'] = nfDialogData.height;
} }
} }
//min-height should always be set in terms of px //min-height should always be set in terms of px
if (nfDialog['min-height'].indexOf("%") > 0) { if (nfDialogData['min-height'].indexOf("%") > 0) {
nfDialog['min-height'] = ($(window).height() * (parseInt(nfDialog['min-height'], 10) / 100)) + 'px'; nfDialogData['min-height'] = ($(window).height() * (parseInt(nfDialogData['min-height'], 10) / 100)) + 'px';
} }
//resize dialog //resize dialog
if ($(window).height() < fullscreenHeight) { if ($(window).height() < fullscreenHeight) {
if (nfDialog.responsive.y) { if (nfDialogData.responsive.y) {
dialog.css('height', '100%'); dialog.css('height', '100%');
dialog.css('min-height', '100%'); dialog.css('min-height', '100%');
} }
} else { } else {
//set the dialog min-height //set the dialog min-height
dialog.css('min-height', nfDialog['min-height']); dialog.css('min-height', nfDialogData['min-height']);
if (nfDialog.responsive.y) { if (nfDialogData.responsive.y) {
//make sure nfDialog.height is in terms of % //make sure nfDialogData.height is in terms of %
if (nfDialog.height.indexOf("px") > 0) { if (nfDialogData.height.indexOf("px") > 0) {
nfDialog.height = (parseInt(nfDialog.height, 10) / $(window).height() * 100) + '%'; nfDialogData.height = (parseInt(nfDialogData.height, 10) / $(window).height() * 100) + '%';
} }
dialog.css('height', nfDialog.height); dialog.css('height', nfDialogData.height);
} }
} }
if ($(window).width() < fullscreenWidth) { if ($(window).width() < fullscreenWidth) {
if (nfDialog.responsive.x) { if (nfDialogData.responsive.x) {
dialog.css('width', '100%'); dialog.css('width', '100%');
dialog.css('min-width', '100%'); dialog.css('min-width', '100%');
} }
} else { } else {
//set the dialog width //set the dialog width
dialog.css('min-width', nfDialog['min-width']); dialog.css('min-width', nfDialogData['min-width']);
if (nfDialog.responsive.x) { if (nfDialogData.responsive.x) {
//make sure nfDialog.width is in terms of % //make sure nfDialogData.width is in terms of %
if (nfDialog.width.indexOf("px") > 0) { if (nfDialogData.width.indexOf("px") > 0) {
nfDialog.width = (parseInt(nfDialog.width, 10) / $(window).width() * 100) + '%'; nfDialogData.width = (parseInt(nfDialogData.width, 10) / $(window).width() * 100) + '%';
} }
dialog.css('width', nfDialog.width); dialog.css('width', nfDialogData.width);
} }
} }
dialog.center(); dialog.center();
//persist data attribute //persist data attribute
dialog.data('nfDialog', nfDialog); dialog.data('nfDialog', nfDialogData);
} }
//apply scrollable style if applicable //apply scrollable style if applicable
if (dialogContent[0].offsetHeight < dialogContent[0].scrollHeight) { if (dialogContent[0].offsetHeight < dialogContent[0].scrollHeight) {
// your element has overflow // your element has overflow
if (isDefinedAndNotNull(nfDialog.scrollableContentStyle)) { if (isDefinedAndNotNull(nfDialogData.scrollableContentStyle)) {
dialogContent.addClass(nfDialog.scrollableContentStyle); dialogContent.addClass(nfDialogData.scrollableContentStyle);
} }
} else { } else {
// your element doesn't have overflow // your element doesn't have overflow
if (isDefinedAndNotNull(nfDialog.scrollableContentStyle)) { if (isDefinedAndNotNull(nfDialogData.scrollableContentStyle)) {
dialogContent.removeClass(nfDialog.scrollableContentStyle); dialogContent.removeClass(nfDialogData.scrollableContentStyle);
} }
} }
if (isDefinedAndNotNull(nfDialog.handler)) { if (isDefinedAndNotNull(nfDialogData.handler)) {
var handler = nfDialog.handler.resize; var handler = nfDialogData.handler.resize;
if (isDefinedAndNotNull(handler) && typeof handler === 'function') { if (isDefinedAndNotNull(handler) && typeof handler === 'function') {
// invoke the handler // invoke the handler
handler.call(dialog); handler.call(dialog);
@ -492,20 +492,20 @@
} }
dialog.css('z-index', zIndex); dialog.css('z-index', zIndex);
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull(dialog.data('nf-dialog'))) { if (isDefinedAndNotNull(dialog.data('nf-dialog'))) {
nfDialog = dialog.data('nf-dialog'); nfDialogData = dialog.data('nf-dialog');
} }
var glasspane; var glasspane;
if (isDefinedAndNotNull(nfDialog.glasspane)) { if (isDefinedAndNotNull(nfDialogData.glasspane)) {
glasspane = nfDialog.glasspane; glasspane = nfDialogData.glasspane;
} else { } else {
nfDialog.glasspane = glasspane = dialog.find('.dialog-header').css('background-color'); //default to header color nfDialogData.glasspane = glasspane = dialog.find('.dialog-header').css('background-color'); //default to header color
} }
if(top !== window || !isDefinedAndNotNull(nfDialog.glasspane)) { if(top !== window || !isDefinedAndNotNull(nfDialogData.glasspane)) {
nfDialog.glasspane = glasspane = 'transparent'; nfDialogData.glasspane = glasspane = 'transparent';
} }
if (!$('body').find("[data-nf-dialog-parent='" + dialog.attr('id') + "']").is(':visible')) { if (!$('body').find("[data-nf-dialog-parent='" + dialog.attr('id') + "']").is(':visible')) {
@ -517,7 +517,7 @@
} }
//persist data attribute //persist data attribute
dialog.data('nfDialog', nfDialog); dialog.data('nfDialog', nfDialogData);
return this.each(function () { return this.each(function () {
// show the dialog // show the dialog
@ -526,8 +526,8 @@
dialog.modal('resize'); dialog.modal('resize');
dialog.center(); dialog.center();
if (isDefinedAndNotNull(nfDialog.handler)) { if (isDefinedAndNotNull(nfDialogData.handler)) {
var handler = nfDialog.handler.open; var handler = nfDialogData.handler.open;
if (isDefinedAndNotNull(handler) && typeof handler === 'function') { if (isDefinedAndNotNull(handler) && typeof handler === 'function') {
// invoke the handler // invoke the handler
handler.call(dialog); handler.call(dialog);
@ -544,13 +544,13 @@
return this.each(function () { return this.each(function () {
var dialog = $(this); var dialog = $(this);
var nfDialog = {}; var nfDialogData = {};
if (isDefinedAndNotNull(dialog.data('nf-dialog'))) { if (isDefinedAndNotNull(dialog.data('nf-dialog'))) {
nfDialog = dialog.data('nf-dialog'); nfDialogData = dialog.data('nf-dialog');
} }
if (isDefinedAndNotNull(nfDialog.handler)) { if (isDefinedAndNotNull(nfDialogData.handler)) {
var handler = nfDialog.handler.close; var handler = nfDialogData.handler.close;
if (isDefinedAndNotNull(handler) && typeof handler === 'function') { if (isDefinedAndNotNull(handler) && typeof handler === 'function') {
// invoke the handler // invoke the handler
handler.call(dialog); handler.call(dialog);

View File

@ -22,8 +22,8 @@
define(['jquery', define(['jquery',
'CodeMirror', 'CodeMirror',
'nf'], 'nf'],
function ($, common) { function ($, CodeMirror, nf) {
factory($, common); factory($, CodeMirror, nf);
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
factory(require('jquery'), factory(require('jquery'),

View File

@ -32,22 +32,22 @@
'nf.Settings'], 'nf.Settings'],
function ($, function ($,
Slick, Slick,
common, nfCommon,
universalCapture, nfUniversalCapture,
dialog, nfDialog,
client, nfClient,
errorHandler, nfErrorHandler,
processGroupConfiguration, nfProcessGroupConfiguration,
settings) { nfSettings) {
factory($, factory($,
Slick, Slick,
common, nfCommon,
universalCapture, nfUniversalCapture,
dialog, nfDialog,
client, nfClient,
errorHandler, nfErrorHandler,
processGroupConfiguration, nfProcessGroupConfiguration,
settings); nfSettings);
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
factory(require('jquery'), factory(require('jquery'),
@ -72,13 +72,13 @@
} }
}(this, function ($, }(this, function ($,
Slick, Slick,
common, nfCommon,
universalCapture, nfUniversalCapture,
dialog, nfDialog,
client, nfClient,
errorHandler, nfErrorHandler,
processGroupConfiguration, nfProcessGroupConfiguration,
settings) { nfSettings) {
var languageId = 'nfel'; var languageId = 'nfel';
var editorClass = languageId + '-editor'; var editorClass = languageId + '-editor';
@ -124,7 +124,8 @@
'width': args.position.width + 'px', 'width': args.position.width + 'px',
'min-width': '212px', 'min-width': '212px',
'margin-bottom': '5px', 'margin-bottom': '5px',
'margin-top': '10px' 'margin-top': '10px',
'white-space': 'pre'
}).tab().on('keydown', scope.handleKeyDown).appendTo(wrapper); }).tab().on('keydown', scope.handleKeyDown).appendTo(wrapper);
wrapper.draggable({ wrapper.draggable({
@ -219,12 +220,12 @@
this.loadValue = function (item) { this.loadValue = function (item) {
// determine if this is a sensitive property // determine if this is a sensitive property
var isEmptyChecked = false; var isEmptyChecked = false;
var sensitive = common.isSensitiveProperty(propertyDescriptor); var sensitive = nfCommon.isSensitiveProperty(propertyDescriptor);
// determine the value to use when populating the text field // determine the value to use when populating the text field
if (common.isDefinedAndNotNull(item[args.column.field])) { if (nfCommon.isDefinedAndNotNull(item[args.column.field])) {
if (sensitive) { if (sensitive) {
initialValue = common.config.sensitiveText; initialValue = nfCommon.config.sensitiveText;
} else { } else {
initialValue = item[args.column.field]; initialValue = item[args.column.field];
isEmptyChecked = initialValue === ''; isEmptyChecked = initialValue === '';
@ -241,7 +242,7 @@
var sensitiveInput = $(this); var sensitiveInput = $(this);
if (sensitiveInput.hasClass('sensitive')) { if (sensitiveInput.hasClass('sensitive')) {
sensitiveInput.removeClass('sensitive'); sensitiveInput.removeClass('sensitive');
if (sensitiveInput.val() === common.config.sensitiveText) { if (sensitiveInput.val() === nfCommon.config.sensitiveText) {
sensitiveInput.val(''); sensitiveInput.val('');
} }
} }
@ -260,8 +261,8 @@
return ''; return '';
} else { } else {
// otherwise if the property is required // otherwise if the property is required
if (common.isRequiredProperty(propertyDescriptor)) { if (nfCommon.isRequiredProperty(propertyDescriptor)) {
if (common.isBlank(propertyDescriptor.defaultValue)) { if (nfCommon.isBlank(propertyDescriptor.defaultValue)) {
return previousValue; return previousValue;
} else { } else {
return propertyDescriptor.defaultValue; return propertyDescriptor.defaultValue;
@ -322,7 +323,7 @@
propertyDescriptor = descriptors[args.item.property]; propertyDescriptor = descriptors[args.item.property];
// determine if this is a sensitive property // determine if this is a sensitive property
var sensitive = common.isSensitiveProperty(propertyDescriptor); var sensitive = nfCommon.isSensitiveProperty(propertyDescriptor);
// record the previous value // record the previous value
previousValue = args.item[args.column.field]; previousValue = args.item[args.column.field];
@ -439,12 +440,12 @@
this.loadValue = function (item) { this.loadValue = function (item) {
// determine if this is a sensitive property // determine if this is a sensitive property
var isEmptyChecked = false; var isEmptyChecked = false;
var sensitive = common.isSensitiveProperty(propertyDescriptor); var sensitive = nfCommon.isSensitiveProperty(propertyDescriptor);
// determine the value to use when populating the text field // determine the value to use when populating the text field
if (common.isDefinedAndNotNull(item[args.column.field])) { if (nfCommon.isDefinedAndNotNull(item[args.column.field])) {
if (sensitive) { if (sensitive) {
initialValue = common.config.sensitiveText; initialValue = nfCommon.config.sensitiveText;
} else { } else {
initialValue = item[args.column.field]; initialValue = item[args.column.field];
isEmptyChecked = initialValue === ''; isEmptyChecked = initialValue === '';
@ -468,8 +469,8 @@
return ''; return '';
} else { } else {
// otherwise if the property is required // otherwise if the property is required
if (common.isRequiredProperty(propertyDescriptor)) { if (nfCommon.isRequiredProperty(propertyDescriptor)) {
if (common.isBlank(propertyDescriptor.defaultValue)) { if (nfCommon.isBlank(propertyDescriptor.defaultValue)) {
return previousValue; return previousValue;
} else { } else {
return propertyDescriptor.defaultValue; return propertyDescriptor.defaultValue;
@ -553,7 +554,7 @@
}).appendTo(container); }).appendTo(container);
// check for allowable values which will drive which editor to use // check for allowable values which will drive which editor to use
var allowableValues = common.getAllowableValues(propertyDescriptor); var allowableValues = nfCommon.getAllowableValues(propertyDescriptor);
// show the output port options // show the output port options
var options = []; var options = [];
@ -571,7 +572,7 @@
text: allowableValue.displayName, text: allowableValue.displayName,
value: allowableValue.value, value: allowableValue.value,
disabled: allowableValueEntity.canRead === false && allowableValue.value !== args.item['previousValue'], disabled: allowableValueEntity.canRead === false && allowableValue.value !== args.item['previousValue'],
description: common.escapeHtml(allowableValue.description) description: nfCommon.escapeHtml(allowableValue.description)
}); });
}); });
} }
@ -587,7 +588,7 @@
} }
// if this descriptor identifies a controller service, provide a way to create one // if this descriptor identifies a controller service, provide a way to create one
if (common.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService)) { if (nfCommon.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService)) {
options.push({ options.push({
text: 'Create new service...', text: 'Create new service...',
value: undefined, value: undefined,
@ -685,13 +686,13 @@
this.loadValue = function (item) { this.loadValue = function (item) {
// select as appropriate // select as appropriate
if (!common.isUndefined(item.value)) { if (!nfCommon.isUndefined(item.value)) {
initialValue = item.value; initialValue = item.value;
combo.combo('setSelectedOption', { combo.combo('setSelectedOption', {
value: item.value value: item.value
}); });
} else if (common.isDefinedAndNotNull(propertyDescriptor.defaultValue)) { } else if (nfCommon.isDefinedAndNotNull(propertyDescriptor.defaultValue)) {
initialValue = propertyDescriptor.defaultValue; initialValue = propertyDescriptor.defaultValue;
combo.combo('setSelectedOption', { combo.combo('setSelectedOption', {
@ -735,20 +736,20 @@
*/ */
var showPropertyValue = function (propertyGrid, descriptors, row, cell) { var showPropertyValue = function (propertyGrid, descriptors, row, cell) {
// remove any currently open detail dialogs // remove any currently open detail dialogs
universalCapture.removeAllPropertyDetailDialogs(); nfUniversalCapture.removeAllPropertyDetailDialogs();
// get the property in question // get the property in question
var propertyData = propertyGrid.getData(); var propertyData = propertyGrid.getData();
var property = propertyData.getItem(row); var property = propertyData.getItem(row);
// ensure there is a value // ensure there is a value
if (common.isDefinedAndNotNull(property.value)) { if (nfCommon.isDefinedAndNotNull(property.value)) {
// get the descriptor to insert the description tooltip // get the descriptor to insert the description tooltip
var propertyDescriptor = descriptors[property.property]; var propertyDescriptor = descriptors[property.property];
// ensure we're not dealing with a sensitive property // ensure we're not dealing with a sensitive property
if (!common.isSensitiveProperty(propertyDescriptor)) { if (!nfCommon.isSensitiveProperty(propertyDescriptor)) {
// get details about the location of the cell // get details about the location of the cell
var cellNode = $(propertyGrid.getCellNode(row, cell)); var cellNode = $(propertyGrid.getCellNode(row, cell));
@ -769,7 +770,7 @@
'left': offset.left - 20 'left': offset.left - 20
}).appendTo('body'); }).appendTo('body');
var allowableValues = common.getAllowableValues(propertyDescriptor); var allowableValues = nfCommon.getAllowableValues(propertyDescriptor);
if ($.isArray(allowableValues)) { if ($.isArray(allowableValues)) {
// prevent dragging over the combo // prevent dragging over the combo
wrapper.draggable({ wrapper.draggable({
@ -784,7 +785,7 @@
options.push({ options.push({
text: allowableValue.displayName, text: allowableValue.displayName,
value: allowableValue.value, value: allowableValue.value,
description: common.escapeHtml(allowableValue.description), description: nfCommon.escapeHtml(allowableValue.description),
disabled: true disabled: true
}); });
}); });
@ -833,7 +834,7 @@
var editor = null; var editor = null;
// so the nfel editor is appropriate // so the nfel editor is appropriate
if (common.supportsEl(propertyDescriptor)) { if (nfCommon.supportsEl(propertyDescriptor)) {
var languageId = 'nfel'; var languageId = 'nfel';
var editorClass = languageId + '-editor'; var editorClass = languageId + '-editor';
@ -957,15 +958,15 @@
var options = []; var options = [];
$.each(response.controllerServiceTypes, function (i, controllerServiceType) { $.each(response.controllerServiceTypes, function (i, controllerServiceType) {
options.push({ options.push({
text: common.substringAfterLast(controllerServiceType.type, '.'), text: nfCommon.substringAfterLast(controllerServiceType.type, '.'),
value: controllerServiceType.type, value: controllerServiceType.type,
description: common.escapeHtml(controllerServiceType.description) description: nfCommon.escapeHtml(controllerServiceType.description)
}); });
}); });
// ensure there are some applicable controller services // ensure there are some applicable controller services
if (options.length === 0) { if (options.length === 0) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Controller Service', headerText: 'Controller Service',
dialogContent: 'No controller service types found that are applicable for this property.' dialogContent: 'No controller service types found that are applicable for this property.'
}); });
@ -1053,7 +1054,7 @@
// build the controller service entity // build the controller service entity
var controllerServiceEntity = { var controllerServiceEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0, 'version': 0,
} }
@ -1065,7 +1066,7 @@
// determine the appropriate uri for creating the controller service // determine the appropriate uri for creating the controller service
var uri = '../nifi-api/controller/controller-services'; var uri = '../nifi-api/controller/controller-services';
if (common.isDefinedAndNotNull(groupId)) { if (nfCommon.isDefinedAndNotNull(groupId)) {
uri = '../nifi-api/process-groups/' + encodeURIComponent(groupId) + '/controller-services'; uri = '../nifi-api/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
} }
@ -1083,7 +1084,7 @@
// store the descriptor for use later // store the descriptor for use later
var descriptors = gridContainer.data('descriptors'); var descriptors = gridContainer.data('descriptors');
if (!common.isUndefined(descriptors)) { if (!nfCommon.isUndefined(descriptors)) {
descriptors[descriptor.name] = descriptor; descriptors[descriptor.name] = descriptor;
} }
@ -1101,7 +1102,7 @@
if (typeof configurationOptions.controllerServiceCreatedDeferred === 'function') { if (typeof configurationOptions.controllerServiceCreatedDeferred === 'function') {
configurationOptions.controllerServiceCreatedDeferred(response); configurationOptions.controllerServiceCreatedDeferred(response);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var cancel = function () { var cancel = function () {
@ -1110,7 +1111,7 @@
newControllerServiceDialog.modal('show'); newControllerServiceDialog.modal('show');
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var initPropertiesTable = function (table, options) { var initPropertiesTable = function (table, options) {
@ -1130,8 +1131,8 @@
var propertyDescriptor = descriptors[dataContext.property]; var propertyDescriptor = descriptors[dataContext.property];
// show the property description if applicable // show the property description if applicable
if (common.isDefinedAndNotNull(propertyDescriptor)) { if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
if (!common.isBlank(propertyDescriptor.description) || !common.isBlank(propertyDescriptor.defaultValue) || !common.isBlank(propertyDescriptor.supportsEl)) { if (!nfCommon.isBlank(propertyDescriptor.description) || !nfCommon.isBlank(propertyDescriptor.defaultValue) || !nfCommon.isBlank(propertyDescriptor.supportsEl)) {
$('<div class="fa fa-question-circle" alt="Info" style="float: right; margin-right: 6px; margin-top: 4px;"></div>').appendTo(cellContent); $('<div class="fa fa-question-circle" alt="Info" style="float: right; margin-right: 6px; margin-top: 4px;"></div>').appendTo(cellContent);
$('<span class="hidden property-descriptor-name"></span>').text(dataContext.property).appendTo(cellContent); $('<span class="hidden property-descriptor-name"></span>').text(dataContext.property).appendTo(cellContent);
nameWidthOffset = 46; // 10 + icon width (10) + icon margin (6) + padding (20) nameWidthOffset = 46; // 10 + icon width (10) + icon margin (6) + padding (20)
@ -1148,17 +1149,17 @@
// function for formatting the property value // function for formatting the property value
var valueFormatter = function (row, cell, value, columnDef, dataContext) { var valueFormatter = function (row, cell, value, columnDef, dataContext) {
var valueMarkup; var valueMarkup;
if (common.isDefinedAndNotNull(value)) { if (nfCommon.isDefinedAndNotNull(value)) {
// get the property descriptor // get the property descriptor
var descriptors = table.data('descriptors'); var descriptors = table.data('descriptors');
var propertyDescriptor = descriptors[dataContext.property]; var propertyDescriptor = descriptors[dataContext.property];
// determine if the property is sensitive // determine if the property is sensitive
if (common.isSensitiveProperty(propertyDescriptor)) { if (nfCommon.isSensitiveProperty(propertyDescriptor)) {
valueMarkup = '<span class="table-cell sensitive">Sensitive value set</span>'; valueMarkup = '<span class="table-cell sensitive">Sensitive value set</span>';
} else { } else {
// if there are allowable values, attempt to swap out for the display name // if there are allowable values, attempt to swap out for the display name
var allowableValues = common.getAllowableValues(propertyDescriptor); var allowableValues = nfCommon.getAllowableValues(propertyDescriptor);
if ($.isArray(allowableValues)) { if ($.isArray(allowableValues)) {
$.each(allowableValues, function (_, allowableValueEntity) { $.each(allowableValues, function (_, allowableValueEntity) {
var allowableValue = allowableValueEntity.allowableValue; var allowableValue = allowableValueEntity.allowableValue;
@ -1172,7 +1173,7 @@
if (value === '') { if (value === '') {
valueMarkup = '<span class="table-cell blank">Empty string set</span>'; valueMarkup = '<span class="table-cell blank">Empty string set</span>';
} else { } else {
valueMarkup = '<div class="table-cell value"><pre class="ellipsis">' + common.escapeHtml(value) + '</pre></div>'; valueMarkup = '<div class="table-cell value"><pre class="ellipsis">' + nfCommon.escapeHtml(value) + '</pre></div>';
} }
} }
} else { } else {
@ -1220,8 +1221,8 @@
var descriptors = table.data('descriptors'); var descriptors = table.data('descriptors');
var propertyDescriptor = descriptors[dataContext.property]; var propertyDescriptor = descriptors[dataContext.property];
var identifiesControllerService = common.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService); var identifiesControllerService = nfCommon.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService);
var isConfigured = common.isDefinedAndNotNull(dataContext.value); var isConfigured = nfCommon.isDefinedAndNotNull(dataContext.value);
// check to see if we should provide a button for going to a controller service // check to see if we should provide a button for going to a controller service
if (identifiesControllerService && isConfigured && (options.supportsGoTo === true)) { if (identifiesControllerService && isConfigured && (options.supportsGoTo === true)) {
@ -1273,7 +1274,7 @@
var propertyDescriptor = descriptors[item.property]; var propertyDescriptor = descriptors[item.property];
// support el if specified or unsure yet (likely a dynamic property) // support el if specified or unsure yet (likely a dynamic property)
if (common.isUndefinedOrNull(propertyDescriptor) || common.supportsEl(propertyDescriptor)) { if (nfCommon.isUndefinedOrNull(propertyDescriptor) || nfCommon.supportsEl(propertyDescriptor)) {
return { return {
columns: { columns: {
value: { value: {
@ -1283,7 +1284,7 @@
}; };
} else { } else {
// check for allowable values which will drive which editor to use // check for allowable values which will drive which editor to use
var allowableValues = common.getAllowableValues(propertyDescriptor); var allowableValues = nfCommon.getAllowableValues(propertyDescriptor);
if ($.isArray(allowableValues)) { if ($.isArray(allowableValues)) {
return { return {
columns: { columns: {
@ -1320,37 +1321,37 @@
var controllerService = controllerServiceEntity.component; var controllerService = controllerServiceEntity.component;
$.Deferred(function (deferred) { $.Deferred(function (deferred) {
if (common.isDefinedAndNotNull(controllerService.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(controllerService.parentGroupId)) {
if ($('#process-group-configuration').is(':visible')) { if ($('#process-group-configuration').is(':visible')) {
processGroupConfiguration.loadConfiguration(controllerService.parentGroupId).done(function () { nfProcessGroupConfiguration.loadConfiguration(controllerService.parentGroupId).done(function () {
deferred.resolve(); deferred.resolve();
}); });
} else { } else {
processGroupConfiguration.showConfiguration(controllerService.parentGroupId).done(function () { nfProcessGroupConfiguration.showConfiguration(controllerService.parentGroupId).done(function () {
deferred.resolve(); deferred.resolve();
}); });
} }
} else { } else {
if ($('#settings').is(':visible')) { if ($('#settings').is(':visible')) {
// reload the settings // reload the settings
settings.loadSettings().done(function () { nfSettings.loadSettings().done(function () {
deferred.resolve(); deferred.resolve();
}); });
} else { } else {
// reload the settings and show // reload the settings and show
settings.showSettings().done(function () { nfSettings.showSettings().done(function () {
deferred.resolve(); deferred.resolve();
}); });
} }
} }
}).done(function () { }).done(function () {
if (common.isDefinedAndNotNull(controllerService.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(controllerService.parentGroupId)) {
processGroupConfiguration.selectControllerService(property.value); nfProcessGroupConfiguration.selectControllerService(property.value);
} else { } else {
settings.selectControllerService(property.value); nfSettings.selectControllerService(property.value);
} }
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
// initialize the grid // initialize the grid
@ -1433,11 +1434,11 @@
var propertyHistory = history[property]; var propertyHistory = history[property];
// format the tooltip // format the tooltip
var tooltip = common.formatPropertyTooltip(propertyDescriptor, propertyHistory); var tooltip = nfCommon.formatPropertyTooltip(propertyDescriptor, propertyHistory);
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
infoIcon.qtip($.extend({}, infoIcon.qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: tooltip content: tooltip
})); }));
@ -1449,7 +1450,7 @@
var saveRow = function (table) { var saveRow = function (table) {
// get the property grid to commit the current edit // get the property grid to commit the current edit
var propertyGrid = table.data('gridInstance'); var propertyGrid = table.data('gridInstance');
if (common.isDefinedAndNotNull(propertyGrid)) { if (nfCommon.isDefinedAndNotNull(propertyGrid)) {
var editController = propertyGrid.getEditController(); var editController = propertyGrid.getEditController();
editController.commitCurrentEdit(); editController.commitCurrentEdit();
} }
@ -1486,7 +1487,7 @@
var propertyData = propertyGrid.getData(); var propertyData = propertyGrid.getData();
// generate the properties // generate the properties
if (common.isDefinedAndNotNull(properties)) { if (nfCommon.isDefinedAndNotNull(properties)) {
propertyData.beginUpdate(); propertyData.beginUpdate();
var i = 0; var i = 0;
@ -1497,10 +1498,10 @@
// determine the property type // determine the property type
var type = 'userDefined'; var type = 'userDefined';
var displayName = name; var displayName = name;
if (common.isDefinedAndNotNull(descriptor)) { if (nfCommon.isDefinedAndNotNull(descriptor)) {
if (common.isRequiredProperty(descriptor)) { if (nfCommon.isRequiredProperty(descriptor)) {
type = 'required'; type = 'required';
} else if (common.isDynamicProperty(descriptor)) { } else if (nfCommon.isDynamicProperty(descriptor)) {
type = 'userDefined'; type = 'userDefined';
} else { } else {
type = 'optional'; type = 'optional';
@ -1510,7 +1511,7 @@
displayName = descriptor.displayName; displayName = descriptor.displayName;
// determine the value // determine the value
if (common.isNull(value) && common.isDefinedAndNotNull(descriptor.defaultValue)) { if (nfCommon.isNull(value) && nfCommon.isDefinedAndNotNull(descriptor.defaultValue)) {
value = descriptor.defaultValue; value = descriptor.defaultValue;
} }
} }
@ -1539,10 +1540,10 @@
var clear = function (propertyTableContainer) { var clear = function (propertyTableContainer) {
var options = propertyTableContainer.data('options'); var options = propertyTableContainer.data('options');
if (options.readOnly === true) { if (options.readOnly === true) {
universalCapture.removeAllPropertyDetailDialogs(); nfUniversalCapture.removeAllPropertyDetailDialogs();
} else { } else {
// clear any existing new property dialogs // clear any existing new property dialogs
if (common.isDefinedAndNotNull(options.dialogContainer)) { if (nfCommon.isDefinedAndNotNull(options.dialogContainer)) {
$('#new-property-dialog').modal("hide"); $('#new-property-dialog').modal("hide");
} }
} }
@ -1552,7 +1553,7 @@
table.removeData('descriptors history'); table.removeData('descriptors history');
// clean up any tooltips that may have been generated // clean up any tooltips that may have been generated
common.cleanUpTooltips(table, 'div.fa-question-circle'); nfCommon.cleanUpTooltips(table, 'div.fa-question-circle');
// clear the data in the grid // clear the data in the grid
var propertyGrid = table.data('gridInstance'); var propertyGrid = table.data('gridInstance');
@ -1586,7 +1587,7 @@
init: function (options) { init: function (options) {
return this.each(function () { return this.each(function () {
// ensure the options have been properly specified // ensure the options have been properly specified
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
// get the tag cloud // get the tag cloud
var propertyTableContainer = $(this); var propertyTableContainer = $(this);
@ -1601,7 +1602,7 @@
var table = $('<div class="property-table"></div>').appendTo(propertyTableContainer); var table = $('<div class="property-table"></div>').appendTo(propertyTableContainer);
// optionally add a add new property button // optionally add a add new property button
if (options.readOnly !== true && common.isDefinedAndNotNull(options.dialogContainer)) { if (options.readOnly !== true && nfCommon.isDefinedAndNotNull(options.dialogContainer)) {
// build the new property dialog // build the new property dialog
var newPropertyDialogMarkup = var newPropertyDialogMarkup =
'<div id="new-property-dialog" class="dialog cancellable small-dialog hidden">' + '<div id="new-property-dialog" class="dialog cancellable small-dialog hidden">' +
@ -1673,7 +1674,7 @@
// store the descriptor for use later // store the descriptor for use later
var descriptors = table.data('descriptors'); var descriptors = table.data('descriptors');
if (!common.isUndefined(descriptors)) { if (!nfCommon.isUndefined(descriptors)) {
descriptors[descriptor.name] = descriptor; descriptors[descriptor.name] = descriptor;
} }
@ -1708,7 +1709,7 @@
propertyGrid.setActiveCell(row, propertyGrid.getColumnIndex('value')); propertyGrid.setActiveCell(row, propertyGrid.getColumnIndex('value'));
propertyGrid.editActiveCell(); propertyGrid.editActiveCell();
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Property Exists', headerText: 'Property Exists',
dialogContent: 'A property with this name already exists.' dialogContent: 'A property with this name already exists.'
}); });
@ -1720,7 +1721,7 @@
} }
} }
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Property Name', headerText: 'Property Name',
dialogContent: 'Property name must be specified.' dialogContent: 'Property name must be specified.'
}); });
@ -1803,7 +1804,7 @@
return this.each(function () { return this.each(function () {
var table = $(this).find('div.property-table'); var table = $(this).find('div.property-table');
var propertyGrid = table.data('gridInstance'); var propertyGrid = table.data('gridInstance');
if (common.isDefinedAndNotNull(propertyGrid)) { if (nfCommon.isDefinedAndNotNull(propertyGrid)) {
propertyGrid.resizeCanvas(); propertyGrid.resizeCanvas();
} }
}); });
@ -1816,7 +1817,7 @@
return this.each(function () { return this.each(function () {
var table = $(this).find('div.property-table'); var table = $(this).find('div.property-table');
var propertyGrid = table.data('gridInstance'); var propertyGrid = table.data('gridInstance');
if (common.isDefinedAndNotNull(propertyGrid)) { if (nfCommon.isDefinedAndNotNull(propertyGrid)) {
var editController = propertyGrid.getEditController(); var editController = propertyGrid.getEditController();
editController.cancelCurrentEdit(); editController.cancelCurrentEdit();
} }
@ -1831,12 +1832,12 @@
var propertyTableContainer = $(this); var propertyTableContainer = $(this);
var options = propertyTableContainer.data('options'); var options = propertyTableContainer.data('options');
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
// clear the property table container // clear the property table container
clear(propertyTableContainer); clear(propertyTableContainer);
// clear any existing new property dialogs // clear any existing new property dialogs
if (common.isDefinedAndNotNull(options.dialogContainer)) { if (nfCommon.isDefinedAndNotNull(options.dialogContainer)) {
$('#new-property-dialog').modal("hide"); $('#new-property-dialog').modal("hide");
$(options.dialogContainer).children('div.new-inline-controller-service-dialog').remove(); $(options.dialogContainer).children('div.new-inline-controller-service-dialog').remove();
} }

View File

@ -30,23 +30,23 @@
'nf.Storage'], 'nf.Storage'],
function ($, function ($,
angular, angular,
common, nfCommon,
appConfig, appConfig,
appCtrl, appCtrl,
serviceProvider, serviceProvider,
angularBridge, nfNgBridge,
errorHandler, nfErrorHandler,
storage) { nfStorage) {
return (nf.ng.BulletinBoardCtrl = return (nf.ng.BulletinBoardCtrl =
factory($, factory($,
angular, angular,
common, nfCommon,
appConfig, appConfig,
appCtrl, appCtrl,
serviceProvider, serviceProvider,
angularBridge, nfNgBridge,
errorHandler, nfErrorHandler,
storage)); nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.BulletinBoardCtrl = module.exports = (nf.ng.BulletinBoardCtrl =
@ -70,7 +70,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, angular, common, appConfig, appCtrl, serviceProvider, angularBridge, errorHandler, storage) { }(this, function ($, angular, nfCommon, appConfig, appCtrl, serviceProvider, nfNgBridge, nfErrorHandler, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -95,10 +95,10 @@
app.service('bulletinBoardCtrl', nfBulletinBoard); app.service('bulletinBoardCtrl', nfBulletinBoard);
//Manually Boostrap Angular App //Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngBulletinBoardApp'], {strictDi: true}); nfNgBridge.injector = angular.bootstrap($('body'), ['ngBulletinBoardApp'], {strictDi: true});
// initialize the bulletin board // initialize the bulletin board
angularBridge.injector.get('bulletinBoardCtrl').init(); nfNgBridge.injector.get('bulletinBoardCtrl').init();
}); });
var nfBulletinBoard = function (serviceProvider) { var nfBulletinBoard = function (serviceProvider) {
@ -158,7 +158,7 @@
// set the document title and the about title // set the document title and the about title
document.title = bulletinBoardTitle; document.title = bulletinBoardTitle;
$('#bulletin-board-header-text').text(bulletinBoardTitle); $('#bulletin-board-header-text').text(bulletinBoardTitle);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// get the banners if we're not in the shell // get the banners if we're not in the shell
var loadBanners = $.Deferred(function (deferred) { var loadBanners = $.Deferred(function (deferred) {
@ -169,8 +169,8 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -184,7 +184,7 @@
updateTop('bulletin-board'); updateTop('bulletin-board');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -200,7 +200,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -286,7 +286,7 @@
// only attempt this if we're within a frame // only attempt this if we're within a frame
if (top !== window) { if (top !== window) {
// and our parent has canvas utils and shell defined // and our parent has canvas utils and shell defined
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) { if (nfCommon.isDefinedAndNotNull(parent.nf) && nfCommon.isDefinedAndNotNull(parent.nf.CanvasUtils) && nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.showComponent(groupId, sourceId); parent.nf.CanvasUtils.showComponent(groupId, sourceId);
parent.$('#shell-close-button').click(); parent.$('#shell-close-button').click();
} }
@ -333,7 +333,7 @@
}); });
} }
storage.init(); nfStorage.init();
initializePage().done(function () { initializePage().done(function () {
start(); start();
@ -347,7 +347,7 @@
var data = {}; var data = {};
// include the timestamp if appropriate // include the timestamp if appropriate
if (common.isDefinedAndNotNull(lastBulletin)) { if (nfCommon.isDefinedAndNotNull(lastBulletin)) {
data['after'] = lastBulletin; data['after'] = lastBulletin;
} else { } else {
data['limit'] = 10; data['limit'] = 10;
@ -382,7 +382,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the bulletin board was specified // ensure the bulletin board was specified
if (common.isDefinedAndNotNull(response.bulletinBoard)) { if (nfCommon.isDefinedAndNotNull(response.bulletinBoard)) {
var bulletinBoard = response.bulletinBoard; var bulletinBoard = response.bulletinBoard;
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
@ -407,13 +407,13 @@
// format the source id // format the source id
var source; var source;
if (common.isDefinedAndNotNull(bulletin.sourceId) && common.isDefinedAndNotNull(bulletin.groupId) && top !== window) { if (nfCommon.isDefinedAndNotNull(bulletin.sourceId) && nfCommon.isDefinedAndNotNull(bulletin.groupId) && top !== window) {
source = $('<div class="bulletin-source bulletin-link"></div>').text(bulletin.sourceId).on('click', function () { source = $('<div class="bulletin-source bulletin-link"></div>').text(bulletin.sourceId).on('click', function () {
goToSource(bulletin.groupId, bulletin.sourceId); goToSource(bulletin.groupId, bulletin.sourceId);
}); });
} else { } else {
var sourceId = bulletin.sourceId; var sourceId = bulletin.sourceId;
if (common.isUndefined(sourceId) || common.isNull(sourceId)) { if (nfCommon.isUndefined(sourceId) || nfCommon.isNull(sourceId)) {
sourceId = ''; sourceId = '';
} }
source = $('<div class="bulletin-source"></div>').text(sourceId); source = $('<div class="bulletin-source"></div>').text(sourceId);
@ -430,7 +430,7 @@
$('<div class="clear"></div>').appendTo(bulletinInfoMarkup); $('<div class="clear"></div>').appendTo(bulletinInfoMarkup);
// format the node address if applicable // format the node address if applicable
if (common.isDefinedAndNotNull(bulletin.nodeAddress)) { if (nfCommon.isDefinedAndNotNull(bulletin.nodeAddress)) {
$('<div class="bulletin-node"></div>').text(bulletin.nodeAddress).appendTo(bulletinMarkup); $('<div class="bulletin-node"></div>').text(bulletin.nodeAddress).appendTo(bulletinMarkup);
} }
@ -467,7 +467,7 @@
// stop future polling // stop future polling
bulletinBoardCtrl.togglePolling(); bulletinBoardCtrl.togglePolling();
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
}, },

View File

@ -21,8 +21,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'nf.Common'], 'nf.Common'],
function ($, common) { function ($, nfCommon) {
return (nf.ng.BreadcrumbsCtrl = factory($, common)); return (nf.ng.BreadcrumbsCtrl = factory($, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.BreadcrumbsCtrl = module.exports = (nf.ng.BreadcrumbsCtrl =
@ -32,7 +32,7 @@
nf.ng.BreadcrumbsCtrl = factory(root.$, nf.ng.BreadcrumbsCtrl = factory(root.$,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, common) { }(this, function ($, nfCommon) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -69,7 +69,7 @@
'label': label 'label': label
}, breadcrumbEntity)); }, breadcrumbEntity));
if (common.isDefinedAndNotNull(breadcrumbEntity.parentBreadcrumb)) { if (nfCommon.isDefinedAndNotNull(breadcrumbEntity.parentBreadcrumb)) {
this.generateBreadcrumbs(breadcrumbEntity.parentBreadcrumb); this.generateBreadcrumbs(breadcrumbEntity.parentBreadcrumb);
} }
}, },
@ -132,7 +132,7 @@
// still having issues with this in IE :/ // still having issues with this in IE :/
element.on('DOMMouseScroll mousewheel', function (evt, d) { element.on('DOMMouseScroll mousewheel', function (evt, d) {
if (common.isUndefinedOrNull(evt.originalEvent)) { if (nfCommon.isUndefinedOrNull(evt.originalEvent)) {
return; return;
} }
@ -155,9 +155,9 @@
//Chrome and Safari both have evt.originalEvent.detail defined but //Chrome and Safari both have evt.originalEvent.detail defined but
//evt.originalEvent.wheelDelta holds the correct value so we must //evt.originalEvent.wheelDelta holds the correct value so we must
//check for evt.originalEvent.wheelDelta first! //check for evt.originalEvent.wheelDelta first!
if (common.isDefinedAndNotNull(evt.originalEvent.wheelDelta)) { if (nfCommon.isDefinedAndNotNull(evt.originalEvent.wheelDelta)) {
delta = evt.originalEvent.wheelDelta; delta = evt.originalEvent.wheelDelta;
} else if (common.isDefinedAndNotNull(evt.originalEvent.detail)) { } else if (nfCommon.isDefinedAndNotNull(evt.originalEvent.detail)) {
delta = -evt.originalEvent.detail; delta = -evt.originalEvent.detail;
} }

View File

@ -27,8 +27,8 @@
'nf.ClusterSummary', 'nf.ClusterSummary',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Settings'], 'nf.Settings'],
function ($, common, dialog, canvasUtils, contextMenu, clusterSummary, errorHandler, settings) { function ($, nfCommon, nfDialog, nfCanvasUtils, nfContextMenu, nfClusterSummary, nfErrorHandler, nfSettings) {
return (nf.ng.Canvas.FlowStatusCtrl = factory($, common, dialog, canvasUtils, contextMenu, clusterSummary, errorHandler, settings)); return (nf.ng.Canvas.FlowStatusCtrl = factory($, nfCommon, nfDialog, nfCanvasUtils, nfContextMenu, nfClusterSummary, nfErrorHandler, nfSettings));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.FlowStatusCtrl = module.exports = (nf.ng.Canvas.FlowStatusCtrl =
@ -50,7 +50,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Settings); root.nf.Settings);
} }
}(this, function ($, common, dialog, canvasUtils, contextMenu, clusterSummary, errorHandler, settings) { }(this, function ($, nfCommon, nfDialog, nfCanvasUtils, nfContextMenu, nfClusterSummary, nfErrorHandler, nfSettings) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -134,7 +134,7 @@
var searchResults = items[0]; var searchResults = items[0];
// show all processors // show all processors
if (!common.isEmpty(searchResults.processorResults)) { if (!nfCommon.isEmpty(searchResults.processorResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-processor"></div>Processors</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-processor"></div>Processors</li>');
$.each(searchResults.processorResults, function (i, processorMatch) { $.each(searchResults.processorResults, function (i, processorMatch) {
nfSearchAutocomplete._renderItem(ul, processorMatch); nfSearchAutocomplete._renderItem(ul, processorMatch);
@ -142,7 +142,7 @@
} }
// show all process groups // show all process groups
if (!common.isEmpty(searchResults.processGroupResults)) { if (!nfCommon.isEmpty(searchResults.processGroupResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-group"></div>Process Groups</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-group"></div>Process Groups</li>');
$.each(searchResults.processGroupResults, function (i, processGroupMatch) { $.each(searchResults.processGroupResults, function (i, processGroupMatch) {
nfSearchAutocomplete._renderItem(ul, processGroupMatch); nfSearchAutocomplete._renderItem(ul, processGroupMatch);
@ -150,7 +150,7 @@
} }
// show all remote process groups // show all remote process groups
if (!common.isEmpty(searchResults.remoteProcessGroupResults)) { if (!nfCommon.isEmpty(searchResults.remoteProcessGroupResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-group-remote"></div>Remote Process Groups</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-group-remote"></div>Remote Process Groups</li>');
$.each(searchResults.remoteProcessGroupResults, function (i, remoteProcessGroupMatch) { $.each(searchResults.remoteProcessGroupResults, function (i, remoteProcessGroupMatch) {
nfSearchAutocomplete._renderItem(ul, remoteProcessGroupMatch); nfSearchAutocomplete._renderItem(ul, remoteProcessGroupMatch);
@ -158,7 +158,7 @@
} }
// show all connections // show all connections
if (!common.isEmpty(searchResults.connectionResults)) { if (!nfCommon.isEmpty(searchResults.connectionResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-connect"></div>Connections</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-connect"></div>Connections</li>');
$.each(searchResults.connectionResults, function (i, connectionMatch) { $.each(searchResults.connectionResults, function (i, connectionMatch) {
nfSearchAutocomplete._renderItem(ul, connectionMatch); nfSearchAutocomplete._renderItem(ul, connectionMatch);
@ -166,7 +166,7 @@
} }
// show all input ports // show all input ports
if (!common.isEmpty(searchResults.inputPortResults)) { if (!nfCommon.isEmpty(searchResults.inputPortResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-in"></div>Input Ports</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-in"></div>Input Ports</li>');
$.each(searchResults.inputPortResults, function (i, inputPortMatch) { $.each(searchResults.inputPortResults, function (i, inputPortMatch) {
nfSearchAutocomplete._renderItem(ul, inputPortMatch); nfSearchAutocomplete._renderItem(ul, inputPortMatch);
@ -174,7 +174,7 @@
} }
// show all output ports // show all output ports
if (!common.isEmpty(searchResults.outputPortResults)) { if (!nfCommon.isEmpty(searchResults.outputPortResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-out"></div>Output Ports</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-out"></div>Output Ports</li>');
$.each(searchResults.outputPortResults, function (i, outputPortMatch) { $.each(searchResults.outputPortResults, function (i, outputPortMatch) {
nfSearchAutocomplete._renderItem(ul, outputPortMatch); nfSearchAutocomplete._renderItem(ul, outputPortMatch);
@ -182,7 +182,7 @@
} }
// show all funnels // show all funnels
if (!common.isEmpty(searchResults.funnelResults)) { if (!nfCommon.isEmpty(searchResults.funnelResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-funnel"></div>Funnels</li>'); ul.append('<li class="search-header"><div class="search-result-icon icon icon-funnel"></div>Funnels</li>');
$.each(searchResults.funnelResults, function (i, funnelMatch) { $.each(searchResults.funnelResults, function (i, funnelMatch) {
nfSearchAutocomplete._renderItem(ul, funnelMatch); nfSearchAutocomplete._renderItem(ul, funnelMatch);
@ -228,7 +228,7 @@
var item = ui.item; var item = ui.item;
// show the selected component // show the selected component
canvasUtils.showComponent(item.groupId, item.id); nfCanvasUtils.showComponent(item.groupId, item.id);
searchCtrl.getInputElement().val('').blur(); searchCtrl.getInputElement().val('').blur();
@ -262,7 +262,7 @@
var searchCtrl = this; var searchCtrl = this;
// hide the context menu if necessary // hide the context menu if necessary
contextMenu.hide(); nfContextMenu.hide();
var isVisible = searchCtrl.getInputElement().is(':visible'); var isVisible = searchCtrl.getInputElement().is(':visible');
var display = 'none'; var display = 'none';
@ -306,11 +306,11 @@
var currentBulletins = bulletinIcon.data('bulletins'); var currentBulletins = bulletinIcon.data('bulletins');
// update the bulletins if necessary // update the bulletins if necessary
if (common.doBulletinsDiffer(currentBulletins, response.bulletins)) { if (nfCommon.doBulletinsDiffer(currentBulletins, response.bulletins)) {
bulletinIcon.data('bulletins', response.bulletins); bulletinIcon.data('bulletins', response.bulletins);
// get the formatted the bulletins // get the formatted the bulletins
var bulletins = common.getFormattedBulletins(response.bulletins); var bulletins = nfCommon.getFormattedBulletins(response.bulletins);
// bulletins for this processor are now gone // bulletins for this processor are now gone
if (bulletins.length === 0) { if (bulletins.length === 0) {
@ -318,7 +318,7 @@
bulletinIcon.removeClass('has-bulletins').qtip('api').destroy(true); bulletinIcon.removeClass('has-bulletins').qtip('api').destroy(true);
} }
} else { } else {
var newBulletins = common.formatUnorderedList(bulletins); var newBulletins = nfCommon.formatUnorderedList(bulletins);
// different bulletins, refresh // different bulletins, refresh
if (bulletinIcon.data('qtip')) { if (bulletinIcon.data('qtip')) {
@ -326,7 +326,7 @@
} else { } else {
// no bulletins before, show icon and tips // no bulletins before, show icon and tips
bulletinIcon.addClass('has-bulletins').qtip($.extend({}, bulletinIcon.addClass('has-bulletins').qtip($.extend({},
canvasUtils.config.systemTooltipConfig, nfCanvasUtils.config.systemTooltipConfig,
{ {
content: newBulletins, content: newBulletins,
position: { position: {
@ -343,7 +343,7 @@
} }
// update controller service and reporting task bulletins // update controller service and reporting task bulletins
settings.setBulletins(response.controllerServiceBulletins, response.reportingTaskBulletins); nfSettings.setBulletins(response.controllerServiceBulletins, response.reportingTaskBulletins);
} }
} }
@ -371,10 +371,10 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// report the updated status // report the updated status
if (common.isDefinedAndNotNull(response.controllerStatus)) { if (nfCommon.isDefinedAndNotNull(response.controllerStatus)) {
flowStatusCtrl.update(response.controllerStatus); flowStatusCtrl.update(response.controllerStatus);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -384,11 +384,11 @@
*/ */
updateClusterSummary: function (summary) { updateClusterSummary: function (summary) {
// see if this node has been (dis)connected // see if this node has been (dis)connected
if (clusterSummary.isConnectedToCluster() !== summary.connectedToCluster) { if (nfClusterSummary.isConnectedToCluster() !== summary.connectedToCluster) {
if (summary.connectedToCluster) { if (summary.connectedToCluster) {
dialog.showConnectedToClusterMessage(); nfDialog.showConnectedToClusterMessage();
} else { } else {
dialog.showDisconnectedFromClusterMessage(); nfDialog.showDisconnectedFromClusterMessage();
} }
} }
@ -396,7 +396,7 @@
// update the connection state // update the connection state
if (summary.connectedToCluster) { if (summary.connectedToCluster) {
if (common.isDefinedAndNotNull(summary.connectedNodes)) { if (nfCommon.isDefinedAndNotNull(summary.connectedNodes)) {
var connectedNodes = summary.connectedNodes.split(' / '); var connectedNodes = summary.connectedNodes.split(' / ');
if (connectedNodes.length === 2 && connectedNodes[0] !== connectedNodes[1]) { if (connectedNodes.length === 2 && connectedNodes[0] !== connectedNodes[1]) {
this.clusterConnectionWarning = true; this.clusterConnectionWarning = true;
@ -404,7 +404,7 @@
} }
} }
this.connectedNodesCount = this.connectedNodesCount =
common.isDefinedAndNotNull(summary.connectedNodes) ? summary.connectedNodes : '-'; nfCommon.isDefinedAndNotNull(summary.connectedNodes) ? summary.connectedNodes : '-';
} else { } else {
this.connectedNodesCount = 'Disconnected'; this.connectedNodesCount = 'Disconnected';
color = '#BA554A'; color = '#BA554A';
@ -420,7 +420,7 @@
* @param status The controller status returned from the `../nifi-api/flow/status` endpoint. * @param status The controller status returned from the `../nifi-api/flow/status` endpoint.
*/ */
update: function (status) { update: function (status) {
var controllerInvalidCount = (common.isDefinedAndNotNull(status.invalidCount)) ? status.invalidCount : 0; var controllerInvalidCount = (nfCommon.isDefinedAndNotNull(status.invalidCount)) ? status.invalidCount : 0;
if (this.controllerInvalidCount > 0) { if (this.controllerInvalidCount > 0) {
$('#controller-invalid-count').parent().removeClass('zero').addClass('invalid'); $('#controller-invalid-count').parent().removeClass('zero').addClass('invalid');
@ -447,7 +447,7 @@
// update the component counts // update the component counts
this.controllerTransmittingCount = this.controllerTransmittingCount =
common.isDefinedAndNotNull(status.activeRemotePortCount) ? nfCommon.isDefinedAndNotNull(status.activeRemotePortCount) ?
status.activeRemotePortCount : '-'; status.activeRemotePortCount : '-';
if (this.controllerTransmittingCount > 0) { if (this.controllerTransmittingCount > 0) {
@ -457,7 +457,7 @@
} }
this.controllerNotTransmittingCount = this.controllerNotTransmittingCount =
common.isDefinedAndNotNull(status.inactiveRemotePortCount) ? nfCommon.isDefinedAndNotNull(status.inactiveRemotePortCount) ?
status.inactiveRemotePortCount : '-'; status.inactiveRemotePortCount : '-';
if (this.controllerNotTransmittingCount > 0) { if (this.controllerNotTransmittingCount > 0) {
@ -467,7 +467,7 @@
} }
this.controllerRunningCount = this.controllerRunningCount =
common.isDefinedAndNotNull(status.runningCount) ? status.runningCount : '-'; nfCommon.isDefinedAndNotNull(status.runningCount) ? status.runningCount : '-';
if (this.controllerRunningCount > 0) { if (this.controllerRunningCount > 0) {
$('#flow-status-container').find('.fa-play').removeClass('zero').addClass('running'); $('#flow-status-container').find('.fa-play').removeClass('zero').addClass('running');
@ -476,7 +476,7 @@
} }
this.controllerStoppedCount = this.controllerStoppedCount =
common.isDefinedAndNotNull(status.stoppedCount) ? status.stoppedCount : '-'; nfCommon.isDefinedAndNotNull(status.stoppedCount) ? status.stoppedCount : '-';
if (this.controllerStoppedCount > 0) { if (this.controllerStoppedCount > 0) {
$('#flow-status-container').find('.fa-stop').removeClass('zero').addClass('stopped'); $('#flow-status-container').find('.fa-stop').removeClass('zero').addClass('stopped');
@ -485,7 +485,7 @@
} }
this.controllerInvalidCount = this.controllerInvalidCount =
common.isDefinedAndNotNull(status.invalidCount) ? status.invalidCount : '-'; nfCommon.isDefinedAndNotNull(status.invalidCount) ? status.invalidCount : '-';
if (this.controllerInvalidCount > 0) { if (this.controllerInvalidCount > 0) {
$('#flow-status-container').find('.fa-warning').removeClass('zero').addClass('invalid'); $('#flow-status-container').find('.fa-warning').removeClass('zero').addClass('invalid');
@ -494,7 +494,7 @@
} }
this.controllerDisabledCount = this.controllerDisabledCount =
common.isDefinedAndNotNull(status.disabledCount) ? status.disabledCount : '-'; nfCommon.isDefinedAndNotNull(status.disabledCount) ? status.disabledCount : '-';
if (this.controllerDisabledCount > 0) { if (this.controllerDisabledCount > 0) {
$('#flow-status-container').find('.icon-enable-false').removeClass('zero').addClass('disabled'); $('#flow-status-container').find('.icon-enable-false').removeClass('zero').addClass('disabled');

View File

@ -28,8 +28,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Settings', 'nf.Settings',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, common, queueListing, shell, policyManagement, clusterSummary, errorHandler, settings, canvasUtils) { function ($, nfCommon, nfQueueListing, nfShell, nfPolicyManagement, nfClusterSummary, nfErrorHandler, nfSettings, nfCanvasUtils) {
return (nf.ng.Canvas.GlobalMenuCtrl = factory($, common, queueListing, shell, policyManagement, clusterSummary, errorHandler, settings, canvasUtils)); return (nf.ng.Canvas.GlobalMenuCtrl = factory($, nfCommon, nfQueueListing, nfShell, nfPolicyManagement, nfClusterSummary, nfErrorHandler, nfSettings, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.GlobalMenuCtrl = module.exports = (nf.ng.Canvas.GlobalMenuCtrl =
@ -53,7 +53,7 @@
root.nf.Settings, root.nf.Settings,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, common, queueListing, shell, policyManagement, clusterSummary, errorHandler, settings, canvasUtils) { }(this, function ($, nfCommon, nfQueueListing, nfShell, nfPolicyManagement, nfClusterSummary, nfErrorHandler, nfSettings, nfCanvasUtils) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -82,7 +82,7 @@
* Launch the summary shell. * Launch the summary shell.
*/ */
launch: function () { launch: function () {
shell.showPage('summary'); nfShell.showPage('summary');
} }
} }
}; };
@ -101,8 +101,8 @@
* Launch the counters shell. * Launch the counters shell.
*/ */
launch: function () { launch: function () {
if (common.canAccessCounters()) { if (nfCommon.canAccessCounters()) {
shell.showPage('counters'); nfShell.showPage('counters');
} }
} }
} }
@ -122,7 +122,7 @@
* Launch the bulletin board shell. * Launch the bulletin board shell.
*/ */
launch: function () { launch: function () {
shell.showPage('bulletin-board'); nfShell.showPage('bulletin-board');
} }
} }
}; };
@ -141,8 +141,8 @@
* Launch the data provenance shell. * Launch the data provenance shell.
*/ */
launch: function () { launch: function () {
if (common.canAccessProvenance()) { if (nfCommon.canAccessProvenance()) {
shell.showPage('provenance'); nfShell.showPage('provenance');
} }
} }
} }
@ -162,7 +162,7 @@
* Launch the settings shell. * Launch the settings shell.
*/ */
launch: function () { launch: function () {
settings.showSettings(); nfSettings.showSettings();
} }
} }
}; };
@ -178,7 +178,7 @@
* @returns {*|boolean} * @returns {*|boolean}
*/ */
visible: function () { visible: function () {
return clusterSummary.isConnectedToCluster(); return nfClusterSummary.isConnectedToCluster();
}, },
/** /**
@ -190,8 +190,8 @@
* Launch the cluster shell. * Launch the cluster shell.
*/ */
launch: function () { launch: function () {
if (common.canAccessController()) { if (nfCommon.canAccessController()) {
shell.showPage('cluster'); nfShell.showPage('cluster');
} }
} }
} }
@ -211,7 +211,7 @@
* Launch the history shell. * Launch the history shell.
*/ */
launch: function () { launch: function () {
shell.showPage('history'); nfShell.showPage('history');
} }
} }
}; };
@ -230,8 +230,8 @@
* Launch the users shell. * Launch the users shell.
*/ */
launch: function () { launch: function () {
if (common.canAccessTenants()) { if (nfCommon.canAccessTenants()) {
shell.showPage('users'); nfShell.showPage('users');
} }
} }
} }
@ -251,8 +251,8 @@
* Launch the policies shell. * Launch the policies shell.
*/ */
launch: function () { launch: function () {
if (common.canModifyPolicies() && common.canAccessTenants()) { if (nfCommon.canModifyPolicies() && nfCommon.canAccessTenants()) {
policyManagement.showGlobalPolicies(); nfPolicyManagement.showGlobalPolicies();
} }
} }
} }
@ -272,8 +272,8 @@
* Launch the templates shell. * Launch the templates shell.
*/ */
launch: function () { launch: function () {
shell.showPage('templates?' + $.param({ nfShell.showPage('templates?' + $.param({
groupId: canvasUtils.getGroupId() groupId: nfCanvasUtils.getGroupId()
})); }));
} }
} }
@ -293,7 +293,7 @@
* Launch the help documentation shell. * Launch the help documentation shell.
*/ */
launch: function () { launch: function () {
shell.showPage(config.urls.helpDocument); nfShell.showPage(config.urls.helpDocument);
} }
} }
}; };
@ -339,11 +339,11 @@
} }
// store the content viewer url if available // store the content viewer url if available
if (!common.isBlank(aboutDetails.contentViewerUrl)) { if (!nfCommon.isBlank(aboutDetails.contentViewerUrl)) {
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl); $('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
queueListing.initFlowFileDetailsDialog(); nfQueueListing.initFlowFileDetailsDialog();
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
this.modal.init(); this.modal.init();
}, },

View File

@ -24,10 +24,9 @@
'nf.Birdseye', 'nf.Birdseye',
'nf.Storage', 'nf.Storage',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.Common',
'nf.ProcessGroupConfiguration'], 'nf.ProcessGroupConfiguration'],
function ($, action, birdseye, storage, canvasUtils, common, processGroupConfiguration) { function ($, nfActions, nfBirdseye, nfStorage, nfCanvasUtils, nfProcessGroupConfiguration) {
return (nf.ng.Canvas.GraphControlsCtrl = factory($, action, birdseye, storage, canvasUtils, common, processGroupConfiguration)); return (nf.ng.Canvas.GraphControlsCtrl = factory($, nfActions, nfBirdseye, nfStorage, nfCanvasUtils, nfProcessGroupConfiguration));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.GraphControlsCtrl = module.exports = (nf.ng.Canvas.GraphControlsCtrl =
@ -36,7 +35,6 @@
require('nf.Birdseye'), require('nf.Birdseye'),
require('nf.Storage'), require('nf.Storage'),
require('nf.CanvasUtils'), require('nf.CanvasUtils'),
require('nf.Common'),
require('nf.ProcessGroupConfiguration'))); require('nf.ProcessGroupConfiguration')));
} else { } else {
nf.ng.Canvas.GraphControlsCtrl = factory(root.$, nf.ng.Canvas.GraphControlsCtrl = factory(root.$,
@ -44,10 +42,9 @@
root.nf.Birdseye, root.nf.Birdseye,
root.nf.Storage, root.nf.Storage,
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.Common,
root.nf.ProcessGroupConfiguration); root.nf.ProcessGroupConfiguration);
} }
}(this, function ($, actions, birdseye, storage, canvasUtils, common, processGroupConfiguration) { }(this, function ($, nfActions, nfBirdseye, nfStorage, nfCanvasUtils, nfProcessGroupConfiguration) {
'use strict'; 'use strict';
return function (serviceProvider, navigateCtrl, operateCtrl) { return function (serviceProvider, navigateCtrl, operateCtrl) {
@ -72,11 +69,11 @@
// handle specific actions as necessary // handle specific actions as necessary
if (graphControl.attr('id') === 'navigation-control') { if (graphControl.attr('id') === 'navigation-control') {
birdseye.updateBirdseyeVisibility(true); nfBirdseye.updateBirdseyeVisibility(true);
} }
// get the current visibility // get the current visibility
var graphControlVisibility = storage.getItem('graph-control-visibility'); var graphControlVisibility = nfStorage.getItem('graph-control-visibility');
if (graphControlVisibility === null) { if (graphControlVisibility === null) {
graphControlVisibility = {}; graphControlVisibility = {};
} }
@ -84,7 +81,7 @@
// update the visibility for this graph control // update the visibility for this graph control
var graphControlId = graphControl.attr('id'); var graphControlId = graphControl.attr('id');
graphControlVisibility[graphControlId] = true; graphControlVisibility[graphControlId] = true;
storage.setItem('graph-control-visibility', graphControlVisibility); nfStorage.setItem('graph-control-visibility', graphControlVisibility);
}; };
/** /**
@ -106,11 +103,11 @@
// handle specific actions as necessary // handle specific actions as necessary
if (graphControl.attr('id') === 'navigation-control') { if (graphControl.attr('id') === 'navigation-control') {
birdseye.updateBirdseyeVisibility(false); nfBirdseye.updateBirdseyeVisibility(false);
} }
// get the current visibility // get the current visibility
var graphControlVisibility = storage.getItem('graph-control-visibility'); var graphControlVisibility = nfStorage.getItem('graph-control-visibility');
if (graphControlVisibility === null) { if (graphControlVisibility === null) {
graphControlVisibility = {}; graphControlVisibility = {};
} }
@ -118,7 +115,7 @@
// update the visibility for this graph control // update the visibility for this graph control
var graphControlId = graphControl.attr('id'); var graphControlId = graphControl.attr('id');
graphControlVisibility[graphControlId] = false; graphControlVisibility[graphControlId] = false;
storage.setItem('graph-control-visibility', graphControlVisibility); nfStorage.setItem('graph-control-visibility', graphControlVisibility);
}; };
function GraphControlsCtrl(navigateCtrl, operateCtrl) { function GraphControlsCtrl(navigateCtrl, operateCtrl) {
@ -144,7 +141,7 @@
init: function () { init: function () {
this.operateCtrl.init(); this.operateCtrl.init();
// initial the graph control visibility // initial the graph control visibility
var graphControlVisibility = storage.getItem('graph-control-visibility'); var graphControlVisibility = nfStorage.getItem('graph-control-visibility');
if (graphControlVisibility !== null) { if (graphControlVisibility !== null) {
$.each(graphControlVisibility, function (id, isVisible) { $.each(graphControlVisibility, function (id, isVisible) {
var graphControl = $('#' + id); var graphControl = $('#' + id);
@ -187,31 +184,31 @@
* Gets the icon to show for the selection context. * Gets the icon to show for the selection context.
*/ */
getContextIcon: function () { getContextIcon: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
if (selection.empty()) { if (selection.empty()) {
if (canvasUtils.getParentGroupId() === null) { if (nfCanvasUtils.getParentGroupId() === null) {
return 'icon-drop'; return 'icon-drop';
} else { } else {
return 'icon-group'; return 'icon-group';
} }
} else { } else {
if (selection.size() === 1) { if (selection.size() === 1) {
if (canvasUtils.isProcessor(selection)) { if (nfCanvasUtils.isProcessor(selection)) {
return 'icon-processor'; return 'icon-processor';
} else if (canvasUtils.isProcessGroup(selection)) { } else if (nfCanvasUtils.isProcessGroup(selection)) {
return 'icon-group'; return 'icon-group';
} else if (canvasUtils.isInputPort(selection)) { } else if (nfCanvasUtils.isInputPort(selection)) {
return 'icon-port-in'; return 'icon-port-in';
} else if (canvasUtils.isOutputPort(selection)) { } else if (nfCanvasUtils.isOutputPort(selection)) {
return 'icon-port-out'; return 'icon-port-out';
} else if (canvasUtils.isRemoteProcessGroup(selection)) { } else if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
return 'icon-group-remote'; return 'icon-group-remote';
} else if (canvasUtils.isFunnel(selection)) { } else if (nfCanvasUtils.isFunnel(selection)) {
return 'icon-funnel'; return 'icon-funnel';
} else if (canvasUtils.isLabel(selection)) { } else if (nfCanvasUtils.isLabel(selection)) {
return 'icon-label'; return 'icon-label';
} else if (canvasUtils.isConnection(selection)) { } else if (nfCanvasUtils.isConnection(selection)) {
return 'icon-connect'; return 'icon-connect';
} }
} else { } else {
@ -224,7 +221,7 @@
* Will hide target when appropriate. * Will hide target when appropriate.
*/ */
hide: function () { hide: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
if (selection.size() > 1) { if (selection.size() > 1) {
return 'invisible' return 'invisible'
} else { } else {
@ -236,27 +233,27 @@
* Gets the name to show for the selection context. * Gets the name to show for the selection context.
*/ */
getContextName: function () { getContextName: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
var canRead = canvasUtils.canReadFromGroup(); var canRead = nfCanvasUtils.canReadFromGroup();
if (selection.empty()) { if (selection.empty()) {
if (canRead) { if (canRead) {
return canvasUtils.getGroupName(); return nfCanvasUtils.getGroupName();
} else { } else {
return canvasUtils.getGroupId(); return nfCanvasUtils.getGroupId();
} }
} else { } else {
if (selection.size() === 1) { if (selection.size() === 1) {
var d = selection.datum(); var d = selection.datum();
if (d.permissions.canRead) { if (d.permissions.canRead) {
if (canvasUtils.isLabel(selection)) { if (nfCanvasUtils.isLabel(selection)) {
if ($.trim(d.component.label) !== '') { if ($.trim(d.component.label) !== '') {
return d.component.label; return d.component.label;
} else { } else {
return ''; return '';
} }
} else if (canvasUtils.isConnection(selection)) { } else if (nfCanvasUtils.isConnection(selection)) {
return canvasUtils.formatConnectionName(d.component); return nfCanvasUtils.formatConnectionName(d.component);
} else { } else {
return d.component.name; return d.component.name;
} }
@ -273,27 +270,27 @@
* Gets the type to show for the selection context. * Gets the type to show for the selection context.
*/ */
getContextType: function () { getContextType: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
if (selection.empty()) { if (selection.empty()) {
return 'Process Group'; return 'Process Group';
} else { } else {
if (selection.size() === 1) { if (selection.size() === 1) {
if (canvasUtils.isProcessor(selection)) { if (nfCanvasUtils.isProcessor(selection)) {
return 'Processor'; return 'Processor';
} else if (canvasUtils.isProcessGroup(selection)) { } else if (nfCanvasUtils.isProcessGroup(selection)) {
return 'Process Group'; return 'Process Group';
} else if (canvasUtils.isInputPort(selection)) { } else if (nfCanvasUtils.isInputPort(selection)) {
return 'Input Port'; return 'Input Port';
} else if (canvasUtils.isOutputPort(selection)) { } else if (nfCanvasUtils.isOutputPort(selection)) {
return 'Output Port'; return 'Output Port';
} else if (canvasUtils.isRemoteProcessGroup(selection)) { } else if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
return 'Remote Process Group'; return 'Remote Process Group';
} else if (canvasUtils.isFunnel(selection)) { } else if (nfCanvasUtils.isFunnel(selection)) {
return 'Funnel'; return 'Funnel';
} else if (canvasUtils.isLabel(selection)) { } else if (nfCanvasUtils.isLabel(selection)) {
return 'Label'; return 'Label';
} else if (canvasUtils.isConnection(selection)) { } else if (nfCanvasUtils.isConnection(selection)) {
return 'Connection'; return 'Connection';
} }
} else { } else {
@ -306,10 +303,10 @@
* Gets the id to show for the selection context. * Gets the id to show for the selection context.
*/ */
getContextId: function () { getContextId: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
if (selection.empty()) { if (selection.empty()) {
return canvasUtils.getGroupId(); return nfCanvasUtils.getGroupId();
} else { } else {
if (selection.size() === 1) { if (selection.size() === 1) {
var d = selection.datum(); var d = selection.datum();
@ -324,29 +321,29 @@
* Determines whether the user can configure or open the details dialog. * Determines whether the user can configure or open the details dialog.
*/ */
canConfigureOrOpenDetails: function () { canConfigureOrOpenDetails: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
if (selection.empty()) { if (selection.empty()) {
return true; return true;
} }
return canvasUtils.isConfigurable(selection) || canvasUtils.hasDetails(selection); return nfCanvasUtils.isConfigurable(selection) || nfCanvasUtils.hasDetails(selection);
}, },
/** /**
* Opens either the configuration or details view based on the current state. * Opens either the configuration or details view based on the current state.
*/ */
openConfigureOrDetailsView: function () { openConfigureOrDetailsView: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
if (selection.empty()) { if (selection.empty()) {
processGroupConfiguration.showConfiguration(canvasUtils.getGroupId()); nfProcessGroupConfiguration.showConfiguration(nfCanvasUtils.getGroupId());
} }
if (canvasUtils.isConfigurable(selection)) { if (nfCanvasUtils.isConfigurable(selection)) {
actions.showConfiguration(selection); nfActions.showConfiguration(selection);
} else if (canvasUtils.hasDetails(selection)) { } else if (nfCanvasUtils.hasDetails(selection)) {
actions.showDetails(selection); nfActions.showDetails(selection);
} }
} }
} }

View File

@ -24,8 +24,8 @@
'nf.Storage', 'nf.Storage',
'nf.Shell', 'nf.Shell',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, common, storage, shell, errorHandler) { function ($, nfCommon, nfStorage, nfShell, nfErrorHandler) {
return (nf.ng.Canvas.HeaderCtrl = factory($, common, storage, shell, errorHandler)); return (nf.ng.Canvas.HeaderCtrl = factory($, nfCommon, nfStorage, nfShell, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.HeaderCtrl = module.exports = (nf.ng.Canvas.HeaderCtrl =
@ -41,7 +41,7 @@
root.nf.Shell, root.nf.Shell,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, common, storage, shell, errorHandler) { }(this, function ($, nfCommon, nfStorage, nfShell, nfErrorHandler) {
'use strict'; 'use strict';
return function (serviceProvider, toolboxCtrl, globalMenuCtrl, flowStatusCtrl) { return function (serviceProvider, toolboxCtrl, globalMenuCtrl, flowStatusCtrl) {
@ -72,7 +72,7 @@
var loginCtrl = this; var loginCtrl = this;
// if the user is not anonymous or accessing via http // if the user is not anonymous or accessing via http
if ($('#current-user').text() !== common.ANONYMOUS_USER_TEXT || location.protocol === 'http:') { if ($('#current-user').text() !== nfCommon.ANONYMOUS_USER_TEXT || location.protocol === 'http:') {
$('#login-link-container').css('display', 'none'); $('#login-link-container').css('display', 'none');
} }
@ -90,7 +90,7 @@
$.when(loginXhr).done(function (loginResult) { $.when(loginXhr).done(function (loginResult) {
loginCtrl.supportsLogin = loginResult.config.supportsLogin; loginCtrl.supportsLogin = loginResult.config.supportsLogin;
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -107,7 +107,7 @@
* Launch the login shell. * Launch the login shell.
*/ */
launch: function () { launch: function () {
shell.showPage('login', false); nfShell.showPage('login', false);
} }
} }
}; };
@ -117,7 +117,7 @@
*/ */
this.logoutCtrl = { this.logoutCtrl = {
logout: function () { logout: function () {
storage.removeItem("jwt"); nfStorage.removeItem("jwt");
window.location = '/nifi'; window.location = '/nifi';
} }
}; };

View File

@ -21,8 +21,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['nf.CanvasUtils', define(['nf.CanvasUtils',
'nf.ContextMenu'], 'nf.ContextMenu'],
function (canvasUtils, contextMenu) { function (nfCanvasUtils, nfContextMenu) {
return (nf.ng.Canvas.NavigateCtrl = factory(canvasUtils, contextMenu)); return (nf.ng.Canvas.NavigateCtrl = factory(nfCanvasUtils, nfContextMenu));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.NavigateCtrl = module.exports = (nf.ng.Canvas.NavigateCtrl =
@ -32,7 +32,7 @@
nf.ng.Canvas.NavigateCtrl = factory(root.nf.CanvasUtils, nf.ng.Canvas.NavigateCtrl = factory(root.nf.CanvasUtils,
root.nf.ContextMenu); root.nf.ContextMenu);
} }
}(this, function (canvasUtils, contextMenu) { }(this, function (nfCanvasUtils, nfContextMenu) {
'use strict'; 'use strict';
return function () { return function () {
@ -44,13 +44,13 @@
* Zoom in on the canvas. * Zoom in on the canvas.
*/ */
this.zoomIn = function () { this.zoomIn = function () {
canvasUtils.zoomCanvasViewIn(); nfCanvasUtils.zoomCanvasViewIn();
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
// refresh the canvas // refresh the canvas
canvasUtils.refreshCanvasView({ nfCanvasUtils.refreshCanvasView({
transition: true transition: true
}); });
}; };
@ -59,13 +59,13 @@
* Zoom out on the canvas. * Zoom out on the canvas.
*/ */
this.zoomOut = function () { this.zoomOut = function () {
canvasUtils.zoomCanvasViewOut(); nfCanvasUtils.zoomCanvasViewOut();
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
// refresh the canvas // refresh the canvas
canvasUtils.refreshCanvasView({ nfCanvasUtils.refreshCanvasView({
transition: true transition: true
}); });
}; };
@ -74,13 +74,13 @@
* Zoom fit on the canvas. * Zoom fit on the canvas.
*/ */
this.zoomFit = function () { this.zoomFit = function () {
canvasUtils.fitCanvasView(); nfCanvasUtils.fitCanvasView();
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
// refresh the canvas // refresh the canvas
canvasUtils.refreshCanvasView({ nfCanvasUtils.refreshCanvasView({
transition: true transition: true
}); });
}; };
@ -89,13 +89,13 @@
* Zoom actual size on the canvas. * Zoom actual size on the canvas.
*/ */
this.zoomActualSize = function () { this.zoomActualSize = function () {
canvasUtils.actualSizeCanvasView(); nfCanvasUtils.actualSizeCanvasView();
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
// refresh the canvas // refresh the canvas
canvasUtils.refreshCanvasView({ nfCanvasUtils.refreshCanvasView({
transition: true transition: true
}); });
}; };

View File

@ -27,8 +27,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.Processor'], 'nf.Processor'],
function ($, d3, dialog, birdseye, canvasUtils, common, client, processor) { function ($, d3, nfDialog, nfBirdseye, nfCanvasUtils, nfCommon, nfClient, nfProcessor) {
return (nf.ng.Canvas.OperateCtrl = factory($, d3, dialog, birdseye, canvasUtils, common, client, processor)); return (nf.ng.Canvas.OperateCtrl = factory($, d3, nfDialog, nfBirdseye, nfCanvasUtils, nfCommon, nfClient, nfProcessor));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.OperateCtrl = module.exports = (nf.ng.Canvas.OperateCtrl =
@ -50,7 +50,7 @@
root.nf.Client, root.nf.Client,
root.nf.Processor); root.nf.Processor);
} }
}(this, function ($, d3, dialog, birdseye, canvasUtils, common, client, processor) { }(this, function ($, d3, nfDialog, nfBirdseye, nfCanvasUtils, nfCommon, nfClient, nfProcessor) {
'use strict'; 'use strict';
return function () { return function () {
@ -154,12 +154,12 @@
dataType: 'xml', dataType: 'xml',
beforeSubmit: function (formData, $form, options) { beforeSubmit: function (formData, $form, options) {
// ensure uploading to the current process group // ensure uploading to the current process group
options.url += (encodeURIComponent(canvasUtils.getGroupId()) + '/templates/upload'); options.url += (encodeURIComponent(nfCanvasUtils.getGroupId()) + '/templates/upload');
}, },
success: function (response, statusText, xhr, form) { success: function (response, statusText, xhr, form) {
// see if the import was successful and inform the user // see if the import was successful and inform the user
if (response.documentElement.tagName === 'templateEntity') { if (response.documentElement.tagName === 'templateEntity') {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Success', headerText: 'Success',
dialogContent: 'Template successfully imported.' dialogContent: 'Template successfully imported.'
}); });
@ -169,23 +169,23 @@
if (response.documentElement.tagName === 'errorResponse') { if (response.documentElement.tagName === 'errorResponse') {
// if a more specific error was given, use it // if a more specific error was given, use it
var errorMessage = response.documentElement.getAttribute('statusText'); var errorMessage = response.documentElement.getAttribute('statusText');
if (!common.isBlank(errorMessage)) { if (!nfCommon.isBlank(errorMessage)) {
statusText = errorMessage; statusText = errorMessage;
} }
} }
// show reason // show reason
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Unable to Upload', headerText: 'Unable to Upload',
dialogContent: common.escapeHtml(statusText) dialogContent: nfCommon.escapeHtml(statusText)
}); });
} }
}, },
error: function (xhr, statusText, error) { error: function (xhr, statusText, error) {
// request failed // request failed
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Unable to Upload', headerText: 'Unable to Upload',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} }
}); });
@ -205,7 +205,7 @@
var selectedTemplate = $('#selected-template-name').text(); var selectedTemplate = $('#selected-template-name').text();
// submit the template if necessary // submit the template if necessary
if (common.isBlank(selectedTemplate)) { if (nfCommon.isBlank(selectedTemplate)) {
$('#upload-template-status').text('No template selected. Please browse to select a template.'); $('#upload-template-status').text('No template selected. Please browse to select a template.');
} else { } else {
templateForm.submit(); templateForm.submit();
@ -248,7 +248,7 @@
// add a handler for the change file input chain event // add a handler for the change file input chain event
$('#template-file-field').on('change', function (e) { $('#template-file-field').on('change', function (e) {
var filename = $(this).val(); var filename = $(this).val();
if (!common.isBlank(filename)) { if (!nfCommon.isBlank(filename)) {
filename = filename.replace(/^.*[\\\/]/, ''); filename = filename.replace(/^.*[\\\/]/, '');
} }
@ -320,7 +320,7 @@
}, },
handler: { handler: {
click: function () { click: function () {
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
// color the selected components // color the selected components
selection.each(function (d) { selection.each(function (d) {
@ -334,7 +334,7 @@
if (color !== selectedData.component.style['background-color']) { if (color !== selectedData.component.style['background-color']) {
// build the request entity // build the request entity
var entity = { var entity = {
'revision': client.getRevision(selectedData), 'revision': nfClient.getRevision(selectedData),
'component': { 'component': {
'id': selectedData.id, 'id': selectedData.id,
'style': { 'style': {
@ -352,16 +352,16 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// update the component // update the component
canvasUtils.getComponentByType(selectedData.type).set(response); nfCanvasUtils.getComponentByType(selectedData.type).set(response);
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Error', headerText: 'Error',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} }
}).always(function () { }).always(function () {
birdseye.refresh(); nfBirdseye.refresh();
}); });
} }
}); });
@ -448,13 +448,13 @@
if (hex.toLowerCase() === '#ffffff') { if (hex.toLowerCase() === '#ffffff') {
//special case #ffffff implies default fill //special case #ffffff implies default fill
$('#fill-color-processor-preview-icon').css({ $('#fill-color-processor-preview-icon').css({
'color': processor.defaultIconColor(), 'color': nfProcessor.defaultIconColor(),
'background-color': hex 'background-color': hex
}); });
} else { } else {
$('#fill-color-processor-preview-icon').css({ $('#fill-color-processor-preview-icon').css({
'color': common.determineContrastColor( 'color': nfCommon.determineContrastColor(
common.substringAfterLast( nfCommon.substringAfterLast(
hex, '#')), hex, '#')),
'background-color': hex 'background-color': hex
}); });
@ -472,7 +472,7 @@
'background': hex 'background': hex
}); });
$('#fill-color-label-preview-value').css('color', $('#fill-color-label-preview-value').css('color',
common.determineContrastColor(common.substringAfterLast(hex, '#')) nfCommon.determineContrastColor(nfCommon.substringAfterLast(hex, '#'))
); );
} }
}); });

View File

@ -21,8 +21,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['nf.CanvasUtils', define(['nf.CanvasUtils',
'nf.ContextMenu'], 'nf.ContextMenu'],
function (canvasUtils, contextMenu) { function (nfCanvasUtils, nfContextMenu) {
return (nf.ng.Canvas.ToolboxCtrl = factory(canvasUtils, contextMenu)); return (nf.ng.Canvas.ToolboxCtrl = factory(nfCanvasUtils, nfContextMenu));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Canvas.ToolboxCtrl = module.exports = (nf.ng.Canvas.ToolboxCtrl =
@ -32,7 +32,7 @@
nf.ng.Canvas.ToolboxCtrl = factory(root.nf.CanvasUtils, nf.ng.Canvas.ToolboxCtrl = factory(root.nf.CanvasUtils,
root.nf.ContextMenu); root.nf.ContextMenu);
} }
}(this, function (canvasUtils, contextMenu) { }(this, function (nfCanvasUtils, nfContextMenu) {
'use strict'; 'use strict';
return function (processorComponent, return function (processorComponent,
@ -127,14 +127,14 @@
cursor: '-webkit-grabbing', cursor: '-webkit-grabbing',
start: function (e, ui) { start: function (e, ui) {
// hide the context menu if necessary // hide the context menu if necessary
contextMenu.hide(); nfContextMenu.hide();
}, },
stop: function (e, ui) { stop: function (e, ui) {
var translate = canvasUtils.translateCanvasView(); var translate = nfCanvasUtils.translateCanvasView();
var scale = canvasUtils.scaleCanvasView(); var scale = nfCanvasUtils.scaleCanvasView();
var mouseX = e.originalEvent.pageX; var mouseX = e.originalEvent.pageX;
var mouseY = e.originalEvent.pageY - canvasUtils.getCanvasOffset(); var mouseY = e.originalEvent.pageY - nfCanvasUtils.getCanvasOffset();
// invoke the drop handler if we're over the canvas // invoke the drop handler if we're over the canvas
if (mouseX >= 0 && mouseY >= 0) { if (mouseX >= 0 && mouseY >= 0) {

View File

@ -25,8 +25,8 @@
'nf.Graph', 'nf.Graph',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, client, birdseye, graph, canvasUtils, errorHandler) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
return (nf.ng.FunnelComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler)); return (nf.ng.FunnelComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.FunnelComponent = module.exports = (nf.ng.FunnelComponent =
@ -44,7 +44,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -108,7 +108,7 @@
*/ */
createFunnel: function (pt) { createFunnel: function (pt) {
var outputPortEntity = { var outputPortEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -124,21 +124,21 @@
// create a new funnel // create a new funnel
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/funnels', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/funnels',
data: JSON.stringify(outputPortEntity), data: JSON.stringify(outputPortEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the funnel to the graph // add the funnel to the graph
graph.add({ nfGraph.add({
'funnels': [response] 'funnels': [response]
}, { }, {
'selectAll': true 'selectAll': true
}); });
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
} }

View File

@ -25,8 +25,8 @@
'nf.Graph', 'nf.Graph',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, client, birdseye, graph, canvasUtils, errorHandler) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
return (nf.ng.GroupComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler)); return (nf.ng.GroupComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.GroupComponent = module.exports = (nf.ng.GroupComponent =
@ -44,7 +44,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -58,7 +58,7 @@
*/ */
var createGroup = function (groupName, pt) { var createGroup = function (groupName, pt) {
var processGroupEntity = { var processGroupEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -75,24 +75,24 @@
// create a new processor of the defined type // create a new processor of the defined type
return $.ajax({ return $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/process-groups', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/process-groups',
data: JSON.stringify(processGroupEntity), data: JSON.stringify(processGroupEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the process group to the graph // add the process group to the graph
graph.add({ nfGraph.add({
'processGroups': [response] 'processGroups': [response]
}, { }, {
'selectAll': true 'selectAll': true
}); });
// update component visibility // update component visibility
graph.updateVisibility(); nfGraph.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
function GroupComponent() { function GroupComponent() {

View File

@ -25,8 +25,8 @@
'nf.Graph', 'nf.Graph',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, client, birdseye, graph, canvasUtils, errorHandler) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
return (nf.ng.InputPortComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler)); return (nf.ng.InputPortComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.InputPortComponent = module.exports = (nf.ng.InputPortComponent =
@ -44,7 +44,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -58,7 +58,7 @@
*/ */
var createInputPort = function (portName, pt) { var createInputPort = function (portName, pt) {
var inputPortEntity = { var inputPortEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -75,24 +75,24 @@
// create a new processor of the defined type // create a new processor of the defined type
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/input-ports', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/input-ports',
data: JSON.stringify(inputPortEntity), data: JSON.stringify(inputPortEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the port to the graph // add the port to the graph
graph.add({ nfGraph.add({
'inputPorts': [response] 'inputPorts': [response]
}, { }, {
'selectAll': true 'selectAll': true
}); });
// update component visibility // update component visibility
graph.updateVisibility(); nfGraph.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
function InputPortComponent() { function InputPortComponent() {

View File

@ -26,8 +26,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Label'], 'nf.Label'],
function ($, client, birdseye, graph, canvasUtils, errorHandler, label) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfLabel) {
return (nf.ng.LabelComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler, label)); return (nf.ng.LabelComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfLabel));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.LabelComponent = module.exports = (nf.ng.LabelComponent =
@ -47,7 +47,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Label); root.nf.Label);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler, label) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfLabel) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -111,14 +111,14 @@
*/ */
createLabel: function (pt) { createLabel: function (pt) {
var labelEntity = { var labelEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
}), }),
'component': { 'component': {
'width': label.config.width, 'width': nfLabel.config.width,
'height': label.config.height, 'height': nfLabel.config.height,
'position': { 'position': {
'x': pt.x, 'x': pt.x,
'y': pt.y 'y': pt.y
@ -129,21 +129,21 @@
// create a new label // create a new label
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/labels', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/labels',
data: JSON.stringify(labelEntity), data: JSON.stringify(labelEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the label to the graph // add the label to the graph
graph.add({ nfGraph.add({
'labels': [response] 'labels': [response]
}, { }, {
'selectAll': true 'selectAll': true
}); });
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
} }

View File

@ -25,8 +25,8 @@
'nf.Graph', 'nf.Graph',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, client, birdseye, graph, canvasUtils, errorHandler) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
return (nf.ng.OutputPortComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler)); return (nf.ng.OutputPortComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.OutputPortComponent = module.exports = (nf.ng.OutputPortComponent =
@ -44,7 +44,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -58,7 +58,7 @@
*/ */
var createOutputPort = function (portName, pt) { var createOutputPort = function (portName, pt) {
var outputPortEntity = { var outputPortEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -75,24 +75,24 @@
// create a new processor of the defined type // create a new processor of the defined type
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/output-ports', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/output-ports',
data: JSON.stringify(outputPortEntity), data: JSON.stringify(outputPortEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the port to the graph // add the port to the graph
graph.add({ nfGraph.add({
'outputPorts': [response] 'outputPorts': [response]
}, { }, {
'selectAll': true 'selectAll': true
}); });
// update component visibility // update component visibility
graph.updateVisibility(); nfGraph.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
function OutputPortComponent() { function OutputPortComponent() {

View File

@ -28,8 +28,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Dialog', 'nf.Dialog',
'nf.Common'], 'nf.Common'],
function ($, Slick, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) { function ($, Slick, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon) {
return (nf.ng.ProcessorComponent = factory($, Slick, client, birdseye, graph, canvasUtils, errorHandler, dialog, common)); return (nf.ng.ProcessorComponent = factory($, Slick, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.ProcessorComponent = module.exports = (nf.ng.ProcessorComponent =
@ -53,7 +53,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, Slick, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) { }(this, function ($, Slick, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -67,7 +67,7 @@
var processorTypesGrid = $('#processor-types-table').data('gridInstance'); var processorTypesGrid = $('#processor-types-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(processorTypesGrid)) { if (nfCommon.isDefinedAndNotNull(processorTypesGrid)) {
var processorTypesData = processorTypesGrid.getData(); var processorTypesData = processorTypesGrid.getData();
// update the search criteria // update the search criteria
@ -187,8 +187,8 @@
var sort = function (sortDetails, data) { var sort = function (sortDetails, data) {
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
}; };
@ -239,7 +239,7 @@
*/ */
var createProcessor = function (name, processorType, pt) { var createProcessor = function (name, processorType, pt) {
var processorEntity = { var processorEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -257,24 +257,24 @@
// create a new processor of the defined type // create a new processor of the defined type
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/processors', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/processors',
data: JSON.stringify(processorEntity), data: JSON.stringify(processorEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the processor to the graph // add the processor to the graph
graph.add({ nfGraph.add({
'processors': [response] 'processors': [response]
}, { }, {
'selectAll': true 'selectAll': true
}); });
// update component visibility // update component visibility
graph.updateVisibility(); nfGraph.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -283,7 +283,7 @@
* @param item process type * @param item process type
*/ */
var isSelectable = function (item) { var isSelectable = function (item) {
return common.isBlank(item.usageRestriction) || common.canAccessRestrictedComponents(); return nfCommon.isBlank(item.usageRestriction) || nfCommon.canAccessRestrictedComponents();
}; };
function ProcessorComponent() { function ProcessorComponent() {
@ -312,7 +312,7 @@
id: 'type', id: 'type',
name: 'Type', name: 'Type',
field: 'label', field: 'label',
formatter: common.typeFormatter, formatter: nfCommon.typeFormatter,
sortable: true, sortable: true,
resizable: true resizable: true
}, },
@ -368,8 +368,8 @@
var processorType = processorTypesGrid.getDataItem(processorTypeIndex); var processorType = processorTypesGrid.getDataItem(processorTypeIndex);
// set the processor type description // set the processor type description
if (common.isDefinedAndNotNull(processorType)) { if (nfCommon.isDefinedAndNotNull(processorType)) {
if (common.isBlank(processorType.description)) { if (nfCommon.isBlank(processorType.description)) {
$('#processor-type-description') $('#processor-type-description')
.attr('title', '') .attr('title', '')
.html('<span class="unset">No description specified</span>'); .html('<span class="unset">No description specified</span>');
@ -391,7 +391,7 @@
} }
}); });
processorTypesGrid.onViewportChanged.subscribe(function (e, args) { processorTypesGrid.onViewportChanged.subscribe(function (e, args) {
common.cleanUpTooltips($('#processor-types-table'), 'div.view-usage-restriction'); nfCommon.cleanUpTooltips($('#processor-types-table'), 'div.view-usage-restriction');
}); });
// wire up the dataview to the grid // wire up the dataview to the grid
@ -418,8 +418,8 @@
var item = processorTypesData.getItemById(rowId); var item = processorTypesData.getItemById(rowId);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(item.usageRestriction)) { if (nfCommon.isDefinedAndNotNull(item.usageRestriction)) {
usageRestriction.qtip($.extend({}, common.config.tooltipConfig, { usageRestriction.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: item.usageRestriction, content: item.usageRestriction,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -454,10 +454,10 @@
// create the row for the processor type // create the row for the processor type
processorTypesData.addItem({ processorTypesData.addItem({
id: i, id: i,
label: common.substringAfterLast(type, '.'), label: nfCommon.substringAfterLast(type, '.'),
type: type, type: type,
description: common.escapeHtml(documentedType.description), description: nfCommon.escapeHtml(documentedType.description),
usageRestriction: common.escapeHtml(documentedType.usageRestriction), usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction),
tags: documentedType.tags.join(', ') tags: documentedType.tags.join(', ')
}); });
@ -479,7 +479,7 @@
select: applyFilter, select: applyFilter,
remove: applyFilter remove: applyFilter
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}, },
@ -600,7 +600,7 @@
// ensure something was selected // ensure something was selected
if (name === '' || processorType === '') { if (name === '' || processorType === '') {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Add Processor', headerText: 'Add Processor',
dialogContent: 'The type of processor to create must be selected.' dialogContent: 'The type of processor to create must be selected.'
}); });

View File

@ -27,8 +27,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Dialog', 'nf.Dialog',
'nf.Common'], 'nf.Common'],
function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon) {
return (nf.ng.RemoteProcessGroupComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common)); return (nf.ng.RemoteProcessGroupComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.RemoteProcessGroupComponent = module.exports = (nf.ng.RemoteProcessGroupComponent =
@ -50,7 +50,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -64,7 +64,7 @@
var createRemoteProcessGroup = function (pt) { var createRemoteProcessGroup = function (pt) {
var remoteProcessGroupEntity = { var remoteProcessGroupEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -88,13 +88,13 @@
// create a new processor of the defined type // create a new processor of the defined type
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/remote-process-groups', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/remote-process-groups',
data: JSON.stringify(remoteProcessGroupEntity), data: JSON.stringify(remoteProcessGroupEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// add the processor to the graph // add the processor to the graph
graph.add({ nfGraph.add({
'remoteProcessGroups': [response] 'remoteProcessGroups': [response]
}, { }, {
'selectAll': true 'selectAll': true
@ -104,10 +104,10 @@
$('#new-remote-process-group-dialog').modal('hide'); $('#new-remote-process-group-dialog').modal('hide');
// update component visibility // update component visibility
graph.updateVisibility(); nfGraph.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400) { if (xhr.status === 400) {
var errors = xhr.responseText.split('\n'); var errors = xhr.responseText.split('\n');
@ -116,15 +116,15 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Configuration Error' headerText: 'Configuration Error'
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
}; };

View File

@ -27,8 +27,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Dialog', 'nf.Dialog',
'nf.Common'], 'nf.Common'],
function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) { function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon) {
return (nf.ng.TemplateComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common)); return (nf.ng.TemplateComponent = factory($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.TemplateComponent = module.exports = (nf.ng.TemplateComponent =
@ -50,7 +50,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) { }(this, function ($, nfClient, nfBirdseye, nfGraph, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon) {
'use strict'; 'use strict';
return function (serviceProvider) { return function (serviceProvider) {
@ -72,22 +72,22 @@
// create a new instance of the new template // create a new instance of the new template
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/template-instance', url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/template-instance',
data: JSON.stringify(instantiateTemplateInstance), data: JSON.stringify(instantiateTemplateInstance),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// populate the graph accordingly // populate the graph accordingly
graph.add(response.flow, { nfGraph.add(response.flow, {
'selectAll': true 'selectAll': true
}); });
// update component visibility // update component visibility
graph.updateVisibility(); nfGraph.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
function TemplateComponent() { function TemplateComponent() {
@ -205,11 +205,11 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
var templates = response.templates; var templates = response.templates;
if (common.isDefinedAndNotNull(templates) && templates.length > 0) { if (nfCommon.isDefinedAndNotNull(templates) && templates.length > 0) {
// sort the templates // sort the templates
templates = templates.sort(function (one, two) { templates = templates.sort(function (one, two) {
var oneDate = common.parseDateTime(one.template.timestamp); var oneDate = nfCommon.parseDateTime(one.template.timestamp);
var twoDate = common.parseDateTime(two.template.timestamp); var twoDate = nfCommon.parseDateTime(two.template.timestamp);
// newest templates first // newest templates first
return twoDate.getTime() - oneDate.getTime(); return twoDate.getTime() - oneDate.getTime();
@ -221,7 +221,7 @@
options.push({ options.push({
text: templateEntity.template.name, text: templateEntity.template.name,
value: templateEntity.id, value: templateEntity.id,
description: common.escapeHtml(templateEntity.template.description) description: nfCommon.escapeHtml(templateEntity.template.description)
}); });
} }
}); });
@ -271,13 +271,13 @@
// show the dialog // show the dialog
templateComponent.modal.show(); templateComponent.modal.show();
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Instantiate Template', headerText: 'Instantiate Template',
dialogContent: 'No templates have been loaded into this NiFi.' dialogContent: 'No templates have been loaded into this NiFi.'
}); });
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
} }

View File

@ -21,19 +21,17 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'd3', 'd3',
'nf.ErrorHandler',
'nf.Common', 'nf.Common',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ContextMenu', 'nf.ContextMenu',
'nf.Label'], 'nf.Label'],
function ($, d3, errorHandler, common, canvasUtils, contextMenu, label) { function ($, d3, nfCommon, nfCanvasUtils, nfContextMenu, nfLabel) {
return (nf.Birdseye = factory($, d3, errorHandler, common, canvasUtils, contextMenu, label)); return (nf.Birdseye = factory($, d3, nfCommon, nfCanvasUtils, nfContextMenu, nfLabel));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Birdseye = module.exports = (nf.Birdseye =
factory(require('jquery'), factory(require('jquery'),
require('d3'), require('d3'),
require('nf.ErrorHandler'),
require('nf.Common'), require('nf.Common'),
require('nf.CanvasUtils'), require('nf.CanvasUtils'),
require('nf.ContextMenu'), require('nf.ContextMenu'),
@ -41,13 +39,12 @@
} else { } else {
nf.Birdseye = factory(root.$, nf.Birdseye = factory(root.$,
root.d3, root.d3,
root.nf.ErrorHandler,
root.nf.Common, root.nf.Common,
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.ContextMenu, root.nf.ContextMenu,
root.nf.Label); root.nf.Label);
} }
}(this, function ($, d3, errorHandler, common, canvasUtils, contextMenu, label) { }(this, function ($, d3, nfCommon, nfCanvasUtils, nfContextMenu, nfLabel) {
'use strict'; 'use strict';
var nfGraph; var nfGraph;
@ -56,8 +53,8 @@
// refreshes the birdseye // refreshes the birdseye
var refresh = function (components) { var refresh = function (components) {
var translate = canvasUtils.translateCanvasView(); var translate = nfCanvasUtils.translateCanvasView();
var scale = canvasUtils.scaleCanvasView(); var scale = nfCanvasUtils.scaleCanvasView();
// scale the translation // scale the translation
translate = [translate[0] / scale, translate[1] / scale]; translate = [translate[0] / scale, translate[1] / scale];
@ -65,7 +62,7 @@
// get the bounding box for the graph and convert into canvas space // get the bounding box for the graph and convert into canvas space
var graphBox = d3.select('#canvas').node().getBoundingClientRect(); var graphBox = d3.select('#canvas').node().getBoundingClientRect();
var graphLeft = (graphBox.left / scale) - translate[0]; var graphLeft = (graphBox.left / scale) - translate[0];
var graphTop = ((graphBox.top - canvasUtils.getCanvasOffset()) / scale) - translate[1]; var graphTop = ((graphBox.top - nfCanvasUtils.getCanvasOffset()) / scale) - translate[1];
var graphRight = (graphBox.right / scale) - translate[0]; var graphRight = (graphBox.right / scale) - translate[0];
var graphBottom = (graphBox.bottom / scale) - translate[1]; var graphBottom = (graphBox.bottom / scale) - translate[1];
@ -181,11 +178,11 @@
// labels // labels
$.each(components.labels, function (_, d) { $.each(components.labels, function (_, d) {
var color = label.defaultColor(); var color = nfLabel.defaultColor();
if (d.permissions.canRead) { if (d.permissions.canRead) {
// use the specified color if appropriate // 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']; color = d.component.style['background-color'];
} }
} }
@ -224,7 +221,7 @@
if (d.permissions.canRead) { if (d.permissions.canRead) {
// use the specified color if appropriate // 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']; color = d.component.style['background-color'];
//if the background color is #ffffff use the default instead //if the background color is #ffffff use the default instead
@ -245,8 +242,14 @@
var visible = true; var visible = true;
var nfBirdseye = { var nfBirdseye = {
init: function (graph) {
nfGraph = graph; /**
* Initializes of the graph controller.
*
* @param nfGraphRef The nfConnectable module.
*/
init: function (nfGraphRef) {
nfGraph = nfGraphRef;
var birdseye = $('#birdseye'); var birdseye = $('#birdseye');
@ -278,7 +281,7 @@
}) })
.on('dragstart', function () { .on('dragstart', function () {
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
}) })
.on('drag', function (d) { .on('drag', function (d) {
d.x += d3.event.dx; d.x += d3.event.dx;
@ -289,17 +292,17 @@
return 'translate(' + d.x + ', ' + d.y + ')'; return 'translate(' + d.x + ', ' + d.y + ')';
}); });
// get the current transformation // get the current transformation
var scale = canvasUtils.scaleCanvasView(); var scale = nfCanvasUtils.scaleCanvasView();
var translate = canvasUtils.translateCanvasView(); var translate = nfCanvasUtils.translateCanvasView();
// update the translation according to the delta // update the translation according to the delta
translate = [(-d3.event.dx * scale) + translate[0], (-d3.event.dy * scale) + translate[1]]; translate = [(-d3.event.dx * scale) + translate[0], (-d3.event.dy * scale) + translate[1]];
// record the current transforms // record the current transforms
canvasUtils.translateCanvasView(translate); nfCanvasUtils.translateCanvasView(translate);
// refresh the canvas // refresh the canvas
canvasUtils.refreshCanvasView({ nfCanvasUtils.refreshCanvasView({
persist: false, persist: false,
transition: false, transition: false,
refreshComponents: false, refreshComponents: false,
@ -311,7 +314,7 @@
nfGraph.updateVisibility(); nfGraph.updateVisibility();
// persist the users view // persist the users view
canvasUtils.persistUserView(); nfCanvasUtils.persistUserView();
// refresh the birdseye // refresh the birdseye
nfBirdseye.refresh(); nfBirdseye.refresh();

View File

@ -79,8 +79,8 @@
'nf.ng.Canvas.OperateCtrl', 'nf.ng.Canvas.OperateCtrl',
'nf.ng.BreadcrumbsDirective', 'nf.ng.BreadcrumbsDirective',
'nf.ng.DraggableDirective'], 'nf.ng.DraggableDirective'],
function ($, angular, common, canvasUtils, errorHandler, client, clusterSummary, dialog, storage, canvas, graph, contextMenu, shell, settings, actions, snippet, queueListing, componentState, draggable, connectable, statusHistory, birdseye, connectionConfiguration, controllerService, reportingTask, policyManagement, processorConfiguration, processGroupConfiguration, controllerServices, remoteProcessGroupConfiguration, remoteProcessGroupPorts, portConfiguration, labelConfiguration, processorDetails, portDetails, connectionDetails, remoteProcessGroupDetails, nfGoto, angularBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) { function ($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfClusterSummary, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfShell, nfSettings, nfActions, nfSnippet, nfQueueListing, nfComponentState, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) {
return factory($, angular, common, canvasUtils, errorHandler, client, clusterSummary, dialog, storage, canvas, graph, contextMenu, shell, settings, actions, snippet, queueListing, componentState, draggable, connectable, statusHistory, birdseye, connectionConfiguration, controllerService, reportingTask, policyManagement, processorConfiguration, processGroupConfiguration, controllerServices, remoteProcessGroupConfiguration, remoteProcessGroupPorts, portConfiguration, labelConfiguration, processorDetails, portDetails, connectionDetails, remoteProcessGroupDetails, nfGoto, angularBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective); return factory($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfClusterSummary, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfShell, nfSettings, nfActions, nfSnippet, nfQueueListing, nfComponentState, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective);
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = factory(require('jquery'), module.exports = factory(require('jquery'),
@ -205,7 +205,7 @@
root.nf.ng.BreadcrumbsDirective, root.nf.ng.BreadcrumbsDirective,
root.nf.ng.DraggableDirective); root.nf.ng.DraggableDirective);
} }
}(this, function ($, angular, common, canvasUtils, errorHandler, client, clusterSummary, dialog, storage, canvas, graph, contextMenu, shell, settings, actions, snippet, queueListing, componentState, draggable, connectable, statusHistory, birdseye, connectionConfiguration, controllerService, reportingTask, policyManagement, processorConfiguration, processGroupConfiguration, controllerServices, remoteProcessGroupConfiguration, remoteProcessGroupPorts, portConfiguration, labelConfiguration, processorDetails, portDetails, connectionDetails, remoteProcessGroupDetails, nfGoto, angularBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) { }(this, function ($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfClusterSummary, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfShell, nfSettings, nfActions, nfSnippet, nfQueueListing, nfComponentState, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) {
var config = { var config = {
urls: { urls: {
@ -217,7 +217,7 @@
* Bootstrap the canvas application. * Bootstrap the canvas application.
*/ */
$(document).ready(function () { $(document).ready(function () {
if (canvas.SUPPORTS_SVG) { if (nfCanvas.SUPPORTS_SVG) {
//Create Angular App //Create Angular App
var app = angular.module('ngCanvasApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']); var app = angular.module('ngCanvasApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
@ -283,17 +283,17 @@
// initialize the canvas utils and invert control of the canvas, // initialize the canvas utils and invert control of the canvas,
// actions, snippet, birdseye, and graph // actions, snippet, birdseye, and graph
canvasUtils.init(canvas, actions, snippet, birdseye, graph); nfCanvasUtils.init(nfCanvas, nfActions, nfSnippet, nfBirdseye, nfGraph);
//Manually Boostrap Angular App //Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngCanvasApp'], {strictDi: true}); nfNgBridge.injector = angular.bootstrap($('body'), ['ngCanvasApp'], {strictDi: true});
// initialize the NiFi // initialize the NiFi
var userXhr = canvas.init(); var userXhr = nfCanvas.init();
userXhr.done(function () { userXhr.done(function () {
// load the client id // load the client id
var clientXhr = client.init(); var clientXhr = nfClient.init();
// get the controller config to register the status poller // get the controller config to register the status poller
var configXhr = $.ajax({ var configXhr = $.ajax({
@ -303,89 +303,89 @@
}); });
// ensure the config requests are loaded // ensure the config requests are loaded
$.when(configXhr, clusterSummary.loadClusterSummary(), userXhr, clientXhr).done(function (configResult) { $.when(configXhr, nfClusterSummary.loadClusterSummary(), userXhr, clientXhr).done(function (configResult) {
var configResponse = configResult[0]; var configResponse = configResult[0];
// calculate the canvas offset // calculate the canvas offset
var canvasContainer = $('#canvas-container'); var canvasContainer = $('#canvas-container');
canvas.CANVAS_OFFSET = canvasContainer.offset().top; nfCanvas.CANVAS_OFFSET = canvasContainer.offset().top;
// get the config details // get the config details
var configDetails = configResponse.flowConfiguration; var configDetails = configResponse.flowConfiguration;
// show disconnected message on load if necessary // show disconnected message on load if necessary
if (clusterSummary.isClustered() && !clusterSummary.isConnectedToCluster()) { if (nfClusterSummary.isClustered() && !nfClusterSummary.isConnectedToCluster()) {
dialog.showDisconnectedFromClusterMessage(); nfDialog.showDisconnectedFromClusterMessage();
} }
// get the auto refresh interval // get the auto refresh interval
var autoRefreshIntervalSeconds = parseInt(configDetails.autoRefreshIntervalSeconds, 10); var autoRefreshIntervalSeconds = parseInt(configDetails.autoRefreshIntervalSeconds, 10);
// record whether we can configure the authorizer // record whether we can configure the authorizer
canvas.setConfigurableAuthorizer(configDetails.supportsConfigurableAuthorizer); nfCanvas.setConfigurableAuthorizer(configDetails.supportsConfigurableAuthorizer);
// init storage // init nfStorage
storage.init(); nfStorage.init();
// initialize the application // initialize the application
canvas.initCanvas(); nfCanvas.initCanvas();
canvas.View.init(); nfCanvas.View.init();
// initialize the context menu and invert control of the actions // initialize the context menu and invert control of the actions
contextMenu.init(actions); nfContextMenu.init(nfActions);
// initialize the shell and invert control of the context menu // initialize the shell and invert control of the context menu
shell.init(contextMenu); nfShell.init(nfContextMenu);
angularBridge.injector.get('headerCtrl').init(); nfNgBridge.injector.get('headerCtrl').init();
settings.init(); nfSettings.init();
actions.init(); nfActions.init();
queueListing.init(); nfQueueListing.init();
componentState.init(); nfComponentState.init();
// initialize the component behaviors // initialize the component behaviors
draggable.init(); nfDraggable.init();
connectable.init(); nfConnectable.init();
// initialize the chart // initialize the chart
statusHistory.init(configDetails.timeOffset); nfStatusHistory.init(configDetails.timeOffset);
// initialize the birdseye // initialize the birdseye
birdseye.init(graph); nfBirdseye.init(nfGraph);
// initialize the connection config and invert control of the birdseye and graph // initialize the connection config and invert control of the birdseye and graph
connectionConfiguration.init(birdseye, graph); nfConnectionConfiguration.init(nfBirdseye, nfGraph);
controllerService.init(); nfControllerService.init();
reportingTask.init(settings); nfReportingTask.init(nfSettings);
policyManagement.init(); nfPolicyManagement.init();
processorConfiguration.init(); nfProcessorConfiguration.init();
// initialize the PG config and invert control of the controllerServices // initialize the PG config and invert control of the controllerServices
processGroupConfiguration.init(controllerServices); nfProcessGroupConfiguration.init(nfControllerServices);
remoteProcessGroupConfiguration.init(); nfRemoteProcessGroupConfiguration.init();
remoteProcessGroupPorts.init(); nfRemoteProcessGroupPorts.init();
portConfiguration.init(); nfPortConfiguration.init();
labelConfiguration.init(); nfLabelConfiguration.init();
processorDetails.init(true); nfProcessorDetails.init(true);
portDetails.init(); nfPortDetails.init();
connectionDetails.init(); nfConnectionDetails.init();
remoteProcessGroupDetails.init(); nfRemoteProcessGroupDetails.init();
nfGoto.init(); nfGoto.init();
graph.init().done(function () { nfGraph.init().done(function () {
angularBridge.injector.get('graphControlsCtrl').init(); nfNgBridge.injector.get('graphControlsCtrl').init();
// determine the split between the polling // determine the split between the polling
var pollingSplit = autoRefreshIntervalSeconds / 2; var pollingSplit = autoRefreshIntervalSeconds / 2;
// register the polling // register the polling
setTimeout(function () { setTimeout(function () {
canvas.startPolling(autoRefreshIntervalSeconds); nfCanvas.startPolling(autoRefreshIntervalSeconds);
}, pollingSplit * 1000); }, pollingSplit * 1000);
// hide the splash screen // hide the splash screen
canvas.hideSplash(); nfCanvas.hideSplash();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
//initialize toolbox components tooltips //initialize toolbox components tooltips
$('.component-button').qtip($.extend({}, common.config.tooltipConfig)); $('.component-button').qtip($.extend({}, nfCommon.config.tooltipConfig));
} else { } else {
$('#message-title').text('Unsupported Browser'); $('#message-title').text('Unsupported Browser');
$('#message-content').text('Flow graphs are shown using SVG. Please use a browser that supports rendering SVG.'); $('#message-content').text('Flow graphs are shown using SVG. Please use a browser that supports rendering SVG.');
@ -394,7 +394,7 @@
$('#message-pane').show(); $('#message-pane').show();
// hide the splash screen // hide the splash screen
canvas.hideSplash(); nfCanvas.hideSplash();
} }
}); });
})); }));

View File

@ -23,8 +23,8 @@
'nf.Common', 'nf.Common',
'nf.Canvas', 'nf.Canvas',
'nf.ContextMenu'], 'nf.ContextMenu'],
function (ajaxErrorHandler, common, canvas, contextMenu) { function (ajaxErrorHandler, nfCommon, nfCanvas, nfContextMenu) {
return (nf.ErrorHandler = factory(ajaxErrorHandler, common, canvas, contextMenu)); return (nf.ErrorHandler = factory(ajaxErrorHandler, nfCommon, nfCanvas, nfContextMenu));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ErrorHandler = module.exports = (nf.ErrorHandler =
@ -38,7 +38,7 @@
root.nf.Canvas, root.nf.Canvas,
root.nf.ContextMenu); root.nf.ContextMenu);
} }
}(this, function (ajaxErrorHandler, common, canvas, contextMenu) { }(this, function (ajaxErrorHandler, nfCommon, nfCanvas, nfContextMenu) {
'use strict'; 'use strict';
return { return {
@ -52,21 +52,21 @@
*/ */
handleAjaxError: function (xhr, status, error) { handleAjaxError: function (xhr, status, error) {
ajaxErrorHandler.handleAjaxError(xhr, status, error); ajaxErrorHandler.handleAjaxError(xhr, status, error);
common.showLogoutLink(); nfCommon.showLogoutLink();
// hide the splash screen if required // hide the splash screen if required
if ($('#splash').is(':visible')) { if ($('#splash').is(':visible')) {
canvas.hideSplash(); nfCanvas.hideSplash();
} }
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
// shut off the auto refresh // shut off the auto refresh
canvas.stopPolling(); nfCanvas.stopPolling();
// allow page refresh with ctrl-r // allow page refresh with ctrl-r
canvas.disableRefreshHotKey(); nfCanvas.disableRefreshHotKey();
} }
}; };
})); }));

View File

@ -24,8 +24,8 @@
'nf.Dialog', 'nf.Dialog',
'nf.Clipboard', 'nf.Clipboard',
'nf.Storage'], 'nf.Storage'],
function (d3, $, common, dialog, clipboard, storage) { function (d3, $, nfCommon, nfDialog, nfClipboard, nfStorage) {
return (nf.CanvasUtils = factory(d3, $, common, dialog, clipboard, storage)); return (nf.CanvasUtils = factory(d3, $, nfCommon, nfDialog, nfClipboard, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.CanvasUtils = factory( module.exports = (nf.CanvasUtils = factory(
@ -44,7 +44,7 @@
root.nf.Clipboard, root.nf.Clipboard,
root.nf.Storage); root.nf.Storage);
} }
}(this, function (d3, $, common, dialog, clipboard, storage) { }(this, function (d3, $, nfCommon, nfDialog, nfClipboard, nfStorage) {
'use strict'; 'use strict';
var nfCanvas; var nfCanvas;
@ -116,10 +116,10 @@
nfBirdseye.refresh(); nfBirdseye.refresh();
deferred.resolve(); deferred.resolve();
}).fail(common.handleAjaxError).fail(function () { }).fail(nfCommon.handleAjaxError).fail(function () {
deferred.reject(); deferred.reject();
}); });
}).fail(common.handleAjaxError).fail(function () { }).fail(nfCommon.handleAjaxError).fail(function () {
deferred.reject(); deferred.reject();
}); });
}).promise(); }).promise();
@ -130,18 +130,18 @@
/** /**
* Initialize the canvas utils. * Initialize the canvas utils.
* *
* @param canvas The reference to the canvas controller. * @param nfCanvasRef The nfCanvas module.
* @param actions The reference to the actions controller. * @param nfActionsRef The nfActions module.
* @param snippet The reference to the snippet controller. * @param nfSnippetRef The nfSnippet module.
* @param birdseye The reference to the birdseye controller. * @param nfBirdseyeRef The nfBirdseye module.
* @param graph The reference to the graph controller. * @param nfGraphRef The nfGraph module.
*/ */
init: function(canvas, actions, snippet, birdseye, graph){ init: function(nfCanvasRef, nfActionsRef, nfSnippetRef, nfBirdseyeRef, nfGraphRef){
nfCanvas = canvas; nfCanvas = nfCanvasRef;
nfActions = actions; nfActions = nfActionsRef;
nfSnippet = snippet; nfSnippet = nfSnippetRef;
nfBirdseye = birdseye; nfBirdseye = nfBirdseyeRef;
nfGraph = graph; nfGraph = nfGraphRef;
}, },
config: { config: {
@ -241,7 +241,7 @@
*/ */
showComponent: function (groupId, componentId) { showComponent: function (groupId, componentId) {
// ensure the group id is specified // ensure the group id is specified
if (common.isDefinedAndNotNull(groupId)) { if (nfCommon.isDefinedAndNotNull(groupId)) {
// initiate a graph refresh // initiate a graph refresh
var refreshGraph = $.Deferred(function (deferred) { var refreshGraph = $.Deferred(function (deferred) {
// load a different group if necessary // load a different group if necessary
@ -253,7 +253,7 @@
nfCanvas.reload().done(function () { nfCanvas.reload().done(function () {
deferred.resolve(); deferred.resolve();
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Group', headerText: 'Process Group',
dialogContent: 'Unable to load the group for the specified component.' dialogContent: 'Unable to load the group for the specified component.'
}); });
@ -271,7 +271,7 @@
if (!component.empty()) { if (!component.empty()) {
nfActions.show(component); nfActions.show(component);
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Group', headerText: 'Process Group',
dialogContent: 'Unable to find the specified component.' dialogContent: 'Unable to find the specified component.'
}); });
@ -313,21 +313,23 @@
* Enables/disables the editable behavior for the specified selection based on their access policies. * Enables/disables the editable behavior for the specified selection based on their access policies.
* *
* @param selection selection * @param selection selection
* @param nfConnectableRef The nfConnectable module.
* @param nfDraggableRef The nfDraggable module.
*/ */
editable: function (selection, connectable, draggable) { editable: function (selection, nfConnectableRef, nfDraggableRef) {
if (nfCanvasUtils.canModify(selection)) { if (nfCanvasUtils.canModify(selection)) {
if (!selection.classed('connectable')) { if (!selection.classed('connectable')) {
selection.call(connectable.activate); selection.call(nfConnectableRef.activate);
} }
if (!selection.classed('moveable')) { if (!selection.classed('moveable')) {
selection.call(draggable.activate); selection.call(nfDraggableRef.activate);
} }
} else { } else {
if (selection.classed('connectable')) { if (selection.classed('connectable')) {
selection.call(connectable.deactivate); selection.call(nfConnectableRef.deactivate);
} }
if (selection.classed('moveable')) { if (selection.classed('moveable')) {
selection.call(draggable.deactivate); selection.call(nfDraggableRef.deactivate);
} }
} }
}, },
@ -425,7 +427,7 @@
// go through each word // go through each word
var word = words.pop(); var word = words.pop();
while (common.isDefinedAndNotNull(word)) { while (nfCommon.isDefinedAndNotNull(word)) {
// add the current word // add the current word
line.push(word); line.push(word);
@ -536,20 +538,20 @@
* @param {function} offset Optional offset * @param {function} offset Optional offset
*/ */
bulletins: function (selection, d, getTooltipContainer, offset) { bulletins: function (selection, d, getTooltipContainer, offset) {
offset = common.isDefinedAndNotNull(offset) ? offset : 0; offset = nfCommon.isDefinedAndNotNull(offset) ? offset : 0;
// get the tip // get the tip
var tip = d3.select('#bulletin-tip-' + d.id); var tip = d3.select('#bulletin-tip-' + d.id);
var hasBulletins = false; var hasBulletins = false;
if (!common.isEmpty(d.bulletins)) { if (!nfCommon.isEmpty(d.bulletins)) {
// format the bulletins // format the bulletins
var bulletins = common.getFormattedBulletins(d.bulletins); var bulletins = nfCommon.getFormattedBulletins(d.bulletins);
hasBulletins = bulletins.length > 0; hasBulletins = bulletins.length > 0;
if (hasBulletins) { if (hasBulletins) {
// create the unordered list based off the formatted bulletins // create the unordered list based off the formatted bulletins
var list = common.formatUnorderedList(bulletins); var list = nfCommon.formatUnorderedList(bulletins);
} }
} }
@ -1094,7 +1096,7 @@
} }
// ensure access to read tenants // ensure access to read tenants
return common.canAccessTenants(); return nfCommon.canAccessTenants();
} }
return false; return false;
@ -1266,7 +1268,7 @@
* Determines if something is currently pastable. * Determines if something is currently pastable.
*/ */
isPastable: function () { isPastable: function () {
return nfCanvas.canWrite() && clipboard.isCopied(); return nfCanvas.canWrite() && nfClipboard.isCopied();
}, },
/** /**
@ -1284,7 +1286,7 @@
}; };
// store the item // store the item
storage.setItem(name, item); nfStorage.setItem(name, item);
}, },
/** /**
@ -1293,9 +1295,9 @@
* @param {object} connection * @param {object} connection
*/ */
formatConnectionName: function (connection) { formatConnectionName: function (connection) {
if (!common.isBlank(connection.name)) { if (!nfCommon.isBlank(connection.name)) {
return connection.name; return connection.name;
} else if (common.isDefinedAndNotNull(connection.selectedRelationships)) { } else if (nfCommon.isDefinedAndNotNull(connection.selectedRelationships)) {
return connection.selectedRelationships.join(', '); return connection.selectedRelationships.join(', ');
} }
return ''; return '';
@ -1308,13 +1310,13 @@
* @param {string} destinationComponentId The connection destination id * @param {string} destinationComponentId The connection destination id
*/ */
reloadConnectionSourceAndDestination: function (sourceComponentId, destinationComponentId) { reloadConnectionSourceAndDestination: function (sourceComponentId, destinationComponentId) {
if (common.isBlank(sourceComponentId) === false) { if (nfCommon.isBlank(sourceComponentId) === false) {
var source = d3.select('#id-' + sourceComponentId); var source = d3.select('#id-' + sourceComponentId);
if (source.empty() === false) { if (source.empty() === false) {
nfGraph.reload(source); nfGraph.reload(source);
} }
} }
if (common.isBlank(destinationComponentId) === false) { if (nfCommon.isBlank(destinationComponentId) === false) {
var destination = d3.select('#id-' + destinationComponentId); var destination = d3.select('#id-' + destinationComponentId);
if (destination.empty() === false) { if (destination.empty() === false) {
nfGraph.reload(destination); nfGraph.reload(destination);
@ -1362,10 +1364,10 @@
try { try {
// see if we can restore the view position from storage // see if we can restore the view position from storage
var name = config.storage.namePrefix + nfCanvas.getGroupId(); var name = config.storage.namePrefix + nfCanvas.getGroupId();
var item = storage.getItem(name); var item = nfStorage.getItem(name);
// ensure the item is valid // ensure the item is valid
if (common.isDefinedAndNotNull(item)) { if (nfCommon.isDefinedAndNotNull(item)) {
if (isFinite(item.scale) && isFinite(item.translateX) && isFinite(item.translateY)) { if (isFinite(item.scale) && isFinite(item.translateX) && isFinite(item.translateY)) {
// restore previous view // restore previous view
nfCanvas.View.translate([item.translateX, item.translateY]); nfCanvas.View.translate([item.translateX, item.translateY]);
@ -1398,10 +1400,10 @@
selection.each(function (d) { selection.each(function (d) {
var selected = d3.select(this); var selected = d3.select(this);
if (!nfCanvasUtils.isConnection(selected)) { if (!nfCanvasUtils.isConnection(selected)) {
if (common.isUndefined(origin.x) || d.position.x < origin.x) { if (nfCommon.isUndefined(origin.x) || d.position.x < origin.x) {
origin.x = d.position.x; origin.x = d.position.x;
} }
if (common.isUndefined(origin.y) || d.position.y < origin.y) { if (nfCommon.isUndefined(origin.y) || d.position.y < origin.y) {
origin.y = d.position.y; origin.y = d.position.y;
} }
} }
@ -1420,7 +1422,7 @@
// if the group id is null, we're already in the top most group // if the group id is null, we're already in the top most group
if (groupId === null) { if (groupId === null) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Group', headerText: 'Process Group',
dialogContent: 'Components are already in the topmost group.' dialogContent: 'Components are already in the topmost group.'
}); });

View File

@ -33,8 +33,8 @@
'nf.ContextMenu', 'nf.ContextMenu',
'nf.Actions', 'nf.Actions',
'nf.ProcessGroup'], 'nf.ProcessGroup'],
function ($, d3, common, nfGraph, nfShell, angularBridge, nfClusterSummary, errorHandler, storage, canvasUtils, birdseye, contextMenu, actions, processGroup) { function ($, d3, nfCommon, nfGraph, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils, nfBirdseye, nfContextMenu, nfActions, nfProcessGroup) {
return (nf.Canvas = factory($, d3, common, nfGraph, nfShell, angularBridge, nfClusterSummary, errorHandler, storage, canvasUtils, birdseye, contextMenu, actions, processGroup)); return (nf.Canvas = factory($, d3, nfCommon, nfGraph, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils, nfBirdseye, nfContextMenu, nfActions, nfProcessGroup));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Canvas = module.exports = (nf.Canvas =
@ -68,7 +68,7 @@
root.nf.Actions, root.nf.Actions,
root.nf.ProcessGroup); root.nf.ProcessGroup);
} }
}(this, function ($, d3, common, nfGraph, nfShell, angularBridge, nfClusterSummary, errorHandler, storage, canvasUtils, birdseye, contextMenu, actions, processGroup) { }(this, function ($, d3, nfCommon, nfGraph, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils, nfBirdseye, nfContextMenu, nfActions, nfProcessGroup) {
'use strict'; 'use strict';
var SCALE = 1; var SCALE = 1;
@ -155,17 +155,17 @@
permissions = flowResponse.permissions; permissions = flowResponse.permissions;
// update the breadcrumbs // update the breadcrumbs
angularBridge.injector.get('breadcrumbsCtrl').resetBreadcrumbs(); nfNgBridge.injector.get('breadcrumbsCtrl').resetBreadcrumbs();
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
angularBridge.injector.get('breadcrumbsCtrl').generateBreadcrumbs(breadcrumb); nfNgBridge.injector.get('breadcrumbsCtrl').generateBreadcrumbs(breadcrumb);
angularBridge.injector.get('breadcrumbsCtrl').resetScrollPosition(); nfNgBridge.injector.get('breadcrumbsCtrl').resetScrollPosition();
// update the timestamp // update the timestamp
$('#stats-last-refreshed').text(processGroupFlow.lastRefreshed); $('#stats-last-refreshed').text(processGroupFlow.lastRefreshed);
// set the parent id if applicable // set the parent id if applicable
if (common.isDefinedAndNotNull(processGroupFlow.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(processGroupFlow.parentGroupId)) {
nfCanvas.setParentGroupId(processGroupFlow.parentGroupId); nfCanvas.setParentGroupId(processGroupFlow.parentGroupId);
} else { } else {
nfCanvas.setParentGroupId(null); nfCanvas.setParentGroupId(null);
@ -181,8 +181,8 @@
nfCanvas.View.updateVisibility(); nfCanvas.View.updateVisibility();
// update the birdseye // update the birdseye
birdseye.refresh(); nfBirdseye.refresh();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -198,7 +198,7 @@
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
// set the current user // set the current user
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}); });
}; };
@ -240,26 +240,26 @@
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
// issue the requests // issue the requests
var processGroupXhr = reloadProcessGroup(nfCanvas.getGroupId(), options); var processGroupXhr = reloadProcessGroup(nfCanvas.getGroupId(), options);
var statusXhr = angularBridge.injector.get('flowStatusCtrl').reloadFlowStatus(); var statusXhr = nfNgBridge.injector.get('flowStatusCtrl').reloadFlowStatus();
var currentUserXhr = loadCurrentUser(); var currentUserXhr = loadCurrentUser();
var controllerBulletins = $.ajax({ var controllerBulletins = $.ajax({
type: 'GET', type: 'GET',
url: config.urls.controllerBulletins, url: config.urls.controllerBulletins,
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
angularBridge.injector.get('flowStatusCtrl').updateBulletins(response); nfNgBridge.injector.get('flowStatusCtrl').updateBulletins(response);
}); });
var clusterSummary = nfClusterSummary.loadClusterSummary().done(function (response) { var clusterSummary = nfClusterSummary.loadClusterSummary().done(function (response) {
var clusterSummary = response.clusterSummary; var clusterSummary = response.clusterSummary;
// update the cluster summary // update the cluster summary
angularBridge.injector.get('flowStatusCtrl').updateClusterSummary(clusterSummary); nfNgBridge.injector.get('flowStatusCtrl').updateClusterSummary(clusterSummary);
}); });
// wait for all requests to complete // wait for all requests to complete
$.when(processGroupXhr, statusXhr, currentUserXhr, controllerBulletins, clusterSummary).done(function (processGroupResult) { $.when(processGroupXhr, statusXhr, currentUserXhr, controllerBulletins, clusterSummary).done(function (processGroupResult) {
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
// resolve the deferred // resolve the deferred
deferred.resolve(processGroupResult); deferred.resolve(processGroupResult);
@ -282,10 +282,10 @@
canvasClicked = false; canvasClicked = false;
// since the context menu event propagated back to the canvas, clear the selection // since the context menu event propagated back to the canvas, clear the selection
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
// show the context menu on the canvas // show the context menu on the canvas
contextMenu.show(); nfContextMenu.show();
// prevent default browser behavior // prevent default browser behavior
d3.event.preventDefault(); d3.event.preventDefault();
@ -555,11 +555,11 @@
selectionBox.remove(); selectionBox.remove();
} else if (panning === false) { } else if (panning === false) {
// deselect as necessary if we are not panning // deselect as necessary if we are not panning
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
} }
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
}); });
// define a function for update the graph dimensions // define a function for update the graph dimensions
@ -587,7 +587,7 @@
}); });
//breadcrumbs //breadcrumbs
angularBridge.injector.get('breadcrumbsCtrl').updateBreadcrumbsCss({'bottom': bottom + 'px'}); nfNgBridge.injector.get('breadcrumbsCtrl').updateBreadcrumbsCss({'bottom': bottom + 'px'});
// body // body
$('#canvas-body').css({ $('#canvas-body').css({
@ -606,16 +606,16 @@
// listen for events to go to components // listen for events to go to components
$('body').on('GoTo:Component', function (e, item) { $('body').on('GoTo:Component', function (e, item) {
canvasUtils.showComponent(item.parentGroupId, item.id); nfCanvasUtils.showComponent(item.parentGroupId, item.id);
}); });
// listen for events to go to process groups // listen for events to go to process groups
$('body').on('GoTo:ProcessGroup', function (e, item) { $('body').on('GoTo:ProcessGroup', function (e, item) {
processGroup.enterGroup(item.id).done(function () { nfProcessGroup.enterGroup(item.id).done(function () {
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
// inform Angular app that values have changed // inform Angular app that values have changed
angularBridge.digest(); nfNgBridge.digest();
}); });
}); });
@ -670,7 +670,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
} }
}).on('keydown', function (evt) { }).on('keydown', function (evt) {
@ -680,7 +680,7 @@
} }
// get the current selection // get the current selection
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
// handle shortcuts // handle shortcuts
var isCtrl = evt.ctrlKey || evt.metaKey; var isCtrl = evt.ctrlKey || evt.metaKey;
@ -691,25 +691,25 @@
return; return;
} }
// ctrl-r // ctrl-r
actions.reload(); nfActions.reload();
// default prevented in nf-universal-capture.js // default prevented in nf-universal-capture.js
} else if (evt.keyCode === 65) { } else if (evt.keyCode === 65) {
// ctrl-a // ctrl-a
actions.selectAll(); nfActions.selectAll();
angularBridge.digest(); nfNgBridge.digest();
// only want to prevent default if the action was performed, otherwise default select all would be overridden // only want to prevent default if the action was performed, otherwise default select all would be overridden
evt.preventDefault(); evt.preventDefault();
} else if (evt.keyCode === 67) { } else if (evt.keyCode === 67) {
// ctrl-c // ctrl-c
if (nfCanvas.canWrite() && canvasUtils.isCopyable(selection)) { if (nfCanvas.canWrite() && nfCanvasUtils.isCopyable(selection)) {
actions.copy(selection); nfActions.copy(selection);
} }
} else if (evt.keyCode === 86) { } else if (evt.keyCode === 86) {
// ctrl-v // ctrl-v
if (nfCanvas.canWrite() && canvasUtils.isPastable()) { if (nfCanvas.canWrite() && nfCanvasUtils.isPastable()) {
actions.paste(selection); nfActions.paste(selection);
// only want to prevent default if the action was performed, otherwise default paste would be overridden // only want to prevent default if the action was performed, otherwise default paste would be overridden
evt.preventDefault(); evt.preventDefault();
@ -718,8 +718,8 @@
} else { } else {
if (evt.keyCode === 8 || evt.keyCode === 46) { if (evt.keyCode === 8 || evt.keyCode === 46) {
// backspace or delete // backspace or delete
if (nfCanvas.canWrite() && canvasUtils.areDeletable(selection)) { if (nfCanvas.canWrite() && nfCanvasUtils.areDeletable(selection)) {
actions['delete'](selection); nfActions['delete'](selection);
} }
// default prevented in nf-universal-capture.js // default prevented in nf-universal-capture.js
@ -734,14 +734,14 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text and show it // update the header text and show it
$('#banner-header').addClass('banner-header-background').text(response.banners.headerText).show(); $('#banner-header').addClass('banner-header-background').text(response.banners.headerText).show();
$('#canvas-container').css('top', '98px'); $('#canvas-container').css('top', '98px');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -757,7 +757,7 @@
// update the graph dimensions // update the graph dimensions
updateGraphSize(); updateGraphSize();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -766,7 +766,7 @@
init: function () { init: function () {
// attempt kerberos authentication // attempt kerberos authentication
var ticketExchange = $.Deferred(function (deferred) { var ticketExchange = $.Deferred(function (deferred) {
if (storage.hasItem('jwt')) { if (nfStorage.hasItem('jwt')) {
deferred.resolve(); deferred.resolve();
} else { } else {
$.ajax({ $.ajax({
@ -775,9 +775,9 @@
dataType: 'text' dataType: 'text'
}).done(function (jwt) { }).done(function (jwt) {
// get the payload and store the token with the appropriate expiration // get the payload and store the token with the appropriate expiration
var token = common.getJwtPayload(jwt); var token = nfCommon.getJwtPayload(jwt);
var expiration = parseInt(token['exp'], 10) * common.MILLIS_PER_SECOND; var expiration = parseInt(token['exp'], 10) * nfCommon.MILLIS_PER_SECOND;
storage.setItem('jwt', jwt, expiration); nfStorage.setItem('jwt', jwt, expiration);
deferred.resolve(); deferred.resolve();
}).fail(function () { }).fail(function () {
deferred.reject(); deferred.reject();
@ -795,12 +795,12 @@
$('#current-user').text(currentUser.identity).show(); $('#current-user').text(currentUser.identity).show();
// render the logout button if there is a token locally // render the logout button if there is a token locally
if (storage.getItem('jwt') !== null) { if (nfStorage.getItem('jwt') !== null) {
$('#logout-link-container').show(); $('#logout-link-container').show();
} }
} else { } else {
// set the anonymous user label // set the anonymous user label
common.setAnonymousUserLabel(); nfCommon.setAnonymousUserLabel();
} }
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
@ -1024,7 +1024,7 @@
.scale(SCALE) .scale(SCALE)
.on('zoomstart', function () { .on('zoomstart', function () {
// hide the context menu // hide the context menu
contextMenu.hide(); nfContextMenu.hide();
}) })
.on('zoom', function () { .on('zoom', function () {
// if we have zoomed, indicate that we are panning // if we have zoomed, indicate that we are panning
@ -1050,16 +1050,16 @@
}) })
.on('zoomend', function () { .on('zoomend', function () {
// ensure the canvas was actually refreshed // ensure the canvas was actually refreshed
if (common.isDefinedAndNotNull(refreshed)) { if (nfCommon.isDefinedAndNotNull(refreshed)) {
nfCanvas.View.updateVisibility(); nfCanvas.View.updateVisibility();
// refresh the birdseye // refresh the birdseye
refreshed.done(function () { refreshed.done(function () {
birdseye.refresh(); nfBirdseye.refresh();
}); });
// persist the users view // persist the users view
canvasUtils.persistUserView(); nfCanvasUtils.persistUserView();
// reset the refreshed deferred // reset the refreshed deferred
refreshed = null; refreshed = null;
@ -1096,7 +1096,7 @@
* @param {array} translate [x, y] * @param {array} translate [x, y]
*/ */
translate: function (translate) { translate: function (translate) {
if (common.isUndefined(translate)) { if (nfCommon.isUndefined(translate)) {
return behavior.translate(); return behavior.translate();
} else { } else {
behavior.translate(translate); behavior.translate(translate);
@ -1109,7 +1109,7 @@
* @param {number} scale The new scale * @param {number} scale The new scale
*/ */
scale: function (scale) { scale: function (scale) {
if (common.isUndefined(scale)) { if (nfCommon.isUndefined(scale)) {
return behavior.scale(); return behavior.scale();
} else { } else {
behavior.scale(scale); behavior.scale(scale);
@ -1133,7 +1133,7 @@
nfCanvas.View.scale(newScale); nfCanvas.View.scale(newScale);
// center around the center of the screen accounting for the translation accordingly // center around the center of the screen accounting for the translation accordingly
canvasUtils.centerBoundingBox({ nfCanvasUtils.centerBoundingBox({
x: (screenWidth / 2) - (translate[0] / scale), x: (screenWidth / 2) - (translate[0] / scale),
y: (screenHeight / 2) - (translate[1] / scale), y: (screenHeight / 2) - (translate[1] / scale),
width: 1, width: 1,
@ -1158,7 +1158,7 @@
nfCanvas.View.scale(newScale); nfCanvas.View.scale(newScale);
// center around the center of the screen accounting for the translation accordingly // center around the center of the screen accounting for the translation accordingly
canvasUtils.centerBoundingBox({ nfCanvasUtils.centerBoundingBox({
x: (screenWidth / 2) - (translate[0] / scale), x: (screenWidth / 2) - (translate[0] / scale),
y: (screenHeight / 2) - (translate[1] / scale), y: (screenHeight / 2) - (translate[1] / scale),
width: 1, width: 1,
@ -1205,7 +1205,7 @@
nfCanvas.View.scale(newScale); nfCanvas.View.scale(newScale);
// center as appropriate // center as appropriate
canvasUtils.centerBoundingBox({ nfCanvasUtils.centerBoundingBox({
x: graphLeft - (translate[0] / scale), x: graphLeft - (translate[0] / scale),
y: graphTop - (translate[1] / scale), y: graphTop - (translate[1] / scale),
width: canvasWidth / newScale, width: canvasWidth / newScale,
@ -1221,7 +1221,7 @@
var scale = nfCanvas.View.scale(); var scale = nfCanvas.View.scale();
// get the first selected component // get the first selected component
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
// set the updated scale // set the updated scale
nfCanvas.View.scale(1); nfCanvas.View.scale(1);
@ -1259,7 +1259,7 @@
} }
// center as appropriate // center as appropriate
canvasUtils.centerBoundingBox(box); nfCanvasUtils.centerBoundingBox(box);
}, },
/** /**
@ -1276,11 +1276,11 @@
var refreshBirdseye = true; var refreshBirdseye = true;
// extract the options if specified // extract the options if specified
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
persist = common.isDefinedAndNotNull(options.persist) ? options.persist : persist; persist = nfCommon.isDefinedAndNotNull(options.persist) ? options.persist : persist;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
refreshComponents = common.isDefinedAndNotNull(options.refreshComponents) ? options.refreshComponents : refreshComponents; refreshComponents = nfCommon.isDefinedAndNotNull(options.refreshComponents) ? options.refreshComponents : refreshComponents;
refreshBirdseye = common.isDefinedAndNotNull(options.refreshBirdseye) ? options.refreshBirdseye : refreshBirdseye; refreshBirdseye = nfCommon.isDefinedAndNotNull(options.refreshBirdseye) ? options.refreshBirdseye : refreshBirdseye;
} }
// update component visibility // update component visibility
@ -1290,7 +1290,7 @@
// persist if appropriate // persist if appropriate
if (persist === true) { if (persist === true) {
canvasUtils.persistUserView(); nfCanvasUtils.persistUserView();
} }
// update the canvas // update the canvas
@ -1303,7 +1303,7 @@
.each('end', function () { .each('end', function () {
// refresh birdseye if appropriate // refresh birdseye if appropriate
if (refreshBirdseye === true) { if (refreshBirdseye === true) {
birdseye.refresh(); nfBirdseye.refresh();
} }
deferred.resolve(); deferred.resolve();
@ -1315,7 +1315,7 @@
// refresh birdseye if appropriate // refresh birdseye if appropriate
if (refreshBirdseye === true) { if (refreshBirdseye === true) {
birdseye.refresh(); nfBirdseye.refresh();
} }
deferred.resolve(); deferred.resolve();

View File

@ -24,8 +24,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'nf.Common'], 'nf.Common'],
function ($, common) { function ($, nfCommon) {
return (nf.Clipboard = factory($, common)); return (nf.Clipboard = factory($, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Clipboard = module.exports = (nf.Clipboard =
@ -35,7 +35,7 @@
nf.Clipboard = factory(root.$, nf.Clipboard = factory(root.$,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, common) { }(this, function ($, nfCommon) {
'use strict'; 'use strict';
var COPY = 'copy'; var COPY = 'copy';
@ -60,7 +60,7 @@
* @argument {object} listener A clipboard listener * @argument {object} listener A clipboard listener
*/ */
removeListener: function (listener) { removeListener: function (listener) {
if (common.isDefinedAndNotNull(listeners[listener])) { if (nfCommon.isDefinedAndNotNull(listeners[listener])) {
delete listeners[listener]; delete listeners[listener];
} }
}, },
@ -83,7 +83,7 @@
* Checks to see if any data has been copied. * Checks to see if any data has been copied.
*/ */
isCopied: function () { isCopied: function () {
return common.isDefinedAndNotNull(data); return nfCommon.isDefinedAndNotNull(data);
}, },
/** /**
@ -93,7 +93,7 @@
paste: function () { paste: function () {
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
// ensure there was data // ensure there was data
if (common.isDefinedAndNotNull(data)) { if (nfCommon.isDefinedAndNotNull(data)) {
var clipboardData = data; var clipboardData = data;
// resolve the deferred // resolve the deferred

View File

@ -28,8 +28,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Dialog', 'nf.Dialog',
'nf.Common'], 'nf.Common'],
function ($, Slick, clusterSummary, errorHandler, dialog, common) { function ($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon) {
return (nf.ComponentState = factory($, Slick, clusterSummary, errorHandler, dialog, common)); return (nf.ComponentState = factory($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ComponentState = module.exports = (nf.ComponentState =
@ -47,7 +47,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, Slick, clusterSummary, errorHandler, dialog, common) { }(this, function ($, Slick, nfClusterSummary, nfErrorHandler, nfDialog, nfCommon) {
'use strict'; 'use strict';
/** /**
@ -58,7 +58,7 @@
var componentStateTable = $('#component-state-table').data('gridInstance'); var componentStateTable = $('#component-state-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(componentStateTable)) { if (nfCommon.isDefinedAndNotNull(componentStateTable)) {
var componentStateData = componentStateTable.getData(); var componentStateData = componentStateTable.getData();
// update the search criteria // update the search criteria
@ -95,7 +95,7 @@
// conditionally consider the scope // conditionally consider the scope
var matchesScope = false; var matchesScope = false;
if (common.isDefinedAndNotNull(item['scope'])) { if (nfCommon.isDefinedAndNotNull(item['scope'])) {
matchesScope = item['scope'].search(filterExp) >= 0; matchesScope = item['scope'].search(filterExp) >= 0;
} }
@ -111,8 +111,8 @@
var sort = function (sortDetails, data) { var sort = function (sortDetails, data) {
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
}; };
@ -162,7 +162,7 @@
componentStateData.beginUpdate(); componentStateData.beginUpdate();
// local state // local state
if (common.isDefinedAndNotNull(localState)) { if (nfCommon.isDefinedAndNotNull(localState)) {
$.each(localState.state, function (i, stateEntry) { $.each(localState.state, function (i, stateEntry) {
componentStateData.addItem($.extend({ componentStateData.addItem($.extend({
id: count++, id: count++,
@ -171,12 +171,12 @@
}); });
totalEntries += localState.totalEntryCount; totalEntries += localState.totalEntryCount;
if (common.isDefinedAndNotNull(localState.state) && localState.totalEntryCount !== localState.state.length) { if (nfCommon.isDefinedAndNotNull(localState.state) && localState.totalEntryCount !== localState.state.length) {
showPartialDetails = true; showPartialDetails = true;
} }
} }
if (common.isDefinedAndNotNull(clusterState)) { if (nfCommon.isDefinedAndNotNull(clusterState)) {
$.each(clusterState.state, function (i, stateEntry) { $.each(clusterState.state, function (i, stateEntry) {
componentStateData.addItem($.extend({ componentStateData.addItem($.extend({
id: count++, id: count++,
@ -185,7 +185,7 @@
}); });
totalEntries += clusterState.totalEntryCount; totalEntries += clusterState.totalEntryCount;
if (common.isDefinedAndNotNull(clusterState.state) && clusterState.totalEntryCount !== clusterState.state.length) { if (nfCommon.isDefinedAndNotNull(clusterState.state) && clusterState.totalEntryCount !== clusterState.state.length) {
showPartialDetails = true; showPartialDetails = true;
} }
} }
@ -199,7 +199,7 @@
} }
// update the total number of state entries // update the total number of state entries
$('#total-component-state-entries').text(common.formatInteger(totalEntries)); $('#total-component-state-entries').text(nfCommon.formatInteger(totalEntries));
}; };
/** /**
@ -281,9 +281,9 @@
// reload the table with no state // reload the table with no state
loadComponentState() loadComponentState()
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Component State', headerText: 'Component State',
dialogContent: 'This component has no state to clear.' dialogContent: 'This component has no state to clear.'
}); });
@ -310,7 +310,7 @@
]; ];
// conditionally show the cluster node identifier // conditionally show the cluster node identifier
if (clusterSummary.isClustered()) { if (nfClusterSummary.isClustered()) {
componentStateColumns.push({ componentStateColumns.push({
id: 'scope', id: 'scope',
field: 'scope', field: 'scope',
@ -418,7 +418,7 @@
// reset the grid size // reset the grid size
var componentStateGrid = componentStateTable.data('gridInstance'); var componentStateGrid = componentStateTable.data('gridInstance');
componentStateGrid.resizeCanvas(); componentStateGrid.resizeCanvas();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };
})); }));

View File

@ -23,8 +23,8 @@
'nf.Connection', 'nf.Connection',
'nf.ConnectionConfiguration', 'nf.ConnectionConfiguration',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function (d3, connection, connectionConfiguration, canvasUtils) { function (d3, nfConnection, nfConnectionConfiguration, nfCanvasUtils) {
return (nf.Connectable = factory(d3, connection, connectionConfiguration, canvasUtils)); return (nf.Connectable = factory(d3, nfConnection, nfConnectionConfiguration, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Connectable = module.exports = (nf.Connectable =
@ -38,7 +38,7 @@
root.nf.ConnectionConfiguration, root.nf.ConnectionConfiguration,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function (d3, connection, connectionConfiguration, canvasUtils) { }(this, function (d3, nfConnection, nfConnectionConfiguration, nfCanvasUtils) {
'use strict'; 'use strict';
var connect; var connect;
@ -78,7 +78,7 @@
d3.event.sourceEvent.stopPropagation(); d3.event.sourceEvent.stopPropagation();
// unselect the previous components // unselect the previous components
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
// mark the source component has selected // mark the source component has selected
var source = d3.select(this.parentNode).classed('selected', true); var source = d3.select(this.parentNode).classed('selected', true);
@ -128,7 +128,7 @@
// component to itself. requiring the mouse to have actually moved before // component to itself. requiring the mouse to have actually moved before
// checking the eligiblity of the destination addresses the issue // checking the eligiblity of the destination addresses the issue
return (Math.abs(origin[0] - d3.event.x) > 10 || Math.abs(origin[1] - d3.event.y) > 10) && return (Math.abs(origin[0] - d3.event.x) > 10 || Math.abs(origin[1] - d3.event.y) > 10) &&
canvasUtils.isValidConnectionDestination(d3.select(this)); nfCanvasUtils.isValidConnectionDestination(d3.select(this));
}); });
// update the drag line // update the drag line
@ -148,12 +148,12 @@
var x = pathDatum.x; var x = pathDatum.x;
var y = pathDatum.y; var y = pathDatum.y;
var componentOffset = pathDatum.sourceWidth / 2; var componentOffset = pathDatum.sourceWidth / 2;
var xOffset = connection.config.selfLoopXOffset; var xOffset = nfConnection.config.selfLoopXOffset;
var yOffset = connection.config.selfLoopYOffset; var yOffset = nfConnection.config.selfLoopYOffset;
return 'M' + x + ' ' + y + 'L' + (x + componentOffset + xOffset) + ' ' + (y - yOffset) + 'L' + (x + componentOffset + xOffset) + ' ' + (y + yOffset) + 'Z'; return 'M' + x + ' ' + y + 'L' + (x + componentOffset + xOffset) + ' ' + (y - yOffset) + 'L' + (x + componentOffset + xOffset) + ' ' + (y + yOffset) + 'Z';
} else { } else {
// get the position on the destination perimeter // get the position on the destination perimeter
var end = canvasUtils.getPerimeterPoint(pathDatum, { var end = nfCanvasUtils.getPerimeterPoint(pathDatum, {
'x': destinationData.position.x, 'x': destinationData.position.x,
'y': destinationData.position.y, 'y': destinationData.position.y,
'width': destinationData.dimensions.width, 'width': destinationData.dimensions.width,
@ -212,7 +212,7 @@
// create the connection // create the connection
var destinationData = destination.datum(); var destinationData = destination.datum();
connectionConfiguration.createConnection(connectorData.sourceId, destinationData.id); nfConnectionConfiguration.createConnection(connectorData.sourceId, destinationData.id);
} }
}); });
}, },
@ -230,7 +230,7 @@
var selection = d3.select(this); var selection = d3.select(this);
// ensure the current component supports connection source // ensure the current component supports connection source
if (canvasUtils.isValidConnectionSource(selection)) { if (nfCanvasUtils.isValidConnectionSource(selection)) {
// see if theres already a connector rendered // see if theres already a connector rendered
var addConnect = d3.select('text.add-connect'); var addConnect = d3.select('text.add-connect');
if (addConnect.empty()) { if (addConnect.empty()) {

View File

@ -27,8 +27,8 @@
'nf.Client', 'nf.Client',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.Connection'], 'nf.Connection'],
function ($, d3, errorHandler, common, dialog, client, canvasUtils, connection) { function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfConnection) {
return (nf.ConnectionConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, connection)); return (nf.ConnectionConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfConnection));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ConnectionConfiguration = module.exports = (nf.ConnectionConfiguration =
@ -50,7 +50,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.Connection); root.nf.Connection);
} }
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, connection) { }(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfConnection) {
'use strict'; 'use strict';
var nfBirdseye; var nfBirdseye;
@ -80,11 +80,11 @@
*/ */
var initializeSourceNewConnectionDialog = function (source) { var initializeSourceNewConnectionDialog = function (source) {
// handle the selected source // handle the selected source
if (canvasUtils.isProcessor(source)) { if (nfCanvasUtils.isProcessor(source)) {
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
// initialize the source processor // initialize the source processor
initializeSourceProcessor(source).done(function (processor) { initializeSourceProcessor(source).done(function (processor) {
if (!common.isEmpty(processor.relationships)) { if (!nfCommon.isEmpty(processor.relationships)) {
// populate the available connections // populate the available connections
$.each(processor.relationships, function (i, relationship) { $.each(processor.relationships, function (i, relationship) {
createRelationshipOption(relationship.name); createRelationshipOption(relationship.name);
@ -114,7 +114,7 @@
addConnection(selectedRelationships); addConnection(selectedRelationships);
} else { } else {
// inform users that no relationships were selected // inform users that no relationships were selected
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: 'The connection must have at least one relationship selected.' dialogContent: 'The connection must have at least one relationship selected.'
}); });
@ -143,9 +143,9 @@
deferred.resolve(); deferred.resolve();
} else { } else {
// there are no relationships for this processor // there are no relationships for this processor
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: '\'' + common.escapeHtml(processor.name) + '\' does not support any relationships.' dialogContent: '\'' + nfCommon.escapeHtml(processor.name) + '\' does not support any relationships.'
}); });
// reset the dialog // reset the dialog
@ -161,11 +161,11 @@
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
// determine how to initialize the source // determine how to initialize the source
var connectionSourceDeferred; var connectionSourceDeferred;
if (canvasUtils.isInputPort(source)) { if (nfCanvasUtils.isInputPort(source)) {
connectionSourceDeferred = initializeSourceInputPort(source); connectionSourceDeferred = initializeSourceInputPort(source);
} else if (canvasUtils.isRemoteProcessGroup(source)) { } else if (nfCanvasUtils.isRemoteProcessGroup(source)) {
connectionSourceDeferred = initializeSourceRemoteProcessGroup(source); connectionSourceDeferred = initializeSourceRemoteProcessGroup(source);
} else if (canvasUtils.isProcessGroup(source)) { } else if (nfCanvasUtils.isProcessGroup(source)) {
connectionSourceDeferred = initializeSourceProcessGroup(source); connectionSourceDeferred = initializeSourceProcessGroup(source);
} else { } else {
connectionSourceDeferred = initializeSourceFunnel(source); connectionSourceDeferred = initializeSourceFunnel(source);
@ -233,8 +233,8 @@
$('#connection-source-component-id').val(inputPortData.id); $('#connection-source-component-id').val(inputPortData.id);
// populate the group details // populate the group details
$('#connection-source-group-id').val(canvasUtils.getGroupId()); $('#connection-source-group-id').val(nfCanvasUtils.getGroupId());
$('#connection-source-group-name').text(canvasUtils.getGroupName()); $('#connection-source-group-name').text(nfCanvasUtils.getGroupName());
// resolve the deferred // resolve the deferred
deferred.resolve(); deferred.resolve();
@ -259,8 +259,8 @@
$('#connection-source-component-id').val(funnelData.id); $('#connection-source-component-id').val(funnelData.id);
// populate the group details // populate the group details
$('#connection-source-group-id').val(canvasUtils.getGroupId()); $('#connection-source-group-id').val(nfCanvasUtils.getGroupId());
$('#connection-source-group-name').text(canvasUtils.getGroupName()); $('#connection-source-group-name').text(nfCanvasUtils.getGroupName());
// resolve the deferred // resolve the deferred
deferred.resolve(); deferred.resolve();
@ -277,7 +277,7 @@
// get the processor data // get the processor data
var processorData = source.datum(); var processorData = source.datum();
var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id; var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id;
var processorType = processorData.permissions.canRead ? common.substringAfterLast(processorData.component.type, '.') : 'Processor'; var processorType = processorData.permissions.canRead ? nfCommon.substringAfterLast(processorData.component.type, '.') : 'Processor';
// populate the source processor information // populate the source processor information
$('#processor-source').show(); $('#processor-source').show();
@ -289,8 +289,8 @@
$('#connection-source-component-id').val(processorData.id); $('#connection-source-component-id').val(processorData.id);
// populate the group details // populate the group details
$('#connection-source-group-id').val(canvasUtils.getGroupId()); $('#connection-source-group-id').val(nfCanvasUtils.getGroupId());
$('#connection-source-group-name').text(canvasUtils.getGroupName()); $('#connection-source-group-name').text(nfCanvasUtils.getGroupName());
// show the available relationships // show the available relationships
$('#relationship-names-container').show(); $('#relationship-names-container').show();
@ -327,13 +327,13 @@
options.push({ options.push({
text: component.name, text: component.name,
value: component.id, value: component.id,
description: common.escapeHtml(component.comments) description: nfCommon.escapeHtml(component.comments)
}); });
} }
}); });
// only proceed if there are output ports // only proceed if there are output ports
if (!common.isEmpty(options)) { if (!nfCommon.isEmpty(options)) {
$('#output-port-source').show(); $('#output-port-source').show();
// sort the options // sort the options
@ -359,13 +359,13 @@
deferred.resolve(); deferred.resolve();
} else { } else {
var message = '\'' + common.escapeHtml(processGroupName) + '\' does not have any output ports.'; var message = '\'' + nfCommon.escapeHtml(processGroupName) + '\' does not have any output ports.';
if (common.isEmpty(processGroupContents.outputPorts) === false) { if (nfCommon.isEmpty(processGroupContents.outputPorts) === false) {
message = 'Not authorized for any output ports in \'' + common.escapeHtml(processGroupName) + '\'.'; message = 'Not authorized for any output ports in \'' + nfCommon.escapeHtml(processGroupName) + '\'.';
} }
// there are no output ports for this process group // there are no output ports for this process group
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: message dialogContent: message
}); });
@ -377,7 +377,7 @@
} }
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
// handle the error // handle the error
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
@ -403,7 +403,7 @@
var remoteProcessGroupContents = remoteProcessGroup.contents; var remoteProcessGroupContents = remoteProcessGroup.contents;
// only proceed if there are output ports // only proceed if there are output ports
if (!common.isEmpty(remoteProcessGroupContents.outputPorts)) { if (!nfCommon.isEmpty(remoteProcessGroupContents.outputPorts)) {
$('#output-port-source').show(); $('#output-port-source').show();
// show the output port options // show the output port options
@ -413,7 +413,7 @@
text: outputPort.name, text: outputPort.name,
value: outputPort.id, value: outputPort.id,
disabled: outputPort.exists === false, disabled: outputPort.exists === false,
description: common.escapeHtml(outputPort.comments) description: nfCommon.escapeHtml(outputPort.comments)
}); });
}); });
@ -441,9 +441,9 @@
deferred.resolve(); deferred.resolve();
} else { } else {
// there are no relationships for this processor // there are no relationships for this processor
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: '\'' + common.escapeHtml(remoteProcessGroup.name) + '\' does not have any output ports.' dialogContent: '\'' + nfCommon.escapeHtml(remoteProcessGroup.name) + '\' does not have any output ports.'
}); });
// reset the dialog // reset the dialog
@ -453,7 +453,7 @@
} }
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
// handle the error // handle the error
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
@ -461,13 +461,13 @@
}; };
var initializeDestinationNewConnectionDialog = function (destination) { var initializeDestinationNewConnectionDialog = function (destination) {
if (canvasUtils.isOutputPort(destination)) { if (nfCanvasUtils.isOutputPort(destination)) {
return initializeDestinationOutputPort(destination); return initializeDestinationOutputPort(destination);
} else if (canvasUtils.isProcessor(destination)) { } else if (nfCanvasUtils.isProcessor(destination)) {
return initializeDestinationProcessor(destination); return initializeDestinationProcessor(destination);
} else if (canvasUtils.isRemoteProcessGroup(destination)) { } else if (nfCanvasUtils.isRemoteProcessGroup(destination)) {
return initializeDestinationRemoteProcessGroup(destination); return initializeDestinationRemoteProcessGroup(destination);
} else if (canvasUtils.isFunnel(destination)) { } else if (nfCanvasUtils.isFunnel(destination)) {
return initializeDestinationFunnel(destination); return initializeDestinationFunnel(destination);
} else { } else {
return initializeDestinationProcessGroup(destination); return initializeDestinationProcessGroup(destination);
@ -487,8 +487,8 @@
$('#connection-destination-component-id').val(outputPortData.id); $('#connection-destination-component-id').val(outputPortData.id);
// populate the group details // populate the group details
$('#connection-destination-group-id').val(canvasUtils.getGroupId()); $('#connection-destination-group-id').val(nfCanvasUtils.getGroupId());
$('#connection-destination-group-name').text(canvasUtils.getGroupName()); $('#connection-destination-group-name').text(nfCanvasUtils.getGroupName());
deferred.resolve(); deferred.resolve();
}).promise(); }).promise();
@ -505,8 +505,8 @@
$('#connection-destination-component-id').val(funnelData.id); $('#connection-destination-component-id').val(funnelData.id);
// populate the group details // populate the group details
$('#connection-destination-group-id').val(canvasUtils.getGroupId()); $('#connection-destination-group-id').val(nfCanvasUtils.getGroupId());
$('#connection-destination-group-name').text(canvasUtils.getGroupName()); $('#connection-destination-group-name').text(nfCanvasUtils.getGroupName());
deferred.resolve(); deferred.resolve();
}).promise(); }).promise();
@ -516,7 +516,7 @@
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
var processorData = destination.datum(); var processorData = destination.datum();
var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id; var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id;
var processorType = processorData.permissions.canRead ? common.substringAfterLast(processorData.component.type, '.') : 'Processor'; var processorType = processorData.permissions.canRead ? nfCommon.substringAfterLast(processorData.component.type, '.') : 'Processor';
$('#processor-destination').show(); $('#processor-destination').show();
$('#processor-destination-name').text(processorName).attr('title', processorName); $('#processor-destination-name').text(processorName).attr('title', processorName);
@ -527,8 +527,8 @@
$('#connection-destination-component-id').val(processorData.id); $('#connection-destination-component-id').val(processorData.id);
// populate the group details // populate the group details
$('#connection-destination-group-id').val(canvasUtils.getGroupId()); $('#connection-destination-group-id').val(nfCanvasUtils.getGroupId());
$('#connection-destination-group-name').text(canvasUtils.getGroupName()); $('#connection-destination-group-name').text(nfCanvasUtils.getGroupName());
deferred.resolve(); deferred.resolve();
}).promise(); }).promise();
@ -558,12 +558,12 @@
options.push({ options.push({
text: inputPort.permissions.canRead ? inputPort.component.name : inputPort.id, text: inputPort.permissions.canRead ? inputPort.component.name : inputPort.id,
value: inputPort.id, value: inputPort.id,
description: inputPort.permissions.canRead ? common.escapeHtml(inputPort.component.comments) : null description: inputPort.permissions.canRead ? nfCommon.escapeHtml(inputPort.component.comments) : null
}); });
}); });
// only proceed if there are output ports // only proceed if there are output ports
if (!common.isEmpty(options)) { if (!nfCommon.isEmpty(options)) {
$('#input-port-destination').show(); $('#input-port-destination').show();
// sort the options // sort the options
@ -590,9 +590,9 @@
deferred.resolve(); deferred.resolve();
} else { } else {
// there are no relationships for this processor // there are no relationships for this processor
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: '\'' + common.escapeHtml(processGroupName) + '\' does not have any input ports.' dialogContent: '\'' + nfCommon.escapeHtml(processGroupName) + '\' does not have any input ports.'
}); });
// reset the dialog // reset the dialog
@ -602,7 +602,7 @@
} }
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
// handle the error // handle the error
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
@ -628,7 +628,7 @@
var remoteProcessGroupContents = remoteProcessGroup.contents; var remoteProcessGroupContents = remoteProcessGroup.contents;
// only proceed if there are output ports // only proceed if there are output ports
if (!common.isEmpty(remoteProcessGroupContents.inputPorts)) { if (!nfCommon.isEmpty(remoteProcessGroupContents.inputPorts)) {
$('#input-port-destination').show(); $('#input-port-destination').show();
// show the input port options // show the input port options
@ -638,7 +638,7 @@
text: inputPort.name, text: inputPort.name,
value: inputPort.id, value: inputPort.id,
disabled: inputPort.exists === false, disabled: inputPort.exists === false,
description: common.escapeHtml(inputPort.comments) description: nfCommon.escapeHtml(inputPort.comments)
}); });
}); });
@ -666,9 +666,9 @@
deferred.resolve(); deferred.resolve();
} else { } else {
// there are no relationships for this processor // there are no relationships for this processor
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: '\'' + common.escapeHtml(remoteProcessGroup.name) + '\' does not have any input ports.' dialogContent: '\'' + nfCommon.escapeHtml(remoteProcessGroup.name) + '\' does not have any input ports.'
}); });
// reset the dialog // reset the dialog
@ -678,7 +678,7 @@
} }
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
// handle the error // handle the error
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
@ -716,11 +716,11 @@
* @argument {selection} source The source * @argument {selection} source The source
*/ */
var initializeSourceEditConnectionDialog = function (source) { var initializeSourceEditConnectionDialog = function (source) {
if (canvasUtils.isProcessor(source)) { if (nfCanvasUtils.isProcessor(source)) {
return initializeSourceProcessor(source); return initializeSourceProcessor(source);
} else if (canvasUtils.isInputPort(source)) { } else if (nfCanvasUtils.isInputPort(source)) {
return initializeSourceInputPort(source); return initializeSourceInputPort(source);
} else if (canvasUtils.isFunnel(source)) { } else if (nfCanvasUtils.isFunnel(source)) {
return initializeSourceFunnel(source); return initializeSourceFunnel(source);
} else { } else {
return initializeSourceReadOnlyGroup(source); return initializeSourceReadOnlyGroup(source);
@ -734,13 +734,13 @@
* @argument {object} connectionDestination The connection destination object * @argument {object} connectionDestination The connection destination object
*/ */
var initializeDestinationEditConnectionDialog = function (destination, connectionDestination) { var initializeDestinationEditConnectionDialog = function (destination, connectionDestination) {
if (canvasUtils.isProcessor(destination)) { if (nfCanvasUtils.isProcessor(destination)) {
return initializeDestinationProcessor(destination); return initializeDestinationProcessor(destination);
} else if (canvasUtils.isOutputPort(destination)) { } else if (nfCanvasUtils.isOutputPort(destination)) {
return initializeDestinationOutputPort(destination); return initializeDestinationOutputPort(destination);
} else if (canvasUtils.isRemoteProcessGroup(destination)) { } else if (nfCanvasUtils.isRemoteProcessGroup(destination)) {
return initializeDestinationRemoteProcessGroup(destination, connectionDestination); return initializeDestinationRemoteProcessGroup(destination, connectionDestination);
} else if (canvasUtils.isFunnel(destination)) { } else if (nfCanvasUtils.isFunnel(destination)) {
return initializeDestinationFunnel(destination); return initializeDestinationFunnel(destination);
} else { } else {
return initializeDestinationProcessGroup(destination); return initializeDestinationProcessGroup(destination);
@ -787,8 +787,8 @@
y: sourceData.position.y + (sourceData.dimensions.height / 2) y: sourceData.position.y + (sourceData.dimensions.height / 2)
}; };
var xOffset = connection.config.selfLoopXOffset; var xOffset = nfConnection.config.selfLoopXOffset;
var yOffset = connection.config.selfLoopYOffset; var yOffset = nfConnection.config.selfLoopYOffset;
bends.push({ bends.push({
'x': (rightCenter.x + xOffset), 'x': (rightCenter.x + xOffset),
'y': (rightCenter.y - yOffset) 'y': (rightCenter.y - yOffset)
@ -801,11 +801,11 @@
var existingConnections = []; var existingConnections = [];
// get all connections for the source component // get all connections for the source component
var connectionsForSourceComponent = connection.getComponentConnections(sourceComponentId); var connectionsForSourceComponent = nfConnection.getComponentConnections(sourceComponentId);
$.each(connectionsForSourceComponent, function (_, connectionForSourceComponent) { $.each(connectionsForSourceComponent, function (_, connectionForSourceComponent) {
// get the id for the source/destination component // get the id for the source/destination component
var connectionSourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionForSourceComponent); var connectionSourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(connectionForSourceComponent);
var connectionDestinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionForSourceComponent); var connectionDestinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(connectionForSourceComponent);
// if the connection is between these same components, consider it for collisions // if the connection is between these same components, consider it for collisions
if ((connectionSourceComponentId === sourceComponentId && connectionDestinationComponentId === destinationComponentId) || if ((connectionSourceComponentId === sourceComponentId && connectionDestinationComponentId === destinationComponentId) ||
@ -822,7 +822,7 @@
$.each(existingConnections, function (_, existingConnection) { $.each(existingConnections, function (_, existingConnection) {
// only consider multiple connections with no bend points a collision, the existance of // only consider multiple connections with no bend points a collision, the existance of
// bend points suggests that the user has placed the connection into a desired location // bend points suggests that the user has placed the connection into a desired location
if (common.isEmpty(existingConnection.bends)) { if (nfCommon.isEmpty(existingConnection.bends)) {
avoidCollision = true; avoidCollision = true;
return false; return false;
} }
@ -842,7 +842,7 @@
var collides = function (x, y) { var collides = function (x, y) {
var collides = false; var collides = false;
$.each(existingConnections, function (_, existingConnection) { $.each(existingConnections, function (_, existingConnection) {
if (!common.isEmpty(existingConnection.bends)) { if (!nfCommon.isEmpty(existingConnection.bends)) {
if (isMoreHorizontal) { if (isMoreHorizontal) {
// horizontal lines are adjusted in the y space // horizontal lines are adjusted in the y space
if (existingConnection.bends[0].y === y) { if (existingConnection.bends[0].y === y) {
@ -900,8 +900,8 @@
var destinationGroupId = $('#connection-destination-group-id').val(); var destinationGroupId = $('#connection-destination-group-id').val();
// determine the source and destination types // determine the source and destination types
var sourceType = canvasUtils.getConnectableTypeForSource(source); var sourceType = nfCanvasUtils.getConnectableTypeForSource(source);
var destinationType = canvasUtils.getConnectableTypeForDestination(destination); var destinationType = nfCanvasUtils.getConnectableTypeForDestination(destination);
// get the settings // get the settings
var connectionName = $('#connection-name').val(); var connectionName = $('#connection-name').val();
@ -912,7 +912,7 @@
if (validateSettings()) { if (validateSettings()) {
var connectionEntity = { var connectionEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -941,7 +941,7 @@
// create the new connection // create the new connection
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/connections', url: config.urls.api + '/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/connections',
data: JSON.stringify(connectionEntity), data: JSON.stringify(connectionEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
@ -954,7 +954,7 @@
}); });
// reload the connections source/destination components // reload the connections source/destination components
canvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId); nfCanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
// update component visibility // update component visibility
nfGraph.updateVisibility(); nfGraph.updateVisibility();
@ -963,7 +963,7 @@
nfBirdseye.refresh(); nfBirdseye.refresh();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
// handle the error // handle the error
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
}); });
} }
}; };
@ -984,7 +984,7 @@
// get the destination details // get the destination details
var destinationComponentId = $('#connection-destination-component-id').val(); var destinationComponentId = $('#connection-destination-component-id').val();
var destination = d3.select('#id-' + destinationComponentId); var destination = d3.select('#id-' + destinationComponentId);
var destinationType = canvasUtils.getConnectableTypeForDestination(destination); var destinationType = nfCanvasUtils.getConnectableTypeForDestination(destination);
// get the destination details // get the destination details
var destinationId = $('#connection-destination-id').val(); var destinationId = $('#connection-destination-id').val();
@ -998,9 +998,9 @@
var prioritizers = $('#prioritizer-selected').sortable('toArray'); var prioritizers = $('#prioritizer-selected').sortable('toArray');
if (validateSettings()) { if (validateSettings()) {
var d = connection.get(connectionId); var d = nfConnection.get(connectionId);
var connectionEntity = { var connectionEntity = {
'revision': client.getRevision(d), 'revision': nfClient.getRevision(d),
'component': { 'component': {
'id': connectionId, 'id': connectionId,
'name': connectionName, 'name': connectionName,
@ -1026,18 +1026,18 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// update this connection // update this connection
connection.set(response); nfConnection.set(response);
// reload the connections source/destination components // reload the connections source/destination components
canvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId); nfCanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: common.escapeHtml(xhr.responseText), dialogContent: nfCommon.escapeHtml(xhr.responseText),
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
} else { } else {
@ -1078,20 +1078,20 @@
var errors = []; var errors = [];
// validate the settings // validate the settings
if (common.isBlank($('#flow-file-expiration').val())) { if (nfCommon.isBlank($('#flow-file-expiration').val())) {
errors.push('File expiration must be specified'); errors.push('File expiration must be specified');
} }
if (!$.isNumeric($('#back-pressure-object-threshold').val())) { if (!$.isNumeric($('#back-pressure-object-threshold').val())) {
errors.push('Back pressure object threshold must be an integer value'); errors.push('Back pressure object threshold must be an integer value');
} }
if (common.isBlank($('#back-pressure-data-size-threshold').val())) { if (nfCommon.isBlank($('#back-pressure-data-size-threshold').val())) {
errors.push('Back pressure data size threshold must be specified'); errors.push('Back pressure data size threshold must be specified');
} }
if (errors.length > 0) { if (errors.length > 0) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: common.formatUnorderedList(errors) dialogContent: nfCommon.formatUnorderedList(errors)
}); });
return false; return false;
} else { } else {
@ -1130,7 +1130,7 @@
$('#relationship-names-container').hide(); $('#relationship-names-container').hide();
// clear the id field // clear the id field
common.clearField('connection-id'); nfCommon.clearField('connection-id');
// hide all the connection source panels // hide all the connection source panels
$('#processor-source').hide(); $('#processor-source').hide();
@ -1168,12 +1168,12 @@
/** /**
* Initialize the connection configuration. * Initialize the connection configuration.
* *
* @param birdseye The reference to the birdseye controller. * @param nfBirdseyeRef The nfBirdseye module.
* @param graph The reference to the graph controller. * @param nfGraphRef The nfGraph module.
*/ */
init: function (birdseye, graph) { init: function (nfBirdseyeRef, nfGraphRef) {
nfBirdseye = birdseye; nfBirdseye = nfBirdseyeRef;
nfGraph = graph; nfGraph = nfGraphRef;
// initially hide the relationship names container // initially hide the relationship names container
$('#relationship-names-container').hide(); $('#relationship-names-container').hide();
@ -1188,7 +1188,7 @@
resetDialog(); resetDialog();
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -1226,7 +1226,7 @@
opacity: 0.6 opacity: 0.6
}); });
$('#prioritizer-available, #prioritizer-selected').disableSelection(); $('#prioritizer-available, #prioritizer-selected').disableSelection();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -1237,17 +1237,17 @@
*/ */
addAvailablePrioritizer: function (prioritizerContainer, prioritizerType) { addAvailablePrioritizer: function (prioritizerContainer, prioritizerType) {
var type = prioritizerType.type; var type = prioritizerType.type;
var name = common.substringAfterLast(type, '.'); var name = nfCommon.substringAfterLast(type, '.');
// add the prioritizers to the available list // add the prioritizers to the available list
var prioritizerList = $(prioritizerContainer); var prioritizerList = $(prioritizerContainer);
var prioritizer = $('<li></li>').append($('<span style="float: left;"></span>').text(name)).attr('id', type).addClass('ui-state-default').appendTo(prioritizerList); var prioritizer = $('<li></li>').append($('<span style="float: left;"></span>').text(name)).attr('id', type).addClass('ui-state-default').appendTo(prioritizerList);
// add the description if applicable // add the description if applicable
if (common.isDefinedAndNotNull(prioritizerType.description)) { if (nfCommon.isDefinedAndNotNull(prioritizerType.description)) {
$('<div class="fa fa-question-circle" style="float: right; margin-right: 5px;""></div>').appendTo(prioritizer).qtip($.extend({ $('<div class="fa fa-question-circle" style="float: right; margin-right: 5px;""></div>').appendTo(prioritizer).qtip($.extend({
content: common.escapeHtml(prioritizerType.description) content: nfCommon.escapeHtml(prioritizerType.description)
}, common.config.tooltipConfig)); }, nfCommon.config.tooltipConfig));
} }
}, },
@ -1283,7 +1283,7 @@
$('#connection-configuration div.relationship-name').ellipsis(); $('#connection-configuration div.relationship-name').ellipsis();
// fill in the connection id // fill in the connection id
common.populateField('connection-id', null); nfCommon.populateField('connection-id', null);
// show the border if necessary // show the border if necessary
var relationshipNames = $('#relationship-names'); var relationshipNames = $('#relationship-names');
@ -1309,12 +1309,12 @@
var connection = connectionEntry.component; var connection = connectionEntry.component;
// identify the source component // identify the source component
var sourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionEntry); var sourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(connectionEntry);
var source = d3.select('#id-' + sourceComponentId); var source = d3.select('#id-' + sourceComponentId);
// identify the destination component // identify the destination component
if (common.isUndefinedOrNull(destination)) { if (nfCommon.isUndefinedOrNull(destination)) {
var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionEntry); var destinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(connectionEntry);
destination = d3.select('#id-' + destinationComponentId); destination = d3.select('#id-' + destinationComponentId);
} }
@ -1324,7 +1324,7 @@
var selectedRelationships = connection.selectedRelationships; var selectedRelationships = connection.selectedRelationships;
// show the available relationship if applicable // show the available relationship if applicable
if (common.isDefinedAndNotNull(availableRelationships) || common.isDefinedAndNotNull(selectedRelationships)) { if (nfCommon.isDefinedAndNotNull(availableRelationships) || nfCommon.isDefinedAndNotNull(selectedRelationships)) {
// populate the available connections // populate the available connections
$.each(availableRelationships, function (i, name) { $.each(availableRelationships, function (i, name) {
createRelationshipOption(name); createRelationshipOption(name);
@ -1351,14 +1351,14 @@
} }
// if the source is a process group or remote process group, select the appropriate port if applicable // if the source is a process group or remote process group, select the appropriate port if applicable
if (canvasUtils.isProcessGroup(source) || canvasUtils.isRemoteProcessGroup(source)) { if (nfCanvasUtils.isProcessGroup(source) || nfCanvasUtils.isRemoteProcessGroup(source)) {
// populate the connection source details // populate the connection source details
$('#connection-source-id').val(connection.source.id); $('#connection-source-id').val(connection.source.id);
$('#read-only-output-port-name').text(connection.source.name).attr('title', connection.source.name); $('#read-only-output-port-name').text(connection.source.name).attr('title', connection.source.name);
} }
// if the destination is a process gorup or remote process group, select the appropriate port if applicable // if the destination is a process gorup or remote process group, select the appropriate port if applicable
if (canvasUtils.isProcessGroup(destination) || canvasUtils.isRemoteProcessGroup(destination)) { if (nfCanvasUtils.isProcessGroup(destination) || nfCanvasUtils.isRemoteProcessGroup(destination)) {
var destinationData = destination.datum(); var destinationData = destination.datum();
// when the group ids differ, its a new destination component so we don't want to preselect any port // when the group ids differ, its a new destination component so we don't want to preselect any port
@ -1376,7 +1376,7 @@
$('#back-pressure-data-size-threshold').val(connection.backPressureDataSizeThreshold); $('#back-pressure-data-size-threshold').val(connection.backPressureDataSizeThreshold);
// format the connection id // format the connection id
common.populateField('connection-id', connection.id); nfCommon.populateField('connection-id', connection.id);
// handle each prioritizer // handle each prioritizer
$.each(connection.prioritizers, function (i, type) { $.each(connection.prioritizers, function (i, type) {
@ -1400,7 +1400,7 @@
var selectedRelationships = getSelectedRelationships(); var selectedRelationships = getSelectedRelationships();
// see if we're working with a processor as the source // see if we're working with a processor as the source
if (canvasUtils.isProcessor(source)) { if (nfCanvasUtils.isProcessor(source)) {
if (selectedRelationships.length > 0) { if (selectedRelationships.length > 0) {
// if there are relationships selected update // if there are relationships selected update
updateConnection(selectedRelationships).done(function () { updateConnection(selectedRelationships).done(function () {
@ -1410,7 +1410,7 @@
}); });
} else { } else {
// inform users that no relationships were selected and the source is a processor // inform users that no relationships were selected and the source is a processor
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection Configuration', headerText: 'Connection Configuration',
dialogContent: 'The connection must have at least one relationship selected.' dialogContent: 'The connection must have at least one relationship selected.'
}); });

View File

@ -26,8 +26,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Client', 'nf.Client',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, common, dialog, errorHandler, client, canvasUtils) { function ($, d3, nfCommon, nfDialog, nfErrorHandler, nfClient, nfCanvasUtils) {
return (nf.Connection = factory($, d3, common, dialog, errorHandler, client, canvasUtils)); return (nf.Connection = factory($, d3, nfCommon, nfDialog, nfErrorHandler, nfClient, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Connection = module.exports = (nf.Connection =
@ -47,7 +47,7 @@
root.nf.Client, root.nf.Client,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, d3, common, dialog, errorHandler, client, canvasUtils) { }(this, function ($, d3, nfCommon, nfDialog, nfErrorHandler, nfClient, nfCanvasUtils) {
'use strict'; 'use strict';
var nfCanvas; var nfCanvas;
@ -197,7 +197,7 @@
for (var i = 0; i < line.length; i++) { for (var i = 0; i < line.length; i++) {
if (i + 1 < line.length) { if (i + 1 < line.length) {
var distance = distanceToSegment(p, line[i], line[i + 1]); var distance = distanceToSegment(p, line[i], line[i + 1]);
if (common.isUndefined(minimumDistance) || distance < minimumDistance) { if (nfCommon.isUndefined(minimumDistance) || distance < minimumDistance) {
minimumDistance = distance; minimumDistance = distance;
index = i; index = i;
} }
@ -232,7 +232,7 @@
* @param {object} terminal * @param {object} terminal
*/ */
var isGroup = function (terminal) { var isGroup = function (terminal) {
return terminal.groupId !== canvasUtils.getGroupId() && (isInputPortType(terminal.type) || isOutputPortType(terminal.type)); return terminal.groupId !== nfCanvasUtils.getGroupId() && (isInputPortType(terminal.type) || isOutputPortType(terminal.type));
}; };
/** /**
@ -242,7 +242,7 @@
* @return {boolean} Whether expiration is configured * @return {boolean} Whether expiration is configured
*/ */
var isExpirationConfigured = function (connection) { var isExpirationConfigured = function (connection) {
if (common.isDefinedAndNotNull(connection.flowFileExpiration)) { if (nfCommon.isDefinedAndNotNull(connection.flowFileExpiration)) {
var match = connection.flowFileExpiration.match(/^(\d+).*/); var match = connection.flowFileExpiration.match(/^(\d+).*/);
if (match !== null && match.length > 0) { if (match !== null && match.length > 0) {
if (parseInt(match[0], 10) > 0) { if (parseInt(match[0], 10) > 0) {
@ -319,7 +319,7 @@
var unavailable = false; var unavailable = false;
// verify each selected relationship is still available // verify each selected relationship is still available
if (common.isDefinedAndNotNull(d.component.selectedRelationships) && common.isDefinedAndNotNull(d.component.availableRelationships)) { if (nfCommon.isDefinedAndNotNull(d.component.selectedRelationships) && nfCommon.isDefinedAndNotNull(d.component.availableRelationships)) {
$.each(d.component.selectedRelationships, function (_, selectedRelationship) { $.each(d.component.selectedRelationships, function (_, selectedRelationship) {
if ($.inArray(selectedRelationship, d.component.availableRelationships) === -1) { if ($.inArray(selectedRelationship, d.component.availableRelationships) === -1) {
unavailable = true; unavailable = true;
@ -366,7 +366,7 @@
// determines whether the connection is in warning based on the object count threshold // determines whether the connection is in warning based on the object count threshold
var isWarningCount = function (d) { var isWarningCount = function (d) {
var percentUseCount = d.status.aggregateSnapshot.percentUseCount; var percentUseCount = d.status.aggregateSnapshot.percentUseCount;
if (common.isDefinedAndNotNull(percentUseCount)) { if (nfCommon.isDefinedAndNotNull(percentUseCount)) {
return percentUseCount >= 61 && percentUseCount <= 85; return percentUseCount >= 61 && percentUseCount <= 85;
} }
@ -376,7 +376,7 @@
// determines whether the connection is in error based on the object count threshold // determines whether the connection is in error based on the object count threshold
var isErrorCount = function (d) { var isErrorCount = function (d) {
var percentUseCount = d.status.aggregateSnapshot.percentUseCount; var percentUseCount = d.status.aggregateSnapshot.percentUseCount;
if (common.isDefinedAndNotNull(percentUseCount)) { if (nfCommon.isDefinedAndNotNull(percentUseCount)) {
return percentUseCount > 85; return percentUseCount > 85;
} }
@ -391,7 +391,7 @@
// determines whether the connection is in warning based on the data size threshold // determines whether the connection is in warning based on the data size threshold
var isWarningBytes = function (d) { var isWarningBytes = function (d) {
var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes; var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes;
if (common.isDefinedAndNotNull(percentUseBytes)) { if (nfCommon.isDefinedAndNotNull(percentUseBytes)) {
return percentUseBytes >= 61 && percentUseBytes <= 85; return percentUseBytes >= 61 && percentUseBytes <= 85;
} }
@ -401,7 +401,7 @@
// determines whether the connection is in error based on the data size threshold // determines whether the connection is in error based on the data size threshold
var isErrorBytes = function (d) { var isErrorBytes = function (d) {
var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes; var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes;
if (common.isDefinedAndNotNull(percentUseBytes)) { if (nfCommon.isDefinedAndNotNull(percentUseBytes)) {
return percentUseBytes > 85; return percentUseBytes > 85;
} }
@ -419,10 +419,10 @@
var transition = false; var transition = false;
// extract the options if specified // extract the options if specified
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
updatePath = common.isDefinedAndNotNull(options.updatePath) ? options.updatePath : updatePath; updatePath = nfCommon.isDefinedAndNotNull(options.updatePath) ? options.updatePath : updatePath;
updateLabel = common.isDefinedAndNotNull(options.updateLabel) ? options.updateLabel : updateLabel; updateLabel = nfCommon.isDefinedAndNotNull(options.updateLabel) ? options.updateLabel : updateLabel;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
if (updatePath === true) { if (updatePath === true) {
@ -432,7 +432,7 @@
if (d.permissions.canRead) { if (d.permissions.canRead) {
// if there are more than one selected relationship, mark this as grouped // if there are more than one selected relationship, mark this as grouped
if (common.isDefinedAndNotNull(d.component.selectedRelationships) && d.component.selectedRelationships.length > 1) { if (nfCommon.isDefinedAndNotNull(d.component.selectedRelationships) && d.component.selectedRelationships.length > 1) {
grouped = true; grouped = true;
} }
} }
@ -507,7 +507,7 @@
if (updatePath === true) { if (updatePath === true) {
// calculate the start and end points // calculate the start and end points
var sourceComponentId = canvasUtils.getConnectionSourceComponentId(d); var sourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(d);
var sourceData = d3.select('#id-' + sourceComponentId).datum(); var sourceData = d3.select('#id-' + sourceComponentId).datum();
var end; var end;
@ -524,7 +524,7 @@
// if we are currently dragging the endpoint to a new target, use that // if we are currently dragging the endpoint to a new target, use that
// position, otherwise we need to calculate it for the current target // position, otherwise we need to calculate it for the current target
if (common.isDefinedAndNotNull(d.end) && d.end.dragging === true) { if (nfCommon.isDefinedAndNotNull(d.end) && d.end.dragging === true) {
// since we're dragging, use the same object thats bound to the endpoint drag event // since we're dragging, use the same object thats bound to the endpoint drag event
end = d.end; end = d.end;
@ -534,7 +534,7 @@
var newDestinationData = newDestination.datum(); var newDestinationData = newDestination.datum();
// get the position on the new destination perimeter // get the position on the new destination perimeter
var newEnd = canvasUtils.getPerimeterPoint(endAnchor, { var newEnd = nfCanvasUtils.getPerimeterPoint(endAnchor, {
'x': newDestinationData.position.x, 'x': newDestinationData.position.x,
'y': newDestinationData.position.y, 'y': newDestinationData.position.y,
'width': newDestinationData.dimensions.width, 'width': newDestinationData.dimensions.width,
@ -546,11 +546,11 @@
end.y = newEnd.y; end.y = newEnd.y;
} }
} else { } else {
var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(d); var destinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(d);
var destinationData = d3.select('#id-' + destinationComponentId).datum(); var destinationData = d3.select('#id-' + destinationComponentId).datum();
// get the position on the destination perimeter // get the position on the destination perimeter
end = canvasUtils.getPerimeterPoint(endAnchor, { end = nfCanvasUtils.getPerimeterPoint(endAnchor, {
'x': destinationData.position.x, 'x': destinationData.position.x,
'y': destinationData.position.y, 'y': destinationData.position.y,
'width': destinationData.dimensions.width, 'width': destinationData.dimensions.width,
@ -567,7 +567,7 @@
} }
// get the position on the source perimeter // get the position on the source perimeter
var start = canvasUtils.getPerimeterPoint(startAnchor, { var start = nfCanvasUtils.getPerimeterPoint(startAnchor, {
'x': sourceData.position.x, 'x': sourceData.position.x,
'y': sourceData.position.y, 'y': sourceData.position.y,
'width': sourceData.dimensions.width, 'width': sourceData.dimensions.width,
@ -579,21 +579,21 @@
d.end = end; d.end = end;
// update the connection paths // update the connection paths
canvasUtils.transition(connection.select('path.connection-path'), transition) nfCanvasUtils.transition(connection.select('path.connection-path'), transition)
.attr({ .attr({
'd': function () { 'd': function () {
var datum = [d.start].concat(d.bends, [d.end]); var datum = [d.start].concat(d.bends, [d.end]);
return lineGenerator(datum); return lineGenerator(datum);
} }
}); });
canvasUtils.transition(connection.select('path.connection-selection-path'), transition) nfCanvasUtils.transition(connection.select('path.connection-selection-path'), transition)
.attr({ .attr({
'd': function () { 'd': function () {
var datum = [d.start].concat(d.bends, [d.end]); var datum = [d.start].concat(d.bends, [d.end]);
return lineGenerator(datum); return lineGenerator(datum);
} }
}); });
canvasUtils.transition(connection.select('path.connection-path-selectable'), transition) nfCanvasUtils.transition(connection.select('path.connection-path-selectable'), transition)
.attr({ .attr({
'd': function () { 'd': function () {
var datum = [d.start].concat(d.bends, [d.end]); var datum = [d.start].concat(d.bends, [d.end]);
@ -634,7 +634,7 @@
.call(nfContextMenu.activate); .call(nfContextMenu.activate);
// update the start point // update the start point
canvasUtils.transition(startpoints, transition) nfCanvasUtils.transition(startpoints, transition)
.attr('transform', function (p) { .attr('transform', function (p) {
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')'; return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
}); });
@ -664,7 +664,7 @@
.call(nfContextMenu.activate); .call(nfContextMenu.activate);
// update the end point // update the end point
canvasUtils.transition(endpoints, transition) nfCanvasUtils.transition(endpoints, transition)
.attr('transform', function (p) { .attr('transform', function (p) {
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')'; return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
}); });
@ -695,10 +695,10 @@
var connectionData = connection.datum(); var connectionData = connection.datum();
// if this is a self loop prevent removing the last two bends // if this is a self loop prevent removing the last two bends
var sourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionData); var sourceComponentId = nfCanvasUtils.getConnectionSourceComponentId(connectionData);
var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionData); var destinationComponentId = nfCanvasUtils.getConnectionDestinationComponentId(connectionData);
if (sourceComponentId === destinationComponentId && d.component.bends.length <= 2) { if (sourceComponentId === destinationComponentId && d.component.bends.length <= 2) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection', headerText: 'Connection',
dialogContent: 'Looping connections must have at least two bend points.' dialogContent: 'Looping connections must have at least two bend points.'
}); });
@ -744,7 +744,7 @@
.call(nfContextMenu.activate); .call(nfContextMenu.activate);
// update the midpoints // update the midpoints
canvasUtils.transition(midpoints, transition) nfCanvasUtils.transition(midpoints, transition)
.attr('transform', function (p) { .attr('transform', function (p) {
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')'; return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
}); });
@ -881,7 +881,7 @@
connectionFromLabel.text(null).selectAll('title').remove(); connectionFromLabel.text(null).selectAll('title').remove();
// apply ellipsis to the label as necessary // apply ellipsis to the label as necessary
canvasUtils.ellipsis(connectionFromLabel, d.component.source.name); nfCanvasUtils.ellipsis(connectionFromLabel, d.component.source.name);
}).append('title').text(function () { }).append('title').text(function () {
return d.component.source.name; return d.component.source.name;
}); });
@ -990,7 +990,7 @@
connectionToLabel.text(null).selectAll('title').remove(); connectionToLabel.text(null).selectAll('title').remove();
// apply ellipsis to the label as necessary // apply ellipsis to the label as necessary
canvasUtils.ellipsis(connectionToLabel, d.component.destination.name); nfCanvasUtils.ellipsis(connectionToLabel, d.component.destination.name);
}).append('title').text(function (d) { }).append('title').text(function (d) {
return d.component.destination.name; return d.component.destination.name;
}); });
@ -1033,10 +1033,10 @@
// ----------------------- // -----------------------
// get the connection name // get the connection name
var connectionNameValue = canvasUtils.formatConnectionName(d.component); var connectionNameValue = nfCanvasUtils.formatConnectionName(d.component);
// is there a name to render // is there a name to render
if (!common.isBlank(connectionNameValue)) { if (!nfCommon.isBlank(connectionNameValue)) {
// see if the connection name label is already rendered // see if the connection name label is already rendered
if (connectionName.empty()) { if (connectionName.empty()) {
connectionName = connectionLabelContainer.append('g') connectionName = connectionLabelContainer.append('g')
@ -1095,7 +1095,7 @@
connectionToLabel.text(null).selectAll('title').remove(); connectionToLabel.text(null).selectAll('title').remove();
// apply ellipsis to the label as necessary // apply ellipsis to the label as necessary
canvasUtils.ellipsis(connectionToLabel, connectionNameValue); nfCanvasUtils.ellipsis(connectionToLabel, connectionNameValue);
}).append('title').text(function () { }).append('title').text(function () {
return connectionNameValue; return connectionNameValue;
}); });
@ -1333,21 +1333,21 @@
// update backpressure object fill // update backpressure object fill
connectionLabelContainer.select('rect.backpressure-object') connectionLabelContainer.select('rect.backpressure-object')
.classed('not-configured', function () { .classed('not-configured', function () {
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount); return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount);
}); });
connectionLabelContainer.selectAll('rect.backpressure-tick.object') connectionLabelContainer.selectAll('rect.backpressure-tick.object')
.classed('not-configured', function () { .classed('not-configured', function () {
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount); return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount);
}); });
// update backpressure data size fill // update backpressure data size fill
connectionLabelContainer.select('rect.backpressure-data-size') connectionLabelContainer.select('rect.backpressure-data-size')
.classed('not-configured', function () { .classed('not-configured', function () {
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes); return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes);
}); });
connectionLabelContainer.selectAll('rect.backpressure-tick.data-size') connectionLabelContainer.selectAll('rect.backpressure-tick.data-size')
.classed('not-configured', function () { .classed('not-configured', function () {
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes); return nfCommon.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes);
}); });
if (d.permissions.canWrite) { if (d.permissions.canWrite) {
@ -1365,7 +1365,7 @@
} }
// update the position of the label if possible // update the position of the label if possible
canvasUtils.transition(connection.select('g.connection-label-container'), transition) nfCanvasUtils.transition(connection.select('g.connection-label-container'), transition)
.attr('transform', function () { .attr('transform', function () {
var label = d3.select(this).select('rect.body'); var label = d3.select(this).select('rect.body');
var position = getLabelPosition(label); var position = getLabelPosition(label);
@ -1389,7 +1389,7 @@
// queued count value // queued count value
updated.select('text.queued tspan.count') updated.select('text.queued tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' ');
}); });
var backpressurePercentDataSize = updated.select('rect.backpressure-percent.data-size'); var backpressurePercentDataSize = updated.select('rect.backpressure-percent.data-size');
@ -1397,7 +1397,7 @@
.duration(400) .duration(400)
.attr({ .attr({
'width': function (d) { 'width': function (d) {
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) { if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) {
return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseBytes) / 100; return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseBytes) / 100;
} else { } else {
return 0; return 0;
@ -1416,7 +1416,7 @@
}); });
updated.select('rect.backpressure-data-size').select('title').text(function (d) { updated.select('rect.backpressure-data-size').select('title').text(function (d) {
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) { if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) {
return 'Queue is ' + d.status.aggregateSnapshot.percentUseBytes + '% full based on Back Pressure Data Size Threshold'; return 'Queue is ' + d.status.aggregateSnapshot.percentUseBytes + '% full based on Back Pressure Data Size Threshold';
} else { } else {
return 'Back Pressure Data Size Threshold is not configured'; return 'Back Pressure Data Size Threshold is not configured';
@ -1429,7 +1429,7 @@
// queued size value // queued size value
updated.select('text.queued tspan.size') updated.select('text.queued tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.queued, ' ');
}); });
var backpressurePercentObject = updated.select('rect.backpressure-percent.object'); var backpressurePercentObject = updated.select('rect.backpressure-percent.object');
@ -1437,7 +1437,7 @@
.duration(400) .duration(400)
.attr({ .attr({
'width': function (d) { 'width': function (d) {
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) { if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) {
return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseCount) / 100; return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseCount) / 100;
} else { } else {
return 0; return 0;
@ -1456,7 +1456,7 @@
}); });
updated.select('rect.backpressure-object').select('title').text(function (d) { updated.select('rect.backpressure-object').select('title').text(function (d) {
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) { if (nfCommon.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) {
return 'Queue is ' + d.status.aggregateSnapshot.percentUseCount + '% full based on Back Pressure Object Threshold'; return 'Queue is ' + d.status.aggregateSnapshot.percentUseCount + '% full based on Back Pressure Object Threshold';
} else { } else {
return 'Back Pressure Object Threshold is not configured'; return 'Back Pressure Object Threshold is not configured';
@ -1498,7 +1498,7 @@
*/ */
var save = function (d, connection) { var save = function (d, connection) {
var entity = { var entity = {
'revision': client.getRevision(d), 'revision': nfClient.getRevision(d),
'component': connection 'component': connection
}; };
@ -1513,12 +1513,12 @@
nfConnection.set(response); nfConnection.set(response);
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection', headerText: 'Connection',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
}; };
@ -1527,7 +1527,7 @@
var removeConnections = function (removed) { var removeConnections = function (removed) {
// consider reloading source/destination of connection being removed // consider reloading source/destination of connection being removed
removed.each(function (d) { removed.each(function (d) {
canvasUtils.reloadConnectionSourceAndDestination(d.sourceId, d.destinationId); nfCanvasUtils.reloadConnectionSourceAndDestination(d.sourceId, d.destinationId);
}); });
// remove the connection // remove the connection
@ -1540,9 +1540,15 @@
selfLoopYOffset: 25 selfLoopYOffset: 25
}, },
init: function (selectable, contextMenu) { /**
nfSelectable = selectable; * Initializes the connection.
nfContextMenu = contextMenu; *
* @param nfSelectableRef The nfSelectable module.
* @param nfContextMenuRef The nfContextMenu module.
*/
init: function (nfSelectableRef, nfContextMenuRef) {
nfSelectable = nfSelectableRef;
nfContextMenu = nfContextMenuRef;
connectionMap = d3.map(); connectionMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -1638,7 +1644,7 @@
// ensure the new destination is valid // ensure the new destination is valid
d3.select('g.hover').classed('connectable-destination', function () { d3.select('g.hover').classed('connectable-destination', function () {
return canvasUtils.isValidConnectionDestination(d3.select(this)); return nfCanvasUtils.isValidConnectionDestination(d3.select(this));
}); });
// redraw this connection // redraw this connection
@ -1667,11 +1673,11 @@
}); });
} else { } else {
// prompt for the new port if appropriate // prompt for the new port if appropriate
if (canvasUtils.isProcessGroup(destination) || canvasUtils.isRemoteProcessGroup(destination)) { if (nfCanvasUtils.isProcessGroup(destination) || nfCanvasUtils.isRemoteProcessGroup(destination)) {
// user will select new port and updated connect details will be set accordingly // user will select new port and updated connect details will be set accordingly
nfConnectionConfiguration.showConfiguration(connection, destination).done(function () { nfConnectionConfiguration.showConfiguration(connection, destination).done(function () {
// reload the previous destination // reload the previous destination
canvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId); nfCanvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId);
}).fail(function () { }).fail(function () {
// reset the connection // reset the connection
connection.call(updateConnections, { connection.call(updateConnections, {
@ -1682,15 +1688,15 @@
} else { } else {
// get the destination details // get the destination details
var destinationData = destination.datum(); var destinationData = destination.datum();
var destinationType = canvasUtils.getConnectableTypeForDestination(destination); var destinationType = nfCanvasUtils.getConnectableTypeForDestination(destination);
var connectionEntity = { var connectionEntity = {
'revision': client.getRevision(connectionData), 'revision': nfClient.getRevision(connectionData),
'component': { 'component': {
'id': connectionData.id, 'id': connectionData.id,
'destination': { 'destination': {
'id': destinationData.id, 'id': destinationData.id,
'groupId': canvasUtils.getGroupId(), 'groupId': nfCanvasUtils.getGroupId(),
'type': destinationType 'type': destinationType
} }
} }
@ -1729,13 +1735,13 @@
nfConnection.set(response); nfConnection.set(response);
// reload the previous destination and the new source/destination // reload the previous destination and the new source/destination
canvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId); nfCanvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId);
canvasUtils.reloadConnectionSourceAndDestination(response.sourceId, response.destinationId); nfCanvasUtils.reloadConnectionSourceAndDestination(response.sourceId, response.destinationId);
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 401 || xhr.status === 403 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 401 || xhr.status === 403 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Connection', headerText: 'Connection',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
// reset the connection // reset the connection
@ -1744,7 +1750,7 @@
'updateLabel': false 'updateLabel': false
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
} }
@ -1781,10 +1787,10 @@
.attr('width', width) .attr('width', width)
.attr('height', height) .attr('height', height)
.attr('stroke-width', function () { .attr('stroke-width', function () {
return 1 / canvasUtils.scaleCanvasView(); return 1 / nfCanvasUtils.scaleCanvasView();
}) })
.attr('stroke-dasharray', function () { .attr('stroke-dasharray', function () {
return 4 / canvasUtils.scaleCanvasView(); return 4 / nfCanvasUtils.scaleCanvasView();
}) })
.datum({ .datum({
x: position.x, x: position.x,
@ -1885,8 +1891,8 @@
*/ */
add: function (connectionEntities, options) { add: function (connectionEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// get the current time // get the current time
@ -1906,7 +1912,7 @@
$.each(connectionEntities, function (_, connectionEntity) { $.each(connectionEntities, function (_, connectionEntity) {
add(connectionEntity); add(connectionEntity);
}); });
} else if (common.isDefinedAndNotNull(connectionEntities)) { } else if (nfCommon.isDefinedAndNotNull(connectionEntities)) {
add(connectionEntities); add(connectionEntities);
} }
@ -1962,7 +1968,7 @@
if (isDisconnected) { if (isDisconnected) {
// determine whether this connection and its components are included within the selection // determine whether this connection and its components are included within the selection
isDisconnected = components.has(canvasUtils.getConnectionSourceComponentId(connection)) && components.has(canvasUtils.getConnectionDestinationComponentId(connection)); isDisconnected = components.has(nfCanvasUtils.getConnectionSourceComponentId(connection)) && components.has(nfCanvasUtils.getConnectionDestinationComponentId(connection));
} }
}); });
} }
@ -1978,16 +1984,16 @@
set: function (connectionEntities, options) { set: function (connectionEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
var set = function (proposedConnectionEntity) { var set = function (proposedConnectionEntity) {
var currentConnectionEntity = connectionMap.get(proposedConnectionEntity.id); var currentConnectionEntity = connectionMap.get(proposedConnectionEntity.id);
// set the connection if appropriate due to revision and wasn't previously removed // set the connection if appropriate due to revision and wasn't previously removed
if (client.isNewerRevision(currentConnectionEntity, proposedConnectionEntity) && !removedCache.has(proposedConnectionEntity.id)) { if (nfClient.isNewerRevision(currentConnectionEntity, proposedConnectionEntity) && !removedCache.has(proposedConnectionEntity.id)) {
connectionMap.set(proposedConnectionEntity.id, $.extend({ connectionMap.set(proposedConnectionEntity.id, $.extend({
type: 'Connection' type: 'Connection'
}, proposedConnectionEntity)); }, proposedConnectionEntity));
@ -2010,7 +2016,7 @@
$.each(connectionEntities, function (_, connectionEntity) { $.each(connectionEntities, function (_, connectionEntity) {
set(connectionEntity); set(connectionEntity);
}); });
} else if (common.isDefinedAndNotNull(connectionEntities)) { } else if (nfCommon.isDefinedAndNotNull(connectionEntities)) {
set(connectionEntities); set(connectionEntities);
} }
@ -2031,7 +2037,7 @@
* @param {string} connectionId * @param {string} connectionId
*/ */
refresh: function (connectionId) { refresh: function (connectionId) {
if (common.isDefinedAndNotNull(connectionId)) { if (nfCommon.isDefinedAndNotNull(connectionId)) {
d3.select('#id-' + connectionId).call(updateConnections, { d3.select('#id-' + connectionId).call(updateConnections, {
'updatePath': true, 'updatePath': true,
'updateLabel': true 'updateLabel': true
@ -2134,7 +2140,7 @@
var connections = []; var connections = [];
connectionMap.forEach(function (_, entry) { connectionMap.forEach(function (_, entry) {
// see if this component is the source or destination of this connection // see if this component is the source or destination of this connection
if (canvasUtils.getConnectionSourceComponentId(entry) === id || canvasUtils.getConnectionDestinationComponentId(entry) === id) { if (nfCanvasUtils.getConnectionSourceComponentId(entry) === id || nfCanvasUtils.getConnectionDestinationComponentId(entry) === id) {
connections.push(entry); connections.push(entry);
} }
}); });
@ -2148,7 +2154,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return connectionMap.values(); return connectionMap.values();
} else { } else {
return connectionMap.get(id); return connectionMap.get(id);

View File

@ -21,30 +21,27 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'd3', 'd3',
'nf.ErrorHandler',
'nf.Common', 'nf.Common',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ng.Bridge'], 'nf.ng.Bridge'],
function ($, d3, errorHandler, common, canvasUtils, angularBridge) { function ($, d3, nfCommon, nfCanvasUtils, nfNgBridge) {
return (nf.ContextMenu = factory($, d3, errorHandler, common, canvasUtils, angularBridge)); return (nf.ContextMenu = factory($, d3, nfCommon, nfCanvasUtils, nfNgBridge));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ContextMenu = module.exports = (nf.ContextMenu =
factory(require('jquery'), factory(require('jquery'),
require('d3'), require('d3'),
require('nf.ErrorHandler'),
require('nf.Common'), require('nf.Common'),
require('nf.CanvasUtils'), require('nf.CanvasUtils'),
require('nf.ng.Bridge'))); require('nf.ng.Bridge')));
} else { } else {
nf.ContextMenu = factory(root.$, nf.ContextMenu = factory(root.$,
root.d3, root.d3,
root.nf.ErrorHandler,
root.nf.Common, root.nf.Common,
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.ng.Bridge); root.nf.ng.Bridge);
} }
}(this, function ($, d3, errorHandler, common, canvasUtils, angularBridge) { }(this, function ($, d3, nfCommon, nfCanvasUtils, nfNgBridge) {
'use strict'; 'use strict';
var nfActions; var nfActions;
@ -55,7 +52,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isNotRootGroup = function (selection) { var isNotRootGroup = function (selection) {
return canvasUtils.getParentGroupId() !== null && selection.empty(); return nfCanvasUtils.getParentGroupId() !== null && selection.empty();
}; };
/** /**
@ -64,7 +61,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isConfigurable = function (selection) { var isConfigurable = function (selection) {
return canvasUtils.isConfigurable(selection); return nfCanvasUtils.isConfigurable(selection);
}; };
/** /**
@ -73,7 +70,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var hasDetails = function (selection) { var hasDetails = function (selection) {
return canvasUtils.hasDetails(selection); return nfCanvasUtils.hasDetails(selection);
}; };
/** /**
@ -82,7 +79,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isDeletable = function (selection) { var isDeletable = function (selection) {
return canvasUtils.areDeletable(selection); return nfCanvasUtils.areDeletable(selection);
}; };
/** /**
@ -91,7 +88,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var canCreateTemplate = function (selection) { var canCreateTemplate = function (selection) {
return canvasUtils.canWrite() && (selection.empty() && canvasUtils.canRead(selection)); return nfCanvasUtils.canWrite() && (selection.empty() && nfCanvasUtils.canRead(selection));
}; };
/** /**
@ -100,7 +97,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var canUploadTemplate = function (selection) { var canUploadTemplate = function (selection) {
return canvasUtils.canWrite() && selection.empty(); return nfCanvasUtils.canWrite() && selection.empty();
}; };
/** /**
@ -109,7 +106,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var canGroup = function (selection) { var canGroup = function (selection) {
return canvasUtils.getComponentByType('Connection').isDisconnected(selection) && canvasUtils.canModify(selection); return nfCanvasUtils.getComponentByType('Connection').isDisconnected(selection) && nfCanvasUtils.canModify(selection);
}; };
/** /**
@ -118,7 +115,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var canEnable = function (selection) { var canEnable = function (selection) {
return canvasUtils.canEnable(selection); return nfCanvasUtils.canEnable(selection);
}; };
/** /**
@ -127,7 +124,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var canDisable = function (selection) { var canDisable = function (selection) {
return canvasUtils.canDisable(selection); return nfCanvasUtils.canDisable(selection);
}; };
/** /**
@ -136,7 +133,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var canManagePolicies = function (selection) { var canManagePolicies = function (selection) {
return canvasUtils.isConfigurableAuthorizer() && canvasUtils.canManagePolicies(selection); return nfCanvasUtils.isConfigurableAuthorizer() && nfCanvasUtils.canManagePolicies(selection);
}; };
/** /**
@ -145,7 +142,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isRunnable = function (selection) { var isRunnable = function (selection) {
return canvasUtils.areRunnable(selection); return nfCanvasUtils.areRunnable(selection);
}; };
/** /**
@ -154,7 +151,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isStoppable = function (selection) { var isStoppable = function (selection) {
return canvasUtils.areStoppable(selection); return nfCanvasUtils.areStoppable(selection);
}; };
/** /**
@ -168,7 +165,7 @@
return false; return false;
} }
return canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isConnection(selection); return nfCanvasUtils.isProcessor(selection) || nfCanvasUtils.isProcessGroup(selection) || nfCanvasUtils.isRemoteProcessGroup(selection) || nfCanvasUtils.isConnection(selection);
}; };
/** /**
@ -181,11 +178,11 @@
if (selection.size() !== 1) { if (selection.size() !== 1) {
return false; return false;
} }
if (canvasUtils.canRead(selection) === false) { if (nfCanvasUtils.canRead(selection) === false) {
return false; return false;
} }
return canvasUtils.isProcessor(selection); return nfCanvasUtils.isProcessor(selection);
}; };
/** /**
@ -194,7 +191,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isNotConnection = function (selection) { var isNotConnection = function (selection) {
return selection.size() === 1 && !canvasUtils.isConnection(selection); return selection.size() === 1 && !nfCanvasUtils.isConnection(selection);
}; };
/** /**
@ -203,7 +200,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isCopyable = function (selection) { var isCopyable = function (selection) {
return canvasUtils.isCopyable(selection); return nfCanvasUtils.isCopyable(selection);
}; };
/** /**
@ -212,7 +209,7 @@
* @param {selection} selection The selection of currently selected components * @param {selection} selection The selection of currently selected components
*/ */
var isPastable = function (selection) { var isPastable = function (selection) {
return canvasUtils.isPastable(); return nfCanvasUtils.isPastable();
}; };
/** /**
@ -234,11 +231,11 @@
if (selection.size() !== 1) { if (selection.size() !== 1) {
return false; return false;
} }
if (canvasUtils.canModify(selection) === false) { if (nfCanvasUtils.canModify(selection) === false) {
return false; return false;
} }
return canvasUtils.isConnection(selection); return nfCanvasUtils.isConnection(selection);
}; };
/** /**
@ -247,7 +244,7 @@
* @param {selection} selection The selection * @param {selection} selection The selection
*/ */
var canAlign = function (selection) { var canAlign = function (selection) {
return canvasUtils.canAlign(selection); return nfCanvasUtils.canAlign(selection);
}; };
/** /**
@ -256,7 +253,7 @@
* @param {selection} selection The selection * @param {selection} selection The selection
*/ */
var isColorable = function (selection) { var isColorable = function (selection) {
return canvasUtils.isColorable(selection); return nfCanvasUtils.isColorable(selection);
}; };
/** /**
@ -270,7 +267,7 @@
return false; return false;
} }
return canvasUtils.isConnection(selection); return nfCanvasUtils.isConnection(selection);
}; };
/** /**
@ -284,9 +281,9 @@
return false; return false;
} }
return canvasUtils.isFunnel(selection) || canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || return nfCanvasUtils.isFunnel(selection) || nfCanvasUtils.isProcessor(selection) || nfCanvasUtils.isProcessGroup(selection) ||
canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isInputPort(selection) || nfCanvasUtils.isRemoteProcessGroup(selection) || nfCanvasUtils.isInputPort(selection) ||
(canvasUtils.isOutputPort(selection) && canvasUtils.getParentGroupId() !== null); (nfCanvasUtils.isOutputPort(selection) && nfCanvasUtils.getParentGroupId() !== null);
}; };
/** /**
@ -300,9 +297,9 @@
return false; return false;
} }
return canvasUtils.isFunnel(selection) || canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || return nfCanvasUtils.isFunnel(selection) || nfCanvasUtils.isProcessor(selection) || nfCanvasUtils.isProcessGroup(selection) ||
canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isOutputPort(selection) || nfCanvasUtils.isRemoteProcessGroup(selection) || nfCanvasUtils.isOutputPort(selection) ||
(canvasUtils.isInputPort(selection) && canvasUtils.getParentGroupId() !== null); (nfCanvasUtils.isInputPort(selection) && nfCanvasUtils.getParentGroupId() !== null);
}; };
/** /**
@ -315,11 +312,11 @@
if (selection.size() !== 1) { if (selection.size() !== 1) {
return false; return false;
} }
if (canvasUtils.canRead(selection) === false || canvasUtils.canModify(selection) === false) { if (nfCanvasUtils.canRead(selection) === false || nfCanvasUtils.canModify(selection) === false) {
return false; return false;
} }
if (canvasUtils.isProcessor(selection)) { if (nfCanvasUtils.isProcessor(selection)) {
var processorData = selection.datum(); var processorData = selection.datum();
return processorData.component.persistsState === true; return processorData.component.persistsState === true;
} else { } else {
@ -338,7 +335,7 @@
return false; return false;
} }
return canvasUtils.isProcessGroup(selection); return nfCanvasUtils.isProcessGroup(selection);
}; };
/** /**
@ -352,8 +349,8 @@
return false; return false;
} }
return !canvasUtils.isLabel(selection) && !canvasUtils.isConnection(selection) && !canvasUtils.isProcessGroup(selection) return !nfCanvasUtils.isLabel(selection) && !nfCanvasUtils.isConnection(selection) && !nfCanvasUtils.isProcessGroup(selection)
&& !canvasUtils.isRemoteProcessGroup(selection) && common.canAccessProvenance(); && !nfCanvasUtils.isRemoteProcessGroup(selection) && nfCommon.canAccessProvenance();
}; };
/** /**
@ -366,11 +363,11 @@
if (selection.size() !== 1) { if (selection.size() !== 1) {
return false; return false;
} }
if (canvasUtils.canRead(selection) === false) { if (nfCanvasUtils.canRead(selection) === false) {
return false; return false;
} }
return canvasUtils.isRemoteProcessGroup(selection); return nfCanvasUtils.isRemoteProcessGroup(selection);
}; };
/** /**
@ -379,11 +376,11 @@
* @param {selection} selection * @param {selection} selection
*/ */
var canStartTransmission = function (selection) { var canStartTransmission = function (selection) {
if (canvasUtils.canModify(selection) === false) { if (nfCanvasUtils.canModify(selection) === false) {
return false; return false;
} }
return canvasUtils.canAllStartTransmitting(selection); return nfCanvasUtils.canAllStartTransmitting(selection);
}; };
/** /**
@ -392,11 +389,11 @@
* @param {selection} selection * @param {selection} selection
*/ */
var canStopTransmission = function (selection) { var canStopTransmission = function (selection) {
if (canvasUtils.canModify(selection) === false) { if (nfCanvasUtils.canModify(selection) === false) {
return false; return false;
} }
return canvasUtils.canAllStopTransmitting(selection); return nfCanvasUtils.canAllStopTransmitting(selection);
}; };
/** /**
@ -423,13 +420,13 @@
* @param {type} selection * @param {type} selection
*/ */
var canMoveToParent = function (selection) { var canMoveToParent = function (selection) {
if (canvasUtils.canModify(selection) === false) { if (nfCanvasUtils.canModify(selection) === false) {
return false; return false;
} }
// TODO - also check can modify in parent // TODO - also check can modify in parent
return !selection.empty() && canvasUtils.getComponentByType('Connection').isDisconnected(selection) && canvasUtils.getParentGroupId() !== null; return !selection.empty() && nfCanvasUtils.getComponentByType('Connection').isDisconnected(selection) && nfCanvasUtils.getParentGroupId() !== null;
}; };
/** /**
@ -461,7 +458,7 @@
// create the img and conditionally add the style // create the img and conditionally add the style
var img = $('<div class="context-menu-item-img"></div>').addClass(item['clazz']).appendTo(menuItem); var img = $('<div class="context-menu-item-img"></div>').addClass(item['clazz']).appendTo(menuItem);
if (common.isDefinedAndNotNull(item['imgStyle'])) { if (nfCommon.isDefinedAndNotNull(item['imgStyle'])) {
img.addClass(item['imgStyle']); img.addClass(item['imgStyle']);
} }
@ -544,10 +541,10 @@
/** /**
* Initialize the context menu. * Initialize the context menu.
* *
* @param actions The reference to the actions controller. * @param nfActionsRef The nfActions module.
*/ */
init: function (actions) { init: function (nfActionsRef) {
nfActions = actions; nfActions = nfActionsRef;
$('#context-menu').on('contextmenu', function (evt) { $('#context-menu').on('contextmenu', function (evt) {
// stop propagation and prevent default // stop propagation and prevent default
@ -566,12 +563,12 @@
var breadCrumb = $('#breadcrumbs').get(0); var breadCrumb = $('#breadcrumbs').get(0);
// get the current selection // get the current selection
var selection = canvasUtils.getSelection(); var selection = nfCanvasUtils.getSelection();
// consider each component action for the current selection // consider each component action for the current selection
$.each(actions, function (_, action) { $.each(actions, function (_, action) {
// determine if this action is application for this selection // determine if this action is application for this selection
if (action.condition(selection, canvasUtils.getComponentByType('Connection'))) { if (action.condition(selection, nfCanvasUtils.getComponentByType('Connection'))) {
var menuItem = action.menuItem; var menuItem = action.menuItem;
addMenuItem(contextMenu, { addMenuItem(contextMenu, {
@ -603,7 +600,7 @@
}); });
// inform Angular app incase we've click on the canvas // inform Angular app incase we've click on the canvas
angularBridge.digest(); nfNgBridge.digest();
}, },
/** /**

View File

@ -32,8 +32,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ReportingTask', 'nf.ReportingTask',
'nf.Processor'], 'nf.Processor'],
function ($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor) { function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerServices, nfSettings, nfUniversalCapture, nfCustomUi, nfCanvasUtils, nfReportingTask, nfProcessor) {
return (nf.ControllerService = factory($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor)); return (nf.ControllerService = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerServices, nfSettings, nfUniversalCapture, nfCustomUi, nfCanvasUtils, nfReportingTask, nfProcessor));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ControllerService = module.exports = (nf.ControllerService =
@ -65,7 +65,7 @@
root.nf.ReportingTask, root.nf.ReportingTask,
root.nf.Processor); root.nf.Processor);
} }
}(this, function ($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor) { }(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerServices, nfSettings, nfUniversalCapture, nfCustomUi, nfCanvasUtils, nfReportingTask, nfProcessor) {
'use strict'; 'use strict';
var config = { var config = {
@ -93,15 +93,15 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Controller Service' headerText: 'Controller Service'
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}; };
@ -177,7 +177,7 @@
// service B that has been removed. attempting to enable/disable/remove A // service B that has been removed. attempting to enable/disable/remove A
// will attempt to reload B which is no longer a known service. also ensure // will attempt to reload B which is no longer a known service. also ensure
// we have permissions to reload the service // we have permissions to reload the service
if (common.isUndefined(controllerServiceEntity) || controllerServiceEntity.permissions.canRead === false) { if (nfCommon.isUndefined(controllerServiceEntity) || controllerServiceEntity.permissions.canRead === false) {
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
deferred.reject(); deferred.reject();
}).promise(); }).promise();
@ -189,7 +189,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
renderControllerService(serviceTable, response); renderControllerService(serviceTable, response);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -239,8 +239,8 @@
var reference = referencingComponentEntity.component; var reference = referencingComponentEntity.component;
if (reference.referenceType === 'Processor') { if (reference.referenceType === 'Processor') {
// reload the processor on the canvas if appropriate // reload the processor on the canvas if appropriate
if (canvasUtils.getGroupId() === reference.groupId) { if (nfCanvasUtils.getGroupId() === reference.groupId) {
processor.reload(reference.id); nfProcessor.reload(reference.id);
} }
// update the current active thread count // update the current active thread count
@ -253,7 +253,7 @@
} }
} else if (reference.referenceType === 'ReportingTask') { } else if (reference.referenceType === 'ReportingTask') {
// reload the referencing reporting tasks // reload the referencing reporting tasks
reportingTask.reload(reference.id); nfReportingTask.reload(reference.id);
// update the current active thread count // update the current active thread count
$('div.' + reference.id + '-active-threads').text(reference.activeThreadCount); $('div.' + reference.id + '-active-threads').text(reference.activeThreadCount);
@ -313,22 +313,22 @@
var currentBulletins = bulletinIcon.data('bulletins'); var currentBulletins = bulletinIcon.data('bulletins');
// update the bulletins if necessary // update the bulletins if necessary
if (common.doBulletinsDiffer(currentBulletins, bulletins)) { if (nfCommon.doBulletinsDiffer(currentBulletins, bulletins)) {
bulletinIcon.data('bulletins', bulletins); bulletinIcon.data('bulletins', bulletins);
// format the new bulletins // format the new bulletins
var formattedBulletins = common.getFormattedBulletins(bulletins); var formattedBulletins = nfCommon.getFormattedBulletins(bulletins);
// if there are bulletins update them // if there are bulletins update them
if (bulletins.length > 0) { if (bulletins.length > 0) {
var list = common.formatUnorderedList(formattedBulletins); var list = nfCommon.formatUnorderedList(formattedBulletins);
// update existing tooltip or initialize a new one if appropriate // update existing tooltip or initialize a new one if appropriate
if (bulletinIcon.data('qtip')) { if (bulletinIcon.data('qtip')) {
bulletinIcon.qtip('option', 'content.text', list); bulletinIcon.qtip('option', 'content.text', list);
} else { } else {
bulletinIcon.addClass('has-bulletins').show().qtip($.extend({}, bulletinIcon.addClass('has-bulletins').show().qtip($.extend({},
canvasUtils.config.systemTooltipConfig, nfCanvasUtils.config.systemTooltipConfig,
{ {
content: list content: list
})); }));
@ -350,16 +350,16 @@
var icon = $(this); var icon = $(this);
var state = referencingComponent.state.toLowerCase(); var state = referencingComponent.state.toLowerCase();
if (state === 'stopped' && !common.isEmpty(referencingComponent.validationErrors)) { if (state === 'stopped' && !nfCommon.isEmpty(referencingComponent.validationErrors)) {
state = 'invalid'; state = 'invalid';
// add tooltip for the warnings // add tooltip for the warnings
var list = common.formatUnorderedList(referencingComponent.validationErrors); var list = nfCommon.formatUnorderedList(referencingComponent.validationErrors);
if (icon.data('qtip')) { if (icon.data('qtip')) {
icon.qtip('option', 'content.text', list); icon.qtip('option', 'content.text', list);
} else { } else {
icon.qtip($.extend({}, icon.qtip($.extend({},
canvasUtils.config.systemTooltipConfig, nfCanvasUtils.config.systemTooltipConfig,
{ {
content: list content: list
})); }));
@ -382,16 +382,16 @@
var icon = $(this); var icon = $(this);
var state = referencingService.state === 'ENABLED' ? 'enabled' : 'disabled'; var state = referencingService.state === 'ENABLED' ? 'enabled' : 'disabled';
if (state === 'disabled' && !common.isEmpty(referencingService.validationErrors)) { if (state === 'disabled' && !nfCommon.isEmpty(referencingService.validationErrors)) {
state = 'invalid'; state = 'invalid';
// add tooltip for the warnings // add tooltip for the warnings
var list = common.formatUnorderedList(referencingService.validationErrors); var list = nfCommon.formatUnorderedList(referencingService.validationErrors);
if (icon.data('qtip')) { if (icon.data('qtip')) {
icon.qtip('option', 'content.text', list); icon.qtip('option', 'content.text', list);
} else { } else {
icon.qtip($.extend({}, icon.qtip($.extend({},
canvasUtils.config.systemTooltipConfig, nfCanvasUtils.config.systemTooltipConfig,
{ {
content: list content: list
})); }));
@ -430,7 +430,7 @@
* @param {array} referencingComponents * @param {array} referencingComponents
*/ */
var createReferencingComponents = function (serviceTable, referenceContainer, referencingComponents) { var createReferencingComponents = function (serviceTable, referenceContainer, referencingComponents) {
if (common.isEmpty(referencingComponents)) { if (nfCommon.isEmpty(referencingComponents)) {
referenceContainer.append('<div class="unset">No referencing components.</div>'); referenceContainer.append('<div class="unset">No referencing components.</div>');
return; return;
} }
@ -463,7 +463,7 @@
if (referencingComponent.referenceType === 'Processor') { if (referencingComponent.referenceType === 'Processor') {
var processorLink = $('<span class="referencing-component-name link"></span>').text(referencingComponent.name).on('click', function () { var processorLink = $('<span class="referencing-component-name link"></span>').text(referencingComponent.name).on('click', function () {
// show the component // show the component
canvasUtils.showComponent(referencingComponent.groupId, referencingComponent.id); nfCanvasUtils.showComponent(referencingComponent.groupId, referencingComponent.id);
// close the dialog and shell // close the dialog and shell
referenceContainer.closest('.dialog').modal('hide'); referenceContainer.closest('.dialog').modal('hide');
@ -478,11 +478,11 @@
var processorBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins'); var processorBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
// type // type
var processorType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.')); var processorType = $('<span class="referencing-component-type"></span>').text(nfCommon.substringAfterLast(referencingComponent.type, '.'));
// active thread count // active thread count
var processorActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads'); var processorActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads');
if (common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) { if (nfCommon.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) {
processorActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')'); processorActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')');
} }
@ -533,7 +533,7 @@
var serviceBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins'); var serviceBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
// type // type
var serviceType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.')); var serviceType = $('<span class="referencing-component-type"></span>').text(nfCommon.substringAfterLast(referencingComponent.type, '.'));
// service // service
var serviceItem = $('<li></li>').append(serviceTwist).append(serviceState).append(serviceBulletins).append(serviceLink).append(serviceType).append(referencingServiceReferencesContainer); var serviceItem = $('<li></li>').append(serviceTwist).append(serviceState).append(serviceBulletins).append(serviceLink).append(serviceType).append(referencingServiceReferencesContainer);
@ -564,11 +564,11 @@
var reportingTaskBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins'); var reportingTaskBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
// type // type
var reportingTaskType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.')); var reportingTaskType = $('<span class="referencing-component-type"></span>').text(nfCommon.substringAfterLast(referencingComponent.type, '.'));
// active thread count // active thread count
var reportingTaskActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads'); var reportingTaskActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads');
if (common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) { if (nfCommon.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) {
reportingTaskActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')'); reportingTaskActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')');
} }
@ -632,7 +632,7 @@
sourceId: ids sourceId: ids
}, },
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -646,7 +646,7 @@
var setEnabled = function (serviceTable, controllerServiceEntity, enabled, pollCondition) { var setEnabled = function (serviceTable, controllerServiceEntity, enabled, pollCondition) {
// build the request entity // build the request entity
var updateControllerServiceEntity = { var updateControllerServiceEntity = {
'revision': client.getRevision(controllerServiceEntity), 'revision': nfClient.getRevision(controllerServiceEntity),
'component': { 'component': {
'id': controllerServiceEntity.id, 'id': controllerServiceEntity.id,
'state': enabled ? 'ENABLED' : 'DISABLED' 'state': enabled ? 'ENABLED' : 'DISABLED'
@ -661,7 +661,7 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
renderControllerService(serviceTable, response); renderControllerService(serviceTable, response);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// wait until the polling of each service finished // wait until the polling of each service finished
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
@ -740,11 +740,11 @@
if (serviceOnly) { if (serviceOnly) {
if (referencingComponent.referenceType === 'ControllerService') { if (referencingComponent.referenceType === 'ControllerService') {
referencingComponentRevisions[referencingComponentEntity.id] = client.getRevision(referencingComponentEntity); referencingComponentRevisions[referencingComponentEntity.id] = nfClient.getRevision(referencingComponentEntity);
} }
} else { } else {
if (referencingComponent.referenceType !== 'ControllerService') { if (referencingComponent.referenceType !== 'ControllerService') {
referencingComponentRevisions[referencingComponentEntity.id] = client.getRevision(referencingComponentEntity); referencingComponentRevisions[referencingComponentEntity.id] = nfClient.getRevision(referencingComponentEntity);
} }
} }
@ -779,7 +779,7 @@
data: JSON.stringify(referenceEntity), data: JSON.stringify(referenceEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// Note: updated revisions will be retrieved after updateReferencingSchedulableComponents is invoked // Note: updated revisions will be retrieved after updateReferencingSchedulableComponents is invoked
@ -859,7 +859,7 @@
conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins); conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins);
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
deferred.reject(); deferred.reject();
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
}); });
}; };
@ -881,7 +881,7 @@
conditionMet(controllerService, response.bulletinBoard.bulletins); conditionMet(controllerService, response.bulletinBoard.bulletins);
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
deferred.reject(); deferred.reject();
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
}); });
}).promise(); }).promise();
}; };
@ -1051,7 +1051,7 @@
data: JSON.stringify(referenceEntity), data: JSON.stringify(referenceEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// Note: updated revisions will be retrieved after updateReferencingServices is invoked // Note: updated revisions will be retrieved after updateReferencingServices is invoked
@ -1263,7 +1263,7 @@
if (hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) { if (hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) {
setCloseButton(); setCloseButton();
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Controller Service', headerText: 'Controller Service',
dialogContent: 'Unable to disable due to unauthorized referencing components.' dialogContent: 'Unable to disable due to unauthorized referencing components.'
}); });
@ -1312,7 +1312,7 @@
// inform the user if the action was canceled // inform the user if the action was canceled
if (canceled === true && $('#nf-ok-dialog').not(':visible')) { if (canceled === true && $('#nf-ok-dialog').not(':visible')) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Controller Service', headerText: 'Controller Service',
dialogContent: 'The request to disable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.' dialogContent: 'The request to disable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.'
}); });
@ -1416,7 +1416,7 @@
if (scope === config.serviceAndReferencingComponents && hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) { if (scope === config.serviceAndReferencingComponents && hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) {
setCloseButton(); setCloseButton();
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Controller Service', headerText: 'Controller Service',
dialogContent: 'Unable to enable due to unauthorized referencing components.' dialogContent: 'Unable to enable due to unauthorized referencing components.'
}); });
@ -1475,7 +1475,7 @@
// inform the user if the action was canceled // inform the user if the action was canceled
if (canceled === true && $('#nf-ok-dialog').not(':visible')) { if (canceled === true && $('#nf-ok-dialog').not(':visible')) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Controller Service', headerText: 'Controller Service',
dialogContent: 'The request to enable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.' dialogContent: 'The request to enable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.'
}); });
@ -1497,7 +1497,7 @@
propertyName: propertyName propertyName: propertyName
}, },
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -1513,7 +1513,7 @@
// determine if changes have been made // determine if changes have been made
if (isSaveRequired()) { if (isSaveRequired()) {
// see if those changes should be saved // see if those changes should be saved
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Save', headerText: 'Save',
dialogContent: 'Save changes before going to this Controller Service?', dialogContent: 'Save changes before going to this Controller Service?',
noHandler: function () { noHandler: function () {
@ -1540,12 +1540,12 @@
// ensure details are valid as far as we can tell // ensure details are valid as far as we can tell
if (validateDetails(updatedControllerService)) { if (validateDetails(updatedControllerService)) {
updatedControllerService['revision'] = client.getRevision(controllerServiceEntity); updatedControllerService['revision'] = nfClient.getRevision(controllerServiceEntity);
var previouslyReferencedServiceIds = []; var previouslyReferencedServiceIds = [];
$.each(identifyReferencedServiceDescriptors(controllerServiceEntity.component), function (_, descriptor) { $.each(identifyReferencedServiceDescriptors(controllerServiceEntity.component), function (_, descriptor) {
var modifyingService = !common.isUndefined(updatedControllerService.component.properties) && !common.isUndefined(updatedControllerService.component.properties[descriptor.name]); var modifyingService = !nfCommon.isUndefined(updatedControllerService.component.properties) && !nfCommon.isUndefined(updatedControllerService.component.properties[descriptor.name]);
var isCurrentlyConfigured = common.isDefinedAndNotNull(controllerServiceEntity.component.properties[descriptor.name]); var isCurrentlyConfigured = nfCommon.isDefinedAndNotNull(controllerServiceEntity.component.properties[descriptor.name]);
// if we are attempting to update a controller service reference // if we are attempting to update a controller service reference
if (modifyingService && isCurrentlyConfigured) { if (modifyingService && isCurrentlyConfigured) {
@ -1587,7 +1587,7 @@
var referencedServiceDescriptors = []; var referencedServiceDescriptors = [];
$.each(component.descriptors, function (_, descriptor) { $.each(component.descriptors, function (_, descriptor) {
if (common.isDefinedAndNotNull(descriptor.identifiesControllerService)) { if (nfCommon.isDefinedAndNotNull(descriptor.identifiesControllerService)) {
referencedServiceDescriptors.push(descriptor); referencedServiceDescriptors.push(descriptor);
} }
}); });
@ -1607,7 +1607,7 @@
var referencedServiceId = component.properties[descriptor.name]; var referencedServiceId = component.properties[descriptor.name];
// ensure the property is configured // ensure the property is configured
if (common.isDefinedAndNotNull(referencedServiceId) && $.trim(referencedServiceId).length > 0) { if (nfCommon.isDefinedAndNotNull(referencedServiceId) && $.trim(referencedServiceId).length > 0) {
referencedServices.push(referencedServiceId); referencedServices.push(referencedServiceId);
} }
}); });
@ -1642,7 +1642,7 @@
}], }],
select: function () { select: function () {
// remove all property detail dialogs // remove all property detail dialogs
universalCapture.removeAllPropertyDetailDialogs(); nfUniversalCapture.removeAllPropertyDetailDialogs();
// update the property table size in case this is the first time its rendered // update the property table size in case this is the first time its rendered
if ($(this).text() === 'Properties') { if ($(this).text() === 'Properties') {
@ -1666,8 +1666,8 @@
close: function () { close: function () {
// empty the referencing components list // empty the referencing components list
var referencingComponents = $('#controller-service-referencing-components'); var referencingComponents = $('#controller-service-referencing-components');
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
referencingComponents.css('border-width', '0').empty(); referencingComponents.css('border-width', '0').empty();
// cancel any active edits // cancel any active edits
@ -1677,13 +1677,13 @@
$('#controller-service-properties').propertytable('clear'); $('#controller-service-properties').propertytable('clear');
// clear the comments // clear the comments
common.clearField('read-only-controller-service-comments'); nfCommon.clearField('read-only-controller-service-comments');
// removed the cached controller service details // removed the cached controller service details
$('#controller-service-configuration').removeData('controllerServiceDetails'); $('#controller-service-configuration').removeData('controllerServiceDetails');
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -1706,15 +1706,15 @@
// bulletins // bulletins
$('#disable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide(); $('#disable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide();
common.cleanUpTooltips($('#disable-controller-service-service-container'), '#disable-controller-service-bulletins'); nfCommon.cleanUpTooltips($('#disable-controller-service-service-container'), '#disable-controller-service-bulletins');
// reset progress // reset progress
$('div.disable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error'); $('div.disable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error');
// referencing components // referencing components
var referencingComponents = $('#disable-controller-service-referencing-components'); var referencingComponents = $('#disable-controller-service-referencing-components');
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
referencingComponents.css('border-width', '0').empty(); referencingComponents.css('border-width', '0').empty();
} }
} }
@ -1752,15 +1752,15 @@
// bulletins // bulletins
$('#enable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide(); $('#enable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide();
common.cleanUpTooltips($('#enable-controller-service-service-container'), '#enable-controller-service-bulletins'); nfCommon.cleanUpTooltips($('#enable-controller-service-service-container'), '#enable-controller-service-bulletins');
// reset progress // reset progress
$('div.enable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error'); $('div.enable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error');
// referencing components // referencing components
var referencingComponents = $('#enable-controller-service-referencing-components'); var referencingComponents = $('#enable-controller-service-referencing-components');
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state'); nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins'); nfCommon.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
referencingComponents.css('border-width', '0').empty(); referencingComponents.css('border-width', '0').empty();
} }
} }
@ -1774,7 +1774,7 @@
* @argument {object} controllerServiceEntity The controller service * @argument {object} controllerServiceEntity The controller service
*/ */
showConfiguration: function (serviceTable, controllerServiceEntity) { showConfiguration: function (serviceTable, controllerServiceEntity) {
if (common.isUndefined(currentTable)) { if (nfCommon.isUndefined(currentTable)) {
currentTable = serviceTable; currentTable = serviceTable;
} }
var controllerServiceDialog = $('#controller-service-configuration'); var controllerServiceDialog = $('#controller-service-configuration');
@ -1795,14 +1795,14 @@
// calculate the correct uri // calculate the correct uri
var createdControllerService = response.component; var createdControllerService = response.component;
if (common.isDefinedAndNotNull(createdControllerService.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(createdControllerService.parentGroupId)) {
controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(createdControllerService.parentGroupId) + '/controller-services'; controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(createdControllerService.parentGroupId) + '/controller-services';
} else { } else {
controllerServicesUri = config.urls.api + '/flow/controller/controller-services'; controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
} }
// load the controller services accordingly // load the controller services accordingly
return controllerServices.loadControllerServices(controllerServicesUri, serviceTable); return nfControllerServices.loadControllerServices(controllerServicesUri, serviceTable);
}, },
goToServiceDeferred: function () { goToServiceDeferred: function () {
return goToServiceFromProperty(serviceTable); return goToServiceFromProperty(serviceTable);
@ -1843,8 +1843,8 @@
controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity); controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity);
// populate the controller service settings // populate the controller service settings
common.populateField('controller-service-id', controllerService['id']); nfCommon.populateField('controller-service-id', controllerService['id']);
common.populateField('controller-service-type', common.substringAfterLast(controllerService['type'], '.')); nfCommon.populateField('controller-service-type', nfCommon.substringAfterLast(controllerService['type'], '.'));
$('#controller-service-name').val(controllerService['name']); $('#controller-service-name').val(controllerService['name']);
$('#controller-service-comments').val(controllerService['comments']); $('#controller-service-comments').val(controllerService['comments']);
@ -1890,7 +1890,7 @@
}]; }];
// determine if we should show the advanced button // determine if we should show the advanced button
if (common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') { if (nfCommon.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
buttons.push({ buttons.push({
buttonText: 'Advanced', buttonText: 'Advanced',
clazz: 'fa fa-cog button-icon', clazz: 'fa fa-cog button-icon',
@ -1909,12 +1909,12 @@
$('#shell-close-button').click(); $('#shell-close-button').click();
// show the custom ui // show the custom ui
customUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, true).done(function () { nfCustomUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, true).done(function () {
// once the custom ui is closed, reload the controller service // once the custom ui is closed, reload the controller service
reloadControllerServiceAndReferencingComponents(serviceTable, controllerService); reloadControllerServiceAndReferencingComponents(serviceTable, controllerService);
// show the settings // show the settings
settings.showSettings(); nfSettings.showSettings();
}); });
}; };
@ -1924,7 +1924,7 @@
// determine if changes have been made // determine if changes have been made
if (isSaveRequired()) { if (isSaveRequired()) {
// see if those changes should be saved // see if those changes should be saved
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Save', headerText: 'Save',
dialogContent: 'Save changes before opening the advanced configuration?', dialogContent: 'Save changes before opening the advanced configuration?',
noHandler: openCustomUi, noHandler: openCustomUi,
@ -1959,7 +1959,7 @@
updateReferencingComponentsBorder(referenceContainer); updateReferencingComponentsBorder(referenceContainer);
$('#controller-service-properties').propertytable('resetTableSize'); $('#controller-service-properties').propertytable('resetTableSize');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -2012,10 +2012,10 @@
controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity); controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity);
// populate the controller service settings // populate the controller service settings
common.populateField('controller-service-id', controllerService['id']); nfCommon.populateField('controller-service-id', controllerService['id']);
common.populateField('controller-service-type', common.substringAfterLast(controllerService['type'], '.')); nfCommon.populateField('controller-service-type', nfCommon.substringAfterLast(controllerService['type'], '.'));
common.populateField('read-only-controller-service-name', controllerService['name']); nfCommon.populateField('read-only-controller-service-name', controllerService['name']);
common.populateField('read-only-controller-service-comments', controllerService['comments']); nfCommon.populateField('read-only-controller-service-comments', controllerService['comments']);
// get the reference container // get the reference container
var referenceContainer = $('#controller-service-referencing-components'); var referenceContainer = $('#controller-service-referencing-components');
@ -2039,7 +2039,7 @@
}]; }];
// determine if we should show the advanced button // determine if we should show the advanced button
if (common.isDefinedAndNotNull(customUi) && common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') { if (nfCommon.isDefinedAndNotNull(nfCustomUi) && nfCommon.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
buttons.push({ buttons.push({
buttonText: 'Advanced', buttonText: 'Advanced',
clazz: 'fa fa-cog button-icon', clazz: 'fa fa-cog button-icon',
@ -2057,8 +2057,8 @@
$('#shell-close-button').click(); $('#shell-close-button').click();
// show the custom ui // show the custom ui
customUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, false).done(function () { nfCustomUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, false).done(function () {
settings.showSettings(); nfSettings.showSettings();
}); });
} }
} }
@ -2123,9 +2123,9 @@
*/ */
promptToDeleteController: function (serviceTable, controllerServiceEntity) { promptToDeleteController: function (serviceTable, controllerServiceEntity) {
// prompt for deletion // prompt for deletion
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Delete Controller Service', headerText: 'Delete Controller Service',
dialogContent: 'Delete controller service \'' + common.escapeHtml(controllerServiceEntity.component.name) + '\'?', dialogContent: 'Delete controller service \'' + nfCommon.escapeHtml(controllerServiceEntity.component.name) + '\'?',
yesHandler: function () { yesHandler: function () {
nfControllerService.remove(serviceTable, controllerServiceEntity); nfControllerService.remove(serviceTable, controllerServiceEntity);
} }
@ -2141,7 +2141,7 @@
remove: function (serviceTable, controllerServiceEntity) { remove: function (serviceTable, controllerServiceEntity) {
// prompt for removal? // prompt for removal?
var revision = client.getRevision(controllerServiceEntity); var revision = nfClient.getRevision(controllerServiceEntity);
$.ajax({ $.ajax({
type: 'DELETE', type: 'DELETE',
url: controllerServiceEntity.uri + '?' + $.param({ url: controllerServiceEntity.uri + '?' + $.param({
@ -2159,7 +2159,7 @@
if (controllerServiceEntity.permissions.canRead) { if (controllerServiceEntity.permissions.canRead) {
reloadControllerServiceReferences(serviceTable, controllerServiceEntity.component); reloadControllerServiceReferences(serviceTable, controllerServiceEntity.component);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };

View File

@ -34,8 +34,8 @@
'nf.PolicyManagement', 'nf.PolicyManagement',
'nf.ComponentState', 'nf.ComponentState',
'nf.ng.Bridge'], 'nf.ng.Bridge'],
function ($, d3, Slick, client, shell, processGroupConfiguration, canvasUtils, errorHandler, dialog, common, controllerService, processGroup, policyManagement, componentState, angularBridge) { function ($, d3, Slick, nfClient, nfShell, nfProcessGroupConfiguration, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon, nfControllerService, nfProcessGroup, nfPolicyManagement, nfComponentState, nfNgBridge) {
return (nf.ControllerServices = factory($, d3, Slick, client, shell, processGroupConfiguration, canvasUtils, errorHandler, dialog, common, controllerService, processGroup, policyManagement, componentState, angularBridge)); return (nf.ControllerServices = factory($, d3, Slick, nfClient, nfShell, nfProcessGroupConfiguration, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon, nfControllerService, nfProcessGroup, nfPolicyManagement, nfComponentState, nfNgBridge));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ControllerServices = module.exports = (nf.ControllerServices =
@ -71,7 +71,7 @@
root.nf.ComponentState, root.nf.ComponentState,
root.nf.ng.Bridge); root.nf.ng.Bridge);
} }
}(this, function ($, d3, Slick, client, shell, processGroupConfiguration, canvasUtils, errorHandler, dialog, common, controllerService, processGroup, policyManagement, componentState, angularBridge) { }(this, function ($, d3, Slick, nfClient, nfShell, nfProcessGroupConfiguration, nfCanvasUtils, nfErrorHandler, nfDialog, nfCommon, nfControllerService, nfProcessGroup, nfPolicyManagement, nfComponentState, nfNgBridge) {
'use strict'; 'use strict';
var dblClick = null; var dblClick = null;
@ -100,7 +100,7 @@
* @param item controller service type * @param item controller service type
*/ */
var isSelectable = function (item) { var isSelectable = function (item) {
return common.isBlank(item.usageRestriction) || common.canAccessRestrictedComponents(); return nfCommon.isBlank(item.usageRestriction) || nfCommon.canAccessRestrictedComponents();
}; };
/** /**
@ -120,7 +120,7 @@
var controllerServiceTypesGrid = $('#controller-service-types-table').data('gridInstance'); var controllerServiceTypesGrid = $('#controller-service-types-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(controllerServiceTypesGrid)) { if (nfCommon.isDefinedAndNotNull(controllerServiceTypesGrid)) {
var controllerServiceTypesData = controllerServiceTypesGrid.getData(); var controllerServiceTypesData = controllerServiceTypesGrid.getData();
// update the search criteria // update the search criteria
@ -257,7 +257,7 @@
// ensure something was selected // ensure something was selected
if (selectedServiceType === '') { if (selectedServiceType === '') {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Controller Service', headerText: 'Controller Service',
dialogContent: 'The type of controller service to create must be selected.' dialogContent: 'The type of controller service to create must be selected.'
}); });
@ -276,7 +276,7 @@
var addControllerService = function (controllerServicesUri, serviceTable, controllerServiceType) { var addControllerService = function (controllerServicesUri, serviceTable, controllerServiceType) {
// build the controller service entity // build the controller service entity
var controllerServiceEntity = { var controllerServiceEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -307,7 +307,7 @@
var row = controllerServicesData.getRowById(controllerServiceEntity.id); var row = controllerServicesData.getRowById(controllerServiceEntity.id);
controllerServicesGrid.setSelectedRows([row]); controllerServicesGrid.setSelectedRows([row]);
controllerServicesGrid.scrollRowIntoView(row); controllerServicesGrid.scrollRowIntoView(row);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// hide the dialog // hide the dialog
$('#new-controller-service-dialog').modal('hide'); $('#new-controller-service-dialog').modal('hide');
@ -325,7 +325,7 @@
id: 'type', id: 'type',
name: 'Type', name: 'Type',
field: 'label', field: 'label',
formatter: common.typeFormatter, formatter: nfCommon.typeFormatter,
sortable: false, sortable: false,
resizable: true resizable: true
}, },
@ -359,11 +359,11 @@
var controllerServiceType = controllerServiceTypesGrid.getDataItem(controllerServiceTypeIndex); var controllerServiceType = controllerServiceTypesGrid.getDataItem(controllerServiceTypeIndex);
// set the controller service type description // set the controller service type description
if (common.isDefinedAndNotNull(controllerServiceType)) { if (nfCommon.isDefinedAndNotNull(controllerServiceType)) {
// show the selected controller service // show the selected controller service
$('#controller-service-description-container').show(); $('#controller-service-description-container').show();
if (common.isBlank(controllerServiceType.description)) { if (nfCommon.isBlank(controllerServiceType.description)) {
$('#controller-service-type-description') $('#controller-service-type-description')
.attr('title', '') .attr('title', '')
.html('<span class="unset">No description specified</span>'); .html('<span class="unset">No description specified</span>');
@ -385,7 +385,7 @@
} }
}); });
controllerServiceTypesGrid.onViewportChanged.subscribe(function (e, args) { controllerServiceTypesGrid.onViewportChanged.subscribe(function (e, args) {
common.cleanUpTooltips($('#controller-service-types-table'), 'div.view-usage-restriction'); nfCommon.cleanUpTooltips($('#controller-service-types-table'), 'div.view-usage-restriction');
}); });
// wire up the dataview to the grid // wire up the dataview to the grid
@ -412,8 +412,8 @@
var item = controllerServiceTypesData.getItemById(rowId); var item = controllerServiceTypesData.getItemById(rowId);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(item.usageRestriction)) { if (nfCommon.isDefinedAndNotNull(item.usageRestriction)) {
usageRestriction.qtip($.extend({}, common.config.tooltipConfig, { usageRestriction.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: item.usageRestriction, content: item.usageRestriction,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -446,10 +446,10 @@
// add the documented type // add the documented type
controllerServiceTypesData.addItem({ controllerServiceTypesData.addItem({
id: id++, id: id++,
label: common.substringAfterLast(documentedType.type, '.'), label: nfCommon.substringAfterLast(documentedType.type, '.'),
type: documentedType.type, type: documentedType.type,
description: common.escapeHtml(documentedType.description), description: nfCommon.escapeHtml(documentedType.description),
usageRestriction: common.escapeHtml(documentedType.usageRestriction), usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction),
tags: documentedType.tags.join(', ') tags: documentedType.tags.join(', ')
}); });
@ -471,7 +471,7 @@
select: applyControllerServiceTypeFilter, select: applyControllerServiceTypeFilter,
remove: applyControllerServiceTypeFilter remove: applyControllerServiceTypeFilter
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// initialize the controller service dialog // initialize the controller service dialog
$('#new-controller-service-dialog').modal({ $('#new-controller-service-dialog').modal({
@ -539,7 +539,7 @@
return ''; return '';
} }
return common.substringAfterLast(dataContext.component.type, '.'); return nfCommon.substringAfterLast(dataContext.component.type, '.');
}; };
/** /**
@ -557,7 +557,7 @@
return ''; return '';
} }
if (common.isDefinedAndNotNull(dataContext.component.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
return dataContext.component.parentGroupId; return dataContext.component.parentGroupId;
} else { } else {
return 'Controller'; return 'Controller';
@ -574,7 +574,7 @@
// we know the process group for this controller service is part // we know the process group for this controller service is part
// of the current breadcrumb trail // of the current breadcrumb trail
var canWriteProcessGroupParent = function (processGroupId) { var canWriteProcessGroupParent = function (processGroupId) {
var breadcrumbs = angularBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs(); var breadcrumbs = nfNgBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
var isAuthorized = false; var isAuthorized = false;
$.each(breadcrumbs, function (_, breadcrumbEntity) { $.each(breadcrumbs, function (_, breadcrumbEntity) {
@ -587,10 +587,10 @@
return isAuthorized; return isAuthorized;
}; };
if (common.isDefinedAndNotNull(dataContext.component.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
return canWriteProcessGroupParent(dataContext.component.parentGroupId); return canWriteProcessGroupParent(dataContext.component.parentGroupId);
} else { } else {
return common.canModifyController(); return nfCommon.canModifyController();
} }
}; };
@ -606,31 +606,31 @@
if(a.permissions.canRead && b.permissions.canRead) { if(a.permissions.canRead && b.permissions.canRead) {
if (sortDetails.columnId === 'moreDetails') { if (sortDetails.columnId === 'moreDetails') {
var aBulletins = 0; var aBulletins = 0;
if (!common.isEmpty(a.bulletins)) { if (!nfCommon.isEmpty(a.bulletins)) {
aBulletins = a.bulletins.length; aBulletins = a.bulletins.length;
} }
var bBulletins = 0; var bBulletins = 0;
if (!common.isEmpty(b.bulletins)) { if (!nfCommon.isEmpty(b.bulletins)) {
bBulletins = b.bulletins.length; bBulletins = b.bulletins.length;
} }
return aBulletins - bBulletins; return aBulletins - bBulletins;
} else if (sortDetails.columnId === 'type') { } else if (sortDetails.columnId === 'type') {
var aType = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? common.substringAfterLast(a.component[sortDetails.columnId], '.') : ''; var aType = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? nfCommon.substringAfterLast(a.component[sortDetails.columnId], '.') : '';
var bType = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? common.substringAfterLast(b.component[sortDetails.columnId], '.') : ''; var bType = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? nfCommon.substringAfterLast(b.component[sortDetails.columnId], '.') : '';
return aType === bType ? 0 : aType > bType ? 1 : -1; return aType === bType ? 0 : aType > bType ? 1 : -1;
} else if (sortDetails.columnId === 'state') { } else if (sortDetails.columnId === 'state') {
var aState = 'Invalid'; var aState = 'Invalid';
if (common.isEmpty(a.component.validationErrors)) { if (nfCommon.isEmpty(a.component.validationErrors)) {
aState = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; aState = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
} }
var bState = 'Invalid'; var bState = 'Invalid';
if (common.isEmpty(b.component.validationErrors)) { if (nfCommon.isEmpty(b.component.validationErrors)) {
bState = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; bState = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
} }
return aState === bState ? 0 : aState > bState ? 1 : -1; return aState === bState ? 0 : aState > bState ? 1 : -1;
} else { } else {
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} }
} else { } else {
@ -667,8 +667,8 @@
// always include a button to view the usage // always include a button to view the usage
markup += '<div title="Usage" class="pointer controller-service-usage fa fa-book" style="margin-top: 5px; margin-right: 3px;" ></div>'; markup += '<div title="Usage" class="pointer controller-service-usage fa fa-book" style="margin-top: 5px; margin-right: 3px;" ></div>';
var hasErrors = !common.isEmpty(dataContext.component.validationErrors); var hasErrors = !nfCommon.isEmpty(dataContext.component.validationErrors);
var hasBulletins = !common.isEmpty(dataContext.bulletins); var hasBulletins = !nfCommon.isEmpty(dataContext.bulletins);
if (hasErrors) { if (hasErrors) {
markup += '<div class="pointer has-errors fa fa-warning" style="margin-top: 4px; margin-right: 3px; float: left;" ></div>'; markup += '<div class="pointer has-errors fa fa-warning" style="margin-top: 4px; margin-right: 3px; float: left;" ></div>';
@ -679,7 +679,7 @@
} }
if (hasErrors || hasBulletins) { if (hasErrors || hasBulletins) {
markup += '<span class="hidden row-id">' + common.escapeHtml(dataContext.id) + '</span>'; markup += '<span class="hidden row-id">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
} }
return markup; return markup;
@ -692,7 +692,7 @@
// determine the appropriate label // determine the appropriate label
var icon = '', label = ''; var icon = '', label = '';
if (!common.isEmpty(dataContext.component.validationErrors)) { if (!nfCommon.isEmpty(dataContext.component.validationErrors)) {
icon = 'invalid fa fa-warning'; icon = 'invalid fa fa-warning';
label = 'Invalid'; label = 'Invalid';
} else { } else {
@ -726,7 +726,7 @@
markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>';
// if there are no validation errors allow enabling // if there are no validation errors allow enabling
if (common.isEmpty(dataContext.component.validationErrors)) { if (nfCommon.isEmpty(dataContext.component.validationErrors)) {
markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>'; markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
} }
} }
@ -741,7 +741,7 @@
} }
// allow policy configuration conditionally // allow policy configuration conditionally
if (canvasUtils.isConfigurableAuthorizer() && common.canAccessTenants()) { if (nfCanvasUtils.isConfigurableAuthorizer() && nfCommon.canAccessTenants()) {
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>'; markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
} }
@ -827,44 +827,44 @@
// determine the desired action // determine the desired action
if (controllerServicesGrid.getColumns()[args.cell].id === 'actions') { if (controllerServicesGrid.getColumns()[args.cell].id === 'actions') {
if (target.hasClass('edit-controller-service')) { if (target.hasClass('edit-controller-service')) {
controllerService.showConfiguration(serviceTable, controllerServiceEntity); nfControllerService.showConfiguration(serviceTable, controllerServiceEntity);
} else if (target.hasClass('enable-controller-service')) { } else if (target.hasClass('enable-controller-service')) {
controllerService.enable(serviceTable, controllerServiceEntity); nfControllerService.enable(serviceTable, controllerServiceEntity);
} else if (target.hasClass('disable-controller-service')) { } else if (target.hasClass('disable-controller-service')) {
controllerService.disable(serviceTable, controllerServiceEntity); nfControllerService.disable(serviceTable, controllerServiceEntity);
} else if (target.hasClass('delete-controller-service')) { } else if (target.hasClass('delete-controller-service')) {
controllerService.promptToDeleteController(serviceTable, controllerServiceEntity); nfControllerService.promptToDeleteController(serviceTable, controllerServiceEntity);
} else if (target.hasClass('view-state-controller-service')) { } else if (target.hasClass('view-state-controller-service')) {
componentState.showState(controllerServiceEntity, controllerServiceEntity.state === 'DISABLED'); nfComponentState.showState(controllerServiceEntity, controllerServiceEntity.state === 'DISABLED');
} else if (target.hasClass('edit-access-policies')) { } else if (target.hasClass('edit-access-policies')) {
// show the policies for this service // show the policies for this service
policyManagement.showControllerServicePolicy(controllerServiceEntity); nfPolicyManagement.showControllerServicePolicy(controllerServiceEntity);
// close the settings dialog // close the settings dialog
$('#shell-close-button').click(); $('#shell-close-button').click();
} }
} else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') { } else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') {
if (target.hasClass('view-controller-service')) { if (target.hasClass('view-controller-service')) {
controllerService.showDetails(serviceTable, controllerServiceEntity); nfControllerService.showDetails(serviceTable, controllerServiceEntity);
} else if (target.hasClass('controller-service-usage')) { } else if (target.hasClass('controller-service-usage')) {
// close the settings dialog // close the settings dialog
$('#shell-close-button').click(); $('#shell-close-button').click();
// open the documentation for this controller service // open the documentation for this controller service
shell.showPage('../nifi-docs/documentation?' + $.param({ nfShell.showPage('../nifi-docs/documentation?' + $.param({
select: common.substringAfterLast(controllerServiceEntity.component.type, '.') select: nfCommon.substringAfterLast(controllerServiceEntity.component.type, '.')
})).done(function() { })).done(function() {
if (common.isDefinedAndNotNull(controllerServiceEntity.component.parentGroupId)) { if (nfCommon.isDefinedAndNotNull(controllerServiceEntity.component.parentGroupId)) {
var groupId; var groupId;
var processGroup = processGroup.get(controllerServiceEntity.component.parentGroupId); var processGroup = nfProcessGroup.get(controllerServiceEntity.component.parentGroupId);
if (common.isDefinedAndNotNull(processGroup)) { if (nfCommon.isDefinedAndNotNull(processGroup)) {
groupId = processGroup.id; groupId = processGroup.id;
} else { } else {
groupId = canvasUtils.getGroupId(); groupId = nfCanvasUtils.getGroupId();
} }
// reload the corresponding group // reload the corresponding group
processGroupConfiguration.showConfiguration(groupId); nfProcessGroupConfiguration.showConfiguration(groupId);
} else { } else {
showSettings(); showSettings();
} }
@ -894,12 +894,12 @@
var controllerServiceEntity = controllerServicesData.getItemById(serviceId); var controllerServiceEntity = controllerServicesData.getItemById(serviceId);
// format the errors // format the errors
var tooltip = common.formatUnorderedList(controllerServiceEntity.component.validationErrors); var tooltip = nfCommon.formatUnorderedList(controllerServiceEntity.component.validationErrors);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
errorIcon.qtip($.extend({}, errorIcon.qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: tooltip, content: tooltip,
position: { position: {
@ -923,13 +923,13 @@
var controllerServiceEntity = controllerServicesData.getItemById(taskId); var controllerServiceEntity = controllerServicesData.getItemById(taskId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(controllerServiceEntity.bulletins); var bulletins = nfCommon.getFormattedBulletins(controllerServiceEntity.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, bulletinIcon.qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: tooltip, content: tooltip,
position: { position: {
@ -966,8 +966,8 @@
}, service)); }, service));
}); });
common.cleanUpTooltips(serviceTable, 'div.has-errors'); nfCommon.cleanUpTooltips(serviceTable, 'div.has-errors');
common.cleanUpTooltips(serviceTable, 'div.has-bulletins'); nfCommon.cleanUpTooltips(serviceTable, 'div.has-bulletins');
var controllerServicesGrid = serviceTable.data('gridInstance'); var controllerServicesGrid = serviceTable.data('gridInstance');
var controllerServicesData = controllerServicesGrid.getData(); var controllerServicesData = controllerServicesGrid.getData();
@ -1084,7 +1084,7 @@
controllerServiceTypesGrid.onDblClick.subscribe(dblClick); controllerServiceTypesGrid.onDblClick.subscribe(dblClick);
// reset the canvas size after the dialog is shown // reset the canvas size after the dialog is shown
if (common.isDefinedAndNotNull(controllerServiceTypesGrid)) { if (nfCommon.isDefinedAndNotNull(controllerServiceTypesGrid)) {
controllerServiceTypesGrid.setSelectedRows([0]); controllerServiceTypesGrid.setSelectedRows([0]);
controllerServiceTypesGrid.resizeCanvas(); controllerServiceTypesGrid.resizeCanvas();
} }
@ -1100,7 +1100,7 @@
*/ */
resetTableSize: function (serviceTable) { resetTableSize: function (serviceTable) {
var controllerServicesGrid = serviceTable.data('gridInstance'); var controllerServicesGrid = serviceTable.data('gridInstance');
if (common.isDefinedAndNotNull(controllerServicesGrid)) { if (nfCommon.isDefinedAndNotNull(controllerServicesGrid)) {
controllerServicesGrid.resizeCanvas(); controllerServicesGrid.resizeCanvas();
} }
}, },
@ -1128,14 +1128,14 @@
controllerServicesData.beginUpdate(); controllerServicesData.beginUpdate();
// if there are some bulletins process them // if there are some bulletins process them
if (!common.isEmpty(controllerServiceBulletins)) { if (!nfCommon.isEmpty(controllerServiceBulletins)) {
var controllerServiceBulletinsBySource = d3.nest() var controllerServiceBulletinsBySource = d3.nest()
.key(function(d) { return d.sourceId; }) .key(function(d) { return d.sourceId; })
.map(controllerServiceBulletins, d3.map); .map(controllerServiceBulletins, d3.map);
controllerServiceBulletinsBySource.forEach(function(sourceId, sourceBulletins) { controllerServiceBulletinsBySource.forEach(function(sourceId, sourceBulletins) {
var controllerService = controllerServicesData.getItemById(sourceId); var controllerService = controllerServicesData.getItemById(sourceId);
if (common.isDefinedAndNotNull(controllerService)) { if (nfCommon.isDefinedAndNotNull(controllerService)) {
controllerServicesData.updateItem(sourceId, $.extend(controllerService, { controllerServicesData.updateItem(sourceId, $.extend(controllerService, {
bulletins: sourceBulletins bulletins: sourceBulletins
})); }));

View File

@ -23,8 +23,8 @@
'nf.Common', 'nf.Common',
'nf.Shell', 'nf.Shell',
'nf.Dialog', 'nf.Dialog',
'nf.Client'], function ($, common, shell, dialog, client) { 'nf.Client'], function ($, nfCommon, nfShell, nfDialog, nfClient) {
return (nf.CustomUi = factory($, common, shell, dialog, client)); return (nf.CustomUi = factory($, nfCommon, nfShell, nfDialog, nfClient));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.CustomUi = factory(require('jquery'), module.exports = (nf.CustomUi = factory(require('jquery'),
@ -39,7 +39,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Client); root.nf.Client);
} }
}(this, function ($, common, shell, dialog, client) { }(this, function ($, nfCommon, nfShell, nfDialog, nfClient) {
'use strict'; 'use strict';
return { return {
@ -52,11 +52,11 @@
*/ */
showCustomUi: function (entity, uri, editable) { showCustomUi: function (entity, uri, editable) {
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
common.getAccessToken('../nifi-api/access/ui-extension-token').done(function (uiExtensionToken) { nfCommon.getAccessToken('../nifi-api/access/ui-extension-token').done(function (uiExtensionToken) {
// record the processor id // record the processor id
$('#shell-close-button'); $('#shell-close-button');
var revision = client.getRevision(entity); var revision = nfClient.getRevision(entity);
// build the customer ui params // build the customer ui params
var customUiParams = { var customUiParams = {
@ -67,16 +67,16 @@
}; };
// conditionally include the ui extension token // conditionally include the ui extension token
if (!common.isBlank(uiExtensionToken)) { if (!nfCommon.isBlank(uiExtensionToken)) {
customUiParams['access_token'] = uiExtensionToken; customUiParams['access_token'] = uiExtensionToken;
} }
// show the shell // show the shell
shell.showPage('..' + uri + '?' + $.param(customUiParams), false).done(function () { nfShell.showPage('..' + uri + '?' + $.param(customUiParams), false).done(function () {
deferred.resolve(); deferred.resolve();
}); });
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Advanced Configuration', headerText: 'Advanced Configuration',
dialogContent: 'Unable to generate access token for accessing the advanced configuration dialog.' dialogContent: 'Unable to generate access token for accessing the advanced configuration dialog.'
}); });

View File

@ -28,8 +28,8 @@
'nf.Dialog', 'nf.Dialog',
'nf.Client', 'nf.Client',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, d3, nfConnection, birdseye, canvasUtils, common, dialog, client, errorHandler) { function ($, d3, nfConnection, nfBirdseye, nfCanvasUtils, nfCommon, nfDialog, nfClient, nfErrorHandler) {
return (nf.Draggable = factory($, d3, nfConnection, birdseye, canvasUtils, common, dialog, client, errorHandler)); return (nf.Draggable = factory($, d3, nfConnection, nfBirdseye, nfCanvasUtils, nfCommon, nfDialog, nfClient, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Draggable = module.exports = (nf.Draggable =
@ -53,7 +53,7 @@
root.nf.Client, root.nf.Client,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, d3, nfConnection, birdseye, canvasUtils, common, dialog, client, errorHandler) { }(this, function ($, d3, nfConnection, nfBirdseye, nfCanvasUtils, nfCommon, nfDialog, nfClient, nfErrorHandler) {
'use strict'; 'use strict';
var nfCanvas; var nfCanvas;
@ -83,8 +83,8 @@
var selectedComponents = d3.selectAll('g.component.selected'); var selectedComponents = d3.selectAll('g.component.selected');
// ensure every component is writable // ensure every component is writable
if (canvasUtils.canModify(selectedConnections) === false || canvasUtils.canModify(selectedComponents) === false) { if (nfCanvasUtils.canModify(selectedConnections) === false || nfCanvasUtils.canModify(selectedComponents) === false) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Component Position', headerText: 'Component Position',
dialogContent: 'Must be authorized to modify every component selected.' dialogContent: 'Must be authorized to modify every component selected.'
}); });
@ -104,7 +104,7 @@
// consider any self looping connections // consider any self looping connections
var connections = nfConnection.getComponentConnections(d.id); var connections = nfConnection.getComponentConnections(d.id);
$.each(connections, function (_, connection) { $.each(connections, function (_, connection) {
if (!updates.has(connection.id) && canvasUtils.getConnectionSourceComponentId(connection) === canvasUtils.getConnectionDestinationComponentId(connection)) { if (!updates.has(connection.id) && nfCanvasUtils.getConnectionSourceComponentId(connection) === nfCanvasUtils.getConnectionDestinationComponentId(connection)) {
var connectionUpdate = nfDraggable.updateConnectionPosition(nfConnection.get(connection.id), delta); var connectionUpdate = nfDraggable.updateConnectionPosition(nfConnection.get(connection.id), delta);
if (connectionUpdate !== null) { if (connectionUpdate !== null) {
updates.set(connection.id, connectionUpdate); updates.set(connection.id, connectionUpdate);
@ -126,15 +126,15 @@
var selection = d3.selectAll('g.component.selected, g.connection.selected'); var selection = d3.selectAll('g.component.selected, g.connection.selected');
var group = d3.select('g.drop'); var group = d3.select('g.drop');
if (canvasUtils.canModify(selection) === false) { if (nfCanvasUtils.canModify(selection) === false) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Component Position', headerText: 'Component Position',
dialogContent: 'Must be authorized to modify every component selected.' dialogContent: 'Must be authorized to modify every component selected.'
}); });
return; return;
} }
if (canvasUtils.canModify(group) === false) { if (nfCanvasUtils.canModify(group) === false) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Component Position', headerText: 'Component Position',
dialogContent: 'Not authorized to modify the destination group.' dialogContent: 'Not authorized to modify the destination group.'
}); });
@ -142,7 +142,7 @@
} }
// move the seleciton into the group // move the seleciton into the group
canvasUtils.moveComponents(selection, group); nfCanvasUtils.moveComponents(selection, group);
}; };
var nfDraggable = { var nfDraggable = {
@ -193,10 +193,10 @@
.attr('width', maxX - minX) .attr('width', maxX - minX)
.attr('height', maxY - minY) .attr('height', maxY - minY)
.attr('stroke-width', function () { .attr('stroke-width', function () {
return 1 / canvasUtils.scaleCanvasView(); return 1 / nfCanvasUtils.scaleCanvasView();
}) })
.attr('stroke-dasharray', function () { .attr('stroke-dasharray', function () {
return 4 / canvasUtils.scaleCanvasView(); return 4 / nfCanvasUtils.scaleCanvasView();
}) })
.datum({ .datum({
original: { original: {
@ -257,7 +257,7 @@
// build the entity // build the entity
var entity = { var entity = {
'revision': client.getRevision(d), 'revision': nfClient.getRevision(d),
'component': { 'component': {
'id': d.id, 'id': d.id,
'position': newPosition 'position': newPosition
@ -274,7 +274,7 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// update the component // update the component
canvasUtils.getComponentByType(d.type).set(response); nfCanvasUtils.getComponentByType(d.type).set(response);
// resolve with an object so we can refresh when finished // resolve with an object so we can refresh when finished
deferred.resolve({ deferred.resolve({
@ -283,12 +283,12 @@
}); });
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Component Position', headerText: 'Component Position',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
deferred.reject(); deferred.reject();
@ -318,7 +318,7 @@
}); });
var entity = { var entity = {
'revision': client.getRevision(d), 'revision': nfClient.getRevision(d),
'component': { 'component': {
id: d.id, id: d.id,
bends: newBends bends: newBends
@ -344,12 +344,12 @@
}); });
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Component Position', headerText: 'Component Position',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
deferred.reject(); deferred.reject();
@ -388,7 +388,7 @@
nfConnection.refresh(connectionId); nfConnection.refresh(connectionId);
}); });
}).always(function () { }).always(function () {
birdseye.refresh(); nfBirdseye.refresh();
}); });
} }
}, },

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, common, client, canvasUtils) { function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
return (nf.Funnel = factory($, d3, common, client, canvasUtils)); return (nf.Funnel = factory($, d3, nfCommon, nfClient, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Funnel = module.exports = (nf.Funnel =
@ -41,7 +41,7 @@
root.nf.Client, root.nf.Client,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, d3, common, client, canvasUtils) { }(this, function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
'use strict'; 'use strict';
var nfConnectable; var nfConnectable;
@ -105,7 +105,7 @@
'class': 'funnel component' 'class': 'funnel component'
}) })
.classed('selected', selected) .classed('selected', selected)
.call(canvasUtils.position); .call(nfCanvasUtils.position);
// funnel border // funnel border
funnel.append('rect') funnel.append('rect')
@ -178,7 +178,7 @@
var funnel = d3.select(this); var funnel = d3.select(this);
// update the component behavior as appropriate // update the component behavior as appropriate
canvasUtils.editable(funnel, nfConnectable, nfDraggable); nfCanvasUtils.editable(funnel, nfConnectable, nfDraggable);
}); });
}; };
@ -194,12 +194,17 @@
var nfFunnel = { var nfFunnel = {
/** /**
* Initializes of the Processor handler. * 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) { init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) {
nfConnectable = connectable; nfConnectable = nfConnectableRef;
nfDraggable = draggable; nfDraggable = nfDraggableRef;
nfSelectable = selectable; nfSelectable = nfSelectableRef;
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
funnelMap = d3.map(); funnelMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -221,8 +226,8 @@
*/ */
add: function (funnelEntities, options) { add: function (funnelEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// get the current time // get the current time
@ -243,7 +248,7 @@
$.each(funnelEntities, function (_, funnelEntity) { $.each(funnelEntities, function (_, funnelEntity) {
add(funnelEntity); add(funnelEntity);
}); });
} else if (common.isDefinedAndNotNull(funnelEntities)) { } else if (nfCommon.isDefinedAndNotNull(funnelEntities)) {
add(funnelEntities); add(funnelEntities);
} }
@ -262,16 +267,16 @@
set: function (funnelEntities, options) { set: function (funnelEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
var set = function (proposedFunnelEntity) { var set = function (proposedFunnelEntity) {
var currentFunnelEntity = funnelMap.get(proposedFunnelEntity.id); var currentFunnelEntity = funnelMap.get(proposedFunnelEntity.id);
// set the funnel if appropriate due to revision and wasn't previously removed // set the funnel if appropriate due to revision and wasn't previously removed
if (client.isNewerRevision(currentFunnelEntity, proposedFunnelEntity) && !removedCache.has(proposedFunnelEntity.id)) { if (nfClient.isNewerRevision(currentFunnelEntity, proposedFunnelEntity) && !removedCache.has(proposedFunnelEntity.id)) {
funnelMap.set(proposedFunnelEntity.id, $.extend({ funnelMap.set(proposedFunnelEntity.id, $.extend({
type: 'Funnel', type: 'Funnel',
dimensions: dimensions dimensions: dimensions
@ -294,14 +299,14 @@
$.each(funnelEntities, function (_, funnelEntity) { $.each(funnelEntities, function (_, funnelEntity) {
set(funnelEntity); set(funnelEntity);
}); });
} else if (common.isDefinedAndNotNull(funnelEntities)) { } else if (nfCommon.isDefinedAndNotNull(funnelEntities)) {
set(funnelEntities); set(funnelEntities);
} }
// apply the selection and handle all new processors // apply the selection and handle all new processors
var selection = select(); var selection = select();
selection.enter().call(renderFunnels, selectAll); selection.enter().call(renderFunnels, selectAll);
selection.call(updateFunnels).call(canvasUtils.position, transition); selection.call(updateFunnels).call(nfCanvasUtils.position, transition);
selection.exit().call(removeFunnels); selection.exit().call(removeFunnels);
}, },
@ -312,7 +317,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return funnelMap.values(); return funnelMap.values();
} else { } else {
return funnelMap.get(id); return funnelMap.get(id);
@ -326,7 +331,7 @@
* @param {string} id Optional * @param {string} id Optional
*/ */
refresh: function (id) { refresh: function (id) {
if (common.isDefinedAndNotNull(id)) { if (nfCommon.isDefinedAndNotNull(id)) {
d3.select('#id-' + id).call(updateFunnels); d3.select('#id-' + id).call(updateFunnels);
} else { } else {
d3.selectAll('g.funnel').call(updateFunnels); d3.selectAll('g.funnel').call(updateFunnels);
@ -358,7 +363,7 @@
* @param {string} id The id * @param {string} id The id
*/ */
position: function (id) { position: function (id) {
d3.select('#id-' + id).call(canvasUtils.position); d3.select('#id-' + id).call(nfCanvasUtils.position);
}, },
/** /**

View File

@ -25,8 +25,8 @@
define(['jquery', define(['jquery',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, errorHandler, canvasUtils) { function ($, nfErrorHandler, nfCanvasUtils) {
return (nf.GoTo = factory($, errorHandler, canvasUtils)); return (nf.GoTo = factory($, nfErrorHandler, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.GoTo = module.exports = (nf.GoTo =
@ -38,7 +38,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, errorHandler, canvasUtils) { }(this, function ($, nfErrorHandler, nfCanvasUtils) {
'use strict'; 'use strict';
var config = { var config = {
@ -76,7 +76,7 @@
var connectionStyle = 'unset'; var connectionStyle = 'unset';
var connectionName = 'Connection'; var connectionName = 'Connection';
if (connectionEntity.permissions.canRead === true) { if (connectionEntity.permissions.canRead === true) {
var formattedConnectionName = canvasUtils.formatConnectionName(connectionEntity.component); var formattedConnectionName = nfCanvasUtils.formatConnectionName(connectionEntity.component);
if (formattedConnectionName !== '') { if (formattedConnectionName !== '') {
connectionStyle = ''; connectionStyle = '';
connectionName = formattedConnectionName; connectionName = formattedConnectionName;
@ -87,7 +87,7 @@
$('<div class="search-result-icon icon-connect"></div>').appendTo(connectionEntry); $('<div class="search-result-icon icon-connect"></div>').appendTo(connectionEntry);
$('<div class="connection-entry-name go-to-link"></div>').attr('title', connectionName).addClass(connectionStyle).text(connectionName).on('click', function () { $('<div class="connection-entry-name go-to-link"></div>').attr('title', connectionName).addClass(connectionStyle).text(connectionName).on('click', function () {
// go to the connection // go to the connection
canvasUtils.showComponent(parentProcessGroupId, connectionEntity.id); nfCanvasUtils.showComponent(parentProcessGroupId, connectionEntity.id);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -136,7 +136,7 @@
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(downstreamComponent); $('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(downstreamComponent);
$('<div class="destination-component-name go-to-link"></div>').attr('title', destinationName).text(destinationName).on('click', function () { $('<div class="destination-component-name go-to-link"></div>').attr('title', destinationName).text(destinationName).on('click', function () {
// go to the component // go to the component
canvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId); nfCanvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -171,7 +171,7 @@
$('<div class="search-result-icon icon-group"></div>').appendTo(downstreamComponent); $('<div class="search-result-icon icon-group"></div>').appendTo(downstreamComponent);
$('<div class="destination-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () { $('<div class="destination-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
// go to the remote process group // go to the remote process group
canvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id); nfCanvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -193,7 +193,7 @@
$('<div class="search-result-icon icon-port-in"></div>').appendTo(downstreamInputPort); $('<div class="search-result-icon icon-port-in"></div>').appendTo(downstreamInputPort);
$('<div class="destination-input-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () { $('<div class="destination-input-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
// go to the remote process group // go to the remote process group
canvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId); nfCanvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -228,7 +228,7 @@
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(downstreamComponent); $('<div class="search-result-icon icon-group-remote"></div>').appendTo(downstreamComponent);
$('<div class="destination-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () { $('<div class="destination-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
// go to the remote process group // go to the remote process group
canvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id); nfCanvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -282,7 +282,7 @@
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(sourceComponent); $('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(sourceComponent);
$('<div class="source-component-name go-to-link"></div>').attr('title', sourceName).text(sourceName).on('click', function () { $('<div class="source-component-name go-to-link"></div>').attr('title', sourceName).text(sourceName).on('click', function () {
// go to the component // go to the component
canvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId); nfCanvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -317,7 +317,7 @@
$('<div class="search-result-icon icon-group"></div>').appendTo(sourceComponent); $('<div class="search-result-icon icon-group"></div>').appendTo(sourceComponent);
$('<div class="source-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () { $('<div class="source-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
// go to the process group // go to the process group
canvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id); nfCanvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -338,7 +338,7 @@
$('<div class="search-result-icon icon-port-out"></div>').appendTo(sourceOutputPort); $('<div class="search-result-icon icon-port-out"></div>').appendTo(sourceOutputPort);
$('<div class="source-output-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () { $('<div class="source-output-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
// go to the output port // go to the output port
canvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId); nfCanvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -373,7 +373,7 @@
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(sourceComponent); $('<div class="search-result-icon icon-group-remote"></div>').appendTo(sourceComponent);
$('<div class="source-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () { $('<div class="source-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
// go to the remote process group // go to the remote process group
canvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id); nfCanvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
// close the dialog // close the dialog
$('#connections-dialog').modal('hide'); $('#connections-dialog').modal('hide');
@ -451,9 +451,9 @@
*/ */
showDownstreamFromProcessor: function (selection) { showDownstreamFromProcessor: function (selection) {
var processorEntity = selection.datum(); var processorEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
var processorLabel = getDisplayName(processorEntity); var processorLabel = getDisplayName(processorEntity);
@ -471,7 +471,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the source // only show connections for which this selection is the source
if (connectionEntity.sourceId === processorEntity.id) { if (connectionEntity.sourceId === processorEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -491,9 +491,9 @@
*/ */
showUpstreamFromProcessor: function (selection) { showUpstreamFromProcessor: function (selection) {
var processorEntity = selection.datum(); var processorEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
var processorLabel = getDisplayName(processorEntity); var processorLabel = getDisplayName(processorEntity);
@ -511,7 +511,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the destination // only show connections for which this selection is the destination
if (connectionEntity.destinationId === processorEntity.id) { if (connectionEntity.destinationId === processorEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -531,12 +531,12 @@
*/ */
showDownstreamFromGroup: function (selection) { showDownstreamFromGroup: function (selection) {
var groupEntity = selection.datum(); var groupEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
var iconStyle = 'icon-group'; var iconStyle = 'icon-group';
if (canvasUtils.isRemoteProcessGroup(selection)) { if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
iconStyle = 'icon-group-remote'; iconStyle = 'icon-group-remote';
} }
@ -556,7 +556,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the source // only show connections for which this selection is the source
if (connectionEntity.sourceGroupId === groupEntity.id) { if (connectionEntity.sourceGroupId === groupEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -576,12 +576,12 @@
*/ */
showUpstreamFromGroup: function (selection) { showUpstreamFromGroup: function (selection) {
var groupEntity = selection.datum(); var groupEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
var iconStyle = 'icon-group'; var iconStyle = 'icon-group';
if (canvasUtils.isRemoteProcessGroup(selection)) { if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
iconStyle = 'icon-group-remote'; iconStyle = 'icon-group-remote';
} }
@ -601,7 +601,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the destination // only show connections for which this selection is the destination
if (connectionEntity.destinationGroupId === groupEntity.id) { if (connectionEntity.destinationGroupId === groupEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -621,9 +621,9 @@
*/ */
showDownstreamFromInputPort: function (selection) { showDownstreamFromInputPort: function (selection) {
var portEntity = selection.datum(); var portEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
var portLabel = getDisplayName(portEntity); var portLabel = getDisplayName(portEntity);
@ -641,7 +641,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the source // only show connections for which this selection is the source
if (connectionEntity.sourceId === portEntity.id) { if (connectionEntity.sourceId === portEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -664,7 +664,7 @@
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: config.urls.processGroups + encodeURIComponent(canvasUtils.getParentGroupId()), url: config.urls.processGroups + encodeURIComponent(nfCanvasUtils.getParentGroupId()),
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
var flow = response.processGroupFlow.flow; var flow = response.processGroupFlow.flow;
@ -681,7 +681,7 @@
// populate the upstream dialog // populate the upstream dialog
$('#connections-context') $('#connections-context')
.append('<div class="search-result-icon icon-group"></div>') .append('<div class="search-result-icon icon-group"></div>')
.append($('<div class="connections-component-name"></div>').text(canvasUtils.getGroupName())) .append($('<div class="connections-component-name"></div>').text(nfCanvasUtils.getGroupName()))
.append('<div class="clear"></div>') .append('<div class="clear"></div>')
.append('<div class="search-result-icon icon-port-in" style="margin-left: 20px;"></div>') .append('<div class="search-result-icon icon-port-in" style="margin-left: 20px;"></div>')
.append($('<div class="connections-component-name"></div>').text(portLabel)) .append($('<div class="connections-component-name"></div>').text(portLabel))
@ -691,7 +691,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the destination // only show connections for which this selection is the destination
if (connectionEntity.destinationId === portEntity.id) { if (connectionEntity.destinationId === portEntity.id) {
addConnection(canvasUtils.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -702,7 +702,7 @@
// show the upstream dialog // show the upstream dialog
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show'); $('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -715,7 +715,7 @@
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: config.urls.processGroups + encodeURIComponent(canvasUtils.getParentGroupId()), url: config.urls.processGroups + encodeURIComponent(nfCanvasUtils.getParentGroupId()),
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
var flow = response.processGroupFlow.flow; var flow = response.processGroupFlow.flow;
@ -732,7 +732,7 @@
// populate the downstream dialog // populate the downstream dialog
$('#connections-context') $('#connections-context')
.append('<div class="search-result-icon icon-group"></div>') .append('<div class="search-result-icon icon-group"></div>')
.append($('<div class="connections-component-name"></div>').text(canvasUtils.getGroupName())) .append($('<div class="connections-component-name"></div>').text(nfCanvasUtils.getGroupName()))
.append('<div class="clear"></div>') .append('<div class="clear"></div>')
.append('<div class="search-result-icon icon-port-out" style="margin-left: 20px;"></div>') .append('<div class="search-result-icon icon-port-out" style="margin-left: 20px;"></div>')
.append($('<div class="connections-component-name"></div>').text(portLabel)) .append($('<div class="connections-component-name"></div>').text(portLabel))
@ -742,7 +742,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the source // only show connections for which this selection is the source
if (connectionEntity.sourceId === portEntity.id) { if (connectionEntity.sourceId === portEntity.id) {
addConnection(canvasUtils.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -753,7 +753,7 @@
// show the downstream dialog // show the downstream dialog
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show'); $('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -763,9 +763,9 @@
*/ */
showUpstreamFromOutputPort: function (selection) { showUpstreamFromOutputPort: function (selection) {
var portEntity = selection.datum(); var portEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
var portLabel = getDisplayName(portEntity); var portLabel = getDisplayName(portEntity);
@ -783,7 +783,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the destination // only show connections for which this selection is the destination
if (connectionEntity.destinationId === portEntity.id) { if (connectionEntity.destinationId === portEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -803,9 +803,9 @@
*/ */
showDownstreamFromFunnel: function (selection) { showDownstreamFromFunnel: function (selection) {
var funnelEntity = selection.datum(); var funnelEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
// record details of the current component // record details of the current component
currentComponentId = funnelEntity.id; currentComponentId = funnelEntity.id;
@ -821,7 +821,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the source // only show connections for which this selection is the source
if (connectionEntity.sourceId === funnelEntity.id) { if (connectionEntity.sourceId === funnelEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });
@ -841,9 +841,9 @@
*/ */
showUpstreamFromFunnel: function (selection) { showUpstreamFromFunnel: function (selection) {
var funnelEntity = selection.datum(); var funnelEntity = selection.datum();
var connections = canvasUtils.getComponentByType('Connection').get(); var connections = nfCanvasUtils.getComponentByType('Connection').get();
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get(); var processGroups = nfCanvasUtils.getComponentByType('ProcessGroup').get();
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get(); var remoteProcessGroups = nfCanvasUtils.getComponentByType('RemoteProcessGroup').get();
// record details of the current component // record details of the current component
currentComponentId = funnelEntity.id; currentComponentId = funnelEntity.id;
@ -859,7 +859,7 @@
$.each(connections, function (_, connectionEntity) { $.each(connections, function (_, connectionEntity) {
// only show connections for which this selection is the destination // only show connections for which this selection is the destination
if (connectionEntity.destinationId === funnelEntity.id) { if (connectionEntity.destinationId === funnelEntity.id) {
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups); addConnection(nfCanvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
} }
}); });

View File

@ -35,8 +35,8 @@
'nf.Draggable', 'nf.Draggable',
'nf.Selectable', 'nf.Selectable',
'nf.ContextMenu'], 'nf.ContextMenu'],
function ($, d3, common, angularBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, canvasUtils, connectable, draggable, selectable, contextMenu) { function ($, d3, nfCommon, nfNgBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, nfCanvasUtils, nfConnectable, nfDraggable, nfSelectable, nfContextMenu) {
return (nf.Graph = factory($, d3, common, angularBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, canvasUtils, connectable, draggable, selectable, contextMenu)); return (nf.Graph = factory($, d3, nfCommon, nfNgBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, nfCanvasUtils, nfConnectable, nfDraggable, nfSelectable, nfContextMenu));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Graph = module.exports = (nf.Graph =
@ -74,15 +74,15 @@
root.nf.Selectable, root.nf.Selectable,
root.nf.ContextMenu); root.nf.ContextMenu);
} }
}(this, function ($, d3, common, angularBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, canvasUtils, connectable, draggable, selectable, contextMenu) { }(this, function ($, d3, nfCommon, nfNgBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, nfCanvasUtils, nfConnectable, nfDraggable, nfSelectable, nfContextMenu) {
'use strict'; 'use strict';
var combinePorts = function (contents) { var combinePorts = function (contents) {
if (common.isDefinedAndNotNull(contents.inputPorts) && common.isDefinedAndNotNull(contents.outputPorts)) { if (nfCommon.isDefinedAndNotNull(contents.inputPorts) && nfCommon.isDefinedAndNotNull(contents.outputPorts)) {
return contents.inputPorts.concat(contents.outputPorts); return contents.inputPorts.concat(contents.outputPorts);
} else if (common.isDefinedAndNotNull(contents.inputPorts)) { } else if (nfCommon.isDefinedAndNotNull(contents.inputPorts)) {
return contents.inputPorts; return contents.inputPorts;
} else if (common.isDefinedAndNotNull(contents.outputPorts)) { } else if (nfCommon.isDefinedAndNotNull(contents.outputPorts)) {
return contents.outputPorts; return contents.outputPorts;
} else { } else {
return []; return [];
@ -90,11 +90,11 @@
}; };
var combinePortStatus = function (status) { var combinePortStatus = function (status) {
if (common.isDefinedAndNotNull(status.inputPortStatusSnapshots) && common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) { if (nfCommon.isDefinedAndNotNull(status.inputPortStatusSnapshots) && nfCommon.isDefinedAndNotNull(status.outputPortStatusSnapshots)) {
return status.inputPortStatusSnapshots.concat(status.outputPortStatusSnapshots); return status.inputPortStatusSnapshots.concat(status.outputPortStatusSnapshots);
} else if (common.isDefinedAndNotNull(status.inputPortStatusSnapshots)) { } else if (nfCommon.isDefinedAndNotNull(status.inputPortStatusSnapshots)) {
return status.inputPortStatusSnapshots; return status.inputPortStatusSnapshots;
} else if (common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) { } else if (nfCommon.isDefinedAndNotNull(status.outputPortStatusSnapshots)) {
return status.outputPortStatusSnapshots; return status.outputPortStatusSnapshots;
} else { } else {
return []; return [];
@ -106,8 +106,8 @@
*/ */
var updateComponentVisibility = function () { var updateComponentVisibility = function () {
var canvasContainer = $('#canvas-container'); var canvasContainer = $('#canvas-container');
var translate = canvasUtils.translateCanvasView(); var translate = nfCanvasUtils.translateCanvasView();
var scale = canvasUtils.scaleCanvasView(); var scale = nfCanvasUtils.scaleCanvasView();
// scale the translation // scale the translation
translate = [translate[0] / scale, translate[1] / scale]; translate = [translate[0] / scale, translate[1] / scale];
@ -124,7 +124,7 @@
// detects whether a component is visible and should be rendered // detects whether a component is visible and should be rendered
var isComponentVisible = function (d) { var isComponentVisible = function (d) {
if (!canvasUtils.shouldRenderPerScale()) { if (!nfCanvasUtils.shouldRenderPerScale()) {
return false; return false;
} }
@ -139,7 +139,7 @@
// detects whether a connection is visible and should be rendered // detects whether a connection is visible and should be rendered
var isConnectionVisible = function (d) { var isConnectionVisible = function (d) {
if (!canvasUtils.shouldRenderPerScale()) { if (!nfCanvasUtils.shouldRenderPerScale()) {
return false; return false;
} }
@ -195,16 +195,16 @@
var nfGraph = { var nfGraph = {
init: function () { init: function () {
// initialize the object responsible for each type of component // initialize the object responsible for each type of component
nfLabel.init(connectable, draggable, selectable, contextMenu); nfLabel.init(nfConnectable, nfDraggable, nfSelectable, nfContextMenu);
nfFunnel.init(connectable, draggable, selectable, contextMenu); nfFunnel.init(nfConnectable, nfDraggable, nfSelectable, nfContextMenu);
nfPort.init(connectable, draggable, selectable, contextMenu); nfPort.init(nfConnectable, nfDraggable, nfSelectable, nfContextMenu);
nfRemoteProcessGroup.init(connectable, draggable, selectable, contextMenu); nfRemoteProcessGroup.init(nfConnectable, nfDraggable, nfSelectable, nfContextMenu);
nfProcessGroup.init(connectable, draggable, selectable, contextMenu); nfProcessGroup.init(nfConnectable, nfDraggable, nfSelectable, nfContextMenu);
nfProcessor.init(connectable, draggable, selectable, contextMenu); nfProcessor.init(nfConnectable, nfDraggable, nfSelectable, nfContextMenu);
nfConnection.init(selectable, contextMenu); nfConnection.init(nfSelectable, nfContextMenu);
// load the graph // load the graph
return nfProcessGroup.enterGroup(canvasUtils.getGroupId()); return nfProcessGroup.enterGroup(nfCanvasUtils.getGroupId());
}, },
/** /**
@ -215,13 +215,13 @@
*/ */
add: function (processGroupContents, options) { add: function (processGroupContents, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// if we are going to select the new components, deselect the previous selection // if we are going to select the new components, deselect the previous selection
if (selectAll) { if (selectAll) {
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
} }
// merge the ports together // merge the ports together
@ -238,7 +238,7 @@
// inform Angular app if the selection is changing // inform Angular app if the selection is changing
if (selectAll) { if (selectAll) {
angularBridge.digest(); nfNgBridge.digest();
} }
}, },
@ -250,13 +250,13 @@
*/ */
set: function (processGroupContents, options) { set: function (processGroupContents, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// if we are going to select the new components, deselect the previous selection // if we are going to select the new components, deselect the previous selection
if (selectAll) { if (selectAll) {
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
} }
// merge the ports together // merge the ports together
@ -273,7 +273,7 @@
// inform Angular app if the selection is changing // inform Angular app if the selection is changing
if (selectAll) { if (selectAll) {
angularBridge.digest(); nfNgBridge.digest();
} }
}, },
@ -405,11 +405,11 @@
reload: function (component) { reload: function (component) {
var componentData = component.datum(); var componentData = component.datum();
if (componentData.permissions.canRead) { if (componentData.permissions.canRead) {
if (canvasUtils.isProcessor(component)) { if (nfCanvasUtils.isProcessor(component)) {
nfProcessor.reload(componentData.id); nfProcessor.reload(componentData.id);
} else if (canvasUtils.isInputPort(component)) { } else if (nfCanvasUtils.isInputPort(component)) {
nfPort.reload(componentData.id); nfPort.reload(componentData.id);
} else if (canvasUtils.isRemoteProcessGroup(component)) { } else if (nfCanvasUtils.isRemoteProcessGroup(component)) {
nfRemoteProcessGroup.reload(componentData.id); nfRemoteProcessGroup.reload(componentData.id);
} }
} }

View File

@ -27,8 +27,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ng.Bridge', 'nf.ng.Bridge',
'nf.Label'], 'nf.Label'],
function ($, d3, errorHandler, common, client, canvasUtils, angularBridge, label) { function ($, d3, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfLabel) {
return (nf.LabelConfiguration = factory($, d3, errorHandler, common, client, canvasUtils, angularBridge, label)); return (nf.LabelConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfLabel));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.LabelConfiguration = module.exports = (nf.LabelConfiguration =
@ -50,7 +50,7 @@
root.nf.ng.Bridge, root.nf.ng.Bridge,
root.nf.Label); root.nf.Label);
} }
}(this, function ($, d3, errorHandler, common, client, canvasUtils, angularBridge, label) { }(this, function ($, d3, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfLabel) {
'use strict'; 'use strict';
var labelId = ''; var labelId = '';
@ -82,7 +82,7 @@
// build the label entity // build the label entity
var labelEntity = { var labelEntity = {
'revision': client.getRevision(labelData), 'revision': nfClient.getRevision(labelData),
'component': { 'component': {
'id': labelId, 'id': labelId,
'label': labelValue, 'label': labelValue,
@ -101,11 +101,11 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// get the label out of the response // get the label out of the response
label.set(response); nfLabel.set(response);
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// reset and hide the dialog // reset and hide the dialog
this.modal('hide'); this.modal('hide');
@ -166,18 +166,18 @@
* @argument {selection} selection The selection * @argument {selection} selection The selection
*/ */
showConfiguration: function (selection) { showConfiguration: function (selection) {
if (canvasUtils.isLabel(selection)) { if (nfCanvasUtils.isLabel(selection)) {
var selectionData = selection.datum(); var selectionData = selection.datum();
// get the label value // get the label value
var labelValue = ''; var labelValue = '';
if (common.isDefinedAndNotNull(selectionData.component.label)) { if (nfCommon.isDefinedAndNotNull(selectionData.component.label)) {
labelValue = selectionData.component.label; labelValue = selectionData.component.label;
} }
// get the font size // get the font size
var fontSize = '12px'; var fontSize = '12px';
if (common.isDefinedAndNotNull(selectionData.component.style['font-size'])) { if (nfCommon.isDefinedAndNotNull(selectionData.component.style['font-size'])) {
fontSize = selectionData.component.style['font-size']; fontSize = selectionData.component.style['font-size'];
} }

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, common, client, canvasUtils) { function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
return (nf.Label = factory($, d3, common, client, canvasUtils)); return (nf.Label = factory($, d3, nfCommon, nfClient, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Label = module.exports = (nf.Label =
@ -41,7 +41,7 @@
root.nf.Client, root.nf.Client,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, d3, common, client, canvasUtils) { }(this, function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
'use strict'; 'use strict';
var nfConnectable; var nfConnectable;
@ -114,7 +114,7 @@
'class': 'label component' 'class': 'label component'
}) })
.classed('selected', selected) .classed('selected', selected)
.call(canvasUtils.position); .call(nfCanvasUtils.position);
// label border // label border
label.append('rect') label.append('rect')
@ -187,7 +187,7 @@
var color = nfLabel.defaultColor(); var color = nfLabel.defaultColor();
// use the specified color if appropriate // 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']; color = d.component.style['background-color'];
} }
@ -202,7 +202,7 @@
var label = d3.select(this); var label = d3.select(this);
// update the component behavior as appropriate // update the component behavior as appropriate
canvasUtils.editable(label, nfConnectable, nfDraggable); nfCanvasUtils.editable(label, nfConnectable, nfDraggable);
// update the label // update the label
var labelText = label.select('text.label-value'); var labelText = label.select('text.label-value');
@ -213,7 +213,7 @@
var fontSize = '12px'; var fontSize = '12px';
// use the specified color if appropriate // use the specified color if appropriate
if (common.isDefinedAndNotNull(d.component.style['font-size'])) { if (nfCommon.isDefinedAndNotNull(d.component.style['font-size'])) {
fontSize = d.component.style['font-size']; fontSize = d.component.style['font-size'];
} }
@ -225,7 +225,7 @@
// parse the lines in this label // parse the lines in this label
var lines = []; var lines = [];
if (common.isDefinedAndNotNull(d.component.label)) { if (nfCommon.isDefinedAndNotNull(d.component.label)) {
lines = d.component.label.split('\n'); lines = d.component.label.split('\n');
} else { } else {
lines.push(''); lines.push('');
@ -234,7 +234,7 @@
var color = nfLabel.defaultColor(); var color = nfLabel.defaultColor();
// use the specified color if appropriate // 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']; color = d.component.style['background-color'];
} }
@ -247,8 +247,8 @@
return line; return line;
}) })
.style('fill', function (d) { .style('fill', function (d) {
return common.determineContrastColor( return nfCommon.determineContrastColor(
common.substringAfterLast( nfCommon.substringAfterLast(
color, '#')); color, '#'));
}); });
}); });
@ -308,12 +308,17 @@
/** /**
* Initializes of the Processor handler. * 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) { init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) {
nfConnectable = connectable; nfConnectable = nfConnectableRef;
nfDraggable = draggable; nfDraggable = nfDraggableRef;
nfSelectable = selectable; nfSelectable = nfSelectableRef;
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
labelMap = d3.map(); labelMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -349,19 +354,19 @@
// determine if the width has changed // determine if the width has changed
var different = false; var different = false;
if (common.isDefinedAndNotNull(labelData.component.width) || labelData.dimensions.width !== labelData.component.width) { if (nfCommon.isDefinedAndNotNull(labelData.component.width) || labelData.dimensions.width !== labelData.component.width) {
different = true; different = true;
} }
// determine if the height has changed // determine if the height has changed
if (!different && common.isDefinedAndNotNull(labelData.component.height) || labelData.dimensions.height !== labelData.component.height) { if (!different && nfCommon.isDefinedAndNotNull(labelData.component.height) || labelData.dimensions.height !== labelData.component.height) {
different = true; different = true;
} }
// only save the updated bends if necessary // only save the updated bends if necessary
if (different) { if (different) {
var labelEntity = { var labelEntity = {
'revision': client.getRevision(labelData), 'revision': nfClient.getRevision(labelData),
'component': { 'component': {
'id': labelData.id, 'id': labelData.id,
'width': labelData.dimensions.width, 'width': labelData.dimensions.width,
@ -381,13 +386,13 @@
}).fail(function () { }).fail(function () {
// determine the previous width // determine the previous width
var width = dimensions.width; var width = dimensions.width;
if (common.isDefinedAndNotNull(labelData.component.width)) { if (nfCommon.isDefinedAndNotNull(labelData.component.width)) {
width = labelData.component.width; width = labelData.component.width;
} }
// determine the previous height // determine the previous height
var height = dimensions.height; var height = dimensions.height;
if (common.isDefinedAndNotNull(labelData.component.height)) { if (nfCommon.isDefinedAndNotNull(labelData.component.height)) {
height = labelData.component.height; height = labelData.component.height;
} }
@ -415,8 +420,8 @@
*/ */
add: function (labelEntities, options) { add: function (labelEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// get the current time // get the current time
@ -436,7 +441,7 @@
$.each(labelEntities, function (_, labelEntity) { $.each(labelEntities, function (_, labelEntity) {
add(labelEntity); add(labelEntity);
}); });
} else if (common.isDefinedAndNotNull(labelEntities)) { } else if (nfCommon.isDefinedAndNotNull(labelEntities)) {
add(labelEntities); add(labelEntities);
} }
@ -455,16 +460,16 @@
set: function (labelEntities, options) { set: function (labelEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
var set = function (proposedLabelEntity) { var set = function (proposedLabelEntity) {
var currentLabelEntity = labelMap.get(proposedLabelEntity.id); var currentLabelEntity = labelMap.get(proposedLabelEntity.id);
// set the processor if appropriate due to revision and wasn't previously removed // set the processor if appropriate due to revision and wasn't previously removed
if (client.isNewerRevision(currentLabelEntity, proposedLabelEntity) && !removedCache.has(proposedLabelEntity.id)) { if (nfClient.isNewerRevision(currentLabelEntity, proposedLabelEntity) && !removedCache.has(proposedLabelEntity.id)) {
labelMap.set(proposedLabelEntity.id, $.extend({ labelMap.set(proposedLabelEntity.id, $.extend({
type: 'Label' type: 'Label'
}, proposedLabelEntity)); }, proposedLabelEntity));
@ -486,14 +491,14 @@
$.each(labelEntities, function (_, labelEntity) { $.each(labelEntities, function (_, labelEntity) {
set(labelEntity); set(labelEntity);
}); });
} else if (common.isDefinedAndNotNull(labelEntities)) { } else if (nfCommon.isDefinedAndNotNull(labelEntities)) {
set(labelEntities); set(labelEntities);
} }
// apply the selection and handle all new labels // apply the selection and handle all new labels
var selection = select(); var selection = select();
selection.enter().call(renderLabels, selectAll); selection.enter().call(renderLabels, selectAll);
selection.call(updateLabels).call(canvasUtils.position, transition); selection.call(updateLabels).call(nfCanvasUtils.position, transition);
selection.exit().call(removeLabels); selection.exit().call(removeLabels);
}, },
@ -504,7 +509,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return labelMap.values(); return labelMap.values();
} else { } else {
return labelMap.get(id); return labelMap.get(id);
@ -518,7 +523,7 @@
* @param {string} id Optional * @param {string} id Optional
*/ */
refresh: function (id) { refresh: function (id) {
if (common.isDefinedAndNotNull(id)) { if (nfCommon.isDefinedAndNotNull(id)) {
d3.select('#id-' + id).call(updateLabels); d3.select('#id-' + id).call(updateLabels);
} else { } else {
d3.selectAll('g.label').call(updateLabels); d3.selectAll('g.label').call(updateLabels);
@ -550,7 +555,7 @@
* @param {string} id The id * @param {string} id The id
*/ */
position: function (id) { position: function (id) {
d3.select('#id-' + id).call(canvasUtils.position); d3.select('#id-' + id).call(nfCanvasUtils.position);
}, },
/** /**

View File

@ -28,8 +28,8 @@
'nf.ng.Bridge', 'nf.ng.Bridge',
'nf.Dialog', 'nf.Dialog',
'nf.Shell'], 'nf.Shell'],
function ($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell) { function ($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell) {
return (nf.PolicyManagement = factory($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell)); return (nf.PolicyManagement = factory($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.PolicyManagement = module.exports = (nf.PolicyManagement =
@ -53,7 +53,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Shell); 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'; 'use strict';
var config = { var config = {
@ -277,7 +277,7 @@
// also consider groups already selected in the search users dialog // also consider groups already selected in the search users dialog
container.children('li').each(function (_, allowedTenant) { container.children('li').each(function (_, allowedTenant) {
var tenant = $(allowedTenant).data('tenant'); var tenant = $(allowedTenant).data('tenant');
if (common.isDefinedAndNotNull(tenant)) { if (nfCommon.isDefinedAndNotNull(tenant)) {
tenants.push(tenant); tenants.push(tenant);
} }
}); });
@ -381,16 +381,16 @@
// policy type listing // policy type listing
$('#policy-type-list').combo({ $('#policy-type-list').combo({
options: [ options: [
common.getPolicyTypeListing('flow'), nfCommon.getPolicyTypeListing('flow'),
common.getPolicyTypeListing('controller'), nfCommon.getPolicyTypeListing('controller'),
common.getPolicyTypeListing('provenance'), nfCommon.getPolicyTypeListing('provenance'),
common.getPolicyTypeListing('restricted-components'), nfCommon.getPolicyTypeListing('restricted-components'),
common.getPolicyTypeListing('policies'), nfCommon.getPolicyTypeListing('policies'),
common.getPolicyTypeListing('tenants'), nfCommon.getPolicyTypeListing('tenants'),
common.getPolicyTypeListing('site-to-site'), nfCommon.getPolicyTypeListing('site-to-site'),
common.getPolicyTypeListing('system'), nfCommon.getPolicyTypeListing('system'),
common.getPolicyTypeListing('proxy'), nfCommon.getPolicyTypeListing('proxy'),
common.getPolicyTypeListing('counters')], nfCommon.getPolicyTypeListing('counters')],
select: function (option) { select: function (option) {
if (initialized) { if (initialized) {
// record the policy type // record the policy type
@ -636,8 +636,8 @@
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
if(a.permissions.canRead && b.permissions.canRead) { if(a.permissions.canRead && b.permissions.canRead) {
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} else { } else {
if (!a.permissions.canRead && !b.permissions.canRead){ if (!a.permissions.canRead && !b.permissions.canRead){
@ -661,9 +661,9 @@
* @param item * @param item
*/ */
var promptToRemoveUserFromPolicy = function (item) { var promptToRemoveUserFromPolicy = function (item) {
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Update Policy', 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 () { yesHandler: function () {
removeUserFromPolicy(item); removeUserFromPolicy(item);
} }
@ -696,7 +696,7 @@
* Prompts for the deletion of the selected policy. * Prompts for the deletion of the selected policy.
*/ */
var promptToDeletePolicy = function () { var promptToDeletePolicy = function () {
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Delete Policy', headerText: 'Delete Policy',
dialogContent: 'By deleting this policy, the permissions for this component will revert to the inherited policy if applicable.', dialogContent: 'By deleting this policy, the permissions for this component will revert to the inherited policy if applicable.',
yesText: 'Delete', yesText: 'Delete',
@ -713,20 +713,20 @@
var deletePolicy = function () { var deletePolicy = function () {
var currentEntity = $('#policy-table').data('policy'); var currentEntity = $('#policy-table').data('policy');
if (common.isDefinedAndNotNull(currentEntity)) { if (nfCommon.isDefinedAndNotNull(currentEntity)) {
$.ajax({ $.ajax({
type: 'DELETE', type: 'DELETE',
url: currentEntity.uri + '?' + $.param(client.getRevision(currentEntity)), url: currentEntity.uri + '?' + $.param(nfClient.getRevision(currentEntity)),
dataType: 'json' dataType: 'json'
}).done(function () { }).done(function () {
loadPolicy(); loadPolicy();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
resetPolicy(); resetPolicy();
loadPolicy(); loadPolicy();
}); });
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Delete Policy', headerText: 'Delete Policy',
dialogContent: 'No policy selected' dialogContent: 'No policy selected'
}); });
@ -802,11 +802,11 @@
return $('<span>Showing effective policy inherited from the controller.</span>'); return $('<span>Showing effective policy inherited from the controller.</span>');
} else { } else {
// extract the group id // extract the group id
var processGroupId = common.substringAfterLast(resource, '/'); var processGroupId = nfCommon.substringAfterLast(resource, '/');
var processGroupName = processGroupId; var processGroupName = processGroupId;
// attempt to resolve the group name // attempt to resolve the group name
var breadcrumbs = angularBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs(); var breadcrumbs = nfNgBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
$.each(breadcrumbs, function (_, breadcrumbEntity) { $.each(breadcrumbs, function (_, breadcrumbEntity) {
if (breadcrumbEntity.id === processGroupId) { if (breadcrumbEntity.id === processGroupId) {
processGroupName = breadcrumbEntity.label; processGroupName = breadcrumbEntity.label;
@ -824,11 +824,11 @@
$('#shell-close-button').click(); $('#shell-close-button').click();
// load the correct group and unselect everything if necessary // load the correct group and unselect everything if necessary
canvasUtils.getComponentByType('ProcessGroup').enterGroup(processGroupId).done(function () { nfCanvasUtils.getComponentByType('ProcessGroup').enterGroup(processGroupId).done(function () {
canvasUtils.getSelection().classed('selected', false); nfCanvasUtils.getSelection().classed('selected', false);
// inform Angular app that values have changed // inform Angular app that values have changed
angularBridge.digest(); nfNgBridge.digest();
}); });
}) })
).append('<span>.</span>'); ).append('<span>.</span>');
@ -948,7 +948,7 @@
resetPolicy(); resetPolicy();
deferred.reject(); deferred.reject();
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
}).promise(); }).promise();
@ -1006,7 +1006,7 @@
resetPolicy(); resetPolicy();
deferred.reject(); deferred.reject();
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
}).promise(); }).promise();
@ -1045,7 +1045,7 @@
} }
var entity = { var entity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -1074,7 +1074,7 @@
resetPolicy(); resetPolicy();
loadPolicy(); loadPolicy();
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -1102,9 +1102,9 @@
}); });
var currentEntity = $('#policy-table').data('policy'); var currentEntity = $('#policy-table').data('policy');
if (common.isDefinedAndNotNull(currentEntity)) { if (nfCommon.isDefinedAndNotNull(currentEntity)) {
var entity = { var entity = {
'revision': client.getRevision(currentEntity), 'revision': nfClient.getRevision(currentEntity),
'component': { 'component': {
'id': currentEntity.id, 'id': currentEntity.id,
'users': users, 'users': users,
@ -1129,16 +1129,16 @@
loadPolicy(); loadPolicy();
} }
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
resetPolicy(); resetPolicy();
loadPolicy(); loadPolicy();
}).always(function () { }).always(function () {
canvasUtils.reload({ nfCanvasUtils.reload({
'transition': true 'transition': true
}); });
}); });
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Update Policy', headerText: 'Update Policy',
dialogContent: 'No policy selected' dialogContent: 'No policy selected'
}); });
@ -1150,7 +1150,7 @@
*/ */
var showPolicy = function () { var showPolicy = function () {
// show the configuration dialog // show the configuration dialog
shell.showContent('#policy-management').always(function () { nfShell.showContent('#policy-management').always(function () {
reset(); reset();
}); });
@ -1227,7 +1227,7 @@
var policyTable = $('#policy-table'); var policyTable = $('#policy-table');
if (policyTable.is(':visible')) { if (policyTable.is(':visible')) {
var policyGrid = policyTable.data('gridInstance'); var policyGrid = policyTable.data('gridInstance');
if (common.isDefinedAndNotNull(policyGrid)) { if (nfCommon.isDefinedAndNotNull(policyGrid)) {
policyGrid.resizeCanvas(); policyGrid.resizeCanvas();
} }
} }
@ -1381,7 +1381,7 @@
var resource; var resource;
if (selection.empty()) { if (selection.empty()) {
$('#selected-policy-component-id').text(canvasUtils.getGroupId()); $('#selected-policy-component-id').text(nfCanvasUtils.getGroupId());
resource = 'process-groups'; resource = 'process-groups';
// disable site to site option // disable site to site option
@ -1402,19 +1402,19 @@
var d = selection.datum(); var d = selection.datum();
$('#selected-policy-component-id').text(d.id); $('#selected-policy-component-id').text(d.id);
if (canvasUtils.isProcessor(selection)) { if (nfCanvasUtils.isProcessor(selection)) {
resource = 'processors'; resource = 'processors';
} else if (canvasUtils.isProcessGroup(selection)) { } else if (nfCanvasUtils.isProcessGroup(selection)) {
resource = 'process-groups'; resource = 'process-groups';
} else if (canvasUtils.isInputPort(selection)) { } else if (nfCanvasUtils.isInputPort(selection)) {
resource = 'input-ports'; resource = 'input-ports';
} else if (canvasUtils.isOutputPort(selection)) { } else if (nfCanvasUtils.isOutputPort(selection)) {
resource = 'output-ports'; resource = 'output-ports';
} else if (canvasUtils.isRemoteProcessGroup(selection)) { } else if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
resource = 'remote-process-groups'; resource = 'remote-process-groups';
} else if (canvasUtils.isLabel(selection)) { } else if (nfCanvasUtils.isLabel(selection)) {
resource = 'labels'; resource = 'labels';
} else if (canvasUtils.isFunnel(selection)) { } else if (nfCanvasUtils.isFunnel(selection)) {
resource = 'funnels'; resource = 'funnels';
} }
@ -1422,16 +1422,16 @@
$('#component-policy-target') $('#component-policy-target')
.combo('setOptionEnabled', { .combo('setOptionEnabled', {
value: 'write-receive-data' value: 'write-receive-data'
}, canvasUtils.isInputPort(selection) && canvasUtils.getParentGroupId() === null) }, nfCanvasUtils.isInputPort(selection) && nfCanvasUtils.getParentGroupId() === null)
.combo('setOptionEnabled', { .combo('setOptionEnabled', {
value: 'write-send-data' value: 'write-send-data'
}, canvasUtils.isOutputPort(selection) && canvasUtils.getParentGroupId() === null) }, nfCanvasUtils.isOutputPort(selection) && nfCanvasUtils.getParentGroupId() === null)
.combo('setOptionEnabled', { .combo('setOptionEnabled', {
value: 'read-data' value: 'read-data'
}, !canvasUtils.isLabel(selection)) }, !nfCanvasUtils.isLabel(selection))
.combo('setOptionEnabled', { .combo('setOptionEnabled', {
value: 'write-data' value: 'write-data'
}, !canvasUtils.isLabel(selection)); }, !nfCanvasUtils.isLabel(selection));
} }
// populate the initial resource // populate the initial resource

View File

@ -28,8 +28,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ng.Bridge', 'nf.ng.Bridge',
'nf.Port'], 'nf.Port'],
function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port) { function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfPort) {
return (nf.PortConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port)); return (nf.PortConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfPort));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.PortConfiguration = module.exports = (nf.PortConfiguration =
@ -53,7 +53,7 @@
root.nf.ng.Bridge, root.nf.ng.Bridge,
root.nf.Port); 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'; 'use strict';
/** /**
@ -97,7 +97,7 @@
// build the port entity // build the port entity
var portEntity = { var portEntity = {
'revision': client.getRevision(portData), 'revision': nfClient.getRevision(portData),
'component': port 'component': port
}; };
@ -110,10 +110,10 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// refresh the port component // refresh the port component
port.set(response); nfPort.set(response);
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
// close the details panel // close the details panel
$('#port-configuration').modal('hide'); $('#port-configuration').modal('hide');
@ -128,10 +128,10 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Port Configuration' headerText: 'Port Configuration'
}); });
@ -140,7 +140,7 @@
$('#port-configuration').modal('hide'); $('#port-configuration').modal('hide');
// handle the error // handle the error
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
} }
@ -184,7 +184,7 @@
*/ */
showConfiguration: function (selection) { showConfiguration: function (selection) {
// if the specified component is a port, load its properties // 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(); var selectionData = selection.datum();
// determine if the enabled checkbox is checked or not // determine if the enabled checkbox is checked or not
@ -194,7 +194,7 @@
} }
// show concurrent tasks for root groups only // show concurrent tasks for root groups only
if (canvasUtils.getParentGroupId() === null) { if (nfCanvasUtils.getParentGroupId() === null) {
$('#port-concurrent-task-container').show(); $('#port-concurrent-task-container').show();
} else { } else {
$('#port-concurrent-task-container').hide(); $('#port-concurrent-task-container').hide();

View File

@ -22,8 +22,8 @@
define(['jquery', define(['jquery',
'nf.Common', 'nf.Common',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, common, canvasUtils) { function ($, nfCommon, nfCanvasUtils) {
return (nf.PortDetails = factory($, common, canvasUtils)); return (nf.PortDetails = factory($, nfCommon, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.PortDetails = module.exports = (nf.PortDetails =
@ -35,7 +35,7 @@
root.nf.Common, root.nf.Common,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, common, canvasUtils) { }(this, function ($, nfCommon, nfCanvasUtils) {
'use strict'; 'use strict';
return { return {
@ -61,9 +61,9 @@
handler: { handler: {
close: function () { close: function () {
// clear the processor details // clear the processor details
common.clearField('read-only-port-name'); nfCommon.clearField('read-only-port-name');
common.clearField('read-only-port-id'); nfCommon.clearField('read-only-port-id');
common.clearField('read-only-port-comments'); nfCommon.clearField('read-only-port-comments');
} }
} }
}); });
@ -71,13 +71,13 @@
showDetails: function (selection) { showDetails: function (selection) {
// if the specified component is a processor, load its properties // 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(); var selectionData = selection.datum();
// populate the port settings // populate the port settings
common.populateField('read-only-port-name', selectionData.component.name); nfCommon.populateField('read-only-port-name', selectionData.component.name);
common.populateField('read-only-port-id', selectionData.id); nfCommon.populateField('read-only-port-id', selectionData.id);
common.populateField('read-only-port-comments', selectionData.component.comments); nfCommon.populateField('read-only-port-comments', selectionData.component.comments);
// show the details // show the details
$('#port-details').modal('show'); $('#port-details').modal('show');

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, common, client, canvasUtils) { function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
return (nf.Port = factory($, d3, common, client, canvasUtils)); return (nf.Port = factory($, d3, nfCommon, nfClient, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Port = module.exports = (nf.Port =
@ -41,7 +41,7 @@
root.nf.Client, root.nf.Client,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, d3, common, client, canvasUtils) { }(this, function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
'use strict'; 'use strict';
var nfConnectable; var nfConnectable;
@ -118,7 +118,7 @@
} }
}) })
.classed('selected', selected) .classed('selected', selected)
.call(canvasUtils.position); .call(nfCanvasUtils.position);
// port border // port border
port.append('rect') port.append('rect')
@ -151,7 +151,7 @@
var offset = 0; var offset = 0;
// conditionally render the remote banner // conditionally render the remote banner
if (canvasUtils.getParentGroupId() === null) { if (nfCanvasUtils.getParentGroupId() === null) {
offset = OFFSET_VALUE; offset = OFFSET_VALUE;
// port remote banner // port remote banner
@ -227,7 +227,7 @@
var details = port.select('g.port-details'); var details = port.select('g.port-details');
// update the component behavior as appropriate // 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 this process group is visible, render everything
if (port.classed('visible')) { if (port.classed('visible')) {
@ -235,7 +235,7 @@
details = port.append('g').attr('class', 'port-details'); details = port.append('g').attr('class', 'port-details');
var offset = 0; var offset = 0;
if (canvasUtils.getParentGroupId() === null) { if (nfCanvasUtils.getParentGroupId() === null) {
offset = OFFSET_VALUE; offset = OFFSET_VALUE;
// port transmitting icon // port transmitting icon
@ -313,9 +313,9 @@
// handle based on the number of tokens in the port name // handle based on the number of tokens in the port name
if (words.length === 1) { if (words.length === 1) {
// apply ellipsis to the port name as necessary // apply ellipsis to the port name as necessary
canvasUtils.ellipsis(portName, name); nfCanvasUtils.ellipsis(portName, name);
} else { } else {
canvasUtils.multilineEllipsis(portName, 2, name); nfCanvasUtils.multilineEllipsis(portName, 2, name);
} }
}).append('title').text(function (d) { }).append('title').text(function (d) {
return d.component.name; return d.component.name;
@ -407,7 +407,7 @@
var tip = d3.select('#run-status-tip-' + d.id); var tip = d3.select('#run-status-tip-' + d.id);
// if there are validation errors generate a tooltip // 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 // create the tip if necessary
if (tip.empty()) { if (tip.empty()) {
tip = d3.select('#port-tooltips').append('div') tip = d3.select('#port-tooltips').append('div')
@ -419,7 +419,7 @@
// update the tip // update the tip
tip.html(function () { tip.html(function () {
var list = common.formatUnorderedList(d.component.validationErrors); var list = nfCommon.formatUnorderedList(d.component.validationErrors);
if (list === null || list.length === 0) { if (list === null || list.length === 0) {
return ''; return '';
} else { } else {
@ -428,7 +428,7 @@
}); });
// add the tooltip // add the tooltip
canvasUtils.canvasTooltip(tip, d3.select(this)); nfCanvasUtils.canvasTooltip(tip, d3.select(this));
} else { } else {
// remove if necessary // remove if necessary
if (!tip.empty()) { if (!tip.empty()) {
@ -477,7 +477,7 @@
// active thread count // active thread count
// ------------------- // -------------------
canvasUtils.activeThreadCount(port, d, function (off) { nfCanvasUtils.activeThreadCount(port, d, function (off) {
offset = off; offset = off;
}); });
@ -486,10 +486,10 @@
// --------- // ---------
port.select('rect.bulletin-background').classed('has-bulletins', function () { 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'); return d3.select('#port-tooltips');
}, offset); }, offset);
}); });
@ -524,12 +524,17 @@
var nfPort = { var nfPort = {
/** /**
* Initializes of the Port handler. * 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) { init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) {
nfConnectable = connectable; nfConnectable = nfConnectableRef;
nfDraggable = draggable; nfDraggable = nfDraggableRef;
nfSelectable = selectable; nfSelectable = nfSelectableRef;
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
portMap = d3.map(); portMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -551,13 +556,13 @@
*/ */
add: function (portEntities, options) { add: function (portEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// determine the appropriate dimensions for this port // determine the appropriate dimensions for this port
var dimensions = portDimensions; var dimensions = portDimensions;
if (canvasUtils.getParentGroupId() === null) { if (nfCanvasUtils.getParentGroupId() === null) {
dimensions = remotePortDimensions; dimensions = remotePortDimensions;
} }
@ -582,7 +587,7 @@
$.each(portEntities, function (_, portNode) { $.each(portEntities, function (_, portNode) {
add(portNode); add(portNode);
}); });
} else if (common.isDefinedAndNotNull(portEntities)) { } else if (nfCommon.isDefinedAndNotNull(portEntities)) {
add(portEntities); add(portEntities);
} }
@ -601,14 +606,14 @@
set: function (portEntities, options) { set: function (portEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
// determine the appropriate dimensions for this port // determine the appropriate dimensions for this port
var dimensions = portDimensions; var dimensions = portDimensions;
if (canvasUtils.getParentGroupId() === null) { if (nfCanvasUtils.getParentGroupId() === null) {
dimensions = remotePortDimensions; dimensions = remotePortDimensions;
} }
@ -616,7 +621,7 @@
var currentPortEntity = portMap.get(proposedPortEntity.id); var currentPortEntity = portMap.get(proposedPortEntity.id);
// set the port if appropriate due to revision and wasn't previously removed // 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 // add the port
portMap.set(proposedPortEntity.id, $.extend({ portMap.set(proposedPortEntity.id, $.extend({
type: 'Port', type: 'Port',
@ -644,14 +649,14 @@
$.each(portEntities, function (_, portNode) { $.each(portEntities, function (_, portNode) {
set(portNode); set(portNode);
}); });
} else if (common.isDefinedAndNotNull(portEntities)) { } else if (nfCommon.isDefinedAndNotNull(portEntities)) {
set(portEntities); set(portEntities);
} }
// apply the selection and handle all new ports // apply the selection and handle all new ports
var selection = select(); var selection = select();
selection.enter().call(renderPorts, selectAll); selection.enter().call(renderPorts, selectAll);
selection.call(updatePorts).call(canvasUtils.position, transition); selection.call(updatePorts).call(nfCanvasUtils.position, transition);
selection.exit().call(removePorts); selection.exit().call(removePorts);
}, },
@ -662,7 +667,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return portMap.values(); return portMap.values();
} else { } else {
return portMap.get(id); return portMap.get(id);
@ -676,7 +681,7 @@
* @param {string} id Optional * @param {string} id Optional
*/ */
refresh: function (id) { refresh: function (id) {
if (common.isDefinedAndNotNull(id)) { if (nfCommon.isDefinedAndNotNull(id)) {
d3.select('#id-' + id).call(updatePorts); d3.select('#id-' + id).call(updatePorts);
} else { } else {
d3.selectAll('g.input-port, g.output-port').call(updatePorts); d3.selectAll('g.input-port, g.output-port').call(updatePorts);
@ -715,7 +720,7 @@
* @param {string} id The id * @param {string} id The id
*/ */
position: function (id) { position: function (id) {
d3.select('#id-' + id).call(canvasUtils.position); d3.select('#id-' + id).call(nfCanvasUtils.position);
}, },
/** /**

View File

@ -28,8 +28,8 @@
'nf.ProcessGroup', 'nf.ProcessGroup',
'nf.Shell', 'nf.Shell',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils) { function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfProcessGroup, nfShell, nfCanvasUtils) {
return (nf.ProcessGroupConfiguration = factory($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils)); return (nf.ProcessGroupConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfProcessGroup, nfShell, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ProcessGroupConfiguration = module.exports = (nf.ProcessGroupConfiguration =
@ -53,7 +53,7 @@
root.nf.Shell, root.nf.Shell,
root.nf.CanvasUtils); 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'; 'use strict';
var nfControllerServices; var nfControllerServices;
@ -88,7 +88,7 @@
var saveConfiguration = function (version, groupId) { var saveConfiguration = function (version, groupId) {
// build the entity // build the entity
var entity = { var entity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': version 'version': version
} }
@ -109,12 +109,12 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// refresh the process group if necessary // refresh the process group if necessary
if (response.permissions.canRead && response.component.parentGroupId === canvasUtils.getGroupId()) { if (response.permissions.canRead && response.component.parentGroupId === nfCanvasUtils.getGroupId()) {
processGroup.set(response); nfProcessGroup.set(response);
} }
// show the result dialog // show the result dialog
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Group Configuration', headerText: 'Process Group Configuration',
dialogContent: 'Process group configuration successfully saved.' dialogContent: 'Process group configuration successfully saved.'
}); });
@ -124,8 +124,8 @@
saveConfiguration(response.revision.version, groupId); saveConfiguration(response.revision.version, groupId);
}); });
canvasUtils.reload(); nfCanvasUtils.reload();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -188,15 +188,15 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 403) { if (xhr.status === 403) {
if (groupId === canvasUtils.getGroupId()) { if (groupId === nfCanvasUtils.getGroupId()) {
$('#process-group-configuration').data('process-group', { $('#process-group-configuration').data('process-group', {
'permissions': { 'permissions': {
canRead: false, canRead: false,
canWrite: canvasUtils.canWrite() canWrite: nfCanvasUtils.canWrite()
} }
}); });
} else { } else {
$('#process-group-configuration').data('process-group', processGroup.get(groupId)); $('#process-group-configuration').data('process-group', nfProcessGroup.get(groupId));
} }
setUnauthorizedText(); setUnauthorizedText();
@ -218,7 +218,7 @@
// update the current time // update the current time
$('#process-group-configuration-last-refreshed').text(controllerServicesResponse.currentTime); $('#process-group-configuration-last-refreshed').text(controllerServicesResponse.currentTime);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -226,7 +226,7 @@
*/ */
var showConfiguration = function () { var showConfiguration = function () {
// show the configuration dialog // show the configuration dialog
shell.showContent('#process-group-configuration').done(function () { nfShell.showContent('#process-group-configuration').done(function () {
reset(); reset();
}); });
@ -256,10 +256,10 @@
/** /**
* Initialize the process group configuration. * Initialize the process group configuration.
* *
* @param controllerServices The reference to the controllerServices controller. * @param nfControllerServicesRef The nfControllerServices module.
*/ */
init: function (controllerServices) { init: function (nfControllerServicesRef) {
nfControllerServices = controllerServices; nfControllerServices = nfControllerServicesRef;
// initialize the process group configuration tabs // initialize the process group configuration tabs
$('#process-group-configuration-tabs').tabbs({ $('#process-group-configuration-tabs').tabbs({
@ -275,7 +275,7 @@
}], }],
select: function () { select: function () {
var processGroup = $('#process-group-configuration').data('process-group'); 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(); var tab = $(this).text();
if (tab === 'General') { if (tab === 'General') {

View File

@ -26,8 +26,8 @@
'nf.Client', 'nf.Client',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.Dialog'], 'nf.Dialog'],
function ($, d3, connection, common, client, canvasUtils, dialog) { function ($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils, nfDialog) {
return (nf.ProcessGroup = factory($, d3, connection, common, client, canvasUtils, dialog)); return (nf.ProcessGroup = factory($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils, nfDialog));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ProcessGroup = module.exports = (nf.ProcessGroup =
@ -47,7 +47,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.Dialog); root.nf.Dialog);
} }
}(this, function ($, d3, connection, common, client, canvasUtils, dialog) { }(this, function ($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils, nfDialog) {
'use strict'; 'use strict';
var nfConnectable; var nfConnectable;
@ -91,7 +91,7 @@
* @param {object} d * @param {object} d
*/ */
var getProcessGroupComments = function (d) { var getProcessGroupComments = function (d) {
if (common.isBlank(d.component.comments)) { if (nfCommon.isBlank(d.component.comments)) {
return 'No comments specified'; return 'No comments specified';
} else { } else {
return d.component.comments; return d.component.comments;
@ -126,7 +126,7 @@
'class': 'process-group component' 'class': 'process-group component'
}) })
.classed('selected', selected) .classed('selected', selected)
.call(canvasUtils.position); .call(nfCanvasUtils.position);
// ---- // ----
// body // body
@ -203,7 +203,7 @@
var drag = d3.select('rect.drag-selection'); var drag = d3.select('rect.drag-selection');
if (!drag.empty()) { if (!drag.empty()) {
// filter the current selection by this group // 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; return targetData.id === d.id;
}); });
@ -212,7 +212,7 @@
// mark that we are hovering over a drop area if appropriate // mark that we are hovering over a drop area if appropriate
target.classed('drop', function () { target.classed('drop', function () {
// get the current selection and ensure its disconnected // 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'); var details = processGroup.select('g.process-group-details');
// update the component behavior as appropriate // update the component behavior as appropriate
canvasUtils.editable(processGroup, nfConnectable, nfDraggable); nfCanvasUtils.editable(processGroup, nfConnectable, nfDraggable);
// if this processor is visible, render everything // if this processor is visible, render everything
if (processGroup.classed('visible')) { if (processGroup.classed('visible')) {
@ -848,9 +848,9 @@
processGroupComments.text(null).selectAll('tspan, title').remove(); processGroupComments.text(null).selectAll('tspan, title').remove();
// apply ellipsis to the port name as necessary // apply ellipsis to the port name as necessary
canvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d)); nfCanvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d));
}).classed('unset', function (d) { }).classed('unset', function (d) {
return common.isBlank(d.component.comments); return nfCommon.isBlank(d.component.comments);
}).append('title').text(function (d) { }).append('title').text(function (d) {
return getProcessGroupComments(d); return getProcessGroupComments(d);
}); });
@ -864,7 +864,7 @@
processGroupName.text(null).selectAll('title').remove(); processGroupName.text(null).selectAll('title').remove();
// apply ellipsis to the process group name as necessary // 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) { }).append('title').text(function (d) {
return d.component.name; return d.component.name;
}); });
@ -919,25 +919,25 @@
// queued count value // queued count value
updated.select('text.process-group-queued tspan.count') updated.select('text.process-group-queued tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' ');
}); });
// queued size value // queued size value
updated.select('text.process-group-queued tspan.size') updated.select('text.process-group-queued tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.queued, ' ');
}); });
// in count value // in count value
updated.select('text.process-group-in tspan.count') updated.select('text.process-group-in tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.input, ' ');
}); });
// in size value // in size value
updated.select('text.process-group-in tspan.size') updated.select('text.process-group-in tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.input, ' ');
}); });
// in ports value // in ports value
@ -961,13 +961,13 @@
// out count value // out count value
updated.select('text.process-group-out tspan.count') updated.select('text.process-group-out tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.output, ' ');
}); });
// out size value // out size value
updated.select('text.process-group-out tspan.size') updated.select('text.process-group-out tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.output, ' ');
}); });
updated.each(function (d) { updated.each(function (d) {
@ -978,7 +978,7 @@
// active thread count // active thread count
// ------------------- // -------------------
canvasUtils.activeThreadCount(processGroup, d, function (off) { nfCanvasUtils.activeThreadCount(processGroup, d, function (off) {
offset = off; offset = off;
}); });
@ -987,10 +987,10 @@
// --------- // ---------
processGroup.select('rect.bulletin-background').classed('has-bulletins', function () { 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'); return d3.select('#process-group-tooltips');
}, offset); }, offset);
}); });
@ -1024,12 +1024,17 @@
var nfProcessGroup = { var nfProcessGroup = {
/** /**
* Initializes of the Process Group handler. * 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) { init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) {
nfConnectable = connectable; nfConnectable = nfConnectableRef;
nfDraggable = draggable; nfDraggable = nfDraggableRef;
nfSelectable = selectable; nfSelectable = nfSelectableRef;
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
processGroupMap = d3.map(); processGroupMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -1051,8 +1056,8 @@
*/ */
add: function (processGroupEntities, options) { add: function (processGroupEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// get the current time // get the current time
@ -1073,7 +1078,7 @@
$.each(processGroupEntities, function (_, processGroupEntity) { $.each(processGroupEntities, function (_, processGroupEntity) {
add(processGroupEntity); add(processGroupEntity);
}); });
} else if (common.isDefinedAndNotNull(processGroupEntities)) { } else if (nfCommon.isDefinedAndNotNull(processGroupEntities)) {
add(processGroupEntities); add(processGroupEntities);
} }
@ -1092,16 +1097,16 @@
set: function (processGroupEntities, options) { set: function (processGroupEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
var set = function (proposedProcessGroupEntity) { var set = function (proposedProcessGroupEntity) {
var currentProcessGroupEntity = processGroupMap.get(proposedProcessGroupEntity.id); var currentProcessGroupEntity = processGroupMap.get(proposedProcessGroupEntity.id);
// set the process group if appropriate due to revision and wasn't previously removed // 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({ processGroupMap.set(proposedProcessGroupEntity.id, $.extend({
type: 'ProcessGroup', type: 'ProcessGroup',
dimensions: dimensions dimensions: dimensions
@ -1125,14 +1130,14 @@
$.each(processGroupEntities, function (_, processGroupEntity) { $.each(processGroupEntities, function (_, processGroupEntity) {
set(processGroupEntity); set(processGroupEntity);
}); });
} else if (common.isDefinedAndNotNull(processGroupEntities)) { } else if (nfCommon.isDefinedAndNotNull(processGroupEntities)) {
set(processGroupEntities); set(processGroupEntities);
} }
// apply the selection and handle all new process group // apply the selection and handle all new process group
var selection = select(); var selection = select();
selection.enter().call(renderProcessGroups, selectAll); selection.enter().call(renderProcessGroups, selectAll);
selection.call(updateProcessGroups).call(canvasUtils.position, transition); selection.call(updateProcessGroups).call(nfCanvasUtils.position, transition);
selection.exit().call(removeProcessGroups); selection.exit().call(removeProcessGroups);
}, },
@ -1143,7 +1148,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return processGroupMap.values(); return processGroupMap.values();
} else { } else {
return processGroupMap.get(id); return processGroupMap.get(id);
@ -1157,7 +1162,7 @@
* @param {string} id Optional * @param {string} id Optional
*/ */
refresh: function (id) { refresh: function (id) {
if (common.isDefinedAndNotNull(id)) { if (nfCommon.isDefinedAndNotNull(id)) {
d3.select('#id-' + id).call(updateProcessGroups); d3.select('#id-' + id).call(updateProcessGroups);
} else { } else {
d3.selectAll('g.process-group').call(updateProcessGroups); d3.selectAll('g.process-group').call(updateProcessGroups);
@ -1196,7 +1201,7 @@
* @param {string} id The id * @param {string} id The id
*/ */
position: function (id) { position: function (id) {
d3.select('#id-' + id).call(canvasUtils.position); d3.select('#id-' + id).call(nfCanvasUtils.position);
}, },
/** /**
@ -1257,25 +1262,25 @@
nfContextMenu.hide(); nfContextMenu.hide();
// set the new group id // set the new group id
canvasUtils.setGroupId(groupId); nfCanvasUtils.setGroupId(groupId);
// reload the graph // reload the graph
return canvasUtils.reload().done(function () { return nfCanvasUtils.reload().done(function () {
// attempt to restore the view // attempt to restore the view
var viewRestored = canvasUtils.restoreUserView(); var viewRestored = nfCanvasUtils.restoreUserView();
// if the view was not restore attempt to fit // if the view was not restore attempt to fit
if (viewRestored === false) { if (viewRestored === false) {
canvasUtils.fitCanvasView(); nfCanvasUtils.fitCanvasView();
// refresh the canvas // refresh the canvas
canvasUtils.refreshCanvasView({ nfCanvasUtils.refreshCanvasView({
transition: true transition: true
}); });
} }
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Group', headerText: 'Process Group',
dialogContent: 'Unable to enter the selected group.' dialogContent: 'Unable to enter the selected group.'
}); });

View File

@ -31,8 +31,8 @@
'nf.CustomUi', 'nf.CustomUi',
'nf.UniversalCapture', 'nf.UniversalCapture',
'nf.Connection'], 'nf.Connection'],
function ($, 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($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection)); return (nf.ProcessorConfiguration = factory($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfProcessor, nfClusterSummary, nfCustomUi, nfUniversalCapture, nfConnection));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ProcessorConfiguration = module.exports = (nf.ProcessorConfiguration =
@ -62,7 +62,7 @@
root.nf.UniversalCapture, root.nf.UniversalCapture,
root.nf.Connection); 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'; 'use strict';
// possible values for a processor's run duration (in millis) // possible values for a processor's run duration (in millis)
@ -133,7 +133,7 @@
text: 'Primary node', text: 'Primary node',
value: 'PRIMARY', value: 'PRIMARY',
description: 'Processor will be scheduled to run only on the primary node', 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) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Processor Configuration' headerText: 'Processor Configuration'
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}; };
@ -183,7 +183,7 @@
// build the relationship container element // build the relationship container element
var relationshipContainerElement = $('<div class="processor-relationship-container"></div>').append(relationshipCheckbox).append(relationshipLabel).append(relationshipValue).appendTo('#auto-terminate-relationship-names'); 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); var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description);
relationshipContainerElement.append(relationshipDescription); relationshipContainerElement.append(relationshipDescription);
} }
@ -255,7 +255,7 @@
} }
// check the scheduling period // check the scheduling period
if (common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) { if (nfCommon.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) {
return true; return true;
} }
@ -321,7 +321,7 @@
} }
// get the scheduling period if appropriate // get the scheduling period if appropriate
if (common.isDefinedAndNotNull(schedulingPeriod)) { if (nfCommon.isDefinedAndNotNull(schedulingPeriod)) {
processorConfigDto['schedulingPeriod'] = schedulingPeriod.val(); processorConfigDto['schedulingPeriod'] = schedulingPeriod.val();
} }
@ -405,22 +405,22 @@
var config = processor['config']; var config = processor['config'];
// ensure numeric fields are specified correctly // 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'); 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'); errors.push('Run schedule must be specified');
} }
if (common.isBlank(config['penaltyDuration'])) { if (nfCommon.isBlank(config['penaltyDuration'])) {
errors.push('Penalty duration must be specified'); errors.push('Penalty duration must be specified');
} }
if (common.isBlank(config['yieldDuration'])) { if (nfCommon.isBlank(config['yieldDuration'])) {
errors.push('Yield duration must be specified'); errors.push('Yield duration must be specified');
} }
if (errors.length > 0) { if (errors.length > 0) {
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: common.formatUnorderedList(errors), dialogContent: nfCommon.formatUnorderedList(errors),
headerText: 'Processor Configuration' headerText: 'Processor Configuration'
}); });
return false; return false;
@ -456,7 +456,7 @@
// determine if changes have been made // determine if changes have been made
if (isSaveRequired()) { if (isSaveRequired()) {
// see if those changes should be saved // see if those changes should be saved
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Processor Configuration', headerText: 'Processor Configuration',
dialogContent: 'Save changes before going to this Controller Service?', dialogContent: 'Save changes before going to this Controller Service?',
noHandler: function () { noHandler: function () {
@ -490,7 +490,7 @@
if (validateDetails(updatedProcessor)) { if (validateDetails(updatedProcessor)) {
// set the revision // set the revision
var d = nfProcessor.get(processor.id); var d = nfProcessor.get(processor.id);
updatedProcessor['revision'] = client.getRevision(d); updatedProcessor['revision'] = nfClient.getRevision(d);
// update the selected component // update the selected component
return $.ajax({ return $.ajax({
@ -535,7 +535,7 @@
}], }],
select: function () { select: function () {
// remove all property detail dialogs // remove all property detail dialogs
universalCapture.removeAllPropertyDetailDialogs(); nfUniversalCapture.removeAllPropertyDetailDialogs();
// update the processor property table size in case this is the first time its rendered // update the processor property table size in case this is the first time its rendered
if ($(this).text() === 'Properties') { if ($(this).text() === 'Properties') {
@ -569,7 +569,7 @@
$('#processor-configuration').removeData('processorDetails'); $('#processor-configuration').removeData('processorDetails');
}, },
open: function () { 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 propertyName: propertyName
}, },
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
goToServiceDeferred: goToServiceFromProperty goToServiceDeferred: goToServiceFromProperty
}); });
@ -632,7 +632,7 @@
* @argument {selection} selection The selection * @argument {selection} selection The selection
*/ */
showConfiguration: function (selection) { showConfiguration: function (selection) {
if (canvasUtils.isProcessor(selection)) { if (nfCanvasUtils.isProcessor(selection)) {
var selectionData = selection.datum(); var selectionData = selection.datum();
// get the processor details // get the processor details
@ -670,7 +670,7 @@
// populate the processor settings // populate the processor settings
$('#processor-id').text(processor['id']); $('#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-name').val(processor['name']);
$('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle); $('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle);
$('#penalty-duration').val(processor.config['penaltyDuration']); $('#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 // 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(); $('#execution-node-options').show();
} else { } else {
$('#execution-node-options').hide(); $('#execution-node-options').hide();
@ -759,7 +759,7 @@
} }
// conditionally allow the user to specify the concurrent tasks // conditionally allow the user to specify the concurrent tasks
if (common.isDefinedAndNotNull(concurrentTasks)) { if (nfCommon.isDefinedAndNotNull(concurrentTasks)) {
if (processor.supportsParallelProcessing === true) { if (processor.supportsParallelProcessing === true) {
concurrentTasks.prop('disabled', false); concurrentTasks.prop('disabled', false);
} else { } else {
@ -780,7 +780,7 @@
} }
// load the relationship list // load the relationship list
if (!common.isEmpty(processor.relationships)) { if (!nfCommon.isEmpty(processor.relationships)) {
$.each(processor.relationships, function (i, relationship) { $.each(processor.relationships, function (i, relationship) {
createRelationshipOption(relationship); createRelationshipOption(relationship);
}); });
@ -809,7 +809,7 @@
$('#processor-configuration').modal('hide'); $('#processor-configuration').modal('hide');
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
}); });
} }
} }
@ -829,7 +829,7 @@
}]; }];
// determine if we should show the advanced button // 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({ buttons.push({
buttonText: 'Advanced', buttonText: 'Advanced',
clazz: 'fa fa-cog button-icon', clazz: 'fa fa-cog button-icon',
@ -845,7 +845,7 @@
$('#processor-configuration').modal('hide'); $('#processor-configuration').modal('hide');
// show the custom ui // 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 // once the custom ui is closed, reload the processor
nfProcessor.reload(processor.id); nfProcessor.reload(processor.id);
@ -860,7 +860,7 @@
// determine if changes have been made // determine if changes have been made
if (isSaveRequired()) { if (isSaveRequired()) {
// see if those changes should be saved // see if those changes should be saved
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Save', headerText: 'Save',
dialogContent: 'Save changes before opening the advanced configuration?', dialogContent: 'Save changes before opening the advanced configuration?',
noHandler: openCustomUi, noHandler: openCustomUi,
@ -899,7 +899,7 @@
if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > Math.round(processorRelationships.innerHeight())) { if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > Math.round(processorRelationships.innerHeight())) {
processorRelationships.css('border-width', '1px'); processorRelationships.css('border-width', '1px');
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
} }
}; };

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, common, client, canvasUtils) { function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
return (nf.Processor = factory($, d3, common, client, canvasUtils)); return (nf.Processor = factory($, d3, nfCommon, nfClient, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Processor = module.exports = (nf.Processor =
@ -41,7 +41,7 @@
root.nf.Client, root.nf.Client,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, d3, common, client, canvasUtils) { }(this, function ($, d3, nfCommon, nfClient, nfCanvasUtils) {
'use strict'; 'use strict';
var nfConnectable; var nfConnectable;
@ -103,7 +103,7 @@
'class': 'processor component' 'class': 'processor component'
}) })
.classed('selected', selected) .classed('selected', selected)
.call(canvasUtils.position); .call(nfCanvasUtils.position);
// processor border // processor border
processor.append('rect') processor.append('rect')
@ -211,7 +211,7 @@
var details = processor.select('g.processor-canvas-details'); var details = processor.select('g.processor-canvas-details');
// update the component behavior as appropriate // update the component behavior as appropriate
canvasUtils.editable(processor, nfConnectable, nfDraggable); nfCanvasUtils.editable(processor, nfConnectable, nfDraggable);
// if this processor is visible, render everything // if this processor is visible, render everything
if (processor.classed('visible')) { if (processor.classed('visible')) {
@ -538,7 +538,7 @@
processorName.text(null).selectAll('title').remove(); processorName.text(null).selectAll('title').remove();
// apply ellipsis to the processor name as necessary // 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) { }).append('title').text(function (d) {
return d.component.name; return d.component.name;
}); });
@ -552,9 +552,9 @@
processorType.text(null).selectAll('title').remove(); processorType.text(null).selectAll('title').remove();
// apply ellipsis to the processor type as necessary // 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) { }).append('title').text(function (d) {
return common.substringAfterLast(d.component.type, '.'); return nfCommon.substringAfterLast(d.component.type, '.');
}); });
} else { } else {
// clear the processor name // clear the processor name
@ -607,7 +607,7 @@
// use the specified color if appropriate // use the specified color if appropriate
if (processorData.permissions.canRead) { 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']; var color = processorData.component.style['background-color'];
//update the processor icon container //update the processor icon container
@ -636,15 +636,15 @@
} }
// use the specified color if appropriate // 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']; color = d.component.style['background-color'];
//special case #ffffff implies default fill //special case #ffffff implies default fill
if (color.toLowerCase() === '#ffffff') { if (color.toLowerCase() === '#ffffff') {
color = nfProcessor.defaultIconColor(); color = nfProcessor.defaultIconColor();
} else { } else {
color = common.determineContrastColor( color = nfCommon.determineContrastColor(
common.substringAfterLast( nfCommon.substringAfterLast(
color, '#')); color, '#'));
} }
} }
@ -723,7 +723,7 @@
var tip = d3.select('#run-status-tip-' + d.id); var tip = d3.select('#run-status-tip-' + d.id);
// if there are validation errors generate a tooltip // 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 // create the tip if necessary
if (tip.empty()) { if (tip.empty()) {
tip = d3.select('#processor-tooltips').append('div') tip = d3.select('#processor-tooltips').append('div')
@ -735,7 +735,7 @@
// update the tip // update the tip
tip.html(function () { tip.html(function () {
var list = common.formatUnorderedList(d.component.validationErrors); var list = nfCommon.formatUnorderedList(d.component.validationErrors);
if (list === null || list.length === 0) { if (list === null || list.length === 0) {
return ''; return '';
} else { } else {
@ -744,7 +744,7 @@
}); });
// add the tooltip // add the tooltip
canvasUtils.canvasTooltip(tip, d3.select(this)); nfCanvasUtils.canvasTooltip(tip, d3.select(this));
} else { } else {
// remove the tip if necessary // remove the tip if necessary
if (!tip.empty()) { if (!tip.empty()) {
@ -756,13 +756,13 @@
// in count value // in count value
updated.select('text.processor-in tspan.count') updated.select('text.processor-in tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.input, ' ');
}); });
// in size value // in size value
updated.select('text.processor-in tspan.size') updated.select('text.processor-in tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.input, ' ');
}); });
// read/write value // read/write value
@ -774,13 +774,13 @@
// out count value // out count value
updated.select('text.processor-out tspan.count') updated.select('text.processor-out tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.output, ' ');
}); });
// out size value // out size value
updated.select('text.processor-out tspan.size') updated.select('text.processor-out tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.output, ' ');
}); });
// tasks/time value // tasks/time value
@ -796,17 +796,17 @@
// active thread count // active thread count
// ------------------- // -------------------
canvasUtils.activeThreadCount(processor, d); nfCanvasUtils.activeThreadCount(processor, d);
// --------- // ---------
// bulletins // bulletins
// --------- // ---------
processor.select('rect.bulletin-background').classed('has-bulletins', function () { 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'); return d3.select('#processor-tooltips');
}, 286); }, 286);
}); });
@ -841,12 +841,17 @@
var nfProcessor = { var nfProcessor = {
/** /**
* Initializes of the Processor handler. * 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) { init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) {
nfConnectable = connectable; nfConnectable = nfConnectableRef;
nfDraggable = draggable; nfDraggable = nfDraggableRef;
nfSelectable = selectable; nfSelectable = nfSelectableRef;
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
processorMap = d3.map(); processorMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -868,8 +873,8 @@
*/ */
add: function (processorEntities, options) { add: function (processorEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// get the current time // get the current time
@ -890,7 +895,7 @@
$.each(processorEntities, function (_, processorEntity) { $.each(processorEntities, function (_, processorEntity) {
add(processorEntity); add(processorEntity);
}); });
} else if (common.isDefinedAndNotNull(processorEntities)) { } else if (nfCommon.isDefinedAndNotNull(processorEntities)) {
add(processorEntities); add(processorEntities);
} }
@ -909,16 +914,16 @@
set: function (processorEntities, options) { set: function (processorEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
var set = function (proposedProcessorEntity) { var set = function (proposedProcessorEntity) {
var currentProcessorEntity = processorMap.get(proposedProcessorEntity.id); var currentProcessorEntity = processorMap.get(proposedProcessorEntity.id);
// set the processor if appropriate due to revision and wasn't previously removed // 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({ processorMap.set(proposedProcessorEntity.id, $.extend({
type: 'Processor', type: 'Processor',
dimensions: dimensions dimensions: dimensions
@ -942,14 +947,14 @@
$.each(processorEntities, function (_, processorEntity) { $.each(processorEntities, function (_, processorEntity) {
set(processorEntity); set(processorEntity);
}); });
} else if (common.isDefinedAndNotNull(processorEntities)) { } else if (nfCommon.isDefinedAndNotNull(processorEntities)) {
set(processorEntities); set(processorEntities);
} }
// apply the selection and handle all new processors // apply the selection and handle all new processors
var selection = select(); var selection = select();
selection.enter().call(renderProcessors, selectAll); selection.enter().call(renderProcessors, selectAll);
selection.call(updateProcessors).call(canvasUtils.position, transition); selection.call(updateProcessors).call(nfCanvasUtils.position, transition);
selection.exit().call(removeProcessors); selection.exit().call(removeProcessors);
}, },
@ -960,7 +965,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return processorMap.values(); return processorMap.values();
} else { } else {
return processorMap.get(id); return processorMap.get(id);
@ -974,7 +979,7 @@
* @param {string} id Optional * @param {string} id Optional
*/ */
refresh: function (id) { refresh: function (id) {
if (common.isDefinedAndNotNull(id)) { if (nfCommon.isDefinedAndNotNull(id)) {
d3.select('#id-' + id).call(updateProcessors); d3.select('#id-' + id).call(updateProcessors);
} else { } else {
d3.selectAll('g.processor').call(updateProcessors); d3.selectAll('g.processor').call(updateProcessors);
@ -987,7 +992,7 @@
* @param {string} id The id * @param {string} id The id
*/ */
position: function (id) { position: function (id) {
d3.select('#id-' + id).call(canvasUtils.position); d3.select('#id-' + id).call(nfCanvasUtils.position);
}, },
/** /**

View File

@ -32,8 +32,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage', 'nf.Storage',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils) { function ($, Slick, nfCommon, nfDialog, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils) {
return (nf.QueueListing = factory($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils)); return (nf.QueueListing = factory($, Slick, nfCommon, nfDialog, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.QueueListing = module.exports = (nf.QueueListing =
@ -59,7 +59,7 @@
root.nf.Storage, root.nf.Storage,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils) { }(this, function ($, Slick, nfCommon, nfDialog, nfShell, nfNgBridge, nfClusterSummary, nfErrorHandler, nfStorage, nfCanvasUtils) {
'use strict'; 'use strict';
/** /**
@ -96,17 +96,17 @@
var dataUri = $('#flowfile-uri').text() + '/content'; var dataUri = $('#flowfile-uri').text() + '/content';
// perform the request once we've received a token // perform the request once we've received a token
common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { nfCommon.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
var parameters = {}; var parameters = {};
// conditionally include the ui extension token // conditionally include the ui extension token
if (!common.isBlank(downloadToken)) { if (!nfCommon.isBlank(downloadToken)) {
parameters['access_token'] = downloadToken; parameters['access_token'] = downloadToken;
} }
// conditionally include the cluster node id // conditionally include the cluster node id
var clusterNodeId = $('#flowfile-cluster-node-id').text(); var clusterNodeId = $('#flowfile-cluster-node-id').text();
if (!common.isBlank(clusterNodeId)) { if (!nfCommon.isBlank(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId; parameters['clusterNodeId'] = clusterNodeId;
} }
@ -117,7 +117,7 @@
window.open(dataUri + '?' + $.param(parameters)); window.open(dataUri + '?' + $.param(parameters));
} }
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Queue Listing', headerText: 'Queue Listing',
dialogContent: 'Unable to generate access token for downloading content.' dialogContent: 'Unable to generate access token for downloading content.'
}); });
@ -132,7 +132,7 @@
// generate tokens as necessary // generate tokens as necessary
var getAccessTokens = $.Deferred(function (deferred) { var getAccessTokens = $.Deferred(function (deferred) {
if (storage.hasItem('jwt')) { if (nfStorage.hasItem('jwt')) {
// generate a token for the ui extension and another for the callback // generate a token for the ui extension and another for the callback
var uiExtensionToken = $.ajax({ var uiExtensionToken = $.ajax({
type: 'POST', type: 'POST',
@ -149,7 +149,7 @@
var downloadToken = downloadTokenResult[0]; var downloadToken = downloadTokenResult[0];
deferred.resolve(uiExtensionToken, downloadToken); deferred.resolve(uiExtensionToken, downloadToken);
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Queue Listing', headerText: 'Queue Listing',
dialogContent: 'Unable to generate access token for viewing content.' dialogContent: 'Unable to generate access token for viewing content.'
}); });
@ -166,12 +166,12 @@
// conditionally include the cluster node id // conditionally include the cluster node id
var clusterNodeId = $('#flowfile-cluster-node-id').text(); var clusterNodeId = $('#flowfile-cluster-node-id').text();
if (!common.isBlank(clusterNodeId)) { if (!nfCommon.isBlank(clusterNodeId)) {
dataUriParameters['clusterNodeId'] = clusterNodeId; dataUriParameters['clusterNodeId'] = clusterNodeId;
} }
// include the download token if applicable // include the download token if applicable
if (!common.isBlank(downloadToken)) { if (!nfCommon.isBlank(downloadToken)) {
dataUriParameters['access_token'] = downloadToken; dataUriParameters['access_token'] = downloadToken;
} }
@ -197,7 +197,7 @@
}; };
// include the download token if applicable // include the download token if applicable
if (!common.isBlank(uiExtensionToken)) { if (!nfCommon.isBlank(uiExtensionToken)) {
contentViewerParameters['access_token'] = uiExtensionToken; contentViewerParameters['access_token'] = uiExtensionToken;
} }
@ -227,7 +227,7 @@
// update the progress // update the progress
var label = $('<div class="progress-label"></div>').text(percentComplete + '%'); var label = $('<div class="progress-label"></div>').text(percentComplete + '%');
(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); (nfNgBridge.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>'))(nfNgBridge.rootScope)).appendTo(progressBar);
progressBar.append(label); progressBar.append(label);
}; };
@ -263,7 +263,7 @@
var reject = cancelled; var reject = cancelled;
// ensure the listing requests are present // ensure the listing requests are present
if (common.isDefinedAndNotNull(listingRequest)) { if (nfCommon.isDefinedAndNotNull(listingRequest)) {
$.ajax({ $.ajax({
type: 'DELETE', type: 'DELETE',
url: listingRequest.uri, url: listingRequest.uri,
@ -271,20 +271,20 @@
}); });
// use the listing request from when the listing completed // use the listing request from when the listing completed
if (common.isEmpty(listingRequest.flowFileSummaries)) { if (nfCommon.isEmpty(listingRequest.flowFileSummaries)) {
if (cancelled === false) { if (cancelled === false) {
reject = true; reject = true;
// show the dialog // show the dialog
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Queue Listing', headerText: 'Queue Listing',
dialogContent: 'The queue has no FlowFiles.' dialogContent: 'The queue has no FlowFiles.'
}); });
} }
} else { } else {
// update the queue size // update the queue size
$('#total-flowfiles-count').text(common.formatInteger(listingRequest.queueSize.objectCount)); $('#total-flowfiles-count').text(nfCommon.formatInteger(listingRequest.queueSize.objectCount));
$('#total-flowfiles-size').text(common.formatDataSize(listingRequest.queueSize.byteCount)); $('#total-flowfiles-size').text(nfCommon.formatDataSize(listingRequest.queueSize.byteCount));
// update the last updated time // update the last updated time
$('#queue-listing-last-refreshed').text(listingRequest.lastUpdated); $('#queue-listing-last-refreshed').text(listingRequest.lastUpdated);
@ -356,7 +356,7 @@
}).done(function (response) { }).done(function (response) {
listingRequest = response.listingRequest; listingRequest = response.listingRequest;
processListingRequest(nextDelay); processListingRequest(nextDelay);
}).fail(completeListingRequest).fail(errorHandler.handleAjaxError); }).fail(completeListingRequest).fail(nfErrorHandler.handleAjaxError);
}; };
// issue the request to list the flow files // issue the request to list the flow files
@ -375,7 +375,7 @@
// process the drop request // process the drop request
listingRequest = response.listingRequest; listingRequest = response.listingRequest;
processListingRequest(1); processListingRequest(1);
}).fail(completeListingRequest).fail(errorHandler.handleAjaxError); }).fail(completeListingRequest).fail(nfErrorHandler.handleAjaxError);
}).promise(); }).promise();
}; };
@ -389,13 +389,13 @@
var formatFlowFileDetail = function (label, value) { var formatFlowFileDetail = function (label, value) {
$('<div class="flowfile-detail"></div>').append( $('<div class="flowfile-detail"></div>').append(
$('<div class="detail-name"></div>').text(label)).append( $('<div class="detail-name"></div>').text(label)).append(
$('<div class="detail-value">' + common.formatValue(value) + '</div>').ellipsis()).append( $('<div class="detail-value">' + nfCommon.formatValue(value) + '</div>').ellipsis()).append(
$('<div class="clear"></div>')).appendTo('#additional-flowfile-details'); $('<div class="clear"></div>')).appendTo('#additional-flowfile-details');
}; };
// formats the content value // formats the content value
var formatContentValue = function (element, value) { var formatContentValue = function (element, value) {
if (common.isDefinedAndNotNull(value)) { if (nfCommon.isDefinedAndNotNull(value)) {
element.removeClass('unset').text(value); element.removeClass('unset').text(value);
} else { } else {
element.addClass('unset').text('No value set'); element.addClass('unset').text('No value set');
@ -403,7 +403,7 @@
}; };
var params = {}; var params = {};
if (common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) {
params['clusterNodeId'] = flowFileSummary.clusterNodeId; params['clusterNodeId'] = flowFileSummary.clusterNodeId;
} }
@ -419,16 +419,16 @@
$('#flowfile-uri').text(flowFile.uri); $('#flowfile-uri').text(flowFile.uri);
// show the flowfile details dialog // show the flowfile details dialog
$('#flowfile-uuid').html(common.formatValue(flowFile.uuid)); $('#flowfile-uuid').html(nfCommon.formatValue(flowFile.uuid));
$('#flowfile-filename').html(common.formatValue(flowFile.filename)); $('#flowfile-filename').html(nfCommon.formatValue(flowFile.filename));
$('#flowfile-queue-position').html(common.formatValue(flowFile.position)); $('#flowfile-queue-position').html(nfCommon.formatValue(flowFile.position));
$('#flowfile-file-size').html(common.formatValue(flowFile.contentClaimFileSize)); $('#flowfile-file-size').html(nfCommon.formatValue(flowFile.contentClaimFileSize));
$('#flowfile-queued-duration').text(common.formatDuration(flowFile.queuedDuration)); $('#flowfile-queued-duration').text(nfCommon.formatDuration(flowFile.queuedDuration));
$('#flowfile-lineage-duration').text(common.formatDuration(flowFile.lineageDuration)); $('#flowfile-lineage-duration').text(nfCommon.formatDuration(flowFile.lineageDuration));
$('#flowfile-penalized').text(flowFile.penalized === true ? 'Yes' : 'No'); $('#flowfile-penalized').text(flowFile.penalized === true ? 'Yes' : 'No');
// conditionally show the cluster node identifier // conditionally show the cluster node identifier
if (common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) {
// save the cluster node id // save the cluster node id
$('#flowfile-cluster-node-id').text(flowFileSummary.clusterNodeId); $('#flowfile-cluster-node-id').text(flowFileSummary.clusterNodeId);
@ -436,7 +436,7 @@
formatFlowFileDetail('Node Address', flowFileSummary.clusterNodeAddress); formatFlowFileDetail('Node Address', flowFileSummary.clusterNodeAddress);
} }
if (common.isDefinedAndNotNull(flowFile.contentClaimContainer)) { if (nfCommon.isDefinedAndNotNull(flowFile.contentClaimContainer)) {
// content claim // content claim
formatContentValue($('#content-container'), flowFile.contentClaimContainer); formatContentValue($('#content-container'), flowFile.contentClaimContainer);
formatContentValue($('#content-section'), flowFile.contentClaimSection); formatContentValue($('#content-section'), flowFile.contentClaimSection);
@ -447,9 +447,9 @@
// input content file size // input content file size
var contentSize = $('#content-size'); var contentSize = $('#content-size');
formatContentValue(contentSize, flowFile.contentClaimFileSize); formatContentValue(contentSize, flowFile.contentClaimFileSize);
if (common.isDefinedAndNotNull(flowFile.contentClaimFileSize)) { if (nfCommon.isDefinedAndNotNull(flowFile.contentClaimFileSize)) {
// over the default tooltip with the actual byte count // over the default tooltip with the actual byte count
contentSize.attr('title', common.formatInteger(flowFile.contentClaimFileSizeBytes) + ' bytes'); contentSize.attr('title', nfCommon.formatInteger(flowFile.contentClaimFileSizeBytes) + ' bytes');
} }
// show the content details // show the content details
@ -465,18 +465,18 @@
$.each(flowFile.attributes, function (attributeName, attributeValue) { $.each(flowFile.attributes, function (attributeName, attributeValue) {
// create the attribute record // create the attribute record
var attributeRecord = $('<div class="attribute-detail"></div>') var attributeRecord = $('<div class="attribute-detail"></div>')
.append($('<div class="attribute-name">' + common.formatValue(attributeName) + '</div>').ellipsis()) .append($('<div class="attribute-name">' + nfCommon.formatValue(attributeName) + '</div>').ellipsis())
.appendTo(attributesContainer); .appendTo(attributesContainer);
// add the current value // add the current value
attributeRecord attributeRecord
.append($('<div class="attribute-value">' + common.formatValue(attributeValue) + '</div>').ellipsis()) .append($('<div class="attribute-value">' + nfCommon.formatValue(attributeValue) + '</div>').ellipsis())
.append('<div class="clear"></div>'); .append('<div class="clear"></div>');
}); });
// show the dialog // show the dialog
$('#flowfile-details-dialog').modal('show'); $('#flowfile-details-dialog').modal('show');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var nfQueueListing = { var nfQueueListing = {
@ -496,12 +496,12 @@
// function for formatting data sizes // function for formatting data sizes
var dataSizeFormatter = function (row, cell, value, columnDef, dataContext) { var dataSizeFormatter = function (row, cell, value, columnDef, dataContext) {
return common.formatDataSize(value); return nfCommon.formatDataSize(value);
}; };
// function for formatting durations // function for formatting durations
var durationFormatter = function (row, cell, value, columnDef, dataContext) { var durationFormatter = function (row, cell, value, columnDef, dataContext) {
return common.formatDuration(value); return nfCommon.formatDuration(value);
}; };
// function for formatting penalization // function for formatting penalization
@ -588,7 +588,7 @@
]; ];
// conditionally show the cluster node identifier // conditionally show the cluster node identifier
if (clusterSummary.isClustered()) { if (nfClusterSummary.isClustered()) {
queueListingColumns.push({ queueListingColumns.push({
id: 'clusterNodeAddress', id: 'clusterNodeAddress',
name: 'Node', name: 'Node',
@ -599,7 +599,7 @@
} }
// add an actions column when the user can access provenance // add an actions column when the user can access provenance
if (common.canAccessProvenance()) { if (nfCommon.canAccessProvenance()) {
// function for formatting actions // function for formatting actions
var actionsFormatter = function () { var actionsFormatter = function () {
return '<div title="Provenance" class="pointer icon icon-provenance view-provenance"></div>'; return '<div title="Provenance" class="pointer icon icon-provenance view-provenance"></div>';
@ -654,7 +654,7 @@
$('#shell-close-button').click(); $('#shell-close-button').click();
// open the provenance page with the specified component // open the provenance page with the specified component
shell.showPage('provenance?' + $.param({ nfShell.showPage('provenance?' + $.param({
flowFileUuid: item.uuid flowFileUuid: item.uuid
})); }));
} }
@ -688,7 +688,7 @@
$('#content-download').on('click', downloadContent); $('#content-download').on('click', downloadContent);
// only show if content viewer is configured // only show if content viewer is configured
if (common.isContentViewConfigured()) { if (nfCommon.isContentViewConfigured()) {
$('#content-view').show(); $('#content-view').show();
$('#content-view').on('click', viewContent); $('#content-view').on('click', viewContent);
} }
@ -730,7 +730,7 @@
$('#additional-flowfile-details').empty(); $('#additional-flowfile-details').empty();
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -741,7 +741,7 @@
*/ */
resetTableSize: function () { resetTableSize: function () {
var queueListingGrid = $('#queue-listing-table').data('gridInstance'); var queueListingGrid = $('#queue-listing-table').data('gridInstance');
if (common.isDefinedAndNotNull(queueListingGrid)) { if (nfCommon.isDefinedAndNotNull(queueListingGrid)) {
queueListingGrid.resizeCanvas(); queueListingGrid.resizeCanvas();
} }
}, },
@ -757,7 +757,7 @@
// update the connection name // update the connection name
var connectionName = ''; var connectionName = '';
if (connection.permissions.canRead) { if (connection.permissions.canRead) {
connectionName = canvasUtils.formatConnectionName(connection.component); connectionName = nfCanvasUtils.formatConnectionName(connection.component);
} }
if (connectionName === '') { if (connectionName === '') {
connectionName = 'Connection'; connectionName = 'Connection';
@ -765,7 +765,7 @@
$('#queue-listing-header-text').text(connectionName); $('#queue-listing-header-text').text(connectionName);
// show the listing container // show the listing container
shell.showContent('#queue-listing-container').done(function () { nfShell.showContent('#queue-listing-container').done(function () {
$('#queue-listing-table').removeData('connection'); $('#queue-listing-table').removeData('connection');
// clear the table // clear the table
@ -779,7 +779,7 @@
// reset stats // reset stats
$('#displayed-flowfiles, #total-flowfiles-count').text('0'); $('#displayed-flowfiles, #total-flowfiles-count').text('0');
$('#total-flowfiles-size').text(common.formatDataSize(0)); $('#total-flowfiles-size').text(nfCommon.formatDataSize(0));
}); });
// adjust the table size // adjust the table size

View File

@ -28,8 +28,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ng.Bridge', 'nf.ng.Bridge',
'nf.RemoteProcessGroup'], 'nf.RemoteProcessGroup'],
function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) { function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfRemoteProcessGroup) {
return (nf.RemoteProcessGroupConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup)); return (nf.RemoteProcessGroupConfiguration = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfRemoteProcessGroup));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.RemoteProcessGroupConfiguration = module.exports = (nf.RemoteProcessGroupConfiguration =
@ -53,7 +53,7 @@
root.nf.ng.Bridge, root.nf.ng.Bridge,
root.nf.RemoteProcessGroup); root.nf.RemoteProcessGroup);
} }
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) { }(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfRemoteProcessGroup) {
'use strict'; 'use strict';
return { return {
@ -75,7 +75,7 @@
// create the remote process group details // create the remote process group details
var remoteProcessGroupEntity = { var remoteProcessGroupEntity = {
'revision': client.getRevision(remoteProcessGroupData), 'revision': nfClient.getRevision(remoteProcessGroupData),
'component': { 'component': {
id: remoteProcessGroupId, id: remoteProcessGroupId,
communicationsTimeout: $('#remote-process-group-timeout').val(), communicationsTimeout: $('#remote-process-group-timeout').val(),
@ -100,7 +100,7 @@
nfRemoteProcessGroup.set(response); nfRemoteProcessGroup.set(response);
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
// close the details panel // close the details panel
$('#remote-process-group-configuration').modal('hide'); $('#remote-process-group-configuration').modal('hide');
@ -112,15 +112,15 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Remote Process Group Configuration' headerText: 'Remote Process Group Configuration'
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
} }
@ -176,7 +176,7 @@
*/ */
showConfiguration: function (selection) { showConfiguration: function (selection) {
// if the specified component is a remote process group, load its properties // if the specified component is a remote process group, load its properties
if (canvasUtils.isRemoteProcessGroup(selection)) { if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
var selectionData = selection.datum(); var selectionData = selection.datum();
// populate the port settings // populate the port settings

View File

@ -22,8 +22,8 @@
define(['jquery', define(['jquery',
'nf.Common', 'nf.Common',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, common, canvasUtils) { function ($, nfCommon, nfCanvasUtils) {
return (nf.RemoteProcessGroupDetails = factory($, common, canvasUtils)); return (nf.RemoteProcessGroupDetails = factory($, nfCommon, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.RemoteProcessGroupDetails = module.exports = (nf.RemoteProcessGroupDetails =
@ -35,7 +35,7 @@
root.nf.Common, root.nf.Common,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, common, canvasUtils) { }(this, function ($, nfCommon, nfCanvasUtils) {
'use strict'; 'use strict';
return { return {
@ -59,16 +59,16 @@
handler: { handler: {
close: function () { close: function () {
// clear the remote process group details // clear the remote process group details
common.clearField('read-only-remote-process-group-id'); nfCommon.clearField('read-only-remote-process-group-id');
common.clearField('read-only-remote-process-group-name'); nfCommon.clearField('read-only-remote-process-group-name');
common.clearField('read-only-remote-process-group-urls'); nfCommon.clearField('read-only-remote-process-group-urls');
common.clearField('read-only-remote-process-group-timeout'); nfCommon.clearField('read-only-remote-process-group-timeout');
common.clearField('read-only-remote-process-group-yield-duration'); nfCommon.clearField('read-only-remote-process-group-yield-duration');
common.clearField('read-only-remote-process-group-transport-protocol'); nfCommon.clearField('read-only-remote-process-group-transport-protocol');
common.clearField('read-only-remote-process-group-proxy-host'); nfCommon.clearField('read-only-remote-process-group-proxy-host');
common.clearField('read-only-remote-process-group-proxy-port'); nfCommon.clearField('read-only-remote-process-group-proxy-port');
common.clearField('read-only-remote-process-group-proxy-user'); nfCommon.clearField('read-only-remote-process-group-proxy-user');
common.clearField('read-only-remote-process-group-proxy-password'); nfCommon.clearField('read-only-remote-process-group-proxy-password');
} }
} }
}); });
@ -81,20 +81,20 @@
*/ */
showDetails: function (selection) { showDetails: function (selection) {
// if the specified component is a remote process group, load its properties // if the specified component is a remote process group, load its properties
if (canvasUtils.isRemoteProcessGroup(selection)) { if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
var selectionData = selection.datum(); var selectionData = selection.datum();
// populate the port settings // populate the port settings
common.populateField('read-only-remote-process-group-id', selectionData.id); nfCommon.populateField('read-only-remote-process-group-id', selectionData.id);
common.populateField('read-only-remote-process-group-name', selectionData.component.name); nfCommon.populateField('read-only-remote-process-group-name', selectionData.component.name);
common.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris); nfCommon.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris);
common.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout); nfCommon.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout);
common.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration); nfCommon.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration);
common.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol); nfCommon.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol);
common.populateField('read-only-remote-process-group-proxy-host', selectionData.component.proxyHost); nfCommon.populateField('read-only-remote-process-group-proxy-host', selectionData.component.proxyHost);
common.populateField('read-only-remote-process-group-proxy-port', selectionData.component.proxyPort); nfCommon.populateField('read-only-remote-process-group-proxy-port', selectionData.component.proxyPort);
common.populateField('read-only-remote-process-group-proxy-user', selectionData.component.proxyUser); nfCommon.populateField('read-only-remote-process-group-proxy-user', selectionData.component.proxyUser);
common.populateField('read-only-remote-process-group-proxy-password', selectionData.component.proxyPassword); nfCommon.populateField('read-only-remote-process-group-proxy-password', selectionData.component.proxyPassword);
// show the details // show the details
$('#remote-process-group-details').modal('show'); $('#remote-process-group-details').modal('show');

View File

@ -28,8 +28,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ng.Bridge', 'nf.ng.Bridge',
'nf.RemoteProcessGroup'], 'nf.RemoteProcessGroup'],
function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) { function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfRemoteProcessGroup) {
return (nf.RemoteProcessGroupPorts = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup)); return (nf.RemoteProcessGroupPorts = factory($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfRemoteProcessGroup));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.RemoteProcessGroupPorts = module.exports = (nf.RemoteProcessGroupPorts =
@ -53,7 +53,7 @@
root.nf.ng.Bridge, root.nf.ng.Bridge,
root.nf.RemoteProcessGroup); root.nf.RemoteProcessGroup);
} }
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) { }(this, function ($, d3, nfErrorHandler, nfCommon, nfDialog, nfClient, nfCanvasUtils, nfNgBridge, nfRemoteProcessGroup) {
'use strict'; 'use strict';
/** /**
@ -82,7 +82,7 @@
// create the remote process group details // create the remote process group details
var remoteProcessGroupPortEntity = { var remoteProcessGroupPortEntity = {
'revision': client.getRevision(remoteProcessGroupData), 'revision': nfClient.getRevision(remoteProcessGroupData),
'remoteProcessGroupPort': { 'remoteProcessGroupPort': {
id: remotePortId, id: remotePortId,
groupId: remoteProcessGroupId, groupId: remoteProcessGroupId,
@ -129,22 +129,22 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Remote Process Group Ports' headerText: 'Remote Process Group Ports'
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}).always(function () { }).always(function () {
// close the dialog // close the dialog
$('#remote-port-configuration').modal('hide'); $('#remote-port-configuration').modal('hide');
}); });
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Remote Process Group Ports', headerText: 'Remote Process Group Ports',
dialogContent: 'Concurrent tasks must be an integer value.' dialogContent: 'Concurrent tasks must be an integer value.'
}); });
@ -202,7 +202,7 @@
var remoteProcessGroupData = remoteProcessGroup.datum(); var remoteProcessGroupData = remoteProcessGroup.datum();
// if can modify, the over status of this node may have changed // if can modify, the over status of this node may have changed
if (canvasUtils.canModify(remoteProcessGroup)) { if (nfCanvasUtils.canModify(remoteProcessGroup)) {
// reload the remote process group // reload the remote process group
nfRemoteProcessGroup.reload(remoteProcessGroupData.id); nfRemoteProcessGroup.reload(remoteProcessGroupData.id);
} }
@ -221,8 +221,8 @@
// clear any tooltips // clear any tooltips
var dialog = $('#remote-process-group-ports'); var dialog = $('#remote-process-group-ports');
common.cleanUpTooltips(dialog, 'div.remote-port-removed'); nfCommon.cleanUpTooltips(dialog, 'div.remote-port-removed');
common.cleanUpTooltips(dialog, 'div.concurrent-tasks-info'); nfCommon.cleanUpTooltips(dialog, 'div.concurrent-tasks-info');
// clear the input and output ports // clear the input and output ports
$('#remote-process-group-input-ports-container').empty(); $('#remote-process-group-input-ports-container').empty();
@ -240,7 +240,7 @@
* @argument {string} portType The type of port * @argument {string} portType The type of port
*/ */
var createPortOption = function (container, port, portType) { var createPortOption = function (container, port, portType) {
var portId = common.escapeHtml(port.id); var portId = nfCommon.escapeHtml(port.id);
var portContainer = $('<div class="remote-port-container"></div>').appendTo(container); var portContainer = $('<div class="remote-port-container"></div>').appendTo(container);
var portContainerEditContainer = $('<div class="remote-port-edit-container"></div>').appendTo(portContainer); var portContainerEditContainer = $('<div class="remote-port-edit-container"></div>').appendTo(portContainer);
var portContainerDetailsContainer = $('<div class="remote-port-details-container"></div>').appendTo(portContainer); var portContainerDetailsContainer = $('<div class="remote-port-details-container"></div>').appendTo(portContainer);
@ -250,25 +250,25 @@
var remoteProcessGroup = d3.select('#id-' + remoteProcessGroupId); var remoteProcessGroup = d3.select('#id-' + remoteProcessGroupId);
// if can modify, support updating the remote group port // if can modify, support updating the remote group port
if (canvasUtils.canModify(remoteProcessGroup)) { if (nfCanvasUtils.canModify(remoteProcessGroup)) {
// show the enabled transmission switch // show the enabled transmission switch
var transmissionSwitch; var transmissionSwitch;
if (port.connected === true) { if (port.connected === true) {
if (port.transmitting === true) { if (port.transmitting === true) {
transmissionSwitch = (angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); transmissionSwitch = (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
transmissionSwitch.click(); transmissionSwitch.click();
} else { } else {
if (port.exists === true) { if (port.exists === true) {
transmissionSwitch = (angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); transmissionSwitch = (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} else { } else {
(angularBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} }
} }
} else { } else {
if (port.transmitting === true) { if (port.transmitting === true) {
(angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} else { } else {
(angularBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} }
} }
@ -292,14 +292,14 @@
} }
} else if (port.exists === false) { } else if (port.exists === false) {
$('<div class="remote-port-removed"/>').appendTo(portContainerEditContainer).qtip($.extend({}, $('<div class="remote-port-removed"/>').appendTo(portContainerEditContainer).qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: 'This port has been removed.' content: 'This port has been removed.'
})); }));
} }
// only allow modifications to transmission when the swtich is defined // only allow modifications to transmission when the swtich is defined
if (common.isDefinedAndNotNull(transmissionSwitch)) { if (nfCommon.isDefinedAndNotNull(transmissionSwitch)) {
// create toggle for changing transmission state // create toggle for changing transmission state
transmissionSwitch.click(function () { transmissionSwitch.click(function () {
// get the component being edited // get the component being edited
@ -314,7 +314,7 @@
// create the remote process group details // create the remote process group details
var remoteProcessGroupPortEntity = { var remoteProcessGroupPortEntity = {
'revision': client.getRevision(remoteProcessGroupData), 'revision': nfClient.getRevision(remoteProcessGroupData),
'remoteProcessGroupPort': { 'remoteProcessGroupPort': {
id: port.id, id: port.id,
groupId: remoteProcessGroupId, groupId: remoteProcessGroupId,
@ -349,7 +349,7 @@
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('disabled-inactive-transmission').off('click'); transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('disabled-inactive-transmission').off('click');
// hide the edit button // hide the edit button
if (common.isDefinedAndNotNull(editRemotePort)) { if (nfCommon.isDefinedAndNotNull(editRemotePort)) {
editRemotePort.hide(); editRemotePort.hide();
} }
} else { } else {
@ -359,7 +359,7 @@
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-active-transmission'); transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-active-transmission');
// hide the edit button // hide the edit button
if (common.isDefinedAndNotNull(editRemotePort)) { if (nfCommon.isDefinedAndNotNull(editRemotePort)) {
editRemotePort.hide(); editRemotePort.hide();
} }
} else { } else {
@ -367,7 +367,7 @@
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-inactive-transmission'); transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-inactive-transmission');
// show the edit button // show the edit button
if (common.isDefinedAndNotNull(editRemotePort)) { if (nfCommon.isDefinedAndNotNull(editRemotePort)) {
editRemotePort.show(); editRemotePort.show();
} }
} }
@ -380,15 +380,15 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Remote Process Group Ports', headerText: 'Remote Process Group Ports',
dialogContent: content dialogContent: content
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
}); });
@ -396,9 +396,9 @@
} else { } else {
// show the disabled transmission switch // show the disabled transmission switch
if (port.transmitting === true) { if (port.transmitting === true) {
(angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} else { } else {
(angularBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer); (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} }
} }
@ -410,7 +410,7 @@
$('<div class="clear"></div>').appendTo(portContainerDetailsContainer); $('<div class="clear"></div>').appendTo(portContainerDetailsContainer);
// add the comments for this port // add the comments for this port
if (common.isBlank(port.comments)) { if (nfCommon.isBlank(port.comments)) {
$('<div class="remote-port-description unset">No description specified.</div>').appendTo(portContainerDetailsContainer); $('<div class="remote-port-description unset">No description specified.</div>').appendTo(portContainerDetailsContainer);
} else { } else {
$('<div class="remote-port-description"></div>').text(port.comments).appendTo(portContainerDetailsContainer); $('<div class="remote-port-description"></div>').text(port.comments).appendTo(portContainerDetailsContainer);
@ -431,7 +431,7 @@
'<div class="processor-setting concurrent-tasks-info fa fa-question-circle"></div>' + '<div class="processor-setting concurrent-tasks-info fa fa-question-circle"></div>' +
'</div>' + '</div>' +
'</div>').append(concurrentTasks).appendTo(concurrentTasksContainer).find('div.concurrent-tasks-info').qtip($.extend({}, '</div>').append(concurrentTasks).appendTo(concurrentTasksContainer).find('div.concurrent-tasks-info').qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: 'The number of tasks that should be concurrently scheduled for this port.' content: 'The number of tasks that should be concurrently scheduled for this port.'
})); }));
@ -461,7 +461,7 @@
portContainer.find('.ellipsis').ellipsis(); portContainer.find('.ellipsis').ellipsis();
// inform Angular app values have changed // inform Angular app values have changed
angularBridge.digest(); nfNgBridge.digest();
}; };
/** /**
@ -506,7 +506,7 @@
*/ */
showPorts: function (selection) { showPorts: function (selection) {
// if the specified component is a remote process group, load its properties // if the specified component is a remote process group, load its properties
if (canvasUtils.isRemoteProcessGroup(selection)) { if (nfCanvasUtils.isRemoteProcessGroup(selection)) {
var selectionData = selection.datum(); var selectionData = selection.datum();
// load the properties for the specified component // load the properties for the specified component
@ -527,7 +527,7 @@
// get the contents // get the contents
var remoteProcessGroupContents = remoteProcessGroup.contents; var remoteProcessGroupContents = remoteProcessGroup.contents;
if (common.isDefinedAndNotNull(remoteProcessGroupContents)) { if (nfCommon.isDefinedAndNotNull(remoteProcessGroupContents)) {
var connectedInputPorts = []; var connectedInputPorts = [];
var disconnectedInputPorts = []; var disconnectedInputPorts = [];
@ -551,7 +551,7 @@
createPortOption(inputPortContainer, inputPort, 'input'); createPortOption(inputPortContainer, inputPort, 'input');
}); });
if (common.isEmpty(connectedInputPorts) && common.isEmpty(disconnectedInputPorts)) { if (nfCommon.isEmpty(connectedInputPorts) && nfCommon.isEmpty(disconnectedInputPorts)) {
$('<div class="unset"></div>').text("No ports to display").appendTo(inputPortContainer); $('<div class="unset"></div>').text("No ports to display").appendTo(inputPortContainer);
} }
@ -578,14 +578,14 @@
createPortOption(outputPortContainer, outputPort, 'output'); createPortOption(outputPortContainer, outputPort, 'output');
}); });
if (common.isEmpty(connectedOutputPorts) && common.isEmpty(disconnectedOutputPorts)) { if (nfCommon.isEmpty(connectedOutputPorts) && nfCommon.isEmpty(disconnectedOutputPorts)) {
$('<div class="unset"></div>').text("No ports to display").appendTo(outputPortContainer); $('<div class="unset"></div>').text("No ports to display").appendTo(outputPortContainer);
} }
} }
// show the details // show the details
$('#remote-process-group-ports').modal('show'); $('#remote-process-group-ports').modal('show');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
} }
}; };

View File

@ -25,8 +25,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.CanvasUtils'], 'nf.CanvasUtils'],
function ($, d3, connection, common, client, canvasUtils) { function ($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils) {
return (nf.RemoteProcessGroup = factory($, d3, connection, common, client, canvasUtils)); return (nf.RemoteProcessGroup = factory($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.RemoteProcessGroup = module.exports = (nf.RemoteProcessGroup =
@ -44,7 +44,7 @@
root.nf.Client, root.nf.Client,
root.nf.CanvasUtils); root.nf.CanvasUtils);
} }
}(this, function ($, d3, connection, common, client, canvasUtils) { }(this, function ($, d3, nfConnection, nfCommon, nfClient, nfCanvasUtils) {
'use strict'; 'use strict';
var nfConnectable; var nfConnectable;
@ -88,7 +88,7 @@
* @param {object} d * @param {object} d
*/ */
var getProcessGroupComments = function (d) { var getProcessGroupComments = function (d) {
if (common.isBlank(d.component.comments)) { if (nfCommon.isBlank(d.component.comments)) {
return 'No comments specified'; return 'No comments specified';
} else { } else {
return d.component.comments; return d.component.comments;
@ -123,7 +123,7 @@
'class': 'remote-process-group component' 'class': 'remote-process-group component'
}) })
.classed('selected', selected) .classed('selected', selected)
.call(canvasUtils.position); .call(nfCanvasUtils.position);
// ---- // ----
// body // body
@ -211,7 +211,7 @@
var details = remoteProcessGroup.select('g.remote-process-group-details'); var details = remoteProcessGroup.select('g.remote-process-group-details');
// update the component behavior as appropriate // update the component behavior as appropriate
canvasUtils.editable(remoteProcessGroup, nfConnectable, nfDraggable); nfCanvasUtils.editable(remoteProcessGroup, nfConnectable, nfDraggable);
// if this processor is visible, render everything // if this processor is visible, render everything
if (remoteProcessGroup.classed('visible')) { if (remoteProcessGroup.classed('visible')) {
@ -532,7 +532,7 @@
remoteProcessGroupUri.text(null).selectAll('title').remove(); remoteProcessGroupUri.text(null).selectAll('title').remove();
// apply ellipsis to the remote process group name as necessary // apply ellipsis to the remote process group name as necessary
canvasUtils.ellipsis(remoteProcessGroupUri, d.component.targetUris); nfCanvasUtils.ellipsis(remoteProcessGroupUri, d.component.targetUris);
}).append('title').text(function (d) { }).append('title').text(function (d) {
return d.component.name; return d.component.name;
}); });
@ -571,7 +571,7 @@
}); });
// add the tooltip // add the tooltip
canvasUtils.canvasTooltip(tip, d3.select(this)); nfCanvasUtils.canvasTooltip(tip, d3.select(this));
}); });
// --------------- // ---------------
@ -587,9 +587,9 @@
remoteProcessGroupComments.text(null).selectAll('tspan, title').remove(); remoteProcessGroupComments.text(null).selectAll('tspan, title').remove();
// apply ellipsis to the port name as necessary // apply ellipsis to the port name as necessary
canvasUtils.ellipsis(remoteProcessGroupComments, getProcessGroupComments(d)); nfCanvasUtils.ellipsis(remoteProcessGroupComments, getProcessGroupComments(d));
}).classed('unset', function (d) { }).classed('unset', function (d) {
return common.isBlank(d.component.comments); return nfCommon.isBlank(d.component.comments);
}).append('title').text(function (d) { }).append('title').text(function (d) {
return getProcessGroupComments(d); return getProcessGroupComments(d);
}); });
@ -600,7 +600,7 @@
details.select('text.remote-process-group-last-refresh') details.select('text.remote-process-group-last-refresh')
.text(function (d) { .text(function (d) {
if (common.isDefinedAndNotNull(d.component.flowRefreshed)) { if (nfCommon.isDefinedAndNotNull(d.component.flowRefreshed)) {
return d.component.flowRefreshed; return d.component.flowRefreshed;
} else { } else {
return 'Remote flow not current'; return 'Remote flow not current';
@ -616,7 +616,7 @@
remoteProcessGroupName.text(null).selectAll('title').remove(); remoteProcessGroupName.text(null).selectAll('title').remove();
// apply ellipsis to the remote process group name as necessary // apply ellipsis to the remote process group name as necessary
canvasUtils.ellipsis(remoteProcessGroupName, d.component.name); nfCanvasUtils.ellipsis(remoteProcessGroupName, d.component.name);
}).append('title').text(function (d) { }).append('title').text(function (d) {
return d.component.name; return d.component.name;
}); });
@ -680,13 +680,13 @@
// sent count value // sent count value
updated.select('text.remote-process-group-sent tspan.count') updated.select('text.remote-process-group-sent tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.sent, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.sent, ' ');
}); });
// sent size value // sent size value
updated.select('text.remote-process-group-sent tspan.size') updated.select('text.remote-process-group-sent tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.sent, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.sent, ' ');
}); });
// sent ports value // sent ports value
@ -704,13 +704,13 @@
// received count value // received count value
updated.select('text.remote-process-group-received tspan.count') updated.select('text.remote-process-group-received tspan.count')
.text(function (d) { .text(function (d) {
return common.substringBeforeFirst(d.status.aggregateSnapshot.received, ' '); return nfCommon.substringBeforeFirst(d.status.aggregateSnapshot.received, ' ');
}); });
// received size value // received size value
updated.select('text.remote-process-group-received tspan.size') updated.select('text.remote-process-group-received tspan.size')
.text(function (d) { .text(function (d) {
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.received, ' '); return ' ' + nfCommon.substringAfterFirst(d.status.aggregateSnapshot.received, ' ');
}); });
// -------------------- // --------------------
@ -723,7 +723,7 @@
.text(function (d) { .text(function (d) {
var icon = ''; var icon = '';
if (d.permissions.canRead) { if (d.permissions.canRead) {
if (!common.isEmpty(d.component.authorizationIssues)) { if (!nfCommon.isEmpty(d.component.authorizationIssues)) {
icon = '\uf071'; icon = '\uf071';
} else if (d.component.transmitting === true) { } else if (d.component.transmitting === true) {
icon = '\uf140'; icon = '\uf140';
@ -736,7 +736,7 @@
.attr('font-family', function (d) { .attr('font-family', function (d) {
var family = ''; var family = '';
if (d.permissions.canRead) { if (d.permissions.canRead) {
if (!common.isEmpty(d.component.authorizationIssues) || d.component.transmitting) { if (!nfCommon.isEmpty(d.component.authorizationIssues) || d.component.transmitting) {
family = 'FontAwesome'; family = 'FontAwesome';
} else { } else {
family = 'flowfont'; family = 'flowfont';
@ -745,20 +745,20 @@
return family; return family;
}) })
.classed('invalid', function (d) { .classed('invalid', function (d) {
return d.permissions.canRead && !common.isEmpty(d.component.authorizationIssues); return d.permissions.canRead && !nfCommon.isEmpty(d.component.authorizationIssues);
}) })
.classed('transmitting', function (d) { .classed('transmitting', function (d) {
return d.permissions.canRead && common.isEmpty(d.component.authorizationIssues) && d.component.transmitting === true; return d.permissions.canRead && nfCommon.isEmpty(d.component.authorizationIssues) && d.component.transmitting === true;
}) })
.classed('not-transmitting', function (d) { .classed('not-transmitting', function (d) {
return d.permissions.canRead && common.isEmpty(d.component.authorizationIssues) && d.component.transmitting === false; return d.permissions.canRead && nfCommon.isEmpty(d.component.authorizationIssues) && d.component.transmitting === false;
}) })
.each(function (d) { .each(function (d) {
// get the tip // get the tip
var tip = d3.select('#authorization-issues-' + d.id); var tip = d3.select('#authorization-issues-' + d.id);
// if there are validation errors generate a tooltip // if there are validation errors generate a tooltip
if (d.permissions.canRead && !common.isEmpty(d.component.authorizationIssues)) { if (d.permissions.canRead && !nfCommon.isEmpty(d.component.authorizationIssues)) {
// create the tip if necessary // create the tip if necessary
if (tip.empty()) { if (tip.empty()) {
tip = d3.select('#remote-process-group-tooltips').append('div') tip = d3.select('#remote-process-group-tooltips').append('div')
@ -770,7 +770,7 @@
// update the tip // update the tip
tip.html(function () { tip.html(function () {
var list = common.formatUnorderedList(d.component.authorizationIssues); var list = nfCommon.formatUnorderedList(d.component.authorizationIssues);
if (list === null || list.length === 0) { if (list === null || list.length === 0) {
return ''; return '';
} else { } else {
@ -779,7 +779,7 @@
}); });
// add the tooltip // add the tooltip
canvasUtils.canvasTooltip(tip, d3.select(this)); nfCanvasUtils.canvasTooltip(tip, d3.select(this));
} else { } else {
if (!tip.empty()) { if (!tip.empty()) {
tip.remove(); tip.remove();
@ -795,7 +795,7 @@
// active thread count // active thread count
// ------------------- // -------------------
canvasUtils.activeThreadCount(remoteProcessGroup, d, function (off) { nfCanvasUtils.activeThreadCount(remoteProcessGroup, d, function (off) {
offset = off; offset = off;
}); });
@ -804,10 +804,10 @@
// --------- // ---------
remoteProcessGroup.select('rect.bulletin-background').classed('has-bulletins', function () { remoteProcessGroup.select('rect.bulletin-background').classed('has-bulletins', function () {
return !common.isEmpty(d.status.aggregateSnapshot.bulletins); return !nfCommon.isEmpty(d.status.aggregateSnapshot.bulletins);
}); });
canvasUtils.bulletins(remoteProcessGroup, d, function () { nfCanvasUtils.bulletins(remoteProcessGroup, d, function () {
return d3.select('#remote-process-group-tooltips'); return d3.select('#remote-process-group-tooltips');
}, offset); }, offset);
}); });
@ -843,12 +843,17 @@
var nfRemoteProcessGroup = { var nfRemoteProcessGroup = {
/** /**
* Initializes of the Process Group handler. * 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) { init: function (nfConnectableRef, nfDraggableRef, nfSelectableRef, nfContextMenuRef) {
nfConnectable = connectable; nfConnectable = nfConnectableRef;
nfDraggable = draggable; nfDraggable = nfDraggableRef;
nfSelectable = selectable; nfSelectable = nfSelectableRef;
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
remoteProcessGroupMap = d3.map(); remoteProcessGroupMap = d3.map();
removedCache = d3.map(); removedCache = d3.map();
@ -870,8 +875,8 @@
*/ */
add: function (remoteProcessGroupEntities, options) { add: function (remoteProcessGroupEntities, options) {
var selectAll = false; var selectAll = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
} }
// get the current time // get the current time
@ -892,7 +897,7 @@
$.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) { $.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) {
add(remoteProcessGroupEntity); add(remoteProcessGroupEntity);
}); });
} else if (common.isDefinedAndNotNull(remoteProcessGroupEntities)) { } else if (nfCommon.isDefinedAndNotNull(remoteProcessGroupEntities)) {
add(remoteProcessGroupEntities); add(remoteProcessGroupEntities);
} }
@ -911,16 +916,16 @@
set: function (remoteProcessGroupEntities, options) { set: function (remoteProcessGroupEntities, options) {
var selectAll = false; var selectAll = false;
var transition = false; var transition = false;
if (common.isDefinedAndNotNull(options)) { if (nfCommon.isDefinedAndNotNull(options)) {
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll; selectAll = nfCommon.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition; transition = nfCommon.isDefinedAndNotNull(options.transition) ? options.transition : transition;
} }
var set = function (proposedRemoteProcessGroupEntity) { var set = function (proposedRemoteProcessGroupEntity) {
var currentRemoteProcessGroupEntity = remoteProcessGroupMap.get(proposedRemoteProcessGroupEntity.id); var currentRemoteProcessGroupEntity = remoteProcessGroupMap.get(proposedRemoteProcessGroupEntity.id);
// set the remote process group if appropriate due to revision and wasn't previously removed // set the remote process group if appropriate due to revision and wasn't previously removed
if (client.isNewerRevision(currentRemoteProcessGroupEntity, proposedRemoteProcessGroupEntity) && !removedCache.has(proposedRemoteProcessGroupEntity.id)) { if (nfClient.isNewerRevision(currentRemoteProcessGroupEntity, proposedRemoteProcessGroupEntity) && !removedCache.has(proposedRemoteProcessGroupEntity.id)) {
remoteProcessGroupMap.set(proposedRemoteProcessGroupEntity.id, $.extend({ remoteProcessGroupMap.set(proposedRemoteProcessGroupEntity.id, $.extend({
type: 'RemoteProcessGroup', type: 'RemoteProcessGroup',
dimensions: dimensions dimensions: dimensions
@ -944,14 +949,14 @@
$.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) { $.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) {
set(remoteProcessGroupEntity); set(remoteProcessGroupEntity);
}); });
} else if (common.isDefinedAndNotNull(remoteProcessGroupEntities)) { } else if (nfCommon.isDefinedAndNotNull(remoteProcessGroupEntities)) {
set(remoteProcessGroupEntities); set(remoteProcessGroupEntities);
} }
// apply the selection and handle all new remote process groups // apply the selection and handle all new remote process groups
var selection = select(); var selection = select();
selection.enter().call(renderRemoteProcessGroups, selectAll); selection.enter().call(renderRemoteProcessGroups, selectAll);
selection.call(updateRemoteProcessGroups).call(canvasUtils.position, transition); selection.call(updateRemoteProcessGroups).call(nfCanvasUtils.position, transition);
selection.exit().call(removeRemoteProcessGroups); selection.exit().call(removeRemoteProcessGroups);
}, },
@ -962,7 +967,7 @@
* @param {string} id * @param {string} id
*/ */
get: function (id) { get: function (id) {
if (common.isUndefined(id)) { if (nfCommon.isUndefined(id)) {
return remoteProcessGroupMap.values(); return remoteProcessGroupMap.values();
} else { } else {
return remoteProcessGroupMap.get(id); return remoteProcessGroupMap.get(id);
@ -976,7 +981,7 @@
* @param {string} id Optional * @param {string} id Optional
*/ */
refresh: function (id) { refresh: function (id) {
if (common.isDefinedAndNotNull(id)) { if (nfCommon.isDefinedAndNotNull(id)) {
d3.select('#id-' + id).call(updateRemoteProcessGroups); d3.select('#id-' + id).call(updateRemoteProcessGroups);
} else { } else {
d3.selectAll('g.remote-process-group').call(updateRemoteProcessGroups); d3.selectAll('g.remote-process-group').call(updateRemoteProcessGroups);
@ -1007,10 +1012,10 @@
nfRemoteProcessGroup.set(response); nfRemoteProcessGroup.set(response);
// reload the group's connections // reload the group's connections
var connections = connection.getComponentConnections(id); var connections = nfConnection.getComponentConnections(id);
$.each(connections, function (_, connection) { $.each(connections, function (_, connection) {
if (connection.permissions.canRead) { if (connection.permissions.canRead) {
connection.reload(connection.id); nfConnection.reload(connection.id);
} }
}); });
}); });
@ -1023,7 +1028,7 @@
* @param {string} id The id * @param {string} id The id
*/ */
position: function (id) { position: function (id) {
d3.select('#id-' + id).call(canvasUtils.position); d3.select('#id-' + id).call(nfCanvasUtils.position);
}, },
/** /**

View File

@ -28,8 +28,8 @@
'nf.ControllerServices', 'nf.ControllerServices',
'nf.UniversalCapture', 'nf.UniversalCapture',
'nf.CustomUi'], 'nf.CustomUi'],
function ($, errorHandler, common, dialog, client, controllerService, controllerServices, universalCapture, customUi) { function ($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerService, nfControllerServices, nfUniversalCapture, nfCustomUi) {
return (nf.ReportingTask = factory($, errorHandler, common, dialog, client, controllerService, controllerServices, universalCapture, customUi)); return (nf.ReportingTask = factory($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerService, nfControllerServices, nfUniversalCapture, nfCustomUi));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ReportingTask = module.exports = (nf.ReportingTask =
@ -53,7 +53,7 @@
root.nf.UniversalCapture, root.nf.UniversalCapture,
root.nf.CustomUi); root.nf.CustomUi);
} }
}(this, function ($, errorHandler, common, dialog, client, controllerService, controllerServices, universalCapture, customUi) { }(this, function ($, nfErrorHandler, nfCommon, nfDialog, nfClient, nfControllerService, nfControllerServices, nfUniversalCapture, nfCustomUi) {
'use strict'; 'use strict';
var nfSettings; var nfSettings;
@ -93,15 +93,15 @@
if (errors.length === 1) { if (errors.length === 1) {
content = $('<span></span>').text(errors[0]); content = $('<span></span>').text(errors[0]);
} else { } else {
content = common.formatUnorderedList(errors); content = nfCommon.formatUnorderedList(errors);
} }
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: content, dialogContent: content,
headerText: 'Reporting Task' headerText: 'Reporting Task'
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}; };
@ -141,7 +141,7 @@
} }
// check the scheduling period // check the scheduling period
if (common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (entity.component['schedulingPeriod'] + '')) { if (nfCommon.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (entity.component['schedulingPeriod'] + '')) {
return true; return true;
} }
@ -204,13 +204,13 @@
var errors = []; var errors = [];
var reportingTask = details['component']; var reportingTask = details['component'];
if (common.isBlank(reportingTask['schedulingPeriod'])) { if (nfCommon.isBlank(reportingTask['schedulingPeriod'])) {
errors.push('Run schedule must be specified'); errors.push('Run schedule must be specified');
} }
if (errors.length > 0) { if (errors.length > 0) {
dialog.showOkDialog({ nfDialog.showOkDialog({
dialogContent: common.formatUnorderedList(errors), dialogContent: nfCommon.formatUnorderedList(errors),
headerText: 'Reporting Task' headerText: 'Reporting Task'
}); });
return false; return false;
@ -241,7 +241,7 @@
*/ */
var setRunning = function (reportingTaskEntity, running) { var setRunning = function (reportingTaskEntity, running) {
var entity = { var entity = {
'revision': client.getRevision(reportingTaskEntity), 'revision': nfClient.getRevision(reportingTaskEntity),
'component': { 'component': {
'id': reportingTaskEntity.id, 'id': reportingTaskEntity.id,
'state': running === true ? 'RUNNING' : 'STOPPED' 'state': running === true ? 'RUNNING' : 'STOPPED'
@ -257,8 +257,8 @@
}).done(function (response) { }).done(function (response) {
// update the task // update the task
renderReportingTask(response); renderReportingTask(response);
controllerService.reloadReferencedServices(getControllerServicesTable(), response.component); nfControllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -272,7 +272,7 @@
// determine if changes have been made // determine if changes have been made
if (isSaveRequired()) { if (isSaveRequired()) {
// see if those changes should be saved // see if those changes should be saved
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Save', headerText: 'Save',
dialogContent: 'Save changes before going to this Controller Service?', dialogContent: 'Save changes before going to this Controller Service?',
noHandler: function () { noHandler: function () {
@ -304,7 +304,7 @@
// ensure details are valid as far as we can tell // ensure details are valid as far as we can tell
if (validateDetails(updatedReportingTask)) { if (validateDetails(updatedReportingTask)) {
updatedReportingTask['revision'] = client.getRevision(reportingTaskEntity); updatedReportingTask['revision'] = nfClient.getRevision(reportingTaskEntity);
// update the selected component // update the selected component
return $.ajax({ return $.ajax({
@ -338,15 +338,17 @@
propertyName: propertyName propertyName: propertyName
}, },
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var nfReportingTask = { var nfReportingTask = {
/** /**
* Initializes the reporting task configuration dialog. * Initializes the reporting task configuration dialog.
*
* @param nfSettingsRef The nfSettings module.
*/ */
init: function (settings) { init: function (nfSettingsRef) {
nfSettings = settings; nfSettings = nfSettingsRef;
// initialize the configuration dialog tabs // initialize the configuration dialog tabs
$('#reporting-task-configuration-tabs').tabbs({ $('#reporting-task-configuration-tabs').tabbs({
@ -365,7 +367,7 @@
}], }],
select: function () { select: function () {
// remove all property detail dialogs // remove all property detail dialogs
universalCapture.removeAllPropertyDetailDialogs(); nfUniversalCapture.removeAllPropertyDetailDialogs();
// update the property table size in case this is the first time its rendered // update the property table size in case this is the first time its rendered
if ($(this).text() === 'Properties') { if ($(this).text() === 'Properties') {
@ -390,13 +392,13 @@
$('#reporting-task-properties').propertytable('clear'); $('#reporting-task-properties').propertytable('clear');
// clear the comments // clear the comments
common.clearField('read-only-reporting-task-comments'); nfCommon.clearField('read-only-reporting-task-comments');
// removed the cached reporting task details // removed the cached reporting task details
$('#reporting-task-configuration').removeData('reportingTaskDetails'); $('#reporting-task-configuration').removeData('reportingTaskDetails');
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -408,7 +410,7 @@
dialogContainer: '#new-reporting-task-property-container', dialogContainer: '#new-reporting-task-property-container',
descriptorDeferred: getReportingTaskPropertyDescriptor, descriptorDeferred: getReportingTaskPropertyDescriptor,
controllerServiceCreatedDeferred: function (response) { controllerServiceCreatedDeferred: function (response) {
return controllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table')); return nfControllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table'));
}, },
goToServiceDeferred: goToServiceFromProperty goToServiceDeferred: goToServiceFromProperty
}); });
@ -433,7 +435,7 @@
dialogContainer: '#new-reporting-task-property-container', dialogContainer: '#new-reporting-task-property-container',
descriptorDeferred: getReportingTaskPropertyDescriptor, descriptorDeferred: getReportingTaskPropertyDescriptor,
controllerServiceCreatedDeferred: function (response) { controllerServiceCreatedDeferred: function (response) {
return controllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table')); return nfControllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table'));
}, },
goToServiceDeferred: goToServiceFromProperty goToServiceDeferred: goToServiceFromProperty
}); });
@ -475,8 +477,8 @@
} }
// populate the reporting task settings // populate the reporting task settings
common.populateField('reporting-task-id', reportingTask['id']); nfCommon.populateField('reporting-task-id', reportingTask['id']);
common.populateField('reporting-task-type', common.substringAfterLast(reportingTask['type'], '.')); nfCommon.populateField('reporting-task-type', nfCommon.substringAfterLast(reportingTask['type'], '.'));
$('#reporting-task-name').val(reportingTask['name']); $('#reporting-task-name').val(reportingTask['name']);
$('#reporting-task-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(reportingTaskEnableStyle); $('#reporting-task-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(reportingTaskEnableStyle);
$('#reporting-task-comments').val(reportingTask['comments']); $('#reporting-task-comments').val(reportingTask['comments']);
@ -533,7 +535,7 @@
// save the reporting task // save the reporting task
saveReportingTask(reportingTaskEntity).done(function (response) { saveReportingTask(reportingTaskEntity).done(function (response) {
// reload the reporting task // reload the reporting task
controllerService.reloadReferencedServices(getControllerServicesTable(), response.component); nfControllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
// close the details panel // close the details panel
$('#reporting-task-configuration').modal('hide'); $('#reporting-task-configuration').modal('hide');
@ -556,7 +558,7 @@
}]; }];
// determine if we should show the advanced button // determine if we should show the advanced button
if (common.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') { if (nfCommon.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') {
buttons.push({ buttons.push({
buttonText: 'Advanced', buttonText: 'Advanced',
clazz: 'fa fa-cog button-icon', clazz: 'fa fa-cog button-icon',
@ -575,10 +577,10 @@
$('#shell-close-button').click(); $('#shell-close-button').click();
// show the custom ui // show the custom ui
customUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, true).done(function () { nfCustomUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, true).done(function () {
// once the custom ui is closed, reload the reporting task // once the custom ui is closed, reload the reporting task
nfReportingTask.reload(reportingTaskEntity.id).done(function (response) { nfReportingTask.reload(reportingTaskEntity.id).done(function (response) {
controllerService.reloadReferencedServices(getControllerServicesTable(), response.reportingTask); nfControllerService.reloadReferencedServices(getControllerServicesTable(), response.reportingTask);
}); });
// show the settings // show the settings
@ -592,7 +594,7 @@
// determine if changes have been made // determine if changes have been made
if (isSaveRequired()) { if (isSaveRequired()) {
// see if those changes should be saved // see if those changes should be saved
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Save', headerText: 'Save',
dialogContent: 'Save changes before opening the advanced configuration?', dialogContent: 'Save changes before opening the advanced configuration?',
noHandler: openCustomUi, noHandler: openCustomUi,
@ -624,7 +626,7 @@
$('#reporting-task-configuration').modal('show'); $('#reporting-task-configuration').modal('show');
$('#reporting-task-properties').propertytable('resetTableSize'); $('#reporting-task-properties').propertytable('resetTableSize');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -673,10 +675,10 @@
var reportingTaskHistory = historyResponse[0].componentHistory; var reportingTaskHistory = historyResponse[0].componentHistory;
// populate the reporting task settings // populate the reporting task settings
common.populateField('reporting-task-id', reportingTask['id']); nfCommon.populateField('reporting-task-id', reportingTask['id']);
common.populateField('reporting-task-type', common.substringAfterLast(reportingTask['type'], '.')); nfCommon.populateField('reporting-task-type', nfCommon.substringAfterLast(reportingTask['type'], '.'));
common.populateField('read-only-reporting-task-name', reportingTask['name']); nfCommon.populateField('read-only-reporting-task-name', reportingTask['name']);
common.populateField('read-only-reporting-task-comments', reportingTask['comments']); nfCommon.populateField('read-only-reporting-task-comments', reportingTask['comments']);
// make the scheduling strategy human readable // make the scheduling strategy human readable
var schedulingStrategy = reportingTask['schedulingStrategy']; var schedulingStrategy = reportingTask['schedulingStrategy'];
@ -685,8 +687,8 @@
} else { } else {
schedulingStrategy = "Timer driven"; schedulingStrategy = "Timer driven";
} }
common.populateField('read-only-reporting-task-scheduling-strategy', schedulingStrategy); nfCommon.populateField('read-only-reporting-task-scheduling-strategy', schedulingStrategy);
common.populateField('read-only-reporting-task-scheduling-period', reportingTask['schedulingPeriod']); nfCommon.populateField('read-only-reporting-task-scheduling-period', reportingTask['schedulingPeriod']);
var buttons = [{ var buttons = [{
buttonText: 'Ok', buttonText: 'Ok',
@ -704,7 +706,7 @@
}]; }];
// determine if we should show the advanced button // determine if we should show the advanced button
if (common.isDefinedAndNotNull(customUi) && common.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') { if (nfCommon.isDefinedAndNotNull(nfCustomUi) && nfCommon.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') {
buttons.push({ buttons.push({
buttonText: 'Advanced', buttonText: 'Advanced',
clazz: 'fa fa-cog button-icon', clazz: 'fa fa-cog button-icon',
@ -722,7 +724,7 @@
$('#shell-close-button').click(); $('#shell-close-button').click();
// show the custom ui // show the custom ui
customUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, false).done(function () { nfCustomUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, false).done(function () {
nfSettings.showSettings(); nfSettings.showSettings();
}); });
} }
@ -777,7 +779,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
renderReportingTask(response); renderReportingTask(response);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -787,9 +789,9 @@
*/ */
promptToDeleteReportingTask: function (reportingTaskEntity) { promptToDeleteReportingTask: function (reportingTaskEntity) {
// prompt for deletion // prompt for deletion
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Delete Reporting Task', headerText: 'Delete Reporting Task',
dialogContent: 'Delete reporting task \'' + common.escapeHtml(reportingTaskEntity.component.name) + '\'?', dialogContent: 'Delete reporting task \'' + nfCommon.escapeHtml(reportingTaskEntity.component.name) + '\'?',
yesHandler: function () { yesHandler: function () {
nfReportingTask.remove(reportingTaskEntity); nfReportingTask.remove(reportingTaskEntity);
} }
@ -804,7 +806,7 @@
remove: function (reportingTaskEntity) { remove: function (reportingTaskEntity) {
// prompt for removal? // prompt for removal?
var revision = client.getRevision(reportingTaskEntity); var revision = nfClient.getRevision(reportingTaskEntity);
$.ajax({ $.ajax({
type: 'DELETE', type: 'DELETE',
url: reportingTaskEntity.uri + '?' + $.param({ url: reportingTaskEntity.uri + '?' + $.param({
@ -817,7 +819,7 @@
var reportingTaskGrid = $('#reporting-tasks-table').data('gridInstance'); var reportingTaskGrid = $('#reporting-tasks-table').data('gridInstance');
var reportingTaskData = reportingTaskGrid.getData(); var reportingTaskData = reportingTaskGrid.getData();
reportingTaskData.deleteItem(reportingTaskEntity.id); reportingTaskData.deleteItem(reportingTaskEntity.id);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };

View File

@ -22,8 +22,8 @@
define(['d3', define(['d3',
'nf.ng.Bridge', 'nf.ng.Bridge',
'nf.ContextMenu'], 'nf.ContextMenu'],
function (d3, angularBridge, contextMenu) { function (d3, nfNgBridge, nfContextMenu) {
return (nf.Selectable = factory(d3, angularBridge, contextMenu)); return (nf.Selectable = factory(d3, nfNgBridge, nfContextMenu));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Selectable = module.exports = (nf.Selectable =
@ -35,14 +35,14 @@
root.nf.ng.Bridge, root.nf.ng.Bridge,
root.nf.ContextMenu); root.nf.ContextMenu);
} }
}(this, function (d3, angularBridge, contextMenu) { }(this, function (d3, nfNgBridge, nfContextMenu) {
'use strict'; 'use strict';
var nfSelectable = { var nfSelectable = {
select: function (g) { select: function (g) {
// hide any context menus as necessary // hide any context menus as necessary
contextMenu.hide(); nfContextMenu.hide();
// only need to update selection if necessary // only need to update selection if necessary
if (!g.classed('selected')) { if (!g.classed('selected')) {
@ -62,7 +62,7 @@
// inform Angular app that values have changed since the // inform Angular app that values have changed since the
// enabled operate palette buttons are based off of the selection // enabled operate palette buttons are based off of the selection
angularBridge.digest(); nfNgBridge.digest();
// stop propagation // stop propagation
d3.event.stopPropagation(); d3.event.stopPropagation();

View File

@ -32,8 +32,8 @@
'nf.Shell', 'nf.Shell',
'nf.ComponentState', 'nf.ComponentState',
'nf.PolicyManagement'], 'nf.PolicyManagement'],
function ($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement) { function ($, Slick, d3, nfClient, nfDialog, nfCommon, nfCanvasUtils, nfControllerServices, nfErrorHandler, nfReportingTask, nfShell, nfComponentState, nfPolicyManagement) {
return (nf.Settings = factory($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement)); return (nf.Settings = factory($, Slick, d3, nfClient, nfDialog, nfCommon, nfCanvasUtils, nfControllerServices, nfErrorHandler, nfReportingTask, nfShell, nfComponentState, nfPolicyManagement));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Settings = module.exports = (nf.Settings =
@ -65,7 +65,7 @@
root.nf.ComponentState, root.nf.ComponentState,
root.nf.PolicyManagement); root.nf.PolicyManagement);
} }
}(this, function ($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement) { }(this, function ($, Slick, d3, nfClient, nfDialog, nfCommon, nfCanvasUtils, nfControllerServices, nfErrorHandler, nfReportingTask, nfShell, nfComponentState, nfPolicyManagement) {
'use strict'; 'use strict';
@ -107,7 +107,7 @@
// marshal the configuration details // marshal the configuration details
var configuration = marshalConfiguration(); var configuration = marshalConfiguration();
var entity = { var entity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': version 'version': version
} }
@ -124,7 +124,7 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
// close the settings dialog // close the settings dialog
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Settings', headerText: 'Settings',
dialogContent: 'Settings successfully applied.' dialogContent: 'Settings successfully applied.'
}); });
@ -133,7 +133,7 @@
$('#settings-save').off('click').on('click', function () { $('#settings-save').off('click').on('click', function () {
saveSettings(response.revision.version); saveSettings(response.revision.version);
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
/** /**
@ -211,7 +211,7 @@
* @param item reporting task type * @param item reporting task type
*/ */
var isSelectable = function (item) { var isSelectable = function (item) {
return common.isBlank(item.usageRestriction) || common.canAccessRestrictedComponents(); return nfCommon.isBlank(item.usageRestriction) || nfCommon.canAccessRestrictedComponents();
}; };
/** /**
@ -247,7 +247,7 @@
return ''; return '';
} }
return common.substringAfterLast(dataContext.component.type, '.'); return nfCommon.substringAfterLast(dataContext.component.type, '.');
}; };
/** /**
@ -262,31 +262,31 @@
if (a.permissions.canRead && b.permissions.canRead) { if (a.permissions.canRead && b.permissions.canRead) {
if (sortDetails.columnId === 'moreDetails') { if (sortDetails.columnId === 'moreDetails') {
var aBulletins = 0; var aBulletins = 0;
if (!common.isEmpty(a.bulletins)) { if (!nfCommon.isEmpty(a.bulletins)) {
aBulletins = a.bulletins.length; aBulletins = a.bulletins.length;
} }
var bBulletins = 0; var bBulletins = 0;
if (!common.isEmpty(b.bulletins)) { if (!nfCommon.isEmpty(b.bulletins)) {
bBulletins = b.bulletins.length; bBulletins = b.bulletins.length;
} }
return aBulletins - bBulletins; return aBulletins - bBulletins;
} else if (sortDetails.columnId === 'type') { } else if (sortDetails.columnId === 'type') {
var aType = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? common.substringAfterLast(a.component[sortDetails.columnId], '.') : ''; var aType = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? nfCommon.substringAfterLast(a.component[sortDetails.columnId], '.') : '';
var bType = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? common.substringAfterLast(b.component[sortDetails.columnId], '.') : ''; var bType = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? nfCommon.substringAfterLast(b.component[sortDetails.columnId], '.') : '';
return aType === bType ? 0 : aType > bType ? 1 : -1; return aType === bType ? 0 : aType > bType ? 1 : -1;
} else if (sortDetails.columnId === 'state') { } else if (sortDetails.columnId === 'state') {
var aState = 'Invalid'; var aState = 'Invalid';
if (common.isEmpty(a.component.validationErrors)) { if (nfCommon.isEmpty(a.component.validationErrors)) {
aState = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; aState = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
} }
var bState = 'Invalid'; var bState = 'Invalid';
if (common.isEmpty(b.component.validationErrors)) { if (nfCommon.isEmpty(b.component.validationErrors)) {
bState = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; bState = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
} }
return aState === bState ? 0 : aState > bState ? 1 : -1; return aState === bState ? 0 : aState > bState ? 1 : -1;
} else { } else {
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} }
} else { } else {
@ -322,7 +322,7 @@
var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance'); var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(reportingTaskTypesGrid)) { if (nfCommon.isDefinedAndNotNull(reportingTaskTypesGrid)) {
var reportingTaskTypesData = reportingTaskTypesGrid.getData(); var reportingTaskTypesData = reportingTaskTypesGrid.getData();
// update the search criteria // update the search criteria
@ -404,7 +404,7 @@
// ensure something was selected // ensure something was selected
if (selectedTaskType === '') { if (selectedTaskType === '') {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Settings', headerText: 'Settings',
dialogContent: 'The type of reporting task to create must be selected.' dialogContent: 'The type of reporting task to create must be selected.'
}); });
@ -421,7 +421,7 @@
var addReportingTask = function (reportingTaskType) { var addReportingTask = function (reportingTaskType) {
// build the reporting task entity // build the reporting task entity
var reportingTaskEntity = { var reportingTaskEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -452,7 +452,7 @@
var row = reportingTaskData.getRowById(reportingTaskEntity.id); var row = reportingTaskData.getRowById(reportingTaskEntity.id);
reportingTaskGrid.setSelectedRows([row]); reportingTaskGrid.setSelectedRows([row]);
reportingTaskGrid.scrollRowIntoView(row); reportingTaskGrid.scrollRowIntoView(row);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// hide the dialog // hide the dialog
$('#new-reporting-task-dialog').modal('hide'); $('#new-reporting-task-dialog').modal('hide');
@ -490,7 +490,7 @@
id: 'type', id: 'type',
name: 'Type', name: 'Type',
field: 'label', field: 'label',
formatter: common.typeFormatter, formatter: nfCommon.typeFormatter,
sortable: false, sortable: false,
resizable: true resizable: true
}, },
@ -524,11 +524,11 @@
var reportingTaskType = reportingTaskTypesGrid.getDataItem(reportingTaskTypeIndex); var reportingTaskType = reportingTaskTypesGrid.getDataItem(reportingTaskTypeIndex);
// set the reporting task type description // set the reporting task type description
if (common.isDefinedAndNotNull(reportingTaskType)) { if (nfCommon.isDefinedAndNotNull(reportingTaskType)) {
// show the selected reporting task // show the selected reporting task
$('#reporting-task-description-container').show(); $('#reporting-task-description-container').show();
if (common.isBlank(reportingTaskType.description)) { if (nfCommon.isBlank(reportingTaskType.description)) {
$('#reporting-task-type-description') $('#reporting-task-type-description')
.attr('title', '') .attr('title', '')
.html('<span class="unset">No description specified</span>'); .html('<span class="unset">No description specified</span>');
@ -557,7 +557,7 @@
} }
}); });
reportingTaskTypesGrid.onViewportChanged.subscribe(function (e, args) { reportingTaskTypesGrid.onViewportChanged.subscribe(function (e, args) {
common.cleanUpTooltips($('#reporting-task-types-table'), 'div.view-usage-restriction'); nfCommon.cleanUpTooltips($('#reporting-task-types-table'), 'div.view-usage-restriction');
}); });
// wire up the dataview to the grid // wire up the dataview to the grid
@ -584,8 +584,8 @@
var item = reportingTaskTypesData.getItemById(rowId); var item = reportingTaskTypesData.getItemById(rowId);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(item.usageRestriction)) { if (nfCommon.isDefinedAndNotNull(item.usageRestriction)) {
usageRestriction.qtip($.extend({}, common.config.tooltipConfig, { usageRestriction.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: item.usageRestriction, content: item.usageRestriction,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -618,10 +618,10 @@
// add the documented type // add the documented type
reportingTaskTypesData.addItem({ reportingTaskTypesData.addItem({
id: id++, id: id++,
label: common.substringAfterLast(documentedType.type, '.'), label: nfCommon.substringAfterLast(documentedType.type, '.'),
type: documentedType.type, type: documentedType.type,
description: common.escapeHtml(documentedType.description), description: nfCommon.escapeHtml(documentedType.description),
usageRestriction: common.escapeHtml(documentedType.usageRestriction), usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction),
tags: documentedType.tags.join(', ') tags: documentedType.tags.join(', ')
}); });
@ -643,7 +643,7 @@
select: applyReportingTaskTypeFilter, select: applyReportingTaskTypeFilter,
remove: applyReportingTaskTypeFilter remove: applyReportingTaskTypeFilter
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// initialize the reporting task dialog // initialize the reporting task dialog
$('#new-reporting-task-dialog').modal({ $('#new-reporting-task-dialog').modal({
@ -732,8 +732,8 @@
// always include a button to view the usage // always include a button to view the usage
markup += '<div title="Usage" class="pointer reporting-task-usage fa fa-book"></div>'; markup += '<div title="Usage" class="pointer reporting-task-usage fa fa-book"></div>';
var hasErrors = !common.isEmpty(dataContext.component.validationErrors); var hasErrors = !nfCommon.isEmpty(dataContext.component.validationErrors);
var hasBulletins = !common.isEmpty(dataContext.bulletins); var hasBulletins = !nfCommon.isEmpty(dataContext.bulletins);
if (hasErrors) { if (hasErrors) {
markup += '<div class="pointer has-errors fa fa-warning" ></div>'; markup += '<div class="pointer has-errors fa fa-warning" ></div>';
@ -744,7 +744,7 @@
} }
if (hasErrors || hasBulletins) { if (hasErrors || hasBulletins) {
markup += '<span class="hidden row-id">' + common.escapeHtml(dataContext.component.id) + '</span>'; markup += '<span class="hidden row-id">' + nfCommon.escapeHtml(dataContext.component.id) + '</span>';
} }
return markup; return markup;
@ -757,7 +757,7 @@
// determine the appropriate label // determine the appropriate label
var icon = '', label = ''; var icon = '', label = '';
if (!common.isEmpty(dataContext.component.validationErrors)) { if (!nfCommon.isEmpty(dataContext.component.validationErrors)) {
label = 'Invalid'; label = 'Invalid';
icon = 'invalid fa fa-warning'; icon = 'invalid fa fa-warning';
} else { } else {
@ -775,13 +775,13 @@
// include the active thread count if appropriate // include the active thread count if appropriate
var activeThreadCount = ''; var activeThreadCount = '';
if (common.isDefinedAndNotNull(dataContext.component.activeThreadCount) && dataContext.component.activeThreadCount > 0) { if (nfCommon.isDefinedAndNotNull(dataContext.component.activeThreadCount) && dataContext.component.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.component.activeThreadCount + ')'; activeThreadCount = '(' + dataContext.component.activeThreadCount + ')';
} }
// format the markup // format the markup
var formattedValue = '<div layout="row"><div class="' + icon + '" style="margin-top: 3px;"></div>'; var formattedValue = '<div layout="row"><div class="' + icon + '" style="margin-top: 3px;"></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + common.escapeHtml(label) + '</div><div style="float: left; margin-left: 4px;">' + common.escapeHtml(activeThreadCount) + '</div></div>'; return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + nfCommon.escapeHtml(label) + '</div><div style="float: left; margin-left: 4px;">' + nfCommon.escapeHtml(activeThreadCount) + '</div></div>';
}; };
var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) { var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) {
@ -794,7 +794,7 @@
markup += '<div title="Edit" class="pointer edit-reporting-task fa fa-pencil" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div title="Edit" class="pointer edit-reporting-task fa fa-pencil" style="margin-top: 2px; margin-right: 3px;" ></div>';
// support starting when stopped and no validation errors // support starting when stopped and no validation errors
if (dataContext.component.state === 'STOPPED' && common.isEmpty(dataContext.component.validationErrors)) { if (dataContext.component.state === 'STOPPED' && nfCommon.isEmpty(dataContext.component.validationErrors)) {
markup += '<div title="Start" class="pointer start-reporting-task fa fa-play" style="margin-top: 2px; margin-right: 3px;"></div>'; markup += '<div title="Start" class="pointer start-reporting-task fa fa-play" style="margin-top: 2px; margin-right: 3px;"></div>';
} }
} }
@ -804,12 +804,12 @@
} }
} }
if (dataContext.permissions.canWrite && common.canModifyController()) { if (dataContext.permissions.canWrite && nfCommon.canModifyController()) {
markup += '<div title="Remove" class="pointer delete-reporting-task fa fa-trash" style="margin-top: 2px; margin-right: 3px;" ></div>'; markup += '<div title="Remove" class="pointer delete-reporting-task fa fa-trash" style="margin-top: 2px; margin-right: 3px;" ></div>';
} }
// allow policy configuration conditionally // allow policy configuration conditionally
if (canvasUtils.isConfigurableAuthorizer() && common.canAccessTenants()) { if (nfCanvasUtils.isConfigurableAuthorizer() && nfCommon.canAccessTenants()) {
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>'; markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
} }
@ -884,33 +884,33 @@
// determine the desired action // determine the desired action
if (reportingTasksGrid.getColumns()[args.cell].id === 'actions') { if (reportingTasksGrid.getColumns()[args.cell].id === 'actions') {
if (target.hasClass('edit-reporting-task')) { if (target.hasClass('edit-reporting-task')) {
reportingTask.showConfiguration(reportingTaskEntity); nfReportingTask.showConfiguration(reportingTaskEntity);
} else if (target.hasClass('start-reporting-task')) { } else if (target.hasClass('start-reporting-task')) {
reportingTask.start(reportingTaskEntity); nfReportingTask.start(reportingTaskEntity);
} else if (target.hasClass('stop-reporting-task')) { } else if (target.hasClass('stop-reporting-task')) {
reportingTask.stop(reportingTaskEntity); nfReportingTask.stop(reportingTaskEntity);
} else if (target.hasClass('delete-reporting-task')) { } else if (target.hasClass('delete-reporting-task')) {
reportingTask.promptToDeleteReportingTask(reportingTaskEntity); nfReportingTask.promptToDeleteReportingTask(reportingTaskEntity);
} else if (target.hasClass('view-state-reporting-task')) { } else if (target.hasClass('view-state-reporting-task')) {
var canClear = reportingTaskEntity.component.state === 'STOPPED' && reportingTaskEntity.component.activeThreadCount === 0; var canClear = reportingTaskEntity.component.state === 'STOPPED' && reportingTaskEntity.component.activeThreadCount === 0;
componentState.showState(reportingTaskEntity, canClear); nfComponentState.showState(reportingTaskEntity, canClear);
} else if (target.hasClass('edit-access-policies')) { } else if (target.hasClass('edit-access-policies')) {
// show the policies for this service // show the policies for this service
policyManagement.showReportingTaskPolicy(reportingTaskEntity); nfPolicyManagement.showReportingTaskPolicy(reportingTaskEntity);
// close the settings dialog // close the settings dialog
$('#shell-close-button').click(); $('#shell-close-button').click();
} }
} else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') { } else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') {
if (target.hasClass('view-reporting-task')) { if (target.hasClass('view-reporting-task')) {
reportingTask.showDetails(reportingTaskEntity); nfReportingTask.showDetails(reportingTaskEntity);
} else if (target.hasClass('reporting-task-usage')) { } else if (target.hasClass('reporting-task-usage')) {
// close the settings dialog // close the settings dialog
$('#shell-close-button').click(); $('#shell-close-button').click();
// open the documentation for this reporting task // open the documentation for this reporting task
shell.showPage('../nifi-docs/documentation?' + $.param({ nfShell.showPage('../nifi-docs/documentation?' + $.param({
select: common.substringAfterLast(reportingTaskEntity.component.type, '.') select: nfCommon.substringAfterLast(reportingTaskEntity.component.type, '.')
})).done(function () { })).done(function () {
nfSettings.showSettings(); nfSettings.showSettings();
}); });
@ -939,12 +939,12 @@
var reportingTaskEntity = reportingTasksData.getItemById(taskId); var reportingTaskEntity = reportingTasksData.getItemById(taskId);
// format the errors // format the errors
var tooltip = common.formatUnorderedList(reportingTaskEntity.component.validationErrors); var tooltip = nfCommon.formatUnorderedList(reportingTaskEntity.component.validationErrors);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
errorIcon.qtip($.extend({}, errorIcon.qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: tooltip, content: tooltip,
position: { position: {
@ -968,13 +968,13 @@
var reportingTaskEntity = reportingTasksData.getItemById(taskId); var reportingTaskEntity = reportingTasksData.getItemById(taskId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(reportingTaskEntity.bulletins); var bulletins = nfCommon.getFormattedBulletins(reportingTaskEntity.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, bulletinIcon.qtip($.extend({},
common.config.tooltipConfig, nfCommon.config.tooltipConfig,
{ {
content: tooltip, content: tooltip,
position: { position: {
@ -1055,7 +1055,7 @@
// load the controller services // load the controller services
var controllerServicesUri = config.urls.api + '/flow/controller/controller-services'; var controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
var controllerServicesXhr = controllerServices.loadControllerServices(controllerServicesUri, getControllerServicesTable()); var controllerServicesXhr = nfControllerServices.loadControllerServices(controllerServicesUri, getControllerServicesTable());
// load the reporting tasks // load the reporting tasks
var reportingTasks = loadReportingTasks(); var reportingTasks = loadReportingTasks();
@ -1066,7 +1066,7 @@
// update the current time // update the current time
$('#settings-last-refreshed').text(controllerServicesResponse.currentTime); $('#settings-last-refreshed').text(controllerServicesResponse.currentTime);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -1086,8 +1086,8 @@
}); });
var reportingTasksElement = $('#reporting-tasks-table'); var reportingTasksElement = $('#reporting-tasks-table');
common.cleanUpTooltips(reportingTasksElement, 'div.has-errors'); nfCommon.cleanUpTooltips(reportingTasksElement, 'div.has-errors');
common.cleanUpTooltips(reportingTasksElement, 'div.has-bulletins'); nfCommon.cleanUpTooltips(reportingTasksElement, 'div.has-bulletins');
var reportingTasksGrid = reportingTasksElement.data('gridInstance'); var reportingTasksGrid = reportingTasksElement.data('gridInstance');
var reportingTasksData = reportingTasksGrid.getData(); var reportingTasksData = reportingTasksGrid.getData();
@ -1104,7 +1104,7 @@
*/ */
var showSettings = function () { var showSettings = function () {
// show the settings dialog // show the settings dialog
shell.showContent('#settings').done(function () { nfShell.showContent('#settings').done(function () {
reset(); reset();
}); });
@ -1150,9 +1150,9 @@
$('#settings-save').show(); $('#settings-save').show();
} else { } else {
var canModifyController = false; var canModifyController = false;
if (common.isDefinedAndNotNull(common.currentUser)) { if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
// only consider write permissions for creating new controller services/reporting tasks // only consider write permissions for creating new controller services/reporting tasks
canModifyController = common.currentUser.controllerPermissions.canWrite === true; canModifyController = nfCommon.currentUser.controllerPermissions.canWrite === true;
} }
if (canModifyController) { if (canModifyController) {
@ -1190,13 +1190,13 @@
var selectedTab = $('#settings-tabs li.selected-tab').text(); var selectedTab = $('#settings-tabs li.selected-tab').text();
if (selectedTab === 'Controller Services') { if (selectedTab === 'Controller Services') {
var controllerServicesUri = config.urls.api + '/controller/controller-services'; var controllerServicesUri = config.urls.api + '/controller/controller-services';
controllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable()); nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
} else if (selectedTab === 'Reporting Tasks') { } else if (selectedTab === 'Reporting Tasks') {
$('#new-reporting-task-dialog').modal('show'); $('#new-reporting-task-dialog').modal('show');
// reset the canvas size after the dialog is shown // reset the canvas size after the dialog is shown
var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance'); var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance');
if (common.isDefinedAndNotNull(reportingTaskTypesGrid)) { if (nfCommon.isDefinedAndNotNull(reportingTaskTypesGrid)) {
reportingTaskTypesGrid.setSelectedRows([0]); reportingTaskTypesGrid.setSelectedRows([0]);
reportingTaskTypesGrid.resizeCanvas(); reportingTaskTypesGrid.resizeCanvas();
} }
@ -1208,7 +1208,7 @@
// initialize each tab // initialize each tab
initGeneral(); initGeneral();
controllerServices.init(getControllerServicesTable(), nfSettings.showSettings); nfControllerServices.init(getControllerServicesTable(), nfSettings.showSettings);
initReportingTasks(); initReportingTasks();
}, },
@ -1216,10 +1216,10 @@
* Update the size of the grid based on its container's current size. * Update the size of the grid based on its container's current size.
*/ */
resetTableSize: function () { resetTableSize: function () {
controllerServices.resetTableSize(getControllerServicesTable()); nfControllerServices.resetTableSize(getControllerServicesTable());
var reportingTasksGrid = $('#reporting-tasks-table').data('gridInstance'); var reportingTasksGrid = $('#reporting-tasks-table').data('gridInstance');
if (common.isDefinedAndNotNull(reportingTasksGrid)) { if (nfCommon.isDefinedAndNotNull(reportingTasksGrid)) {
reportingTasksGrid.resizeCanvas(); reportingTasksGrid.resizeCanvas();
} }
}, },
@ -1264,7 +1264,7 @@
*/ */
setBulletins: function (controllerServiceBulletins, reportingTaskBulletins) { setBulletins: function (controllerServiceBulletins, reportingTaskBulletins) {
if ($('#controller-services-table').data('gridInstance')) { if ($('#controller-services-table').data('gridInstance')) {
controllerServices.setBulletins(getControllerServicesTable(), controllerServiceBulletins); nfControllerServices.setBulletins(getControllerServicesTable(), controllerServiceBulletins);
} }
// reporting tasks // reporting tasks
@ -1273,7 +1273,7 @@
reportingTasksData.beginUpdate(); reportingTasksData.beginUpdate();
// if there are some bulletins process them // if there are some bulletins process them
if (!common.isEmpty(reportingTaskBulletins)) { if (!nfCommon.isEmpty(reportingTaskBulletins)) {
var reportingTaskBulletinsBySource = d3.nest() var reportingTaskBulletinsBySource = d3.nest()
.key(function (d) { .key(function (d) {
return d.sourceId; return d.sourceId;
@ -1282,7 +1282,7 @@
reportingTaskBulletinsBySource.forEach(function (sourceId, sourceBulletins) { reportingTaskBulletinsBySource.forEach(function (sourceId, sourceBulletins) {
var reportingTask = reportingTasksData.getItemById(sourceId); var reportingTask = reportingTasksData.getItemById(sourceId);
if (common.isDefinedAndNotNull(reportingTask)) { if (nfCommon.isDefinedAndNotNull(reportingTask)) {
reportingTasksData.updateItem(sourceId, $.extend(reportingTask, { reportingTasksData.updateItem(sourceId, $.extend(reportingTask, {
bulletins: sourceBulletins bulletins: sourceBulletins
})); }));

View File

@ -23,8 +23,8 @@
'd3', 'd3',
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.Client'], 'nf.Client'],
function ($, d3, canvasUtils, client) { function ($, d3, nfCanvasUtils, nfClient) {
return (nf.Snippet = factory($, d3, canvasUtils, client)); return (nf.Snippet = factory($, d3, nfCanvasUtils, nfClient));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Snippet = module.exports = (nf.Snippet =
@ -38,7 +38,7 @@
root.nf.CanvasUtils, root.nf.CanvasUtils,
root.nf.Client); root.nf.Client);
} }
}(this, function ($, d3, canvasUtils, client) { }(this, function ($, d3, nfCanvasUtils, nfClient) {
'use strict'; 'use strict';
var config = { var config = {
@ -57,7 +57,7 @@
*/ */
marshal: function (selection) { marshal: function (selection) {
var snippet = { var snippet = {
parentGroupId: canvasUtils.getGroupId(), parentGroupId: nfCanvasUtils.getGroupId(),
processors: {}, processors: {},
funnels: {}, funnels: {},
inputPorts: {}, inputPorts: {},
@ -72,22 +72,22 @@
selection.each(function (d) { selection.each(function (d) {
var selected = d3.select(this); var selected = d3.select(this);
if (canvasUtils.isProcessor(selected)) { if (nfCanvasUtils.isProcessor(selected)) {
snippet.processors[d.id] = client.getRevision(selected.datum()); snippet.processors[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isFunnel(selected)) { } else if (nfCanvasUtils.isFunnel(selected)) {
snippet.funnels[d.id] = client.getRevision(selected.datum()); snippet.funnels[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isLabel(selected)) { } else if (nfCanvasUtils.isLabel(selected)) {
snippet.labels[d.id] = client.getRevision(selected.datum()); snippet.labels[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isInputPort(selected)) { } else if (nfCanvasUtils.isInputPort(selected)) {
snippet.inputPorts[d.id] = client.getRevision(selected.datum()); snippet.inputPorts[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isOutputPort(selected)) { } else if (nfCanvasUtils.isOutputPort(selected)) {
snippet.outputPorts[d.id] = client.getRevision(selected.datum()); snippet.outputPorts[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isProcessGroup(selected)) { } else if (nfCanvasUtils.isProcessGroup(selected)) {
snippet.processGroups[d.id] = client.getRevision(selected.datum()); snippet.processGroups[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isRemoteProcessGroup(selected)) { } else if (nfCanvasUtils.isRemoteProcessGroup(selected)) {
snippet.remoteProcessGroups[d.id] = client.getRevision(selected.datum()); snippet.remoteProcessGroups[d.id] = nfClient.getRevision(selected.datum());
} else if (canvasUtils.isConnection(selected)) { } else if (nfCanvasUtils.isConnection(selected)) {
snippet.connections[d.id] = client.getRevision(selected.datum()); snippet.connections[d.id] = nfClient.getRevision(selected.datum());
} }
}); });
@ -128,7 +128,7 @@
return $.ajax({ return $.ajax({
type: 'POST', type: 'POST',
url: config.urls.processGroups + '/' + encodeURIComponent(canvasUtils.getGroupId()) + '/snippet-instance', url: config.urls.processGroups + '/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/snippet-instance',
data: JSON.stringify(copySnippetRequestEntity), data: JSON.stringify(copySnippetRequestEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Dialog', 'nf.Dialog',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, Slick, common, dialog, errorHandler) { function ($, Slick, nfCommon, nfDialog, nfErrorHandler) {
return (nf.ClusterTable = factory($, Slick, common, dialog, errorHandler)); return (nf.ClusterTable = factory($, Slick, nfCommon, nfDialog, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ClusterTable = module.exports = (nf.ClusterTable =
@ -41,7 +41,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, Slick, common, dialog, errorHandler) { }(this, function ($, Slick, nfCommon, nfDialog, nfErrorHandler) {
'use strict'; 'use strict';
/** /**
@ -58,11 +58,11 @@
data: [{ data: [{
name: 'cluster', name: 'cluster',
update: refreshClusterData, update: refreshClusterData,
isAuthorized: common.canAccessController isAuthorized: nfCommon.canAccessController
}, { }, {
name: 'systemDiagnostics', name: 'systemDiagnostics',
update: refreshSystemDiagnosticsData, update: refreshSystemDiagnosticsData,
isAuthorized: common.canAccessSystem isAuthorized: nfCommon.canAccessSystem
} }
] ]
}; };
@ -452,7 +452,7 @@
// function for formatting the last accessed time // function for formatting the last accessed time
var valueFormatter = function (row, cell, value, columnDef, dataContext) { var valueFormatter = function (row, cell, value, columnDef, dataContext) {
return common.formatValue(value); return nfCommon.formatValue(value);
}; };
// define a custom formatter for the status column // define a custom formatter for the status column
@ -523,7 +523,7 @@
]; ];
// only allow the admin to modify the cluster // only allow the admin to modify the cluster
if (common.canModifyController()) { if (nfCommon.canModifyController()) {
var actionFormatter = function (row, cell, value, columnDef, dataContext) { var actionFormatter = function (row, cell, value, columnDef, dataContext) {
var canDisconnect = false; var canDisconnect = false;
var canConnect = false; var canConnect = false;
@ -571,8 +571,8 @@
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
if (sortDetails.columnId === 'heartbeat' || sortDetails.columnId === 'uptime') { if (sortDetails.columnId === 'heartbeat' || sortDetails.columnId === 'uptime') {
var aDate = common.parseDateTime(a[sortDetails.columnId]); var aDate = nfCommon.parseDateTime(a[sortDetails.columnId]);
var bDate = common.parseDateTime(b[sortDetails.columnId]); var bDate = nfCommon.parseDateTime(b[sortDetails.columnId]);
return aDate.getTime() - bDate.getTime(); return aDate.getTime() - bDate.getTime();
} else if (sortDetails.columnId === 'queued') { } else if (sortDetails.columnId === 'queued') {
var aSplit = a[sortDetails.columnId].split(/ \/ /); var aSplit = a[sortDetails.columnId].split(/ \/ /);
@ -580,13 +580,13 @@
var mod = count % 4; var mod = count % 4;
if (mod < 2) { if (mod < 2) {
$('#cluster-nodes-table span.queued-title').addClass('sorted'); $('#cluster-nodes-table span.queued-title').addClass('sorted');
var aCount = common.parseCount(aSplit[0]); var aCount = nfCommon.parseCount(aSplit[0]);
var bCount = common.parseCount(bSplit[0]); var bCount = nfCommon.parseCount(bSplit[0]);
return aCount - bCount; return aCount - bCount;
} else { } else {
$('#cluster-nodes-table span.queued-size-title').addClass('sorted'); $('#cluster-nodes-table span.queued-size-title').addClass('sorted');
var aSize = common.parseSize(aSplit[1]); var aSize = nfCommon.parseSize(aSplit[1]);
var bSize = common.parseSize(bSplit[1]); var bSize = nfCommon.parseSize(bSplit[1]);
return aSize - bSize; return aSize - bSize;
} }
} else if (sortDetails.columnId === 'maxHeap' || sortDetails.columnId === 'totalHeap' || sortDetails.columnId === 'usedHeap' } else if (sortDetails.columnId === 'maxHeap' || sortDetails.columnId === 'totalHeap' || sortDetails.columnId === 'usedHeap'
@ -594,19 +594,19 @@
|| sortDetails.columnId === 'ffRepoTotal' || sortDetails.columnId === 'ffRepoUsed' || sortDetails.columnId === 'ffRepoTotal' || sortDetails.columnId === 'ffRepoUsed'
|| sortDetails.columnId === 'ffRepoFree' || sortDetails.columnId === 'contentRepoTotal' || sortDetails.columnId === 'ffRepoFree' || sortDetails.columnId === 'contentRepoTotal'
|| sortDetails.columnId === 'contentRepoUsed' || sortDetails.columnId === 'contentRepoFree') { || sortDetails.columnId === 'contentRepoUsed' || sortDetails.columnId === 'contentRepoFree') {
var aSize = common.parseSize(a[sortDetails.columnId]); var aSize = nfCommon.parseSize(a[sortDetails.columnId]);
var bSize = common.parseSize(b[sortDetails.columnId]); var bSize = nfCommon.parseSize(b[sortDetails.columnId]);
return aSize - bSize; return aSize - bSize;
} else if (sortDetails.columnId === 'totalThreads' || sortDetails.columnId === 'daemonThreads' } else if (sortDetails.columnId === 'totalThreads' || sortDetails.columnId === 'daemonThreads'
|| sortDetails.columnId === 'processors') { || sortDetails.columnId === 'processors') {
var aCount = common.parseCount(a[sortDetails.columnId]); var aCount = nfCommon.parseCount(a[sortDetails.columnId]);
var bCount = common.parseCount(b[sortDetails.columnId]); var bCount = nfCommon.parseCount(b[sortDetails.columnId]);
return aCount - bCount; return aCount - bCount;
} else if (sortDetails.columnId === 'gcOldGen' || sortDetails.columnId === 'gcNewGen') { } else if (sortDetails.columnId === 'gcOldGen' || sortDetails.columnId === 'gcNewGen') {
var aSplit = a[sortDetails.columnId].split(/ /); var aSplit = a[sortDetails.columnId].split(/ /);
var bSplit = b[sortDetails.columnId].split(/ /); var bSplit = b[sortDetails.columnId].split(/ /);
var aCount = common.parseCount(aSplit[0]); var aCount = nfCommon.parseCount(aSplit[0]);
var bCount = common.parseCount(bSplit[0]); var bCount = nfCommon.parseCount(bSplit[0]);
return aCount - bCount; return aCount - bCount;
} else if (sortDetails.columnId === 'status') { } else if (sortDetails.columnId === 'status') {
var aStatus = formatNodeStatus(a); var aStatus = formatNodeStatus(a);
@ -617,8 +617,8 @@
var bNode = formatNodeAddress(b); var bNode = formatNodeAddress(b);
return aNode === bNode ? 0 : aNode > bNode ? 1 : -1; return aNode === bNode ? 0 : aNode > bNode ? 1 : -1;
} else { } else {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} }
}; };
@ -648,7 +648,7 @@
* @returns {string} * @returns {string}
*/ */
var formatNodeAddress = function (node) { var formatNodeAddress = function (node) {
return common.escapeHtml(node.address) + ':' + common.escapeHtml(node.apiPort); return nfCommon.escapeHtml(node.address) + ':' + nfCommon.escapeHtml(node.apiPort);
}; };
/** /**
@ -675,7 +675,7 @@
*/ */
var promptForConnect = function (node) { var promptForConnect = function (node) {
// prompt to connect // prompt to connect
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Connect Node', headerText: 'Connect Node',
dialogContent: 'Connect \'' + formatNodeAddress(node) + '\' to this cluster?', dialogContent: 'Connect \'' + formatNodeAddress(node) + '\' to this cluster?',
yesHandler: function () { yesHandler: function () {
@ -709,7 +709,7 @@
var clusterGrid = $('#cluster-nodes-table').data('gridInstance'); var clusterGrid = $('#cluster-nodes-table').data('gridInstance');
var clusterData = clusterGrid.getData(); var clusterData = clusterGrid.getData();
clusterData.updateItem(node.nodeId, node); clusterData.updateItem(node.nodeId, node);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -719,7 +719,7 @@
*/ */
var promptForDisconnect = function (node) { var promptForDisconnect = function (node) {
// prompt for disconnect // prompt for disconnect
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Disconnect Node', headerText: 'Disconnect Node',
dialogContent: 'Disconnect \'' + formatNodeAddress(node) + '\' from the cluster?', dialogContent: 'Disconnect \'' + formatNodeAddress(node) + '\' from the cluster?',
yesHandler: function () { yesHandler: function () {
@ -754,7 +754,7 @@
var clusterGrid = $('#cluster-nodes-table').data('gridInstance'); var clusterGrid = $('#cluster-nodes-table').data('gridInstance');
var clusterData = clusterGrid.getData(); var clusterData = clusterGrid.getData();
clusterData.updateItem(node.nodeId, node); clusterData.updateItem(node.nodeId, node);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -764,7 +764,7 @@
*/ */
var promptForRemoval = function (node) { var promptForRemoval = function (node) {
// prompt for disconnect // prompt for disconnect
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Remove Node', headerText: 'Remove Node',
dialogContent: 'Remove \'' + formatNodeAddress(node) + '\' from the cluster?', dialogContent: 'Remove \'' + formatNodeAddress(node) + '\' from the cluster?',
yesHandler: function () { yesHandler: function () {
@ -788,7 +788,7 @@
var clusterGrid = $('#cluster-nodes-table').data('gridInstance'); var clusterGrid = $('#cluster-nodes-table').data('gridInstance');
var clusterData = clusterGrid.getData(); var clusterData = clusterGrid.getData();
clusterData.deleteItem(nodeId); clusterData.deleteItem(nodeId);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -812,7 +812,7 @@
var grid = visibleTab.grid; var grid = visibleTab.grid;
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(grid)) { if (nfCommon.isDefinedAndNotNull(grid)) {
var gridData = grid.getData(); var gridData = grid.getData();
// update the search criteria // update the search criteria
@ -912,22 +912,22 @@
$.each(node.events, function (i, event) { $.each(node.events, function (i, event) {
eventMessages.push(event.timestamp + ": " + event.message); eventMessages.push(event.timestamp + ": " + event.message);
}); });
$('<div></div>').append(common.formatUnorderedList(eventMessages)).appendTo(events); $('<div></div>').append(nfCommon.formatUnorderedList(eventMessages)).appendTo(events);
} else { } else {
events.append('<div><span class="unset">None</span></div>'); events.append('<div><span class="unset">None</span></div>');
} }
// show the dialog // show the dialog
$('#node-details-dialog').modal('show'); $('#node-details-dialog').modal('show');
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
* Applies system diagnostics data to the JVM tab. * Applies system diagnostics data to the JVM tab.
*/ */
function updateJvmTableData(systemDiagnosticsResponse) { function updateJvmTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var jvmTableRows = []; var jvmTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -970,8 +970,8 @@
* Applies system diagnostics data to the System tab. * Applies system diagnostics data to the System tab.
*/ */
function updateSystemTableData(systemDiagnosticsResponse) { function updateSystemTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var systemTableRows = []; var systemTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -999,8 +999,8 @@
* Applies system diagnostics data to the FlowFile Storage tab. * Applies system diagnostics data to the FlowFile Storage tab.
*/ */
function updateFlowFileTableData(systemDiagnosticsResponse) { function updateFlowFileTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var flowFileTableRows = []; var flowFileTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -1028,8 +1028,8 @@
* Applies system diagnostics data to the Content Storage tab. * Applies system diagnostics data to the Content Storage tab.
*/ */
function updateContentTableData(systemDiagnosticsResponse) { function updateContentTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var contentStorageTableRows = []; var contentStorageTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -1061,8 +1061,8 @@
* Applies system diagnostics data to the Versions tab. * Applies system diagnostics data to the Versions tab.
*/ */
function updateVersionTableData(systemDiagnosticsResponse) { function updateVersionTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var versionTableRows = []; var versionTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -1103,7 +1103,7 @@
handlers.forEach(function (handler) { handlers.forEach(function (handler) {
handler(systemDiagnosticsResponse); handler(systemDiagnosticsResponse);
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
return loadPromise; return loadPromise;
}; };
@ -1176,7 +1176,7 @@
var cluster = clusterResponse.cluster; var cluster = clusterResponse.cluster;
// ensure there are groups specified // ensure there are groups specified
if (common.isDefinedAndNotNull(cluster.nodes)) { if (nfCommon.isDefinedAndNotNull(cluster.nodes)) {
var clusterGrid = nodesTab.grid; var clusterGrid = nodesTab.grid;
var clusterData = clusterGrid.getData(); var clusterData = clusterGrid.getData();
@ -1206,7 +1206,7 @@
handlers.forEach(function (handler) { handlers.forEach(function (handler) {
handler(response); handler(response);
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
return clusterNodesDataPromise; return clusterNodesDataPromise;
} }
@ -1216,7 +1216,7 @@
function onSelectTab(tab) { function onSelectTab(tab) {
// Resize table // Resize table
var tabGrid = tab.grid; var tabGrid = tab.grid;
if (common.isDefinedAndNotNull(tabGrid)) { if (nfCommon.isDefinedAndNotNull(tabGrid)) {
tabGrid.resizeCanvas(); tabGrid.resizeCanvas();
} }

View File

@ -24,8 +24,8 @@
'nf.ClusterTable', 'nf.ClusterTable',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage'], 'nf.Storage'],
function ($, common, clusterTable, errorHandler, storage) { function ($, nfCommon, nfClusterTable, nfErrorHandler, nfStorage) {
return (nf.Cluster = factory($, common, clusterTable, errorHandler, storage)); return (nf.Cluster = factory($, nfCommon, nfClusterTable, nfErrorHandler, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Cluster = module.exports = (nf.Cluster =
@ -41,7 +41,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, common, clusterTable, errorHandler, storage) { }(this, function ($, nfCommon, nfClusterTable, nfErrorHandler, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -69,8 +69,8 @@
url: config.urls.currentUser, url: config.urls.currentUser,
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -79,7 +79,7 @@
var initializeClusterPage = function () { var initializeClusterPage = function () {
// define mouse over event for the refresh button // define mouse over event for the refresh button
$('#refresh-button').click(function () { $('#refresh-button').click(function () {
clusterTable.loadClusterTable(); nfClusterTable.loadClusterTable();
}); });
// return a deferred for page initialization // return a deferred for page initialization
@ -92,8 +92,8 @@
dataType: 'json' dataType: 'json'
}).done(function (bannerResponse) { }).done(function (bannerResponse) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(bannerResponse.banners)) { if (nfCommon.isDefinedAndNotNull(bannerResponse.banners)) {
if (common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show(); var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show();
@ -107,7 +107,7 @@
updateTop('counters'); updateTop('counters');
} }
if (common.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show();
@ -123,7 +123,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -137,7 +137,7 @@
* Initializes the counters page. * Initializes the counters page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
// load the current user // load the current user
loadCurrentUser().done(function () { loadCurrentUser().done(function () {
@ -159,13 +159,13 @@
setBodySize(); setBodySize();
// create the cluster table // create the cluster table
clusterTable.init(); nfClusterTable.init();
// resize to fit // resize to fit
clusterTable.resetTableSize(); nfClusterTable.resetTableSize();
// load the table // load the table
clusterTable.loadClusterTable().done(function () { nfClusterTable.loadClusterTable().done(function () {
// once the table is initialized, finish initializing the page // once the table is initialized, finish initializing the page
initializeClusterPage().done(function () { initializeClusterPage().done(function () {
@ -181,7 +181,7 @@
// set the document title and the about title // set the document title and the about title
document.title = countersTitle; document.title = countersTitle;
$('#counters-header-text').text(countersTitle); $('#counters-header-text').text(countersTitle);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
$(window).on('resize', function (e) { $(window).on('resize', function (e) {
setBodySize(); setBodySize();
@ -214,7 +214,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
}); });
}); });

View File

@ -23,8 +23,8 @@
'Slick', 'Slick',
'nf.Common', 'nf.Common',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, Slick, common, errorHandler) { function ($, Slick, nfCommon, nfErrorHandler) {
return (nf.CountersTable = factory($, Slick, common, errorHandler)); return (nf.CountersTable = factory($, Slick, nfCommon, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.CountersTable = module.exports = (nf.CountersTable =
@ -38,7 +38,7 @@
root.nf.Common, root.nf.Common,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, Slick, common, errorHandler) { }(this, function ($, Slick, nfCommon, nfErrorHandler) {
'use strict'; 'use strict';
/** /**
@ -60,12 +60,12 @@
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
if (sortDetails.columnId === 'value') { if (sortDetails.columnId === 'value') {
var aCount = common.parseCount(a[sortDetails.columnId]); var aCount = nfCommon.parseCount(a[sortDetails.columnId]);
var bCount = common.parseCount(b[sortDetails.columnId]); var bCount = nfCommon.parseCount(b[sortDetails.columnId]);
return aCount - bCount; return aCount - bCount;
} else { } else {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} }
}; };
@ -91,7 +91,7 @@
var countersGrid = $('#counters-table').data('gridInstance'); var countersGrid = $('#counters-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(countersGrid)) { if (nfCommon.isDefinedAndNotNull(countersGrid)) {
var countersData = countersGrid.getData(); var countersData = countersGrid.getData();
// update the search criteria // update the search criteria
@ -144,7 +144,7 @@
var countersGrid = $('#counters-table').data('gridInstance'); var countersGrid = $('#counters-table').data('gridInstance');
var countersData = countersGrid.getData(); var countersData = countersGrid.getData();
countersData.updateItem(counter.id, counter); countersData.updateItem(counter.id, counter);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
return { return {
@ -198,7 +198,7 @@
]; ];
// only allow dfm's to reset counters // only allow dfm's to reset counters
if (common.canModifyCounters()) { if (nfCommon.canModifyCounters()) {
// function for formatting the actions column // function for formatting the actions column
var actionFormatter = function (row, cell, value, columnDef, dataContext) { var actionFormatter = function (row, cell, value, columnDef, dataContext) {
return '<div title="Reset Counter" class="pointer reset-counter fa fa-undo" style="margin-top: 2px;"></div>'; return '<div title="Reset Counter" class="pointer reset-counter fa fa-undo" style="margin-top: 2px;"></div>';
@ -294,7 +294,7 @@
*/ */
resetTableSize: function () { resetTableSize: function () {
var countersGrid = $('#counters-table').data('gridInstance'); var countersGrid = $('#counters-table').data('gridInstance');
if (common.isDefinedAndNotNull(countersGrid)) { if (nfCommon.isDefinedAndNotNull(countersGrid)) {
countersGrid.resizeCanvas(); countersGrid.resizeCanvas();
} }
}, },
@ -312,7 +312,7 @@
var aggregateSnapshot = report.aggregateSnapshot; var aggregateSnapshot = report.aggregateSnapshot;
// ensure there are groups specified // ensure there are groups specified
if (common.isDefinedAndNotNull(aggregateSnapshot.counters)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.counters)) {
var countersGrid = $('#counters-table').data('gridInstance'); var countersGrid = $('#counters-table').data('gridInstance');
var countersData = countersGrid.getData(); var countersData = countersGrid.getData();
@ -329,7 +329,7 @@
} else { } else {
$('#total-counters').text('0'); $('#total-counters').text('0');
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };
})); }));

View File

@ -24,8 +24,8 @@
'nf.CountersTable', 'nf.CountersTable',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage'], 'nf.Storage'],
function ($, common, countersTable, errorHandler, storage) { function ($, nfCommon, nfCountersTable, nfErrorHandler, nfStorage) {
return (nf.Counters = factory($, common, countersTable, errorHandler, storage)); return (nf.Counters = factory($, nfCommon, nfCountersTable, nfErrorHandler, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Counters = module.exports = (nf.Counters =
@ -41,7 +41,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, common, countersTable, errorHandler, storage) { }(this, function ($, nfCommon, nfCountersTable, nfErrorHandler, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -69,9 +69,9 @@
url: config.urls.currentUser, url: config.urls.currentUser,
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -80,7 +80,7 @@
var initializeCountersPage = function () { var initializeCountersPage = function () {
// define mouse over event for the refresh button // define mouse over event for the refresh button
$('#refresh-button').click(function () { $('#refresh-button').click(function () {
countersTable.loadCountersTable(); nfCountersTable.loadCountersTable();
}); });
// return a deferred for page initialization // return a deferred for page initialization
@ -93,8 +93,8 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -108,7 +108,7 @@
updateTop('counters'); updateTop('counters');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -124,7 +124,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -138,15 +138,15 @@
* Initializes the counters page. * Initializes the counters page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
// load the current user // load the current user
loadCurrentUser().done(function () { loadCurrentUser().done(function () {
// create the counters table // create the counters table
countersTable.init(); nfCountersTable.init();
// load the table // load the table
countersTable.loadCountersTable().done(function () { nfCountersTable.loadCountersTable().done(function () {
// once the table is initialized, finish initializing the page // once the table is initialized, finish initializing the page
initializeCountersPage().done(function () { initializeCountersPage().done(function () {
var setBodySize = function () { var setBodySize = function () {
@ -163,7 +163,7 @@
} }
// configure the initial grid height // configure the initial grid height
countersTable.resetTableSize(); nfCountersTable.resetTableSize();
}; };
// get the about details // get the about details
@ -181,7 +181,7 @@
// set the initial size // set the initial size
setBodySize(); setBodySize();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
$(window).on('resize', function (e) { $(window).on('resize', function (e) {
setBodySize(); setBodySize();
@ -214,7 +214,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
}); });
}); });

View File

@ -23,8 +23,8 @@
'Slick', 'Slick',
'nf.Common', 'nf.Common',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, Slick, common, errorHandler) { function ($, Slick, nfCommon, nfErrorHandler) {
return (nf.HistoryModel = factory($, Slick, common, errorHandler)); return (nf.HistoryModel = factory($, Slick, nfCommon, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.HistoryModel = module.exports = (nf.HistoryModel =
@ -38,7 +38,7 @@
root.nf.Common, root.nf.Common,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, Slick, common, errorHandler) { }(this, function ($, Slick, nfCommon, nfErrorHandler) {
'use strict'; 'use strict';
// private // private
@ -164,7 +164,7 @@
$('#history-last-refreshed').text(history.lastRefreshed); $('#history-last-refreshed').text(history.lastRefreshed);
// set the timezone for the start and end time // set the timezone for the start and end time
$('.timezone').text(common.substringAfterLast(history.lastRefreshed, ' ')); $('.timezone').text(nfCommon.substringAfterLast(history.lastRefreshed, ' '));
// show the filter message if applicable // show the filter message if applicable
if (query['sourceId'] || query['userIdentity'] || query['startDate'] || query['endDate']) { if (query['sourceId'] || query['userIdentity'] || query['startDate'] || query['endDate']) {
@ -181,7 +181,7 @@
from: from, from: from,
to: to to: to
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
xhr.fromPage = fromPage; xhr.fromPage = fromPage;
xhr.toPage = toPage; xhr.toPage = toPage;

View File

@ -25,8 +25,8 @@
'nf.Dialog', 'nf.Dialog',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.HistoryModel'], 'nf.HistoryModel'],
function ($, Slick, common, dialog, errorHandler, HistoryModel) { function ($, Slick, nfCommon, nfDialog, nfErrorHandler, nfHistoryModel) {
return (nf.HistoryTable = factory($, Slick, common, dialog, errorHandler, HistoryModel)); return (nf.HistoryTable = factory($, Slick, nfCommon, nfDialog, nfErrorHandler, nfHistoryModel));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.HistoryTable = module.exports = (nf.HistoryTable =
@ -44,7 +44,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.HistoryModel); root.nf.HistoryModel);
} }
}(this, function ($, Slick, common, dialog, errorHandler, HistoryModel) { }(this, function ($, Slick, nfCommon, nfDialog, nfErrorHandler, nfHistoryModel) {
'use strict'; 'use strict';
/** /**
@ -240,15 +240,15 @@
} }
var endDateTime = endDate + ' ' + endTime; var endDateTime = endDate + ' ' + endTime;
var timezone = $('.timezone:first').text(); var timezone = $('.timezone:first').text();
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'History', headerText: 'History',
dialogContent: "Are you sure you want to delete all history before '" + common.escapeHtml(endDateTime) + " " + common.escapeHtml(timezone) + "'?", dialogContent: "Are you sure you want to delete all history before '" + nfCommon.escapeHtml(endDateTime) + " " + nfCommon.escapeHtml(timezone) + "'?",
yesHandler: function () { yesHandler: function () {
purgeHistory(endDateTime); purgeHistory(endDateTime);
} }
}); });
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'History', headerText: 'History',
dialogContent: 'The end date must be specified.' dialogContent: 'The end date must be specified.'
}); });
@ -311,7 +311,7 @@
if (dataContext.canRead !== true) { if (dataContext.canRead !== true) {
return '<span class="unset" style="font-size: 13px; padding-top: 2px;">Not authorized</span>'; return '<span class="unset" style="font-size: 13px; padding-top: 2px;">Not authorized</span>';
} }
return common.formatValue(dataContext.action[columnDef.field]); return nfCommon.formatValue(dataContext.action[columnDef.field]);
}; };
// initialize the templates table // initialize the templates table
@ -377,7 +377,7 @@
}; };
// create the remote model // create the remote model
var historyModel = new HistoryModel(); var historyModel = new nfHistoryModel();
// initialize the grid // initialize the grid
var historyGrid = new Slick.Grid('#history-table', historyModel, historyColumns, historyOptions); var historyGrid = new Slick.Grid('#history-table', historyModel, historyColumns, historyOptions);
@ -429,7 +429,7 @@
$('#history-table').data('gridInstance', historyGrid); $('#history-table').data('gridInstance', historyGrid);
// add the purge button if appropriate // add the purge button if appropriate
if (common.canModifyController()) { if (nfCommon.canModifyController()) {
$('#history-purge-button').on('click', function () { $('#history-purge-button').on('click', function () {
$('#history-purge-dialog').modal('show'); $('#history-purge-dialog').modal('show');
}).show(); }).show();
@ -450,7 +450,7 @@
dataType: 'json' dataType: 'json'
}).done(function () { }).done(function () {
nfHistoryTable.loadHistoryTable(); nfHistoryTable.loadHistoryTable();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -461,19 +461,19 @@
var showActionDetails = function (action) { var showActionDetails = function (action) {
// create the markup for the dialog // create the markup for the dialog
var detailsMarkup = $('<div></div>').append( var detailsMarkup = $('<div></div>').append(
$('<div class="action-detail"><div class="history-details-name">Id</div>' + common.escapeHtml(action.sourceId) + '</div>')); $('<div class="action-detail"><div class="history-details-name">Id</div>' + nfCommon.escapeHtml(action.sourceId) + '</div>'));
// get any component details // get any component details
var componentDetails = action.componentDetails; var componentDetails = action.componentDetails;
// inspect the operation to determine if there are any component details // inspect the operation to determine if there are any component details
if (common.isDefinedAndNotNull(componentDetails)) { if (nfCommon.isDefinedAndNotNull(componentDetails)) {
if (action.sourceType === 'Processor' || action.sourceType === 'ControllerService' || action.sourceType === 'ReportingTask') { if (action.sourceType === 'Processor' || action.sourceType === 'ControllerService' || action.sourceType === 'ReportingTask') {
detailsMarkup.append( detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Type</div>' + common.escapeHtml(componentDetails.type) + '</div>')); $('<div class="action-detail"><div class="history-details-name">Type</div>' + nfCommon.escapeHtml(componentDetails.type) + '</div>'));
} else if (action.sourceType === 'RemoteProcessGroup') { } else if (action.sourceType === 'RemoteProcessGroup') {
detailsMarkup.append( detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Uri</div>' + common.formatValue(componentDetails.uri) + '</div>')); $('<div class="action-detail"><div class="history-details-name">Uri</div>' + nfCommon.formatValue(componentDetails.uri) + '</div>'));
} }
} }
@ -481,30 +481,30 @@
var actionDetails = action.actionDetails; var actionDetails = action.actionDetails;
// inspect the operation to determine if there are any action details // inspect the operation to determine if there are any action details
if (common.isDefinedAndNotNull(actionDetails)) { if (nfCommon.isDefinedAndNotNull(actionDetails)) {
if (action.operation === 'Configure') { if (action.operation === 'Configure') {
detailsMarkup.append( detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Name</div>' + common.formatValue(actionDetails.name) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Name</div>' + nfCommon.formatValue(actionDetails.name) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Value</div>' + common.formatValue(actionDetails.value) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Value</div>' + nfCommon.formatValue(actionDetails.value) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Previous Value</div>' + common.formatValue(actionDetails.previousValue) + '</div>')); $('<div class="action-detail"><div class="history-details-name">Previous Value</div>' + nfCommon.formatValue(actionDetails.previousValue) + '</div>'));
} else if (action.operation === 'Connect' || action.operation === 'Disconnect') { } else if (action.operation === 'Connect' || action.operation === 'Disconnect') {
detailsMarkup.append( detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Source Id</div>' + common.escapeHtml(actionDetails.sourceId) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Source Id</div>' + nfCommon.escapeHtml(actionDetails.sourceId) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Source Name</div>' + common.formatValue(actionDetails.sourceName) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Source Name</div>' + nfCommon.formatValue(actionDetails.sourceName) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Source Type</div>' + common.escapeHtml(actionDetails.sourceType) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Source Type</div>' + nfCommon.escapeHtml(actionDetails.sourceType) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Relationship(s)</div>' + common.formatValue(actionDetails.relationship) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Relationship(s)</div>' + nfCommon.formatValue(actionDetails.relationship) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Destination Id</div>' + common.escapeHtml(actionDetails.destinationId) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Destination Id</div>' + nfCommon.escapeHtml(actionDetails.destinationId) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Destination Name</div>' + common.formatValue(actionDetails.destinationName) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Destination Name</div>' + nfCommon.formatValue(actionDetails.destinationName) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Destination Type</div>' + common.escapeHtml(actionDetails.destinationType) + '</div>')); $('<div class="action-detail"><div class="history-details-name">Destination Type</div>' + nfCommon.escapeHtml(actionDetails.destinationType) + '</div>'));
} else if (action.operation === 'Move') { } else if (action.operation === 'Move') {
detailsMarkup.append( detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Group</div>' + common.formatValue(actionDetails.group) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Group</div>' + nfCommon.formatValue(actionDetails.group) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Group Id</div>' + common.escapeHtml(actionDetails.groupId) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Group Id</div>' + nfCommon.escapeHtml(actionDetails.groupId) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Previous Group</div>' + common.formatValue(actionDetails.previousGroup) + '</div>')).append( $('<div class="action-detail"><div class="history-details-name">Previous Group</div>' + nfCommon.formatValue(actionDetails.previousGroup) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Previous Group Id</div>' + common.escapeHtml(actionDetails.previousGroupId) + '</div>')); $('<div class="action-detail"><div class="history-details-name">Previous Group Id</div>' + nfCommon.escapeHtml(actionDetails.previousGroupId) + '</div>'));
} else if (action.operation === 'Purge') { } else if (action.operation === 'Purge') {
detailsMarkup.append( detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">End Date</div>' + common.escapeHtml(actionDetails.endDate) + '</div>')); $('<div class="action-detail"><div class="history-details-name">End Date</div>' + nfCommon.escapeHtml(actionDetails.endDate) + '</div>'));
} }
} }
@ -528,7 +528,7 @@
*/ */
resetTableSize: function () { resetTableSize: function () {
var historyGrid = $('#history-table').data('gridInstance'); var historyGrid = $('#history-table').data('gridInstance');
if (common.isDefinedAndNotNull(historyGrid)) { if (nfCommon.isDefinedAndNotNull(historyGrid)) {
historyGrid.resizeCanvas(); historyGrid.resizeCanvas();
} }
}, },

View File

@ -25,8 +25,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage', 'nf.Storage',
'nf.ClusterSummary'], 'nf.ClusterSummary'],
function ($, common, historyTable, errorHandler, storage, clusterSummary) { function ($, nfCommon, nfHistoryTable, nfErrorHandler, nfStorage, nfClusterSummary) {
return (nf.History = factory($, common, historyTable, errorHandler, storage, clusterSummary)); return (nf.History = factory($, nfCommon, nfHistoryTable, nfErrorHandler, nfStorage, nfClusterSummary));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.History = module.exports = (nf.History =
@ -44,7 +44,7 @@
root.nf.Storage, root.nf.Storage,
root.nf.ClusterSummary); root.nf.ClusterSummary);
} }
}(this, function ($, common, historyTable, errorHandler, storage, clusterSummary) { }(this, function ($, nfCommon, nfHistoryTable, nfErrorHandler, nfStorage, nfClusterSummary) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -72,8 +72,8 @@
url: config.urls.currentUser, url: config.urls.currentUser,
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -82,7 +82,7 @@
var initializeHistoryPage = function () { var initializeHistoryPage = function () {
// define mouse over event for the refresh button // define mouse over event for the refresh button
$('#refresh-button').click(function () { $('#refresh-button').click(function () {
historyTable.loadHistoryTable(); nfHistoryTable.loadHistoryTable();
}); });
// return a deferred for page initialization // return a deferred for page initialization
@ -95,8 +95,8 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -110,7 +110,7 @@
updateTop('history'); updateTop('history');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -126,7 +126,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -143,20 +143,20 @@
// load the current user // load the current user
var currentUser = loadCurrentUser() var currentUser = loadCurrentUser()
storage.init(); nfStorage.init();
// ensure the config requests are loaded // ensure the config requests are loaded
$.when(currentUser).done(function (currentUserResult) { $.when(currentUser).done(function (currentUserResult) {
// if clustered, show message to indicate location of actions // if clustered, show message to indicate location of actions
if (clusterSummary.isClustered() === true) { if (nfClusterSummary.isClustered() === true) {
$('#cluster-history-message').show(); $('#cluster-history-message').show();
} }
// create the history table // create the history table
historyTable.init(); nfHistoryTable.init();
// load the history table // load the history table
historyTable.loadHistoryTable(); nfHistoryTable.loadHistoryTable();
// once the table is initialized, finish initializing the page // once the table is initialized, finish initializing the page
initializeHistoryPage().done(function () { initializeHistoryPage().done(function () {
@ -173,7 +173,7 @@
} }
// configure the initial grid height // configure the initial grid height
historyTable.resetTableSize(); nfHistoryTable.resetTableSize();
}; };
// get the about details // get the about details
@ -191,7 +191,7 @@
// set the initial size // set the initial size
setBodySize(); setBodySize();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
$(window).on('resize', function (e) { $(window).on('resize', function (e) {
setBodySize(); setBodySize();
@ -224,7 +224,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
}); });
}); });

View File

@ -23,8 +23,8 @@
'nf.Common', 'nf.Common',
'nf.Dialog', 'nf.Dialog',
'nf.Storage'], 'nf.Storage'],
function ($, common, dialog, storage) { function ($, nfCommon, nfDialog, nfStorage) {
return (nf.Login = factory($, common, dialog, storage)); return (nf.Login = factory($, nfCommon, nfDialog, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Login = module.exports = (nf.Login =
@ -38,7 +38,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, common, dialog, storage) { }(this, function ($, nfCommon, nfDialog, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -100,9 +100,9 @@
} }
}).done(function (jwt) { }).done(function (jwt) {
// get the payload and store the token with the appropirate expiration // get the payload and store the token with the appropirate expiration
var token = common.getJwtPayload(jwt); var token = nfCommon.getJwtPayload(jwt);
var expiration = parseInt(token['exp'], 10) * common.MILLIS_PER_SECOND; var expiration = parseInt(token['exp'], 10) * nfCommon.MILLIS_PER_SECOND;
storage.setItem('jwt', jwt, expiration); nfStorage.setItem('jwt', jwt, expiration);
// check to see if they actually have access now // check to see if they actually have access now
$.ajax({ $.ajax({
@ -144,9 +144,9 @@
$('#login-message-container').show(); $('#login-message-container').show();
}); });
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Login', headerText: 'Login',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
// update the form visibility // update the form visibility
@ -156,7 +156,7 @@
}; };
var showLogoutLink = function () { var showLogoutLink = function () {
common.showLogoutLink(); nfCommon.showLogoutLink();
}; };
var nfLogin = { var nfLogin = {
@ -164,9 +164,9 @@
* Initializes the login page. * Initializes the login page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
if (storage.getItem('jwt') !== null) { if (nfStorage.getItem('jwt') !== null) {
showLogoutLink(); showLogoutLink();
} }

View File

@ -21,8 +21,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'nf.Storage'], 'nf.Storage'],
function ($, storage) { function ($, nfStorage) {
return (nf.AjaxSetup = factory($, storage)); return (nf.AjaxSetup = factory($, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.AjaxSetup = factory(require('jquery'), module.exports = (nf.AjaxSetup = factory(require('jquery'),
@ -31,7 +31,7 @@
nf.AjaxSetup = factory(root.$, nf.AjaxSetup = factory(root.$,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, storage) { }(this, function ($, nfStorage) {
/** /**
* Performs ajax setup for use within NiFi. * Performs ajax setup for use within NiFi.
*/ */
@ -39,10 +39,10 @@
// include jwt when possible // include jwt when possible
$.ajaxSetup({ $.ajaxSetup({
'beforeSend': function (xhr) { 'beforeSend': function (xhr) {
var hadToken = storage.hasItem('jwt'); var hadToken = nfStorage.hasItem('jwt');
// get the token to include in all requests // get the token to include in all requests
var token = storage.getItem('jwt'); var token = nfStorage.getItem('jwt');
if (token !== null) { if (token !== null) {
xhr.setRequestHeader('Authorization', 'Bearer ' + token); xhr.setRequestHeader('Authorization', 'Bearer ' + token);
} else { } else {

View File

@ -21,8 +21,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'nf.Common'], 'nf.Common'],
function ($, common) { function ($, nfCommon) {
return (nf.Client = factory($, common)); return (nf.Client = factory($, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Client = module.exports = (nf.Client =
@ -33,7 +33,7 @@
factory(root.$, factory(root.$,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, common) { }(this, function ($, nfCommon) {
'use strict'; 'use strict';
var clientId = null; var clientId = null;
@ -73,7 +73,7 @@
* @return {boolean} whether proposedData is newer than currentData * @return {boolean} whether proposedData is newer than currentData
*/ */
isNewerRevision: function (currentData, proposedData) { isNewerRevision: function (currentData, proposedData) {
if (common.isDefinedAndNotNull(currentData)) { if (nfCommon.isDefinedAndNotNull(currentData)) {
var currentRevision = currentData.revision; var currentRevision = currentData.revision;
var proposedRevision = proposedData.revision; var proposedRevision = proposedData.revision;

View File

@ -23,8 +23,8 @@
define(['jquery', define(['jquery',
'd3', 'd3',
'nf.Storage'], 'nf.Storage'],
function ($, d3, storage) { function ($, d3, nfStorage) {
return (nf.Common = factory($, d3, storage)); return (nf.Common = factory($, d3, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Common = factory(require('jquery'), module.exports = (nf.Common = factory(require('jquery'),
@ -35,7 +35,7 @@
root.d3, root.d3,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, d3, storage) { }(this, function ($, d3, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -73,14 +73,14 @@
}); });
// shows the logout link in the message-pane when appropriate and schedule token refresh // shows the logout link in the message-pane when appropriate and schedule token refresh
if (storage.getItem('jwt') !== null) { if (nfStorage.getItem('jwt') !== null) {
$('#user-logout-container').css('display', 'block'); $('#user-logout-container').css('display', 'block');
nfCommon.scheduleTokenRefresh(); nfCommon.scheduleTokenRefresh();
} }
// handle logout // handle logout
$('#user-logout').on('click', function () { $('#user-logout').on('click', function () {
storage.removeItem('jwt'); nfStorage.removeItem('jwt');
window.location = '/nifi/login'; window.location = '/nifi/login';
}); });
@ -227,7 +227,7 @@
var interval = nfCommon.MILLIS_PER_MINUTE; var interval = nfCommon.MILLIS_PER_MINUTE;
var checkExpiration = function () { var checkExpiration = function () {
var expiration = storage.getItemExpiration('jwt'); var expiration = nfStorage.getItemExpiration('jwt');
// ensure there is an expiration and token present // ensure there is an expiration and token present
if (expiration !== null) { if (expiration !== null) {
@ -501,7 +501,7 @@
* Shows the logout link if appropriate. * Shows the logout link if appropriate.
*/ */
showLogoutLink: function () { showLogoutLink: function () {
if (storage.getItem('jwt') === null) { if (nfStorage.getItem('jwt') === null) {
$('#user-logout-container').css('display', 'none'); $('#user-logout-container').css('display', 'none');
} else { } else {
$('#user-logout-container').css('display', 'block'); $('#user-logout-container').css('display', 'block');
@ -823,7 +823,7 @@
*/ */
getAccessToken: function (accessTokenUrl) { getAccessToken: function (accessTokenUrl) {
return $.Deferred(function (deferred) { return $.Deferred(function (deferred) {
if (storage.hasItem('jwt')) { if (nfStorage.hasItem('jwt')) {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: accessTokenUrl url: accessTokenUrl

View File

@ -22,8 +22,8 @@
define(['jquery', define(['jquery',
'nf.Common', 'nf.Common',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, common, errorHandler) { function ($, nfCommon, nfErrorHandler) {
return (nf.ConnectionDetails = factory($, common, errorHandler)); return (nf.ConnectionDetails = factory($, nfCommon, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ConnectionDetails = factory(require('jquery'), module.exports = (nf.ConnectionDetails = factory(require('jquery'),
@ -34,7 +34,7 @@
root.nf.Common, root.nf.Common,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, common, errorHandler) { }(this, function ($, nfCommon, nfErrorHandler) {
'use strict'; 'use strict';
/** /**
@ -72,7 +72,7 @@
}).done(function (response) { }).done(function (response) {
var processor = response.component; var processor = response.component;
var processorName = $('<div class="label"></div>').text(processor.name).addClass('ellipsis').attr('title', processor.name); var processorName = $('<div class="label"></div>').text(processor.name).addClass('ellipsis').attr('title', processor.name);
var processorType = $('<div></div>').text(common.substringAfterLast(processor.type, '.')).addClass('ellipsis').attr('title', common.substringAfterLast(processor.type, '.')); var processorType = $('<div></div>').text(nfCommon.substringAfterLast(processor.type, '.')).addClass('ellipsis').attr('title', nfCommon.substringAfterLast(processor.type, '.'));
// populate source processor details // populate source processor details
$('#read-only-connection-source-label').text('From processor'); $('#read-only-connection-source-label').text('From processor');
@ -232,7 +232,7 @@
}).done(function (response) { }).done(function (response) {
var processor = response.component; var processor = response.component;
var processorName = $('<div class="label"></div>').text(processor.name).addClass('ellipsis').attr('title', processor.name); var processorName = $('<div class="label"></div>').text(processor.name).addClass('ellipsis').attr('title', processor.name);
var processorType = $('<div></div>').text(common.substringAfterLast(processor.type, '.')).addClass('ellipsis').attr('title', common.substringAfterLast(processor.type, '.')); var processorType = $('<div></div>').text(nfCommon.substringAfterLast(processor.type, '.')).addClass('ellipsis').attr('title', nfCommon.substringAfterLast(processor.type, '.'));
// populate destination processor details // populate destination processor details
$('#read-only-connection-target-label').text('To processor'); $('#read-only-connection-target-label').text('To processor');
@ -410,8 +410,8 @@
$('#read-only-relationship-names').empty(); $('#read-only-relationship-names').empty();
// clear the connection details // clear the connection details
common.clearField('read-only-connection-name'); nfCommon.clearField('read-only-connection-name');
common.clearField('read-only-connection-id'); nfCommon.clearField('read-only-connection-id');
// clear the connection source details // clear the connection source details
$('#read-only-connection-source-label').text(''); $('#read-only-connection-source-label').text('');
@ -433,7 +433,7 @@
$('#read-only-prioritizers').empty(); $('#read-only-prioritizers').empty();
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -483,7 +483,7 @@
var selectedRelationships = connection.selectedRelationships; var selectedRelationships = connection.selectedRelationships;
// show the available relationship if applicable // show the available relationship if applicable
if (common.isDefinedAndNotNull(availableRelationships) || common.isDefinedAndNotNull(selectedRelationships)) { if (nfCommon.isDefinedAndNotNull(availableRelationships) || nfCommon.isDefinedAndNotNull(selectedRelationships)) {
// populate the available connections // populate the available connections
$.each(availableRelationships, function (i, name) { $.each(availableRelationships, function (i, name) {
createRelationshipOption(name); createRelationshipOption(name);
@ -516,17 +516,17 @@
} }
// set the connection details // set the connection details
common.populateField('read-only-connection-name', connection.name); nfCommon.populateField('read-only-connection-name', connection.name);
common.populateField('read-only-connection-id', connection.id); nfCommon.populateField('read-only-connection-id', connection.id);
common.populateField('read-only-flow-file-expiration', connection.flowFileExpiration); nfCommon.populateField('read-only-flow-file-expiration', connection.flowFileExpiration);
common.populateField('read-only-back-pressure-object-threshold', connection.backPressureObjectThreshold); nfCommon.populateField('read-only-back-pressure-object-threshold', connection.backPressureObjectThreshold);
common.populateField('read-only-back-pressure-data-size-threshold', connection.backPressureDataSizeThreshold); nfCommon.populateField('read-only-back-pressure-data-size-threshold', connection.backPressureDataSizeThreshold);
// prioritizers // prioritizers
if (common.isDefinedAndNotNull(connection.prioritizers) && connection.prioritizers.length > 0) { if (nfCommon.isDefinedAndNotNull(connection.prioritizers) && connection.prioritizers.length > 0) {
var prioritizerList = $('<ol></ol>').css('list-style', 'decimal inside none'); var prioritizerList = $('<ol></ol>').css('list-style', 'decimal inside none');
$.each(connection.prioritizers, function (i, type) { $.each(connection.prioritizers, function (i, type) {
prioritizerList.append($('<li></li>').text(common.substringAfterLast(type, '.'))); prioritizerList.append($('<li></li>').text(nfCommon.substringAfterLast(type, '.')));
}); });
$('#read-only-prioritizers').append(prioritizerList); $('#read-only-prioritizers').append(prioritizerList);
} else { } else {
@ -545,9 +545,9 @@
if (relationshipNames.is(':visible') && relationshipNames.get(0).scrollHeight > Math.round(relationshipNames.innerHeight())) { if (relationshipNames.is(':visible') && relationshipNames.get(0).scrollHeight > Math.round(relationshipNames.innerHeight())) {
relationshipNames.css('border-width', '1px'); relationshipNames.css('border-width', '1px');
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };
})); }));

View File

@ -22,8 +22,8 @@
define(['jquery', define(['jquery',
'nf.Dialog', 'nf.Dialog',
'nf.Common'], 'nf.Common'],
function ($, dialog, common) { function ($, nfDialog, nfCommon) {
return (nf.ErrorHandler = factory($, dialog, common)); return (nf.ErrorHandler = factory($, nfDialog, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ErrorHandler = factory(require('jquery'), module.exports = (nf.ErrorHandler = factory(require('jquery'),
@ -34,7 +34,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, dialog, common) { }(this, function ($, nfDialog, nfCommon) {
'use strict'; 'use strict';
return { return {
@ -54,7 +54,7 @@
// show the error pane // show the error pane
$('#message-pane').show(); $('#message-pane').show();
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Session Expired', headerText: 'Session Expired',
dialogContent: 'Your session has expired. Please press Ok to log in again.', dialogContent: 'Your session has expired. Please press Ok to log in again.',
okHandler: function () { okHandler: function () {
@ -88,21 +88,21 @@
return; return;
} }
// status code 400, 404, and 409 are expected response codes for common errors. // status code 400, 404, and 409 are expected response codes for nfCommon errors.
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409 || xhr.status === 503) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409 || xhr.status === 503) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Error', headerText: 'Error',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} else if (xhr.status === 403) { } else if (xhr.status === 403) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Insufficient Permissions', headerText: 'Insufficient Permissions',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} else { } else {
if (xhr.status < 99 || xhr.status === 12007 || xhr.status === 12029) { if (xhr.status < 99 || xhr.status === 12007 || xhr.status === 12029) {
var content = 'Please ensure the application is running and check the logs for any errors.'; var content = 'Please ensure the application is running and check the logs for any errors.';
if (common.isDefinedAndNotNull(status)) { if (nfCommon.isDefinedAndNotNull(status)) {
if (status === 'timeout') { if (status === 'timeout') {
content = 'Request has timed out. Please ensure the application is running and check the logs for any errors.'; content = 'Request has timed out. Please ensure the application is running and check the logs for any errors.';
} else if (status === 'abort') { } else if (status === 'abort') {

View File

@ -24,8 +24,8 @@
'nf.CanvasUtils', 'nf.CanvasUtils',
'nf.ClusterSummary', 'nf.ClusterSummary',
'nf.Actions'], 'nf.Actions'],
function (angularBridge, canvasUtils, common, clusterSummary, actions) { function (nfNgBridge, nfCanvasUtils, nfCommon, nfClusterSummary, nfActions) {
return (nf.ng.AppCtrl = factory(angularBridge, canvasUtils, common, clusterSummary, actions)); return (nf.ng.AppCtrl = factory(nfNgBridge, nfCanvasUtils, nfCommon, nfClusterSummary, nfActions));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.AppCtrl = module.exports = (nf.ng.AppCtrl =
@ -41,7 +41,7 @@
root.nf.ClusterSummary, root.nf.ClusterSummary,
root.nf.Actions); root.nf.Actions);
} }
}(this, function (angularBridge, canvasUtils, common, clusterSummary, actions) { }(this, function (nfNgBridge, nfCanvasUtils, nfCommon, nfClusterSummary, nfActions) {
'use strict'; 'use strict';
return function ($scope, serviceProvider) { return function ($scope, serviceProvider) {
@ -50,10 +50,10 @@
function AppCtrl(serviceProvider) { function AppCtrl(serviceProvider) {
//add essential modules to the scope for availability throughout the angular container //add essential modules to the scope for availability throughout the angular container
this.nf = { this.nf = {
"Common": common, "Common": nfCommon,
"ClusterSummary": clusterSummary, "ClusterSummary": nfClusterSummary,
"Actions": actions, "Actions": nfActions,
"CanvasUtils": canvasUtils, "CanvasUtils": nfCanvasUtils,
}; };
//any registered angular service is available through the serviceProvider //any registered angular service is available through the serviceProvider
@ -69,6 +69,6 @@
//For production angular applications .scope() is unavailable so we set //For production angular applications .scope() is unavailable so we set
//the root scope of the bootstrapped app on the bridge //the root scope of the bootstrapped app on the bridge
angularBridge.rootScope = $scope; nfNgBridge.rootScope = $scope;
} }
})); }));

View File

@ -26,8 +26,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.CustomUi', 'nf.CustomUi',
'nf.ClusterSummary'], 'nf.ClusterSummary'],
function ($, common, universalCapture, dialog, errorHandler, customUi, clusterSummary) { function ($, nfCommon, nfUniversalCapture, nfDialog, nfErrorHandler, nfCustomUi, nfClusterSummary) {
return (nf.ProcessorDetails = factory($, common, universalCapture, dialog, errorHandler, customUi, clusterSummary)); return (nf.ProcessorDetails = factory($, nfCommon, nfUniversalCapture, nfDialog, nfErrorHandler, nfCustomUi, nfClusterSummary));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ProcessorDetails = module.exports = (nf.ProcessorDetails =
@ -47,7 +47,7 @@
root.nf.CustomUi, root.nf.CustomUi,
root.nf.ClusterSummary); root.nf.ClusterSummary);
} }
}(this, function ($, common, universalCapture, dialog, errorHandler, customUi, clusterSummary) { }(this, function ($, nfCommon, nfUniversalCapture, nfDialog, nfErrorHandler, nfCustomUi, nfClusterSummary) {
'use strict'; 'use strict';
/** /**
@ -65,7 +65,7 @@
// build the relationship container element // build the relationship container element
var relationshipContainerElement = $('<div class="processor-relationship-container"></div>').append(relationshipLabel).appendTo('#read-only-auto-terminate-relationship-names'); var relationshipContainerElement = $('<div class="processor-relationship-container"></div>').append(relationshipLabel).appendTo('#read-only-auto-terminate-relationship-names');
if (!common.isBlank(relationship.description)) { if (!nfCommon.isBlank(relationship.description)) {
var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description); var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description);
relationshipContainerElement.append(relationshipDescription); relationshipContainerElement.append(relationshipDescription);
} }
@ -99,7 +99,7 @@
}], }],
select: function () { select: function () {
// remove all property detail dialogs // remove all property detail dialogs
universalCapture.removeAllPropertyDetailDialogs(); nfUniversalCapture.removeAllPropertyDetailDialogs();
// resize the property grid in case this is the first time its rendered // resize the property grid in case this is the first time its rendered
if ($(this).text() === 'Properties') { if ($(this).text() === 'Properties') {
@ -127,25 +127,25 @@
$('#read-only-processor-properties').propertytable('clear'); $('#read-only-processor-properties').propertytable('clear');
// clear the processor details // clear the processor details
common.clearField('read-only-processor-id'); nfCommon.clearField('read-only-processor-id');
common.clearField('read-only-processor-type'); nfCommon.clearField('read-only-processor-type');
common.clearField('read-only-processor-name'); nfCommon.clearField('read-only-processor-name');
common.clearField('read-only-concurrently-schedulable-tasks'); nfCommon.clearField('read-only-concurrently-schedulable-tasks');
common.clearField('read-only-scheduling-period'); nfCommon.clearField('read-only-scheduling-period');
common.clearField('read-only-penalty-duration'); nfCommon.clearField('read-only-penalty-duration');
common.clearField('read-only-yield-duration'); nfCommon.clearField('read-only-yield-duration');
common.clearField('read-only-run-duration'); nfCommon.clearField('read-only-run-duration');
common.clearField('read-only-bulletin-level'); nfCommon.clearField('read-only-bulletin-level');
common.clearField('read-only-execution-node'); nfCommon.clearField('read-only-execution-node');
common.clearField('read-only-execution-status'); nfCommon.clearField('read-only-execution-status');
common.clearField('read-only-processor-comments'); nfCommon.clearField('read-only-processor-comments');
// removed the cached processor details // removed the cached processor details
$('#processor-details').removeData('processorDetails'); $('#processor-details').removeData('processorDetails');
$('#processor-details').removeData('processorHistory'); $('#processor-details').removeData('processorHistory');
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -170,7 +170,7 @@
url: '../nifi-api/processors/' + encodeURIComponent(processorId), url: '../nifi-api/processors/' + encodeURIComponent(processorId),
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.component)) { if (nfCommon.isDefinedAndNotNull(response.component)) {
// get the processor details // get the processor details
var details = response.component; var details = response.component;
@ -178,16 +178,16 @@
$('#processor-details').data('processorDetails', details); $('#processor-details').data('processorDetails', details);
// populate the processor settings // populate the processor settings
common.populateField('read-only-processor-id', details['id']); nfCommon.populateField('read-only-processor-id', details['id']);
common.populateField('read-only-processor-type', common.substringAfterLast(details['type'], '.')); nfCommon.populateField('read-only-processor-type', nfCommon.substringAfterLast(details['type'], '.'));
common.populateField('read-only-processor-name', details['name']); nfCommon.populateField('read-only-processor-name', details['name']);
common.populateField('read-only-concurrently-schedulable-tasks', details.config['concurrentlySchedulableTaskCount']); nfCommon.populateField('read-only-concurrently-schedulable-tasks', details.config['concurrentlySchedulableTaskCount']);
common.populateField('read-only-scheduling-period', details.config['schedulingPeriod']); nfCommon.populateField('read-only-scheduling-period', details.config['schedulingPeriod']);
common.populateField('read-only-penalty-duration', details.config['penaltyDuration']); nfCommon.populateField('read-only-penalty-duration', details.config['penaltyDuration']);
common.populateField('read-only-yield-duration', details.config['yieldDuration']); nfCommon.populateField('read-only-yield-duration', details.config['yieldDuration']);
common.populateField('read-only-run-duration', common.formatDuration(details.config['runDurationMillis'])); nfCommon.populateField('read-only-run-duration', nfCommon.formatDuration(details.config['runDurationMillis']));
common.populateField('read-only-bulletin-level', details.config['bulletinLevel']); nfCommon.populateField('read-only-bulletin-level', details.config['bulletinLevel']);
common.populateField('read-only-processor-comments', details.config['comments']); nfCommon.populateField('read-only-processor-comments', details.config['comments']);
var showRunSchedule = true; var showRunSchedule = true;
@ -204,7 +204,7 @@
} else { } else {
schedulingStrategy = "On primary node"; schedulingStrategy = "On primary node";
} }
common.populateField('read-only-scheduling-strategy', schedulingStrategy); nfCommon.populateField('read-only-scheduling-strategy', schedulingStrategy);
// only show the run schedule when applicable // only show the run schedule when applicable
if (showRunSchedule === true) { if (showRunSchedule === true) {
@ -216,13 +216,13 @@
var executionNode = details.config['executionNode']; var executionNode = details.config['executionNode'];
// only show the execution-node when applicable // only show the execution-node when applicable
if (clusterSummary.isClustered() || executionNode === 'PRIMARY') { if (nfClusterSummary.isClustered() || executionNode === 'PRIMARY') {
if (executionNode === 'ALL') { if (executionNode === 'ALL') {
executionNode = "All nodes"; executionNode = "All nodes";
} else if (executionNode === 'PRIMARY') { } else if (executionNode === 'PRIMARY') {
executionNode = "Primary node only"; executionNode = "Primary node only";
} }
common.populateField('read-only-execution-node', executionNode); nfCommon.populateField('read-only-execution-node', executionNode);
$('#read-only-execution-node-options').show(); $('#read-only-execution-node-options').show();
} else { } else {
@ -230,7 +230,7 @@
} }
// load the relationship list // load the relationship list
if (!common.isEmpty(details.relationships)) { if (!nfCommon.isEmpty(details.relationships)) {
$.each(details.relationships, function (i, relationship) { $.each(details.relationships, function (i, relationship) {
createRelationshipOption(relationship); createRelationshipOption(relationship);
}); });
@ -278,7 +278,7 @@
}]; }];
// determine if we should show the advanced button // determine if we should show the advanced button
if (top === window && common.isDefinedAndNotNull(customUi) && common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') { if (top === window && nfCommon.isDefinedAndNotNull(nfCustomUi) && nfCommon.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') {
buttons.push({ buttons.push({
buttonText: 'Advanced', buttonText: 'Advanced',
clazz: 'fa fa-cog button-icon', clazz: 'fa fa-cog button-icon',
@ -293,7 +293,7 @@
$('#processor-details').modal('hide'); $('#processor-details').modal('hide');
// show the custom ui // show the custom ui
customUi.showCustomUi(processorResponse, processor.config.customUiUrl, false); nfCustomUi.showCustomUi(processorResponse, processor.config.customUiUrl, false);
} }
} }
}); });
@ -312,12 +312,12 @@
} }
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) { if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Error', headerText: 'Error',
dialogContent: common.escapeHtml(xhr.responseText) dialogContent: nfCommon.escapeHtml(xhr.responseText)
}); });
} else { } else {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
} }
}); });
} }

View File

@ -21,8 +21,8 @@
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery', define(['jquery',
'nf.Common'], 'nf.Common'],
function ($, common) { function ($, nfCommon) {
return (nf.Shell = factory($, common)); return (nf.Shell = factory($, nfCommon));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Shell = factory(require('jquery'), module.exports = (nf.Shell = factory(require('jquery'),
@ -31,7 +31,7 @@
nf.Shell = factory(root.$, nf.Shell = factory(root.$,
root.nf.Common); root.nf.Common);
} }
}(this, function ($, common) { }(this, function ($, nfCommon) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -55,7 +55,7 @@
// register a listener when the frame is undocked // register a listener when the frame is undocked
$('#shell-undock-button').click(function () { $('#shell-undock-button').click(function () {
var uri = $('#shell-iframe').attr('src'); var uri = $('#shell-iframe').attr('src');
if (!common.isBlank(uri)) { if (!nfCommon.isBlank(uri)) {
// open the page and close the shell // open the page and close the shell
window.open(uri); window.open(uri);
@ -74,10 +74,10 @@
/** /**
* Initialize the shell. * Initialize the shell.
* *
* @param contextMenu The reference to the contextMenu controller. * @param nfContextMenuRef The nfContextMenu module.
*/ */
init: function (contextMenu) { init: function (nfContextMenuRef) {
nfContextMenu = contextMenu; nfContextMenu = nfContextMenuRef;
}, },
resizeContent: function (shell) { resizeContent: function (shell) {
@ -107,7 +107,7 @@
*/ */
showPage: function (uri, canUndock) { showPage: function (uri, canUndock) {
// if the context menu is on this page, attempt to close // if the context menu is on this page, attempt to close
if (common.isDefinedAndNotNull(nfContextMenu)) { if (nfCommon.isDefinedAndNotNull(nfContextMenu)) {
nfContextMenu.hide(); nfContextMenu.hide();
} }
@ -115,7 +115,7 @@
var shell = $('#shell'); var shell = $('#shell');
// default undockable to true // default undockable to true
if (common.isNull(canUndock) || common.isUndefined(canUndock)) { if (nfCommon.isNull(canUndock) || nfCommon.isUndefined(canUndock)) {
canUndock = true; canUndock = true;
} }
@ -128,7 +128,7 @@
// register a new open handler // register a new open handler
$('#shell-dialog').modal('setOpenHandler', function () { $('#shell-dialog').modal('setOpenHandler', function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
}); });
// show the custom processor ui // show the custom processor ui
@ -161,7 +161,7 @@
*/ */
showContent: function (domId) { showContent: function (domId) {
// if the context menu is on this page, attempt to close // if the context menu is on this page, attempt to close
if (common.isDefinedAndNotNull(nfContextMenu)) { if (nfCommon.isDefinedAndNotNull(nfContextMenu)) {
nfContextMenu.hide(); nfContextMenu.hide();
} }

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Dialog', 'nf.Dialog',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, d3, common, dialog, errorHandler) { function ($, d3, nfCommon, nfDialog, nfErrorHandler) {
return (nf.StatusHistory = factory($, d3, common, dialog, errorHandler)); return (nf.StatusHistory = factory($, d3, nfCommon, nfDialog, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.StatusHistory = factory(require('jquery'), module.exports = (nf.StatusHistory = factory(require('jquery'),
@ -40,7 +40,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, d3, common, dialog, errorHandler) { }(this, function ($, d3, nfCommon, nfDialog, nfErrorHandler) {
var config = { var config = {
nifiInstanceId: 'nifi-instance-id', nifiInstanceId: 'nifi-instance-id',
nifiInstanceLabel: 'NiFi', nifiInstanceLabel: 'NiFi',
@ -65,19 +65,19 @@
*/ */
var formatters = { var formatters = {
'DURATION': function (d) { 'DURATION': function (d) {
return common.formatDuration(d); return nfCommon.formatDuration(d);
}, },
'COUNT': function (d) { 'COUNT': function (d) {
// need to handle floating point number since this formatter // need to handle floating point number since this formatter
// will also be used for average values // will also be used for average values
if (d % 1 === 0) { if (d % 1 === 0) {
return common.formatInteger(d); return nfCommon.formatInteger(d);
} else { } else {
return common.formatFloat(d); return nfCommon.formatFloat(d);
} }
}, },
'DATA_SIZE': function (d) { 'DATA_SIZE': function (d) {
return common.formatDataSize(d); return nfCommon.formatDataSize(d);
} }
}; };
@ -125,10 +125,10 @@
// get the descriptors // get the descriptors
var descriptors = componentStatusHistory.fieldDescriptors; var descriptors = componentStatusHistory.fieldDescriptors;
statusHistory.details = componentStatusHistory.componentDetails; statusHistory.details = componentStatusHistory.componentDetails;
statusHistory.selectedDescriptor = common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor; statusHistory.selectedDescriptor = nfCommon.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor;
// ensure enough status snapshots // ensure enough status snapshots
if (common.isDefinedAndNotNull(componentStatusHistory.aggregateSnapshots) && componentStatusHistory.aggregateSnapshots.length > 1) { if (nfCommon.isDefinedAndNotNull(componentStatusHistory.aggregateSnapshots) && componentStatusHistory.aggregateSnapshots.length > 1) {
statusHistory.instances.push({ statusHistory.instances.push({
id: config.nifiInstanceId, id: config.nifiInstanceId,
label: config.nifiInstanceLabel, label: config.nifiInstanceLabel,
@ -142,7 +142,7 @@
// get the status for each node in the cluster if applicable // get the status for each node in the cluster if applicable
$.each(componentStatusHistory.nodeSnapshots, function (_, nodeSnapshots) { $.each(componentStatusHistory.nodeSnapshots, function (_, nodeSnapshots) {
// ensure enough status snapshots // ensure enough status snapshots
if (common.isDefinedAndNotNull(nodeSnapshots.statusSnapshots) && nodeSnapshots.statusSnapshots.length > 1) { if (nfCommon.isDefinedAndNotNull(nodeSnapshots.statusSnapshots) && nodeSnapshots.statusSnapshots.length > 1) {
statusHistory.instances.push({ statusHistory.instances.push({
id: nodeSnapshots.nodeId, id: nodeSnapshots.nodeId,
label: nodeSnapshots.address + ':' + nodeSnapshots.apiPort, label: nodeSnapshots.address + ':' + nodeSnapshots.apiPort,
@ -168,7 +168,7 @@
*/ */
var insufficientHistory = function () { var insufficientHistory = function () {
// notify the user // notify the user
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Status History', headerText: 'Status History',
dialogContent: 'Insufficient history, please try again later.' dialogContent: 'Insufficient history, please try again later.'
}); });
@ -216,7 +216,7 @@
options.push({ options.push({
text: d.label, text: d.label,
value: d.field, value: d.field,
description: common.escapeHtml(d.description) description: nfCommon.escapeHtml(d.description)
}); });
}); });
@ -329,7 +329,7 @@
// go through each instance of this status history // go through each instance of this status history
$.each(statusHistory.instances, function (_, instance) { $.each(statusHistory.instances, function (_, instance) {
// if this is the first time this instance is being rendered, make it visible // if this is the first time this instance is being rendered, make it visible
if (common.isUndefinedOrNull(instances[instance.id])) { if (nfCommon.isUndefinedOrNull(instances[instance.id])) {
instances[instance.id] = true; instances[instance.id] = true;
} }
@ -463,8 +463,8 @@
return s.timestamp; return s.timestamp;
}); });
}); });
addDetailItem(detailsContainer, 'Start', common.formatDateTime(minDate)); addDetailItem(detailsContainer, 'Start', nfCommon.formatDateTime(minDate));
addDetailItem(detailsContainer, 'End', common.formatDateTime(maxDate)); addDetailItem(detailsContainer, 'End', nfCommon.formatDateTime(maxDate));
// determine the x axis range // determine the x axis range
x.domain([minDate, maxDate]); x.domain([minDate, maxDate]);
@ -744,7 +744,7 @@
.on('brush', brushed); .on('brush', brushed);
// conditionally set the brush extent // conditionally set the brush extent
if (common.isDefinedAndNotNull(brushExtent)) { if (nfCommon.isDefinedAndNotNull(brushExtent)) {
brush = brush.extent(brushExtent); brush = brush.extent(brushExtent);
} }
@ -924,29 +924,29 @@
// containment // containment
// ----------- // -----------
dialog = $('#status-history-dialog'); dialog = $('#status-history-dialog');
var nfDialog = {}; var nfDialogData = {};
if (common.isDefinedAndNotNull(dialog.data('nf-dialog'))) { if (nfCommon.isDefinedAndNotNull(dialog.data('nf-dialog'))) {
nfDialog = dialog.data('nf-dialog'); nfDialogData = dialog.data('nf-dialog');
} }
nfDialog['min-width'] = (dialog.width() / $(window).width()) * 100 + '%'; nfDialogData['min-width'] = (dialog.width() / $(window).width()) * 100 + '%';
nfDialog['min-height'] = (dialog.height() / $(window).height()) * 100 + '%'; nfDialogData['min-height'] = (dialog.height() / $(window).height()) * 100 + '%';
nfDialog.responsive['fullscreen-width'] = dialog.outerWidth() + 'px'; nfDialogData.responsive['fullscreen-width'] = dialog.outerWidth() + 'px';
nfDialog.responsive['fullscreen-height'] = dialog.outerHeight() + 'px'; nfDialogData.responsive['fullscreen-height'] = dialog.outerHeight() + 'px';
maxWidth = getChartMaxWidth(); maxWidth = getChartMaxWidth();
if (ui.helper.width() > maxWidth) { if (ui.helper.width() > maxWidth) {
ui.helper.width(maxWidth); ui.helper.width(maxWidth);
nfDialog.responsive['fullscreen-width'] = $(window).width() + 'px'; nfDialogData.responsive['fullscreen-width'] = $(window).width() + 'px';
nfDialog['min-width'] = '100%'; nfDialogData['min-width'] = '100%';
} }
maxHeight = getChartMaxHeight(); maxHeight = getChartMaxHeight();
if (ui.helper.height() > maxHeight) { if (ui.helper.height() > maxHeight) {
ui.helper.height(maxHeight); ui.helper.height(maxHeight);
nfDialog.responsive['fullscreen-height'] = $(window).height() + 'px'; nfDialogData.responsive['fullscreen-height'] = $(window).height() + 'px';
nfDialog['min-height'] = '100%'; nfDialogData['min-height'] = '100%';
} }
minHeight = getChartMinHeight(); minHeight = getChartMinHeight();
@ -954,11 +954,11 @@
ui.helper.height(minHeight); ui.helper.height(minHeight);
} }
nfDialog['min-width'] = (parseInt(nfDialog['min-width'], 10) >= 100) ? '100%' : nfDialog['min-width']; nfDialogData['min-width'] = (parseInt(nfDialogData['min-width'], 10) >= 100) ? '100%' : nfDialogData['min-width'];
nfDialog['min-height'] = (parseInt(nfDialog['min-height'], 10) >= 100) ? '100%' : nfDialog['min-height']; nfDialogData['min-height'] = (parseInt(nfDialogData['min-height'], 10) >= 100) ? '100%' : nfDialogData['min-height'];
//persist data attribute //persist data attribute
dialog.data('nfDialog', nfDialog); dialog.data('nfDialog', nfDialogData);
// ---------------------- // ----------------------
// status history dialog // status history dialog
@ -1042,7 +1042,7 @@
$('<div class="setting-name"></div>').text(label).appendTo(detailContainer); $('<div class="setting-name"></div>').text(label).appendTo(detailContainer);
var detailElement = $('<div class="setting-field"></div>').text(value).appendTo(detailContainer); var detailElement = $('<div class="setting-field"></div>').text(value).appendTo(detailContainer);
if (common.isDefinedAndNotNull(valueElementId)) { if (nfCommon.isDefinedAndNotNull(valueElementId)) {
detailElement.attr('id', valueElementId); detailElement.attr('id', valueElementId);
} }
}; };
@ -1111,7 +1111,7 @@
if (e.target === window) { if (e.target === window) {
updateChart(); updateChart();
} }
common.toggleScrollable($('#status-history-details').get(0)); nfCommon.toggleScrollable($('#status-history-details').get(0));
}) })
}, },
@ -1129,7 +1129,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
handleStatusHistoryResponse(groupId, connectionId, response.statusHistory, config.type.connection, selectedDescriptor); handleStatusHistoryResponse(groupId, connectionId, response.statusHistory, config.type.connection, selectedDescriptor);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -1146,7 +1146,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
handleStatusHistoryResponse(groupId, processorId, response.statusHistory, config.type.processor, selectedDescriptor); handleStatusHistoryResponse(groupId, processorId, response.statusHistory, config.type.processor, selectedDescriptor);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -1163,7 +1163,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
handleStatusHistoryResponse(groupId, processGroupId, response.statusHistory, config.type.processGroup, selectedDescriptor); handleStatusHistoryResponse(groupId, processGroupId, response.statusHistory, config.type.processGroup, selectedDescriptor);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -1180,7 +1180,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
handleStatusHistoryResponse(groupId, remoteProcessGroupId, response.statusHistory, config.type.remoteProcessGroup, selectedDescriptor); handleStatusHistoryResponse(groupId, remoteProcessGroupId, response.statusHistory, config.type.remoteProcessGroup, selectedDescriptor);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Dialog', 'nf.Dialog',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, d3, common, dialog, errorHandler) { function ($, d3, nfCommon, nfDialog, nfErrorHandler) {
return (nf.ng.ProvenanceLineage = factory($, d3, common, dialog, errorHandler)); return (nf.ng.ProvenanceLineage = factory($, d3, nfCommon, nfDialog, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.ProvenanceLineage = module.exports = (nf.ng.ProvenanceLineage =
@ -41,7 +41,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, d3, common, dialog, errorHandler) { }(this, function ($, d3, nfCommon, nfDialog, nfErrorHandler) {
'use strict'; 'use strict';
var mySelf = function () { var mySelf = function () {
@ -136,7 +136,7 @@
data: JSON.stringify(lineageEntity), data: JSON.stringify(lineageEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -147,7 +147,7 @@
*/ */
var getLineage = function (lineage) { var getLineage = function (lineage) {
var url = lineage.uri; var url = lineage.uri;
if (common.isDefinedAndNotNull(lineage.request.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(lineage.request.clusterNodeId)) {
url += '?' + $.param({ url += '?' + $.param({
clusterNodeId: lineage.request.clusterNodeId clusterNodeId: lineage.request.clusterNodeId
}); });
@ -157,7 +157,7 @@
type: 'GET', type: 'GET',
url: url, url: url,
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -168,7 +168,7 @@
*/ */
var cancelLineage = function (lineage) { var cancelLineage = function (lineage) {
var url = lineage.uri; var url = lineage.uri;
if (common.isDefinedAndNotNull(lineage.request.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(lineage.request.clusterNodeId)) {
url += '?' + $.param({ url += '?' + $.param({
clusterNodeId: lineage.request.clusterNodeId clusterNodeId: lineage.request.clusterNodeId
}); });
@ -178,7 +178,7 @@
type: 'DELETE', type: 'DELETE',
url: url, url: url,
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var DEFAULT_NODE_SPACING = 100; var DEFAULT_NODE_SPACING = 100;
@ -216,7 +216,7 @@
descendants.add(link.target.id); descendants.add(link.target.id);
}); });
if (common.isUndefined(depth)) { if (nfCommon.isUndefined(depth)) {
locateDescendants(children, descendants); locateDescendants(children, descendants);
} else if (depth > 1) { } else if (depth > 1) {
locateDescendants(children, descendants, depth - 1); locateDescendants(children, descendants, depth - 1);
@ -483,11 +483,11 @@
node.incoming = []; node.incoming = [];
// ensure this event has an event time // ensure this event has an event time
if (common.isUndefined(minMillis) || minMillis > node.millis) { if (nfCommon.isUndefined(minMillis) || minMillis > node.millis) {
minMillis = node.millis; minMillis = node.millis;
minTimestamp = node.timestamp; minTimestamp = node.timestamp;
} }
if (common.isUndefined(maxMillis) || maxMillis < node.millis) { if (nfCommon.isUndefined(maxMillis) || maxMillis < node.millis) {
maxMillis = node.millis; maxMillis = node.millis;
} }
}); });
@ -526,7 +526,7 @@
// create the proper date by adjusting by the offsets // create the proper date by adjusting by the offsets
var date = new Date(millis + userTimeOffset + provenanceTableCtrl.serverTimeOffset); var date = new Date(millis + userTimeOffset + provenanceTableCtrl.serverTimeOffset);
return common.formatDateTime(date); return nfCommon.formatDateTime(date);
}; };
// handle context menu clicks... // handle context menu clicks...
@ -800,7 +800,7 @@
// closes the searching dialog and cancels the query on the server // closes the searching dialog and cancels the query on the server
var closeDialog = function () { var closeDialog = function () {
// cancel the provenance results since we've successfully processed the results // cancel the provenance results since we've successfully processed the results
if (common.isDefinedAndNotNull(lineage)) { if (nfCommon.isDefinedAndNotNull(lineage)) {
cancelLineage(lineage); cancelLineage(lineage);
} }
@ -827,11 +827,11 @@
} }
// close the dialog if the results contain an error // close the dialog if the results contain an error
if (!common.isEmpty(lineage.results.errors)) { if (!nfCommon.isEmpty(lineage.results.errors)) {
var errors = lineage.results.errors; var errors = lineage.results.errors;
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Lineage', headerText: 'Process Lineage',
dialogContent: common.formatUnorderedList(errors) dialogContent: nfCommon.formatUnorderedList(errors)
}); });
closeDialog(); closeDialog();
@ -851,7 +851,7 @@
renderEventLineage(results); renderEventLineage(results);
} else { } else {
// inform the user that no results were found // inform the user that no results were found
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Lineage Results', headerText: 'Lineage Results',
dialogContent: 'The lineage search has completed successfully but there no results were found. The events may have aged off.' dialogContent: 'The lineage search has completed successfully but there no results were found. The events may have aged off.'
}); });
@ -1346,7 +1346,7 @@
// closes the searching dialog and cancels the query on the server // closes the searching dialog and cancels the query on the server
var closeDialog = function () { var closeDialog = function () {
// cancel the provenance results since we've successfully processed the results // cancel the provenance results since we've successfully processed the results
if (common.isDefinedAndNotNull(lineage)) { if (nfCommon.isDefinedAndNotNull(lineage)) {
cancelLineage(lineage); cancelLineage(lineage);
} }
@ -1372,11 +1372,11 @@
} }
// close the dialog if the results contain an error // close the dialog if the results contain an error
if (!common.isEmpty(lineage.results.errors)) { if (!nfCommon.isEmpty(lineage.results.errors)) {
var errors = lineage.results.errors; var errors = lineage.results.errors;
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Process Lineage', headerText: 'Process Lineage',
dialogContent: common.formatUnorderedList(errors) dialogContent: nfCommon.formatUnorderedList(errors)
}); });
closeDialog(); closeDialog();

View File

@ -26,8 +26,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage', 'nf.Storage',
'nf.ng.Bridge'], 'nf.ng.Bridge'],
function ($, Slick, common, dialog, errorHandler, storage, angularBridge) { function ($, Slick, nfCommon, nfDialog, nfErrorHandler, nfStorage, nfNgBridge) {
return (nf.ng.ProvenanceTable = factory($, Slick, common, dialog, errorHandler, storage, angularBridge)); return (nf.ng.ProvenanceTable = factory($, Slick, nfCommon, nfDialog, nfErrorHandler, nfStorage, nfNgBridge));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.ProvenanceTable = module.exports = (nf.ng.ProvenanceTable =
@ -47,7 +47,7 @@
root.nf.Storage, root.nf.Storage,
root.nf.ng.Bridge); root.nf.ng.Bridge);
} }
}(this, function ($, Slick, common, dialog, errorHandler, storage, angularBridge) { }(this, function ($, Slick, nfCommon, nfDialog, nfErrorHandler, nfStorage, nfNgBridge) {
'use strict'; 'use strict';
var nfProvenanceTable = function (provenanceLineageCtrl) { var nfProvenanceTable = function (provenanceLineageCtrl) {
@ -93,17 +93,17 @@
var dataUri = config.urls.provenanceEvents + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction); var dataUri = config.urls.provenanceEvents + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction);
// perform the request once we've received a token // perform the request once we've received a token
common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { nfCommon.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
var parameters = {}; var parameters = {};
// conditionally include the ui extension token // conditionally include the ui extension token
if (!common.isBlank(downloadToken)) { if (!nfCommon.isBlank(downloadToken)) {
parameters['access_token'] = downloadToken; parameters['access_token'] = downloadToken;
} }
// conditionally include the cluster node id // conditionally include the cluster node id
var clusterNodeId = $('#provenance-event-cluster-node-id').text(); var clusterNodeId = $('#provenance-event-cluster-node-id').text();
if (!common.isBlank(clusterNodeId)) { if (!nfCommon.isBlank(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId; parameters['clusterNodeId'] = clusterNodeId;
} }
@ -114,7 +114,7 @@
window.open(dataUri + '?' + $.param(parameters)); window.open(dataUri + '?' + $.param(parameters));
} }
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Provenance', headerText: 'Provenance',
dialogContent: 'Unable to generate access token for downloading content.' dialogContent: 'Unable to generate access token for downloading content.'
}); });
@ -135,7 +135,7 @@
// generate tokens as necessary // generate tokens as necessary
var getAccessTokens = $.Deferred(function (deferred) { var getAccessTokens = $.Deferred(function (deferred) {
if (storage.hasItem('jwt')) { if (nfStorage.hasItem('jwt')) {
// generate a token for the ui extension and another for the callback // generate a token for the ui extension and another for the callback
var uiExtensionToken = $.ajax({ var uiExtensionToken = $.ajax({
type: 'POST', type: 'POST',
@ -152,7 +152,7 @@
var downloadToken = downloadTokenResult[0]; var downloadToken = downloadTokenResult[0];
deferred.resolve(uiExtensionToken, downloadToken); deferred.resolve(uiExtensionToken, downloadToken);
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Provenance', headerText: 'Provenance',
dialogContent: 'Unable to generate access token for viewing content.' dialogContent: 'Unable to generate access token for viewing content.'
}); });
@ -169,12 +169,12 @@
// conditionally include the cluster node id // conditionally include the cluster node id
var clusterNodeId = $('#provenance-event-cluster-node-id').text(); var clusterNodeId = $('#provenance-event-cluster-node-id').text();
if (!common.isBlank(clusterNodeId)) { if (!nfCommon.isBlank(clusterNodeId)) {
dataUriParameters['clusterNodeId'] = clusterNodeId; dataUriParameters['clusterNodeId'] = clusterNodeId;
} }
// include the download token if applicable // include the download token if applicable
if (!common.isBlank(downloadToken)) { if (!nfCommon.isBlank(downloadToken)) {
dataUriParameters['access_token'] = downloadToken; dataUriParameters['access_token'] = downloadToken;
} }
@ -200,7 +200,7 @@
}; };
// include the download token if applicable // include the download token if applicable
if (!common.isBlank(uiExtensionToken)) { if (!nfCommon.isBlank(uiExtensionToken)) {
contentViewerParameters['access_token'] = uiExtensionToken; contentViewerParameters['access_token'] = uiExtensionToken;
} }
@ -257,7 +257,7 @@
$('#modified-attribute-toggle').removeClass('checkbox-checked').addClass('checkbox-unchecked'); $('#modified-attribute-toggle').removeClass('checkbox-checked').addClass('checkbox-unchecked');
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -283,7 +283,7 @@
}); });
// if a content viewer url is specified, use it // if a content viewer url is specified, use it
if (common.isContentViewConfigured()) { if (nfCommon.isContentViewConfigured()) {
// input view // input view
$('#input-content-view').on('click', function () { $('#input-content-view').on('click', function () {
viewContent('input'); viewContent('input');
@ -303,7 +303,7 @@
// conditionally include the cluster node id // conditionally include the cluster node id
var clusterNodeId = $('#provenance-event-cluster-node-id').text(); var clusterNodeId = $('#provenance-event-cluster-node-id').text();
if (!common.isBlank(clusterNodeId)) { if (!nfCommon.isBlank(clusterNodeId)) {
replayEntity['clusterNodeId'] = clusterNodeId; replayEntity['clusterNodeId'] = clusterNodeId;
} }
@ -314,11 +314,11 @@
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).done(function (response) { }).done(function (response) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Provenance', headerText: 'Provenance',
dialogContent: 'Successfully submitted replay request.' dialogContent: 'Successfully submitted replay request.'
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
$('#event-details-dialog').modal('hide'); $('#event-details-dialog').modal('hide');
}); });
@ -388,7 +388,7 @@
$('#provenance-search-location').combo({ $('#provenance-search-location').combo({
options: searchableOptions options: searchableOptions
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// show the node search combo // show the node search combo
$('#provenance-search-location-container').show(); $('#provenance-search-location-container').show();
@ -534,7 +534,7 @@
var searchValue = $.trim(searchableField.find('input.searchable-field-input').val()); var searchValue = $.trim(searchableField.find('input.searchable-field-input').val());
// if the field isn't blank include it in the search // if the field isn't blank include it in the search
if (!common.isBlank(searchValue)) { if (!nfCommon.isBlank(searchValue)) {
searchCriteria[fieldId] = searchValue; searchCriteria[fieldId] = searchValue;
} }
}); });
@ -623,7 +623,7 @@
// define how general values are formatted // define how general values are formatted
var valueFormatter = function (row, cell, value, columnDef, dataContext) { var valueFormatter = function (row, cell, value, columnDef, dataContext) {
return common.formatValue(value); return nfCommon.formatValue(value);
}; };
// determine if the this page is in the shell // determine if the this page is in the shell
@ -634,13 +634,13 @@
var markup = ''; var markup = '';
// conditionally include the cluster node id // conditionally include the cluster node id
if (common.SUPPORTS_SVG) { if (nfCommon.SUPPORTS_SVG) {
markup += '<div title="Show Lineage" class="pointer show-lineage icon icon-lineage" style="margin-right: 3px;"></div>'; markup += '<div title="Show Lineage" class="pointer show-lineage icon icon-lineage" style="margin-right: 3px;"></div>';
} }
// conditionally support going to the component // conditionally support going to the component
var isRemotePort = dataContext.componentType === 'Remote Input Port' || dataContext.componentType === 'Remote Output Port'; var isRemotePort = dataContext.componentType === 'Remote Input Port' || dataContext.componentType === 'Remote Output Port';
if (isInShell && common.isDefinedAndNotNull(dataContext.groupId) && isRemotePort === false) { if (isInShell && nfCommon.isDefinedAndNotNull(dataContext.groupId) && isRemotePort === false) {
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To"></div>'; markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To"></div>';
} }
@ -717,7 +717,7 @@
} }
// conditionally show the action column // conditionally show the action column
if (common.SUPPORTS_SVG || isInShell) { if (nfCommon.SUPPORTS_SVG || isInShell) {
provenanceColumns.push({ provenanceColumns.push({
id: 'actions', id: 'actions',
name: '&nbsp;', name: '&nbsp;',
@ -797,7 +797,7 @@
provenanceGrid.render(); provenanceGrid.render();
// update the total number of displayed events if necessary // update the total number of displayed events if necessary
$('#displayed-events').text(common.formatInteger(args.current)); $('#displayed-events').text(nfCommon.formatInteger(args.current));
}); });
provenanceData.onRowsChanged.subscribe(function (e, args) { provenanceData.onRowsChanged.subscribe(function (e, args) {
provenanceGrid.invalidateRows(args.rows); provenanceGrid.invalidateRows(args.rows);
@ -820,7 +820,7 @@
var provenanceGrid = $('#provenance-table').data('gridInstance'); var provenanceGrid = $('#provenance-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(provenanceGrid)) { if (nfCommon.isDefinedAndNotNull(provenanceGrid)) {
var provenanceData = provenanceGrid.getData(); var provenanceData = provenanceGrid.getData();
// update the search criteria // update the search criteria
@ -874,24 +874,24 @@
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
if (sortDetails.columnId === 'eventTime') { if (sortDetails.columnId === 'eventTime') {
var aTime = common.parseDateTime(a[sortDetails.columnId]).getTime(); var aTime = nfCommon.parseDateTime(a[sortDetails.columnId]).getTime();
var bTime = common.parseDateTime(b[sortDetails.columnId]).getTime(); var bTime = nfCommon.parseDateTime(b[sortDetails.columnId]).getTime();
if (aTime === bTime) { if (aTime === bTime) {
return a['id'] - b['id']; return a['id'] - b['id'];
} else { } else {
return aTime - bTime; return aTime - bTime;
} }
} else if (sortDetails.columnId === 'fileSize') { } else if (sortDetails.columnId === 'fileSize') {
var aSize = common.parseSize(a[sortDetails.columnId]); var aSize = nfCommon.parseSize(a[sortDetails.columnId]);
var bSize = common.parseSize(b[sortDetails.columnId]); var bSize = nfCommon.parseSize(b[sortDetails.columnId]);
if (aSize === bSize) { if (aSize === bSize) {
return a['id'] - b['id']; return a['id'] - b['id'];
} else { } else {
return aSize - bSize; return aSize - bSize;
} }
} else { } else {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
if (aString === bString) { if (aString === bString) {
return a['id'] - b['id']; return a['id'] - b['id'];
} else { } else {
@ -928,7 +928,7 @@
data: JSON.stringify(provenanceEntity), data: JSON.stringify(provenanceEntity),
dataType: 'json', dataType: 'json',
contentType: 'application/json' contentType: 'application/json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -939,7 +939,7 @@
*/ */
var getProvenance = function (provenance) { var getProvenance = function (provenance) {
var url = provenance.uri; var url = provenance.uri;
if (common.isDefinedAndNotNull(provenance.request.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(provenance.request.clusterNodeId)) {
url += '?' + $.param({ url += '?' + $.param({
clusterNodeId: provenance.request.clusterNodeId, clusterNodeId: provenance.request.clusterNodeId,
summarize: true, summarize: true,
@ -956,7 +956,7 @@
type: 'GET', type: 'GET',
url: url, url: url,
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -967,7 +967,7 @@
*/ */
var cancelProvenance = function (provenance) { var cancelProvenance = function (provenance) {
var url = provenance.uri; var url = provenance.uri;
if (common.isDefinedAndNotNull(provenance.request.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(provenance.request.clusterNodeId)) {
url += '?' + $.param({ url += '?' + $.param({
clusterNodeId: provenance.request.clusterNodeId clusterNodeId: provenance.request.clusterNodeId
}); });
@ -977,7 +977,7 @@
type: 'DELETE', type: 'DELETE',
url: url, url: url,
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -990,7 +990,7 @@
var provenanceResults = provenance.results; var provenanceResults = provenance.results;
// ensure there are groups specified // ensure there are groups specified
if (common.isDefinedAndNotNull(provenanceResults.provenanceEvents)) { if (nfCommon.isDefinedAndNotNull(provenanceResults.provenanceEvents)) {
var provenanceTable = $('#provenance-table').data('gridInstance'); var provenanceTable = $('#provenance-table').data('gridInstance');
var provenanceData = provenanceTable.getData(); var provenanceData = provenanceTable.getData();
@ -1003,21 +1003,21 @@
$('#provenance-last-refreshed').text(provenanceResults.generated); $('#provenance-last-refreshed').text(provenanceResults.generated);
// update the oldest event available // update the oldest event available
$('#oldest-event').html(common.formatValue(provenanceResults.oldestEvent)); $('#oldest-event').html(nfCommon.formatValue(provenanceResults.oldestEvent));
// record the server offset // record the server offset
provenanceTableCtrl.serverTimeOffset = provenanceResults.timeOffset; provenanceTableCtrl.serverTimeOffset = provenanceResults.timeOffset;
// determines if the specified query is blank (no search terms, start or end date) // determines if the specified query is blank (no search terms, start or end date)
var isBlankQuery = function (query) { var isBlankQuery = function (query) {
return common.isUndefinedOrNull(query.startDate) && common.isUndefinedOrNull(query.endDate) && $.isEmptyObject(query.searchTerms); return nfCommon.isUndefinedOrNull(query.startDate) && nfCommon.isUndefinedOrNull(query.endDate) && $.isEmptyObject(query.searchTerms);
}; };
// update the filter message based on the request // update the filter message based on the request
if (isBlankQuery(provenanceRequest)) { if (isBlankQuery(provenanceRequest)) {
var message = 'Showing the most recent '; var message = 'Showing the most recent ';
if (provenanceResults.totalCount >= config.maxResults) { if (provenanceResults.totalCount >= config.maxResults) {
message += (common.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events, please refine the search.'); message += (nfCommon.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events, please refine the search.');
} else { } else {
message += ('events.'); message += ('events.');
} }
@ -1026,7 +1026,7 @@
} else { } else {
var message = 'Showing '; var message = 'Showing ';
if (provenanceResults.totalCount >= config.maxResults) { if (provenanceResults.totalCount >= config.maxResults) {
message += (common.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events that match the specified query, please refine the search.'); message += (nfCommon.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events that match the specified query, please refine the search.');
} else { } else {
message += ('the events that match the specified query.'); message += ('the events that match the specified query.');
} }
@ -1035,7 +1035,7 @@
} }
// update the total number of events // update the total number of events
$('#total-events').text(common.formatInteger(provenanceResults.provenanceEvents.length)); $('#total-events').text(nfCommon.formatInteger(provenanceResults.provenanceEvents.length));
} else { } else {
$('#total-events').text('0'); $('#total-events').text('0');
} }
@ -1048,11 +1048,11 @@
*/ */
var goTo = function (item) { var goTo = function (item) {
// ensure the component is still present in the flow // ensure the component is still present in the flow
if (common.isDefinedAndNotNull(item.groupId)) { if (nfCommon.isDefinedAndNotNull(item.groupId)) {
// only attempt this if we're within a frame // only attempt this if we're within a frame
if (top !== window) { if (top !== window) {
// and our parent has canvas utils and shell defined // and our parent has canvas utils and shell defined
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) { if (nfCommon.isDefinedAndNotNull(parent.nf) && nfCommon.isDefinedAndNotNull(parent.nf.CanvasUtils) && nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.showComponent(item.groupId, item.componentId); parent.nf.CanvasUtils.showComponent(item.groupId, item.componentId);
parent.$('#shell-close-button').click(); parent.$('#shell-close-button').click();
} }
@ -1083,7 +1083,7 @@
// handles init failure // handles init failure
var failure = function (xhr, status, error) { var failure = function (xhr, status, error) {
deferred.reject(); deferred.reject();
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
}; };
// initialize the lineage view // initialize the lineage view
@ -1104,7 +1104,7 @@
*/ */
resetTableSize: function () { resetTableSize: function () {
var provenanceGrid = $('#provenance-table').data('gridInstance'); var provenanceGrid = $('#provenance-table').data('gridInstance');
if (common.isDefinedAndNotNull(provenanceGrid)) { if (nfCommon.isDefinedAndNotNull(provenanceGrid)) {
provenanceGrid.resizeCanvas(); provenanceGrid.resizeCanvas();
} }
}, },
@ -1123,7 +1123,7 @@
// update the progress bar // update the progress bar
var label = $('<div class="progress-label"></div>').text(value + '%'); var label = $('<div class="progress-label"></div>').text(value + '%');
(angularBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + value + '" class="md-hue-2" md-mode="determinate" aria-label="Progress"></md-progress-linear>'))(angularBridge.rootScope)).appendTo(progressBar); (nfNgBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + value + '" class="md-hue-2" md-mode="determinate" aria-label="Progress"></md-progress-linear>'))(nfNgBridge.rootScope)).appendTo(progressBar);
progressBar.append(label); progressBar.append(label);
}, },
@ -1180,7 +1180,7 @@
// ----------------------------- // -----------------------------
// handle the specified query appropriately // handle the specified query appropriately
if (common.isDefinedAndNotNull(query)) { if (nfCommon.isDefinedAndNotNull(query)) {
// store the last query performed // store the last query performed
cachedQuery = query; cachedQuery = query;
} else if (!$.isEmptyObject(cachedQuery)) { } else if (!$.isEmptyObject(cachedQuery)) {
@ -1194,7 +1194,7 @@
// closes the searching dialog and cancels the query on the server // closes the searching dialog and cancels the query on the server
var closeDialog = function () { var closeDialog = function () {
// cancel the provenance results since we've successfully processed the results // cancel the provenance results since we've successfully processed the results
if (common.isDefinedAndNotNull(provenance)) { if (nfCommon.isDefinedAndNotNull(provenance)) {
cancelProvenance(provenance); cancelProvenance(provenance);
} }
@ -1227,11 +1227,11 @@
// process the results if they are finished // process the results if they are finished
if (provenance.finished === true) { if (provenance.finished === true) {
// show any errors when the query finishes // show any errors when the query finishes
if (!common.isEmpty(provenance.results.errors)) { if (!nfCommon.isEmpty(provenance.results.errors)) {
var errors = provenance.results.errors; var errors = provenance.results.errors;
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Provenance', headerText: 'Provenance',
dialogContent: common.formatUnorderedList(errors), dialogContent: nfCommon.formatUnorderedList(errors),
}); });
} }
@ -1270,7 +1270,7 @@
*/ */
getEventDetails: function (eventId, clusterNodeId) { getEventDetails: function (eventId, clusterNodeId) {
var url; var url;
if (common.isDefinedAndNotNull(clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(clusterNodeId)) {
url = config.urls.provenanceEvents + encodeURIComponent(eventId) + '?' + $.param({ url = config.urls.provenanceEvents + encodeURIComponent(eventId) + '?' + $.param({
clusterNodeId: clusterNodeId clusterNodeId: clusterNodeId
}); });
@ -1282,7 +1282,7 @@
type: 'GET', type: 'GET',
url: url, url: url,
dataType: 'json' dataType: 'json'
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}, },
/** /**
@ -1297,25 +1297,25 @@
// update the event details // update the event details
$('#provenance-event-id').text(event.eventId); $('#provenance-event-id').text(event.eventId);
$('#provenance-event-time').html(common.formatValue(event.eventTime)).ellipsis(); $('#provenance-event-time').html(nfCommon.formatValue(event.eventTime)).ellipsis();
$('#provenance-event-type').html(common.formatValue(event.eventType)).ellipsis(); $('#provenance-event-type').html(nfCommon.formatValue(event.eventType)).ellipsis();
$('#provenance-event-flowfile-uuid').html(common.formatValue(event.flowFileUuid)).ellipsis(); $('#provenance-event-flowfile-uuid').html(nfCommon.formatValue(event.flowFileUuid)).ellipsis();
$('#provenance-event-component-id').html(common.formatValue(event.componentId)).ellipsis(); $('#provenance-event-component-id').html(nfCommon.formatValue(event.componentId)).ellipsis();
$('#provenance-event-component-name').html(common.formatValue(event.componentName)).ellipsis(); $('#provenance-event-component-name').html(nfCommon.formatValue(event.componentName)).ellipsis();
$('#provenance-event-component-type').html(common.formatValue(event.componentType)).ellipsis(); $('#provenance-event-component-type').html(nfCommon.formatValue(event.componentType)).ellipsis();
$('#provenance-event-details').html(common.formatValue(event.details)).ellipsis(); $('#provenance-event-details').html(nfCommon.formatValue(event.details)).ellipsis();
// over the default tooltip with the actual byte count // over the default tooltip with the actual byte count
var fileSize = $('#provenance-event-file-size').html(common.formatValue(event.fileSize)).ellipsis(); var fileSize = $('#provenance-event-file-size').html(nfCommon.formatValue(event.fileSize)).ellipsis();
fileSize.attr('title', common.formatInteger(event.fileSizeBytes) + ' bytes'); fileSize.attr('title', nfCommon.formatInteger(event.fileSizeBytes) + ' bytes');
// sets an duration // sets an duration
var setDuration = function (field, value) { var setDuration = function (field, value) {
if (common.isDefinedAndNotNull(value)) { if (nfCommon.isDefinedAndNotNull(value)) {
if (value === 0) { if (value === 0) {
field.text('< 1ms'); field.text('< 1ms');
} else { } else {
field.text(common.formatDuration(value)); field.text(nfCommon.formatDuration(value));
} }
} else { } else {
field.html('<span class="unset">No value set</span>'); field.html('<span class="unset">No value set</span>');
@ -1330,7 +1330,7 @@
var formatEventDetail = function (label, value) { var formatEventDetail = function (label, value) {
$('<div class="event-detail"></div>').append( $('<div class="event-detail"></div>').append(
$('<div class="detail-name"></div>').text(label)).append( $('<div class="detail-name"></div>').text(label)).append(
$('<div class="detail-value">' + common.formatValue(value) + '</div>').ellipsis()).append( $('<div class="detail-value">' + nfCommon.formatValue(value) + '</div>').ellipsis()).append(
$('<div class="clear"></div>')).appendTo('#additional-provenance-details'); $('<div class="clear"></div>')).appendTo('#additional-provenance-details');
}; };
@ -1361,7 +1361,7 @@
} }
// conditionally show the cluster node identifier // conditionally show the cluster node identifier
if (common.isDefinedAndNotNull(event.clusterNodeId)) { if (nfCommon.isDefinedAndNotNull(event.clusterNodeId)) {
// save the cluster node id // save the cluster node id
$('#provenance-event-cluster-node-id').text(event.clusterNodeId); $('#provenance-event-cluster-node-id').text(event.clusterNodeId);
@ -1374,7 +1374,7 @@
var childUuids = $('#child-flowfiles-container'); var childUuids = $('#child-flowfiles-container');
// handle parent flowfiles // handle parent flowfiles
if (common.isEmpty(event.parentUuids)) { if (nfCommon.isEmpty(event.parentUuids)) {
$('#parent-flowfile-count').text(0); $('#parent-flowfile-count').text(0);
parentUuids.append('<span class="unset">No parents</span>'); parentUuids.append('<span class="unset">No parents</span>');
} else { } else {
@ -1385,7 +1385,7 @@
} }
// handle child flowfiles // handle child flowfiles
if (common.isEmpty(event.childUuids)) { if (nfCommon.isEmpty(event.childUuids)) {
$('#child-flowfile-count').text(0); $('#child-flowfile-count').text(0);
childUuids.append('<span class="unset">No children</span>'); childUuids.append('<span class="unset">No children</span>');
} else { } else {
@ -1402,23 +1402,23 @@
$.each(event.attributes, function (_, attribute) { $.each(event.attributes, function (_, attribute) {
// create the attribute record // create the attribute record
var attributeRecord = $('<div class="attribute-detail"></div>') var attributeRecord = $('<div class="attribute-detail"></div>')
.append($('<div class="attribute-name">' + common.formatValue(attribute.name) + '</div>').ellipsis()) .append($('<div class="attribute-name">' + nfCommon.formatValue(attribute.name) + '</div>').ellipsis())
.appendTo(attributesContainer); .appendTo(attributesContainer);
// add the current value // add the current value
attributeRecord attributeRecord
.append($('<div class="attribute-value">' + common.formatValue(attribute.value) + '</div>').ellipsis()) .append($('<div class="attribute-value">' + nfCommon.formatValue(attribute.value) + '</div>').ellipsis())
.append('<div class="clear"></div>'); .append('<div class="clear"></div>');
// show the previous value if the property has changed // show the previous value if the property has changed
if (attribute.value !== attribute.previousValue) { if (attribute.value !== attribute.previousValue) {
if (common.isDefinedAndNotNull(attribute.previousValue)) { if (nfCommon.isDefinedAndNotNull(attribute.previousValue)) {
attributeRecord attributeRecord
.append($('<div class="modified-attribute-value">' + common.formatValue(attribute.previousValue) + '<span class="unset"> (previous)</span></div>').ellipsis()) .append($('<div class="modified-attribute-value">' + nfCommon.formatValue(attribute.previousValue) + '<span class="unset"> (previous)</span></div>').ellipsis())
.append('<div class="clear"></div>'); .append('<div class="clear"></div>');
} else { } else {
attributeRecord attributeRecord
.append($('<div class="unset" style="font-size: 13px; padding-top: 2px;">' + common.formatValue(attribute.previousValue) + '</div>').ellipsis()) .append($('<div class="unset" style="font-size: 13px; padding-top: 2px;">' + nfCommon.formatValue(attribute.previousValue) + '</div>').ellipsis())
.append('<div class="clear"></div>'); .append('<div class="clear"></div>');
} }
} else { } else {
@ -1428,7 +1428,7 @@
}); });
var formatContentValue = function (element, value) { var formatContentValue = function (element, value) {
if (common.isDefinedAndNotNull(value)) { if (nfCommon.isDefinedAndNotNull(value)) {
element.removeClass('unset').text(value); element.removeClass('unset').text(value);
} else { } else {
element.addClass('unset').text('No value previously set'); element.addClass('unset').text('No value previously set');
@ -1446,9 +1446,9 @@
// input content file size // input content file size
var inputContentSize = $('#input-content-size'); var inputContentSize = $('#input-content-size');
formatContentValue(inputContentSize, event.inputContentClaimFileSize); formatContentValue(inputContentSize, event.inputContentClaimFileSize);
if (common.isDefinedAndNotNull(event.inputContentClaimFileSize)) { if (nfCommon.isDefinedAndNotNull(event.inputContentClaimFileSize)) {
// over the default tooltip with the actual byte count // over the default tooltip with the actual byte count
inputContentSize.attr('title', common.formatInteger(event.inputContentClaimFileSizeBytes) + ' bytes'); inputContentSize.attr('title', nfCommon.formatInteger(event.inputContentClaimFileSizeBytes) + ' bytes');
} }
formatContentValue($('#output-content-container'), event.outputContentClaimContainer); formatContentValue($('#output-content-container'), event.outputContentClaimContainer);
@ -1460,15 +1460,15 @@
// output content file size // output content file size
var outputContentSize = $('#output-content-size'); var outputContentSize = $('#output-content-size');
formatContentValue(outputContentSize, event.outputContentClaimFileSize); formatContentValue(outputContentSize, event.outputContentClaimFileSize);
if (common.isDefinedAndNotNull(event.outputContentClaimFileSize)) { if (nfCommon.isDefinedAndNotNull(event.outputContentClaimFileSize)) {
// over the default tooltip with the actual byte count // over the default tooltip with the actual byte count
outputContentSize.attr('title', common.formatInteger(event.outputContentClaimFileSizeBytes) + ' bytes'); outputContentSize.attr('title', nfCommon.formatInteger(event.outputContentClaimFileSizeBytes) + ' bytes');
} }
if (event.inputContentAvailable === true) { if (event.inputContentAvailable === true) {
$('#input-content-download').show(); $('#input-content-download').show();
if (common.isContentViewConfigured()) { if (nfCommon.isContentViewConfigured()) {
$('#input-content-view').show(); $('#input-content-view').show();
} else { } else {
$('#input-content-view').hide(); $('#input-content-view').hide();
@ -1481,7 +1481,7 @@
if (event.outputContentAvailable === true) { if (event.outputContentAvailable === true) {
$('#output-content-download').show(); $('#output-content-download').show();
if (common.isContentViewConfigured()) { if (nfCommon.isContentViewConfigured()) {
$('#output-content-view').show(); $('#output-content-view').show();
} else { } else {
$('#output-content-view').hide(); $('#output-content-view').hide();

View File

@ -31,25 +31,25 @@
'nf.Storage'], 'nf.Storage'],
function ($, function ($,
angular, angular,
common, nfCommon,
appConfig, appConfig,
appCtrl, appCtrl,
provenanceLineage, provenanceLineage,
provenanceTable, provenanceTable,
angularBridge, nfNgBridge,
errorHandler, nfErrorHandler,
storage) { nfStorage) {
return (nf.ng.Provenance = return (nf.ng.Provenance =
factory($, factory($,
angular, angular,
common, nfCommon,
appConfig, appConfig,
appCtrl, appCtrl,
provenanceLineage, provenanceLineage,
provenanceTable, provenanceTable,
angularBridge, nfNgBridge,
errorHandler, nfErrorHandler,
storage)); nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Provenance = module.exports = (nf.ng.Provenance =
@ -75,7 +75,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, angular, common, appConfig, appCtrl, provenanceLineage, provenanceTable, angularBridge, errorHandler, storage) { }(this, function ($, angular, nfCommon, appConfig, appCtrl, provenanceLineage, provenanceTable, nfNgBridge, nfErrorHandler, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -101,10 +101,10 @@
app.service('provenanceTableCtrl', provenanceTable); app.service('provenanceTableCtrl', provenanceTable);
//Manually Boostrap Angular App //Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngProvenanceApp'], {strictDi: true}); nfNgBridge.injector = angular.bootstrap($('body'), ['ngProvenanceApp'], {strictDi: true});
// initialize the status page // initialize the status page
angularBridge.injector.get('provenanceCtrl').init(); nfNgBridge.injector.get('provenanceCtrl').init();
}); });
var nfProvenance = function (provenanceTableCtrl) { var nfProvenance = function (provenanceTableCtrl) {
@ -135,7 +135,7 @@
url: config.urls.clusterSummary url: config.urls.clusterSummary
}).done(function (response) { }).done(function (response) {
isClustered = response.clusterSummary.connectedToCluster; isClustered = response.clusterSummary.connectedToCluster;
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -158,14 +158,14 @@
$('.timezone').text(aboutDetails.timezone); $('.timezone').text(aboutDetails.timezone);
// store the content viewer url if available // store the content viewer url if available
if (!common.isBlank(aboutDetails.contentViewerUrl)) { if (!nfCommon.isBlank(aboutDetails.contentViewerUrl)) {
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl); $('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
} }
// set the document title and the about title // set the document title and the about title
document.title = provenanceTitle; document.title = provenanceTitle;
$('#provenance-header-text').text(provenanceTitle); $('#provenance-header-text').text(provenanceTitle);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -177,8 +177,8 @@
url: config.urls.currentUser, url: config.urls.currentUser,
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -200,8 +200,8 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -215,7 +215,7 @@
updateTop('provenance'); updateTop('provenance');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -231,7 +231,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -250,7 +250,7 @@
* Initializes the status page. * Initializes the status page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
// load the user and detect if the NiFi is clustered // load the user and detect if the NiFi is clustered
$.when(loadAbout(), loadCurrentUser(), detectedCluster()).done(function () { $.when(loadAbout(), loadCurrentUser(), detectedCluster()).done(function () {
@ -346,7 +346,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
}); });
}); });

View File

@ -23,8 +23,8 @@
'nf.Common', 'nf.Common',
'nf.Dialog', 'nf.Dialog',
'nf.SummaryTable'], 'nf.SummaryTable'],
function ($, common, dialog, summaryTable) { function ($, nfCommon, nfDialog, nfSummaryTable) {
return (nf.ClusterSearch = factory($, common, dialog, summaryTable)); return (nf.ClusterSearch = factory($, nfCommon, nfDialog, nfSummaryTable));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ClusterSearch = module.exports = (nf.ClusterSearch =
@ -38,7 +38,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.SummaryTable); root.nf.SummaryTable);
} }
}(this, function ($, common, dialog, summaryTable) { }(this, function ($, nfCommon, nfDialog, nfSummaryTable) {
'use strict'; 'use strict';
/** /**
@ -85,10 +85,10 @@
// selects the specified node // selects the specified node
var selectNode = function (node) { var selectNode = function (node) {
// update the urls to point to this specific node of the cluster // update the urls to point to this specific node of the cluster
summaryTable.setClusterNodeId(node.id); nfSummaryTable.setClusterNodeId(node.id);
// load the summary for the selected node // load the summary for the selected node
summaryTable.loadSummaryTable(); nfSummaryTable.loadSummaryTable();
// update the header // update the header
$('#summary-header-text').text(node.address + ' Summary'); $('#summary-header-text').text(node.address + ' Summary');
@ -96,9 +96,9 @@
// ensure the search found some results // ensure the search found some results
if (!$.isArray(searchResults) || searchResults.length === 0) { if (!$.isArray(searchResults) || searchResults.length === 0) {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Cluster Search', headerText: 'Cluster Search',
dialogContent: 'No nodes match \'' + common.escapeHtml(clusterSearchTerm) + '\'.' dialogContent: 'No nodes match \'' + nfCommon.escapeHtml(clusterSearchTerm) + '\'.'
}); });
} else if (searchResults.length > 1) { } else if (searchResults.length > 1) {
var exactMatch = false; var exactMatch = false;
@ -117,9 +117,9 @@
// close the dialog // close the dialog
$('#view-single-node-dialog').modal('hide'); $('#view-single-node-dialog').modal('hide');
} else { } else {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Cluster Search', headerText: 'Cluster Search',
dialogContent: 'More than one node matches \'' + common.escapeHtml(clusterSearchTerm) + '\'.' dialogContent: 'More than one node matches \'' + nfCommon.escapeHtml(clusterSearchTerm) + '\'.'
}); });
} }
} else if (searchResults.length === 1) { } else if (searchResults.length === 1) {
@ -234,8 +234,8 @@
// handle the view cluster click event // handle the view cluster click event
$('#view-cluster-link').click(function () { $('#view-cluster-link').click(function () {
// reset the urls and refresh the table // reset the urls and refresh the table
summaryTable.setClusterNodeId(null); nfSummaryTable.setClusterNodeId(null);
summaryTable.loadSummaryTable(); nfSummaryTable.loadSummaryTable();
// update the header // update the header
$('#summary-header-text').text('NiFi Summary'); $('#summary-header-text').text('NiFi Summary');

View File

@ -26,8 +26,8 @@
'nf.ProcessorDetails', 'nf.ProcessorDetails',
'nf.ConnectionDetails', 'nf.ConnectionDetails',
'nf.ng.Bridge'], 'nf.ng.Bridge'],
function ($, Slick, common, errorHandler, statusHistory, processorDetails, connectionDetails, angularBridge) { function ($, Slick, nfCommon, nfErrorHandler, nfStatusHistory, nfProcessorDetails, nfConnectionDetails, nfNgBridge) {
return (nf.SummaryTable = factory($, Slick, common, errorHandler, statusHistory, processorDetails, connectionDetails, angularBridge)); return (nf.SummaryTable = factory($, Slick, nfCommon, nfErrorHandler, nfStatusHistory, nfProcessorDetails, nfConnectionDetails, nfNgBridge));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.SummaryTable = module.exports = (nf.SummaryTable =
@ -49,7 +49,7 @@
root.nf.ConnectionDetails, root.nf.ConnectionDetails,
root.nf.ng.Bridge); root.nf.ng.Bridge);
} }
}(this, function ($, Slick, common, errorHandler, statusHistory, processorDetails, connectionDetails, angularBridge) { }(this, function ($, Slick, nfCommon, nfErrorHandler, nfStatusHistory, nfProcessorDetails, nfConnectionDetails, nfNgBridge) {
'use strict'; 'use strict';
/** /**
@ -74,7 +74,7 @@
// only attempt this if we're within a frame // only attempt this if we're within a frame
if (top !== window) { if (top !== window) {
// and our parent has canvas utils and shell defined // and our parent has canvas utils and shell defined
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) { if (nfCommon.isDefinedAndNotNull(parent.nf) && nfCommon.isDefinedAndNotNull(parent.nf.CanvasUtils) && nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.showComponent(groupId, componentId); parent.nf.CanvasUtils.showComponent(groupId, componentId);
parent.$('#shell-close-button').click(); parent.$('#shell-close-button').click();
} }
@ -121,12 +121,12 @@
if (tab === 'Processors') { if (tab === 'Processors') {
// ensure the processor table is sized properly // ensure the processor table is sized properly
var processorsGrid = $('#processor-summary-table').data('gridInstance'); var processorsGrid = $('#processor-summary-table').data('gridInstance');
if (common.isDefinedAndNotNull(processorsGrid)) { if (nfCommon.isDefinedAndNotNull(processorsGrid)) {
processorsGrid.resizeCanvas(); processorsGrid.resizeCanvas();
// update the total number of processors // update the total number of processors
$('#displayed-items').text(common.formatInteger(processorsGrid.getData().getLength())); $('#displayed-items').text(nfCommon.formatInteger(processorsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(processorsGrid.getData().getLength())); $('#total-items').text(nfCommon.formatInteger(processorsGrid.getData().getLength()));
} }
// update the combo for processors // update the combo for processors
@ -145,12 +145,12 @@
} else if (tab === 'Connections') { } else if (tab === 'Connections') {
// ensure the connection table is size properly // ensure the connection table is size properly
var connectionsGrid = $('#connection-summary-table').data('gridInstance'); var connectionsGrid = $('#connection-summary-table').data('gridInstance');
if (common.isDefinedAndNotNull(connectionsGrid)) { if (nfCommon.isDefinedAndNotNull(connectionsGrid)) {
connectionsGrid.resizeCanvas(); connectionsGrid.resizeCanvas();
// update the total number of connections // update the total number of connections
$('#displayed-items').text(common.formatInteger(connectionsGrid.getData().getLength())); $('#displayed-items').text(nfCommon.formatInteger(connectionsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(connectionsGrid.getData().getLength())); $('#total-items').text(nfCommon.formatInteger(connectionsGrid.getData().getLength()));
} }
// update the combo for connections // update the combo for connections
@ -172,12 +172,12 @@
} else if (tab === 'Input Ports') { } else if (tab === 'Input Ports') {
// ensure the connection table is size properly // ensure the connection table is size properly
var inputPortsGrid = $('#input-port-summary-table').data('gridInstance'); var inputPortsGrid = $('#input-port-summary-table').data('gridInstance');
if (common.isDefinedAndNotNull(inputPortsGrid)) { if (nfCommon.isDefinedAndNotNull(inputPortsGrid)) {
inputPortsGrid.resizeCanvas(); inputPortsGrid.resizeCanvas();
// update the total number of input ports // update the total number of input ports
$('#displayed-items').text(common.formatInteger(inputPortsGrid.getData().getLength())); $('#displayed-items').text(nfCommon.formatInteger(inputPortsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(inputPortsGrid.getData().getLength())); $('#total-items').text(nfCommon.formatInteger(inputPortsGrid.getData().getLength()));
} }
// update the combo for input ports // update the combo for input ports
@ -193,12 +193,12 @@
} else if (tab === 'Output Ports') { } else if (tab === 'Output Ports') {
// ensure the connection table is size properly // ensure the connection table is size properly
var outputPortsGrid = $('#output-port-summary-table').data('gridInstance'); var outputPortsGrid = $('#output-port-summary-table').data('gridInstance');
if (common.isDefinedAndNotNull(outputPortsGrid)) { if (nfCommon.isDefinedAndNotNull(outputPortsGrid)) {
outputPortsGrid.resizeCanvas(); outputPortsGrid.resizeCanvas();
// update the total number of output ports // update the total number of output ports
$('#displayed-items').text(common.formatInteger(outputPortsGrid.getData().getLength())); $('#displayed-items').text(nfCommon.formatInteger(outputPortsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(outputPortsGrid.getData().getLength())); $('#total-items').text(nfCommon.formatInteger(outputPortsGrid.getData().getLength()));
} }
// update the combo for output ports // update the combo for output ports
@ -214,12 +214,12 @@
} else if (tab === 'Remote Process Groups') { } else if (tab === 'Remote Process Groups') {
// ensure the connection table is size properly // ensure the connection table is size properly
var remoteProcessGroupsGrid = $('#remote-process-group-summary-table').data('gridInstance'); var remoteProcessGroupsGrid = $('#remote-process-group-summary-table').data('gridInstance');
if (common.isDefinedAndNotNull(remoteProcessGroupsGrid)) { if (nfCommon.isDefinedAndNotNull(remoteProcessGroupsGrid)) {
remoteProcessGroupsGrid.resizeCanvas(); remoteProcessGroupsGrid.resizeCanvas();
// update the total number of remote process groups // update the total number of remote process groups
$('#displayed-items').text(common.formatInteger(remoteProcessGroupsGrid.getData().getLength())); $('#displayed-items').text(nfCommon.formatInteger(remoteProcessGroupsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(remoteProcessGroupsGrid.getData().getLength())); $('#total-items').text(nfCommon.formatInteger(remoteProcessGroupsGrid.getData().getLength()));
} }
// update the combo for remote process groups // update the combo for remote process groups
@ -238,12 +238,12 @@
} else { } else {
// ensure the connection table is size properly // ensure the connection table is size properly
var processGroupGrid = $('#process-group-summary-table').data('gridInstance'); var processGroupGrid = $('#process-group-summary-table').data('gridInstance');
if (common.isDefinedAndNotNull(processGroupGrid)) { if (nfCommon.isDefinedAndNotNull(processGroupGrid)) {
processGroupGrid.resizeCanvas(); processGroupGrid.resizeCanvas();
// update the total number of process groups // update the total number of process groups
$('#displayed-items').text(common.formatInteger(processGroupGrid.getData().getLength())); $('#displayed-items').text(nfCommon.formatInteger(processGroupGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(processGroupGrid.getData().getLength())); $('#total-items').text(nfCommon.formatInteger(processGroupGrid.getData().getLength()));
} }
// update the combo for process groups // update the combo for process groups
@ -269,8 +269,8 @@
var markup = '<div title="View Processor Details" class="pointer show-processor-details fa fa-info-circle" style="margin-right: 3px;"></div>'; var markup = '<div title="View Processor Details" class="pointer show-processor-details fa fa-info-circle" style="margin-right: 3px;"></div>';
// if there are bulletins, render them on the graph // if there are bulletins, render them on the graph
if (!common.isEmpty(dataContext.bulletins)) { if (!nfCommon.isEmpty(dataContext.bulletins)) {
markup += '<div class="has-bulletins fa fa-sticky-note-o"></div><span class="hidden row-id">' + common.escapeHtml(dataContext.id) + '</span>'; markup += '<div class="has-bulletins fa fa-sticky-note-o"></div><span class="hidden row-id">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
} }
return markup; return markup;
@ -283,22 +283,22 @@
// formatter for tasks // formatter for tasks
var taskTimeFormatter = function (row, cell, value, columnDef, dataContext) { var taskTimeFormatter = function (row, cell, value, columnDef, dataContext) {
return common.formatInteger(dataContext.tasks) + ' / ' + dataContext.tasksDuration; return nfCommon.formatInteger(dataContext.tasks) + ' / ' + dataContext.tasksDuration;
}; };
// function for formatting the last accessed time // function for formatting the last accessed time
var valueFormatter = function (row, cell, value, columnDef, dataContext) { var valueFormatter = function (row, cell, value, columnDef, dataContext) {
return common.formatValue(value); return nfCommon.formatValue(value);
}; };
// define a custom formatter for the run status column // define a custom formatter for the run status column
var runStatusFormatter = function (row, cell, value, columnDef, dataContext) { var runStatusFormatter = function (row, cell, value, columnDef, dataContext) {
var activeThreadCount = ''; var activeThreadCount = '';
if (common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) { if (nfCommon.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.activeThreadCount + ')'; activeThreadCount = '(' + dataContext.activeThreadCount + ')';
} }
var classes = common.escapeHtml(value.toLowerCase()); var classes = nfCommon.escapeHtml(value.toLowerCase());
switch (common.escapeHtml(value.toLowerCase())) { switch (nfCommon.escapeHtml(value.toLowerCase())) {
case 'running': case 'running':
classes += ' fa fa-play running'; classes += ' fa fa-play running';
break; break;
@ -318,7 +318,7 @@
classes += ''; classes += '';
} }
var formattedValue = '<div layout="row"><div class="' + classes + '"></div>'; var formattedValue = '<div layout="row"><div class="' + classes + '"></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + common.escapeHtml(value) + '</div><div style="float: left; margin-left: 4px;">' + common.escapeHtml(activeThreadCount) + '</div></div>'; return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + nfCommon.escapeHtml(value) + '</div><div style="float: left; margin-left: 4px;">' + nfCommon.escapeHtml(activeThreadCount) + '</div></div>';
}; };
// define the input, read, written, and output columns (reused between both tables) // define the input, read, written, and output columns (reused between both tables)
@ -395,7 +395,7 @@
var isInShell = (top !== window); var isInShell = (top !== window);
// add an action column if appropriate // add an action column if appropriate
if (isClustered || isInShell || common.SUPPORTS_SVG) { if (isClustered || isInShell || nfCommon.SUPPORTS_SVG) {
// define how the column is formatted // define how the column is formatted
var processorActionFormatter = function (row, cell, value, columnDef, dataContext) { var processorActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = ''; var markup = '';
@ -404,7 +404,7 @@
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Processor" style="margin-right: 3px;"></div>'; markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Processor" style="margin-right: 3px;"></div>';
} }
if (common.SUPPORTS_SVG) { if (nfCommon.SUPPORTS_SVG) {
markup += '<div class="pointer show-processor-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>'; markup += '<div class="pointer show-processor-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
} }
@ -479,7 +479,7 @@
if (target.hasClass('go-to')) { if (target.hasClass('go-to')) {
goTo(item.groupId, item.id); goTo(item.groupId, item.id);
} else if (target.hasClass('show-processor-status-history')) { } else if (target.hasClass('show-processor-status-history')) {
statusHistory.showProcessorChart(item.groupId, item.id); nfStatusHistory.showProcessorChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-processor-summary')) { } else if (target.hasClass('show-cluster-processor-summary')) {
// load the cluster processor summary // load the cluster processor summary
loadClusterProcessorSummary(item.groupId, item.id); loadClusterProcessorSummary(item.groupId, item.id);
@ -495,7 +495,7 @@
} }
} else if (processorsGrid.getColumns()[args.cell].id === 'moreDetails') { } else if (processorsGrid.getColumns()[args.cell].id === 'moreDetails') {
if (target.hasClass('show-processor-details')) { if (target.hasClass('show-processor-details')) {
processorDetails.showDetails(item.groupId, item.id); nfProcessorDetails.showDetails(item.groupId, item.id);
} }
} }
}); });
@ -507,7 +507,7 @@
// update the total number of displayed processors if necessary // update the total number of displayed processors if necessary
if ($('#processor-summary-table').is(':visible')) { if ($('#processor-summary-table').is(':visible')) {
$('#displayed-items').text(common.formatInteger(args.current)); $('#displayed-items').text(nfCommon.formatInteger(args.current));
} }
}); });
processorsData.onRowsChanged.subscribe(function (e, args) { processorsData.onRowsChanged.subscribe(function (e, args) {
@ -525,12 +525,12 @@
var item = processorsData.getItemById(processorId); var item = processorsData.getItemById(processorId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(item.bulletins); var bulletins = nfCommon.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, { bulletinIcon.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: tooltip, content: tooltip,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -646,11 +646,11 @@
var backpressureFormatter = function (row, cell, value, columnDef, dataContext) { var backpressureFormatter = function (row, cell, value, columnDef, dataContext) {
var percentUseCount = 'NA'; var percentUseCount = 'NA';
if (common.isDefinedAndNotNull(dataContext.percentUseCount)) { if (nfCommon.isDefinedAndNotNull(dataContext.percentUseCount)) {
percentUseCount = dataContext.percentUseCount + '%'; percentUseCount = dataContext.percentUseCount + '%';
} }
var percentUseBytes = 'NA'; var percentUseBytes = 'NA';
if (common.isDefinedAndNotNull(dataContext.percentUseBytes)) { if (nfCommon.isDefinedAndNotNull(dataContext.percentUseBytes)) {
percentUseBytes = dataContext.percentUseBytes + '%'; percentUseBytes = dataContext.percentUseBytes + '%';
} }
return percentUseCount + ' / ' + percentUseBytes; return percentUseCount + ' / ' + percentUseBytes;
@ -704,7 +704,7 @@
]; ];
// add an action column if appropriate // add an action column if appropriate
if (isClustered || isInShell || common.SUPPORTS_SVG) { if (isClustered || isInShell || nfCommon.SUPPORTS_SVG) {
// define how the column is formatted // define how the column is formatted
var connectionActionFormatter = function (row, cell, value, columnDef, dataContext) { var connectionActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = ''; var markup = '';
@ -713,7 +713,7 @@
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Connection" style="margin-right: 3px;"></div>'; markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Connection" style="margin-right: 3px;"></div>';
} }
if (common.SUPPORTS_SVG) { if (nfCommon.SUPPORTS_SVG) {
markup += '<div class="pointer show-connection-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>'; markup += '<div class="pointer show-connection-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
} }
@ -788,7 +788,7 @@
if (target.hasClass('go-to')) { if (target.hasClass('go-to')) {
goTo(item.groupId, item.id); goTo(item.groupId, item.id);
} else if (target.hasClass('show-connection-status-history')) { } else if (target.hasClass('show-connection-status-history')) {
statusHistory.showConnectionChart(item.groupId, item.id); nfStatusHistory.showConnectionChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-connection-summary')) { } else if (target.hasClass('show-cluster-connection-summary')) {
// load the cluster processor summary // load the cluster processor summary
loadClusterConnectionSummary(item.groupId, item.id); loadClusterConnectionSummary(item.groupId, item.id);
@ -804,7 +804,7 @@
} }
} else if (connectionsGrid.getColumns()[args.cell].id === 'moreDetails') { } else if (connectionsGrid.getColumns()[args.cell].id === 'moreDetails') {
if (target.hasClass('show-connection-details')) { if (target.hasClass('show-connection-details')) {
connectionDetails.showDetails(item.groupId, item.id); nfConnectionDetails.showDetails(item.groupId, item.id);
} }
} }
}); });
@ -816,7 +816,7 @@
// update the total number of displayed processors, if necessary // update the total number of displayed processors, if necessary
if ($('#connection-summary-table').is(':visible')) { if ($('#connection-summary-table').is(':visible')) {
$('#displayed-items').text(common.formatInteger(args.current)); $('#displayed-items').text(nfCommon.formatInteger(args.current));
} }
}); });
connectionsData.onRowsChanged.subscribe(function (e, args) { connectionsData.onRowsChanged.subscribe(function (e, args) {
@ -924,8 +924,8 @@
var markup = ''; var markup = '';
// if there are bulletins, render them on the graph // if there are bulletins, render them on the graph
if (!common.isEmpty(dataContext.bulletins)) { if (!nfCommon.isEmpty(dataContext.bulletins)) {
markup += '<div class="has-bulletins fa fa-sticky-note-o" style="margin-top: 5px; margin-left: 5px; float: left;"></div><span class="hidden row-id">' + common.escapeHtml(dataContext.id) + '</span>'; markup += '<div class="has-bulletins fa fa-sticky-note-o" style="margin-top: 5px; margin-left: 5px; float: left;"></div><span class="hidden row-id">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
} }
return markup; return markup;
@ -983,7 +983,7 @@
]; ];
// add an action column if appropriate // add an action column if appropriate
if (isClustered || isInShell || common.SUPPORTS_SVG) { if (isClustered || isInShell || nfCommon.SUPPORTS_SVG) {
// define how the column is formatted // define how the column is formatted
var processGroupActionFormatter = function (row, cell, value, columnDef, dataContext) { var processGroupActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = ''; var markup = '';
@ -992,7 +992,7 @@
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Process Group" style="margin-right: 3px;"></div>'; markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Process Group" style="margin-right: 3px;"></div>';
} }
if (common.SUPPORTS_SVG) { if (nfCommon.SUPPORTS_SVG) {
markup += '<div class="pointer show-process-group-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>'; markup += '<div class="pointer show-process-group-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
} }
@ -1065,12 +1065,12 @@
// determine the desired action // determine the desired action
if (processGroupsGrid.getColumns()[args.cell].id === 'actions') { if (processGroupsGrid.getColumns()[args.cell].id === 'actions') {
if (target.hasClass('go-to')) { if (target.hasClass('go-to')) {
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.ProcessGroup) && common.isDefinedAndNotNull(parent.nf.Shell)) { if (nfCommon.isDefinedAndNotNull(parent.nf) && nfCommon.isDefinedAndNotNull(parent.nf.ProcessGroup) && nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.ProcessGroup.enterGroup(item.id); parent.nf.ProcessGroup.enterGroup(item.id);
parent.$('#shell-close-button').click(); parent.$('#shell-close-button').click();
} }
} else if (target.hasClass('show-process-group-status-history')) { } else if (target.hasClass('show-process-group-status-history')) {
statusHistory.showProcessGroupChart(item.groupId, item.id); nfStatusHistory.showProcessGroupChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-process-group-summary')) { } else if (target.hasClass('show-cluster-process-group-summary')) {
// load the cluster processor summary // load the cluster processor summary
loadClusterProcessGroupSummary(item.id); loadClusterProcessGroupSummary(item.id);
@ -1094,7 +1094,7 @@
// update the total number of displayed process groups if necessary // update the total number of displayed process groups if necessary
if ($('#process-group-summary-table').is(':visible')) { if ($('#process-group-summary-table').is(':visible')) {
$('#displayed-items').text(common.formatInteger(args.current)); $('#displayed-items').text(nfCommon.formatInteger(args.current));
} }
}); });
processGroupsData.onRowsChanged.subscribe(function (e, args) { processGroupsData.onRowsChanged.subscribe(function (e, args) {
@ -1112,12 +1112,12 @@
var item = processGroupsData.getItemById(processGroupId); var item = processGroupsData.getItemById(processGroupId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(item.bulletins); var bulletins = nfCommon.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, { bulletinIcon.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: tooltip, content: tooltip,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -1338,7 +1338,7 @@
// update the total number of displayed processors, if necessary // update the total number of displayed processors, if necessary
if ($('#input-port-summary-table').is(':visible')) { if ($('#input-port-summary-table').is(':visible')) {
$('#display-items').text(common.formatInteger(args.current)); $('#display-items').text(nfCommon.formatInteger(args.current));
} }
}); });
inputPortsData.onRowsChanged.subscribe(function (e, args) { inputPortsData.onRowsChanged.subscribe(function (e, args) {
@ -1356,12 +1356,12 @@
var item = inputPortsData.getItemById(portId); var item = inputPortsData.getItemById(portId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(item.bulletins); var bulletins = nfCommon.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, { bulletinIcon.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: tooltip, content: tooltip,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -1578,7 +1578,7 @@
// update the total number of displayed processors, if necessary // update the total number of displayed processors, if necessary
if ($('#output-port-summary-table').is(':visible')) { if ($('#output-port-summary-table').is(':visible')) {
$('#display-items').text(common.formatInteger(args.current)); $('#display-items').text(nfCommon.formatInteger(args.current));
} }
}); });
outputPortsData.onRowsChanged.subscribe(function (e, args) { outputPortsData.onRowsChanged.subscribe(function (e, args) {
@ -1596,12 +1596,12 @@
var item = outputPortsData.getItemById(portId); var item = outputPortsData.getItemById(portId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(item.bulletins); var bulletins = nfCommon.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, { bulletinIcon.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: tooltip, content: tooltip,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -1710,7 +1710,7 @@
// define a custom formatter for the run status column // define a custom formatter for the run status column
var transmissionStatusFormatter = function (row, cell, value, columnDef, dataContext) { var transmissionStatusFormatter = function (row, cell, value, columnDef, dataContext) {
var activeThreadCount = ''; var activeThreadCount = '';
if (common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) { if (nfCommon.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.activeThreadCount + ')'; activeThreadCount = '(' + dataContext.activeThreadCount + ')';
} }
@ -1727,7 +1727,7 @@
// generate the mark up // generate the mark up
var formattedValue = '<div layout="row"><div class="' + transmissionClass + '"></div>'; var formattedValue = '<div layout="row"><div class="' + transmissionClass + '"></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + transmissionLabel + '</div><div style="float: left; margin-left: 4px;">' + common.escapeHtml(activeThreadCount) + '</div></div>'; return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + transmissionLabel + '</div><div style="float: left; margin-left: 4px;">' + nfCommon.escapeHtml(activeThreadCount) + '</div></div>';
}; };
var transmissionStatusColumn = { var transmissionStatusColumn = {
@ -1767,7 +1767,7 @@
]; ];
// add an action column if appropriate // add an action column if appropriate
if (isClustered || isInShell || common.SUPPORTS_SVG) { if (isClustered || isInShell || nfCommon.SUPPORTS_SVG) {
// define how the column is formatted // define how the column is formatted
var remoteProcessGroupActionFormatter = function (row, cell, value, columnDef, dataContext) { var remoteProcessGroupActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = ''; var markup = '';
@ -1776,7 +1776,7 @@
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Process Group" style="margin-right: 3px;"></div>'; markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Process Group" style="margin-right: 3px;"></div>';
} }
if (common.SUPPORTS_SVG) { if (nfCommon.SUPPORTS_SVG) {
markup += '<div class="pointer show-remote-process-group-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>'; markup += '<div class="pointer show-remote-process-group-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
} }
@ -1851,7 +1851,7 @@
if (target.hasClass('go-to')) { if (target.hasClass('go-to')) {
goTo(item.groupId, item.id); goTo(item.groupId, item.id);
} else if (target.hasClass('show-remote-process-group-status-history')) { } else if (target.hasClass('show-remote-process-group-status-history')) {
statusHistory.showRemoteProcessGroupChart(item.groupId, item.id); nfStatusHistory.showRemoteProcessGroupChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-remote-process-group-summary')) { } else if (target.hasClass('show-cluster-remote-process-group-summary')) {
// load the cluster processor summary // load the cluster processor summary
loadClusterRemoteProcessGroupSummary(item.groupId, item.id); loadClusterRemoteProcessGroupSummary(item.groupId, item.id);
@ -1875,7 +1875,7 @@
// update the total number of displayed processors, if necessary // update the total number of displayed processors, if necessary
if ($('#remote-process-group-summary-table').is(':visible')) { if ($('#remote-process-group-summary-table').is(':visible')) {
$('#displayed-items').text(common.formatInteger(args.current)); $('#displayed-items').text(nfCommon.formatInteger(args.current));
} }
}); });
remoteProcessGroupsData.onRowsChanged.subscribe(function (e, args) { remoteProcessGroupsData.onRowsChanged.subscribe(function (e, args) {
@ -1893,12 +1893,12 @@
var item = remoteProcessGroupsData.getItemById(remoteProcessGroupId); var item = remoteProcessGroupsData.getItemById(remoteProcessGroupId);
// format the tooltip // format the tooltip
var bulletins = common.getFormattedBulletins(item.bulletins); var bulletins = nfCommon.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins); var tooltip = nfCommon.formatUnorderedList(bulletins);
// show the tooltip // show the tooltip
if (common.isDefinedAndNotNull(tooltip)) { if (nfCommon.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, { bulletinIcon.qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: tooltip, content: tooltip,
position: { position: {
container: $('#summary'), container: $('#summary'),
@ -2056,7 +2056,7 @@
$('#summary-loading-container').show(); $('#summary-loading-container').show();
}, },
open: function () { open: function () {
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); nfCommon.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
} }
} }
}); });
@ -2081,7 +2081,7 @@
*/ */
var sort = function (tableId, sortDetails, data) { var sort = function (tableId, sortDetails, data) {
// ensure there is a state object for this table // ensure there is a state object for this table
if (common.isUndefined(sortState[tableId])) { if (nfCommon.isUndefined(sortState[tableId])) {
sortState[tableId] = {}; sortState[tableId] = {};
} }
@ -2089,17 +2089,17 @@
var comparer = function (a, b) { var comparer = function (a, b) {
if (sortDetails.columnId === 'moreDetails') { if (sortDetails.columnId === 'moreDetails') {
var aBulletins = 0; var aBulletins = 0;
if (!common.isEmpty(a.bulletins)) { if (!nfCommon.isEmpty(a.bulletins)) {
aBulletins = a.bulletins.length; aBulletins = a.bulletins.length;
} }
var bBulletins = 0; var bBulletins = 0;
if (!common.isEmpty(b.bulletins)) { if (!nfCommon.isEmpty(b.bulletins)) {
bBulletins = b.bulletins.length; bBulletins = b.bulletins.length;
} }
return aBulletins - bBulletins; return aBulletins - bBulletins;
} else if (sortDetails.columnId === 'runStatus' || sortDetails.columnId === 'transmissionStatus') { } else if (sortDetails.columnId === 'runStatus' || sortDetails.columnId === 'transmissionStatus') {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
if (aString === bString) { if (aString === bString) {
return a.activeThreadCount - b.activeThreadCount; return a.activeThreadCount - b.activeThreadCount;
} else { } else {
@ -2109,26 +2109,26 @@
var mod = sortState[tableId].count % 4; var mod = sortState[tableId].count % 4;
if (mod < 2) { if (mod < 2) {
$('#' + tableId + ' span.queued-title').addClass('sorted'); $('#' + tableId + ' span.queued-title').addClass('sorted');
var aQueueCount = common.parseCount(a['queuedCount']); var aQueueCount = nfCommon.parseCount(a['queuedCount']);
var bQueueCount = common.parseCount(b['queuedCount']); var bQueueCount = nfCommon.parseCount(b['queuedCount']);
return aQueueCount - bQueueCount; return aQueueCount - bQueueCount;
} else { } else {
$('#' + tableId + ' span.queued-size-title').addClass('sorted'); $('#' + tableId + ' span.queued-size-title').addClass('sorted');
var aQueueSize = common.parseSize(a['queuedSize']); var aQueueSize = nfCommon.parseSize(a['queuedSize']);
var bQueueSize = common.parseSize(b['queuedSize']); var bQueueSize = nfCommon.parseSize(b['queuedSize']);
return aQueueSize - bQueueSize; return aQueueSize - bQueueSize;
} }
} else if (sortDetails.columnId === 'backpressure') { } else if (sortDetails.columnId === 'backpressure') {
var mod = sortState[tableId].count % 4; var mod = sortState[tableId].count % 4;
if (mod < 2) { if (mod < 2) {
$('#' + tableId + ' span.backpressure-object-title').addClass('sorted'); $('#' + tableId + ' span.backpressure-object-title').addClass('sorted');
var aPercentUseObject = common.isDefinedAndNotNull(a['percentUseCount']) ? a['percentUseCount'] : -1; var aPercentUseObject = nfCommon.isDefinedAndNotNull(a['percentUseCount']) ? a['percentUseCount'] : -1;
var bPercentUseObject = common.isDefinedAndNotNull(b['percentUseCount']) ? b['percentUseCount'] : -1; var bPercentUseObject = nfCommon.isDefinedAndNotNull(b['percentUseCount']) ? b['percentUseCount'] : -1;
return aPercentUseObject - bPercentUseObject; return aPercentUseObject - bPercentUseObject;
} else { } else {
$('#' + tableId + ' span.backpressure-data-size-title').addClass('sorted'); $('#' + tableId + ' span.backpressure-data-size-title').addClass('sorted');
var aPercentUseDataSize = common.isDefinedAndNotNull(a['percentUseBytes']) ? a['percentUseBytes'] : -1; var aPercentUseDataSize = nfCommon.isDefinedAndNotNull(a['percentUseBytes']) ? a['percentUseBytes'] : -1;
var bPercentUseDataSize = common.isDefinedAndNotNull(b['percentUseBytes']) ? b['percentUseBytes'] : -1; var bPercentUseDataSize = nfCommon.isDefinedAndNotNull(b['percentUseBytes']) ? b['percentUseBytes'] : -1;
return aPercentUseDataSize - bPercentUseDataSize; return aPercentUseDataSize - bPercentUseDataSize;
} }
} else if (sortDetails.columnId === 'sent' || sortDetails.columnId === 'received' || sortDetails.columnId === 'input' || sortDetails.columnId === 'output' || sortDetails.columnId === 'transferred') { } else if (sortDetails.columnId === 'sent' || sortDetails.columnId === 'received' || sortDetails.columnId === 'input' || sortDetails.columnId === 'output' || sortDetails.columnId === 'transferred') {
@ -2137,44 +2137,44 @@
var mod = sortState[tableId].count % 4; var mod = sortState[tableId].count % 4;
if (mod < 2) { if (mod < 2) {
$('#' + tableId + ' span.' + sortDetails.columnId + '-title').addClass('sorted'); $('#' + tableId + ' span.' + sortDetails.columnId + '-title').addClass('sorted');
var aCount = common.parseCount(aSplit[0]); var aCount = nfCommon.parseCount(aSplit[0]);
var bCount = common.parseCount(bSplit[0]); var bCount = nfCommon.parseCount(bSplit[0]);
return aCount - bCount; return aCount - bCount;
} else { } else {
$('#' + tableId + ' span.' + sortDetails.columnId + '-size-title').addClass('sorted'); $('#' + tableId + ' span.' + sortDetails.columnId + '-size-title').addClass('sorted');
var aSize = common.parseSize(aSplit[1]); var aSize = nfCommon.parseSize(aSplit[1]);
var bSize = common.parseSize(bSplit[1]); var bSize = nfCommon.parseSize(bSplit[1]);
return aSize - bSize; return aSize - bSize;
} }
} else if (sortDetails.columnId === 'io') { } else if (sortDetails.columnId === 'io') {
var mod = sortState[tableId].count % 4; var mod = sortState[tableId].count % 4;
if (mod < 2) { if (mod < 2) {
$('#' + tableId + ' span.read-title').addClass('sorted'); $('#' + tableId + ' span.read-title').addClass('sorted');
var aReadSize = common.parseSize(a['read']); var aReadSize = nfCommon.parseSize(a['read']);
var bReadSize = common.parseSize(b['read']); var bReadSize = nfCommon.parseSize(b['read']);
return aReadSize - bReadSize; return aReadSize - bReadSize;
} else { } else {
$('#' + tableId + ' span.written-title').addClass('sorted'); $('#' + tableId + ' span.written-title').addClass('sorted');
var aWriteSize = common.parseSize(a['written']); var aWriteSize = nfCommon.parseSize(a['written']);
var bWriteSize = common.parseSize(b['written']); var bWriteSize = nfCommon.parseSize(b['written']);
return aWriteSize - bWriteSize; return aWriteSize - bWriteSize;
} }
} else if (sortDetails.columnId === 'tasks') { } else if (sortDetails.columnId === 'tasks') {
var mod = sortState[tableId].count % 4; var mod = sortState[tableId].count % 4;
if (mod < 2) { if (mod < 2) {
$('#' + tableId + ' span.tasks-title').addClass('sorted'); $('#' + tableId + ' span.tasks-title').addClass('sorted');
var aTasks = common.parseCount(a['tasks']); var aTasks = nfCommon.parseCount(a['tasks']);
var bTasks = common.parseCount(b['tasks']); var bTasks = nfCommon.parseCount(b['tasks']);
return aTasks - bTasks; return aTasks - bTasks;
} else { } else {
$('#' + tableId + ' span.time-title').addClass('sorted'); $('#' + tableId + ' span.time-title').addClass('sorted');
var aDuration = common.parseDuration(a['tasksDuration']); var aDuration = nfCommon.parseDuration(a['tasksDuration']);
var bDuration = common.parseDuration(b['tasksDuration']); var bDuration = nfCommon.parseDuration(b['tasksDuration']);
return aDuration - bDuration; return aDuration - bDuration;
} }
} else { } else {
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} }
}; };
@ -2244,7 +2244,7 @@
// add the parameter if appropriate // add the parameter if appropriate
var parameters = {}; var parameters = {};
if (!common.isNull(clusterNodeId)) { if (!nfCommon.isNull(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId; parameters['clusterNodeId'] = clusterNodeId;
} }
@ -2268,7 +2268,7 @@
$('#free-heap').text(aggregateSnapshot.freeHeap); $('#free-heap').text(aggregateSnapshot.freeHeap);
// ensure the heap utilization could be calculated // ensure the heap utilization could be calculated
if (common.isDefinedAndNotNull(aggregateSnapshot.heapUtilization)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.heapUtilization)) {
$('#utilization-heap').text('(' + aggregateSnapshot.heapUtilization + ')'); $('#utilization-heap').text('(' + aggregateSnapshot.heapUtilization + ')');
} else { } else {
$('#utilization-heap').text(''); $('#utilization-heap').text('');
@ -2281,7 +2281,7 @@
$('#free-non-heap').text(aggregateSnapshot.freeNonHeap); $('#free-non-heap').text(aggregateSnapshot.freeNonHeap);
// enure the non heap utilization could be calculated // enure the non heap utilization could be calculated
if (common.isDefinedAndNotNull(aggregateSnapshot.nonHeapUtilization)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.nonHeapUtilization)) {
$('#utilization-non-heap').text('(' + aggregateSnapshot.nonHeapUtilization + ')'); $('#utilization-non-heap').text('(' + aggregateSnapshot.nonHeapUtilization + ')');
} else { } else {
$('#utilization-non-heap').text(''); $('#utilization-non-heap').text('');
@ -2289,7 +2289,7 @@
// garbage collection // garbage collection
var garbageCollectionContainer = $('#garbage-collection-table tbody').empty(); var garbageCollectionContainer = $('#garbage-collection-table tbody').empty();
if (common.isDefinedAndNotNull(aggregateSnapshot.garbageCollection)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.garbageCollection)) {
// sort the garbage collections // sort the garbage collections
var sortedGarbageCollection = aggregateSnapshot.garbageCollection.sort(function (a, b) { var sortedGarbageCollection = aggregateSnapshot.garbageCollection.sort(function (a, b) {
return a.name === b.name ? 0 : a.name > b.name ? 1 : -1; return a.name === b.name ? 0 : a.name > b.name ? 1 : -1;
@ -2307,10 +2307,10 @@
$('#available-processors').text(aggregateSnapshot.availableProcessors); $('#available-processors').text(aggregateSnapshot.availableProcessors);
// load // load
if (common.isDefinedAndNotNull(aggregateSnapshot.processorLoadAverage)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.processorLoadAverage)) {
$('#processor-load-average').text(common.formatFloat(aggregateSnapshot.processorLoadAverage)); $('#processor-load-average').text(nfCommon.formatFloat(aggregateSnapshot.processorLoadAverage));
} else { } else {
$('#processor-load-average').html(common.formatValue(aggregateSnapshot.processorLoadAverage)); $('#processor-load-average').html(nfCommon.formatValue(aggregateSnapshot.processorLoadAverage));
} }
// flow file storage usage // flow file storage usage
@ -2319,7 +2319,7 @@
// content repo storage usage // content repo storage usage
var contentRepositoryUsageContainer = $('#content-repository-storage-usage-container').empty(); var contentRepositoryUsageContainer = $('#content-repository-storage-usage-container').empty();
if (common.isDefinedAndNotNull(aggregateSnapshot.contentRepositoryStorageUsage)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.contentRepositoryStorageUsage)) {
// sort the content repos // sort the content repos
var sortedContentRepositoryStorageUsage = aggregateSnapshot.contentRepositoryStorageUsage.sort(function (a, b) { var sortedContentRepositoryStorageUsage = aggregateSnapshot.contentRepositoryStorageUsage.sort(function (a, b) {
return a.identifier === b.identifier ? 0 : a.identifier > b.identifier ? 1 : -1; return a.identifier === b.identifier ? 0 : a.identifier > b.identifier ? 1 : -1;
@ -2354,7 +2354,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#system-diagnostics-last-refreshed').text(aggregateSnapshot.statsLastRefreshed); $('#system-diagnostics-last-refreshed').text(aggregateSnapshot.statsLastRefreshed);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -2383,12 +2383,12 @@
var storage = $('<div class="storage-identifier setting-name"></div>'); var storage = $('<div class="storage-identifier setting-name"></div>');
storage.text('Usage:'); storage.text('Usage:');
if (common.isDefinedAndNotNull(storageUsage.identifier)) { if (nfCommon.isDefinedAndNotNull(storageUsage.identifier)) {
storage.text('Usage for ' + storageUsage.identifier + ':'); storage.text('Usage for ' + storageUsage.identifier + ':');
} }
storage.appendTo(storageUsageContainer); storage.appendTo(storageUsageContainer);
(angularBridge.injector.get('$compile')($('<md-progress-linear class="md-hue-2" md-mode="determinate" value="' + (used / total) * 100 + '" aria-label="FlowFile Repository Storage Usage"></md-progress-linear>'))(angularBridge.rootScope)).appendTo(storageUsageContainer); (nfNgBridge.injector.get('$compile')($('<md-progress-linear class="md-hue-2" md-mode="determinate" value="' + (used / total) * 100 + '" aria-label="FlowFile Repository Storage Usage"></md-progress-linear>'))(nfNgBridge.rootScope)).appendTo(storageUsageContainer);
var usageDetails = $('<div class="storage-usage-details"></div>').text(' (' + storageUsage.usedSpace + ' of ' + storageUsage.totalSpace + ')').prepend($('<b></b>').text(Math.round((used / total) * 100) + '%')); var usageDetails = $('<div class="storage-usage-details"></div>').text(' (' + storageUsage.usedSpace + ' of ' + storageUsage.totalSpace + ')').prepend($('<b></b>').text(Math.round((used / total) * 100) + '%'));
$('<div class="storage-usage-header"></div>').append(usageDetails).append('<div class="clear"></div>').appendTo(storageUsageContainer); $('<div class="storage-usage-header"></div>').append(usageDetails).append('<div class="clear"></div>').appendTo(storageUsageContainer);
@ -2469,7 +2469,7 @@
} }
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(grid)) { if (nfCommon.isDefinedAndNotNull(grid)) {
var data = grid.getData(); var data = grid.getData();
// update the search criteria // update the search criteria
@ -2497,7 +2497,7 @@
}, },
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.processorStatus)) { if (nfCommon.isDefinedAndNotNull(response.processorStatus)) {
var processorStatus = response.processorStatus; var processorStatus = response.processorStatus;
var clusterProcessorsGrid = $('#cluster-processor-summary-table').data('gridInstance'); var clusterProcessorsGrid = $('#cluster-processor-summary-table').data('gridInstance');
@ -2536,7 +2536,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#cluster-processor-summary-last-refreshed').text(processorStatus.statsLastRefreshed); $('#cluster-processor-summary-last-refreshed').text(processorStatus.statsLastRefreshed);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -2555,7 +2555,7 @@
}, },
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.connectionStatus)) { if (nfCommon.isDefinedAndNotNull(response.connectionStatus)) {
var connectionStatus = response.connectionStatus; var connectionStatus = response.connectionStatus;
var clusterConnectionsGrid = $('#cluster-connection-summary-table').data('gridInstance'); var clusterConnectionsGrid = $('#cluster-connection-summary-table').data('gridInstance');
@ -2593,7 +2593,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#cluster-connection-summary-last-refreshed').text(connectionStatus.statsLastRefreshed); $('#cluster-connection-summary-last-refreshed').text(connectionStatus.statsLastRefreshed);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -2612,7 +2612,7 @@
}, },
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.processGroupStatus)) { if (nfCommon.isDefinedAndNotNull(response.processGroupStatus)) {
var processGroupStatus = response.processGroupStatus; var processGroupStatus = response.processGroupStatus;
var clusterProcessGroupsGrid = $('#cluster-process-group-summary-table').data('gridInstance'); var clusterProcessGroupsGrid = $('#cluster-process-group-summary-table').data('gridInstance');
@ -2653,7 +2653,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#cluster-process-group-summary-last-refreshed').text(processGroupStatus.statsLastRefreshed); $('#cluster-process-group-summary-last-refreshed').text(processGroupStatus.statsLastRefreshed);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -2672,7 +2672,7 @@
}, },
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.portStatus)) { if (nfCommon.isDefinedAndNotNull(response.portStatus)) {
var inputPortStatus = response.portStatus; var inputPortStatus = response.portStatus;
var clusterInputPortsGrid = $('#cluster-input-port-summary-table').data('gridInstance'); var clusterInputPortsGrid = $('#cluster-input-port-summary-table').data('gridInstance');
@ -2706,7 +2706,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#cluster-input-port-summary-last-refreshed').text(inputPortStatus.statsLastRefreshed); $('#cluster-input-port-summary-last-refreshed').text(inputPortStatus.statsLastRefreshed);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -2725,7 +2725,7 @@
}, },
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.portStatus)) { if (nfCommon.isDefinedAndNotNull(response.portStatus)) {
var outputPortStatus = response.portStatus; var outputPortStatus = response.portStatus;
var clusterOutputPortsGrid = $('#cluster-output-port-summary-table').data('gridInstance'); var clusterOutputPortsGrid = $('#cluster-output-port-summary-table').data('gridInstance');
@ -2759,7 +2759,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#cluster-output-port-summary-last-refreshed').text(outputPortStatus.statsLastRefreshed); $('#cluster-output-port-summary-last-refreshed').text(outputPortStatus.statsLastRefreshed);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -2778,7 +2778,7 @@
}, },
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
if (common.isDefinedAndNotNull(response.remoteProcessGroupStatus)) { if (nfCommon.isDefinedAndNotNull(response.remoteProcessGroupStatus)) {
var remoteProcessGroupStatus = response.remoteProcessGroupStatus; var remoteProcessGroupStatus = response.remoteProcessGroupStatus;
var clusterRemoteProcessGroupsGrid = $('#cluster-remote-process-group-summary-table').data('gridInstance'); var clusterRemoteProcessGroupsGrid = $('#cluster-remote-process-group-summary-table').data('gridInstance');
@ -2814,7 +2814,7 @@
// update the stats last refreshed timestamp // update the stats last refreshed timestamp
$('#cluster-remote-process-group-summary-last-refreshed').text(remoteProcessGroupStatus.statsLastRefreshed); $('#cluster-remote-process-group-summary-last-refreshed').text(remoteProcessGroupStatus.statsLastRefreshed);
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var clusterNodeId = null; var clusterNodeId = null;
@ -2837,11 +2837,11 @@
var configDetails = configResponse.flowConfiguration; var configDetails = configResponse.flowConfiguration;
// initialize the chart // initialize the chart
statusHistory.init(configDetails.timeOffset); nfStatusHistory.init(configDetails.timeOffset);
// initialize the processor/connection details dialog // initialize the processor/connection details dialog
processorDetails.init(false); nfProcessorDetails.init(false);
connectionDetails.init(); nfConnectionDetails.init();
initSummaryTable(isClustered); initSummaryTable(isClustered);
deferred.resolve(); deferred.resolve();
@ -2867,7 +2867,7 @@
var processorsTable = $('#processor-summary-table'); var processorsTable = $('#processor-summary-table');
if (processorsTable.is(':visible')) { if (processorsTable.is(':visible')) {
var processorsGrid = processorsTable.data('gridInstance'); var processorsGrid = processorsTable.data('gridInstance');
if (common.isDefinedAndNotNull(processorsGrid)) { if (nfCommon.isDefinedAndNotNull(processorsGrid)) {
processorsGrid.resizeCanvas(); processorsGrid.resizeCanvas();
} }
} }
@ -2875,7 +2875,7 @@
var connectionsTable = $('#connection-summary-table'); var connectionsTable = $('#connection-summary-table');
if (connectionsTable.is(':visible')) { if (connectionsTable.is(':visible')) {
var connectionsGrid = connectionsTable.data('gridInstance'); var connectionsGrid = connectionsTable.data('gridInstance');
if (common.isDefinedAndNotNull(connectionsGrid)) { if (nfCommon.isDefinedAndNotNull(connectionsGrid)) {
connectionsGrid.resizeCanvas(); connectionsGrid.resizeCanvas();
} }
} }
@ -2883,7 +2883,7 @@
var processGroupsTable = $('#process-group-summary-table'); var processGroupsTable = $('#process-group-summary-table');
if (processGroupsTable.is(':visible')) { if (processGroupsTable.is(':visible')) {
var processGroupsGrid = processGroupsTable.data('gridInstance'); var processGroupsGrid = processGroupsTable.data('gridInstance');
if (common.isDefinedAndNotNull(processGroupsGrid)) { if (nfCommon.isDefinedAndNotNull(processGroupsGrid)) {
processGroupsGrid.resizeCanvas(); processGroupsGrid.resizeCanvas();
} }
} }
@ -2891,7 +2891,7 @@
var inputPortsTable = $('#input-port-summary-table'); var inputPortsTable = $('#input-port-summary-table');
if (inputPortsTable.is(':visible')) { if (inputPortsTable.is(':visible')) {
var inputPortGrid = inputPortsTable.data('gridInstance'); var inputPortGrid = inputPortsTable.data('gridInstance');
if (common.isDefinedAndNotNull(inputPortGrid)) { if (nfCommon.isDefinedAndNotNull(inputPortGrid)) {
inputPortGrid.resizeCanvas(); inputPortGrid.resizeCanvas();
} }
} }
@ -2899,7 +2899,7 @@
var outputPortsTable = $('#output-port-summary-table'); var outputPortsTable = $('#output-port-summary-table');
if (outputPortsTable.is(':visible')) { if (outputPortsTable.is(':visible')) {
var outputPortGrid = outputPortsTable.data('gridInstance'); var outputPortGrid = outputPortsTable.data('gridInstance');
if (common.isDefinedAndNotNull(outputPortGrid)) { if (nfCommon.isDefinedAndNotNull(outputPortGrid)) {
outputPortGrid.resizeCanvas(); outputPortGrid.resizeCanvas();
} }
} }
@ -2907,7 +2907,7 @@
var remoteProcessGroupsTable = $('#remote-process-group-summary-table'); var remoteProcessGroupsTable = $('#remote-process-group-summary-table');
if (remoteProcessGroupsTable.is(':visible')) { if (remoteProcessGroupsTable.is(':visible')) {
var remoteProcessGroupGrid = remoteProcessGroupsTable.data('gridInstance'); var remoteProcessGroupGrid = remoteProcessGroupsTable.data('gridInstance');
if (common.isDefinedAndNotNull(remoteProcessGroupGrid)) { if (nfCommon.isDefinedAndNotNull(remoteProcessGroupGrid)) {
remoteProcessGroupGrid.resizeCanvas(); remoteProcessGroupGrid.resizeCanvas();
} }
} }
@ -2921,7 +2921,7 @@
// add the parameter if appropriate // add the parameter if appropriate
var parameters = {}; var parameters = {};
if (!common.isNull(clusterNodeId)) { if (!nfCommon.isNull(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId; parameters['clusterNodeId'] = clusterNodeId;
} }
@ -2941,10 +2941,10 @@
var processGroupStatus = response.processGroupStatus; var processGroupStatus = response.processGroupStatus;
var aggregateSnapshot = processGroupStatus.aggregateSnapshot; var aggregateSnapshot = processGroupStatus.aggregateSnapshot;
if (common.isDefinedAndNotNull(aggregateSnapshot)) { if (nfCommon.isDefinedAndNotNull(aggregateSnapshot)) {
// remove any tooltips from the processor table // remove any tooltips from the processor table
var processorsGridElement = $('#processor-summary-table'); var processorsGridElement = $('#processor-summary-table');
common.cleanUpTooltips(processorsGridElement, 'div.has-bulletins'); nfCommon.cleanUpTooltips(processorsGridElement, 'div.has-bulletins');
// get the processor grid/data // get the processor grid/data
var processorsGrid = processorsGridElement.data('gridInstance'); var processorsGrid = processorsGridElement.data('gridInstance');
@ -2956,7 +2956,7 @@
// remove any tooltips from the process group table // remove any tooltips from the process group table
var processGroupGridElement = $('#process-group-summary-table'); var processGroupGridElement = $('#process-group-summary-table');
common.cleanUpTooltips(processGroupGridElement, 'div.has-bulletins'); nfCommon.cleanUpTooltips(processGroupGridElement, 'div.has-bulletins');
// get the process group grid/data // get the process group grid/data
var processGroupGrid = processGroupGridElement.data('gridInstance'); var processGroupGrid = processGroupGridElement.data('gridInstance');
@ -2964,7 +2964,7 @@
// remove any tooltips from the input port table // remove any tooltips from the input port table
var inputPortsGridElement = $('#input-port-summary-table'); var inputPortsGridElement = $('#input-port-summary-table');
common.cleanUpTooltips(inputPortsGridElement, 'div.has-bulletins'); nfCommon.cleanUpTooltips(inputPortsGridElement, 'div.has-bulletins');
// get the input ports grid/data // get the input ports grid/data
var inputPortsGrid = inputPortsGridElement.data('gridInstance'); var inputPortsGrid = inputPortsGridElement.data('gridInstance');
@ -2972,7 +2972,7 @@
// remove any tooltips from the output port table // remove any tooltips from the output port table
var outputPortsGridElement = $('#output-port-summary-table'); var outputPortsGridElement = $('#output-port-summary-table');
common.cleanUpTooltips(outputPortsGridElement, 'div.has-bulletins'); nfCommon.cleanUpTooltips(outputPortsGridElement, 'div.has-bulletins');
// get the output ports grid/data // get the output ports grid/data
var outputPortsGrid = outputPortsGridElement.data('gridInstance'); var outputPortsGrid = outputPortsGridElement.data('gridInstance');
@ -2980,7 +2980,7 @@
// remove any tooltips from the remote process group table // remove any tooltips from the remote process group table
var remoteProcessGroupsGridElement = $('#remote-process-group-summary-table'); var remoteProcessGroupsGridElement = $('#remote-process-group-summary-table');
common.cleanUpTooltips(remoteProcessGroupsGridElement, 'div.has-bulletins'); nfCommon.cleanUpTooltips(remoteProcessGroupsGridElement, 'div.has-bulletins');
// get the remote process groups grid // get the remote process groups grid
var remoteProcessGroupsGrid = remoteProcessGroupsGridElement.data('gridInstance'); var remoteProcessGroupsGrid = remoteProcessGroupsGridElement.data('gridInstance');
@ -3031,22 +3031,22 @@
// update the total number of processors // update the total number of processors
if ($('#processor-summary-table').is(':visible')) { if ($('#processor-summary-table').is(':visible')) {
$('#total-items').text(common.formatInteger(processorItems.length)); $('#total-items').text(nfCommon.formatInteger(processorItems.length));
} else if ($('#connection-summary-table').is(':visible')) { } else if ($('#connection-summary-table').is(':visible')) {
$('#total-items').text(common.formatInteger(connectionItems.length)); $('#total-items').text(nfCommon.formatInteger(connectionItems.length));
} else if ($('#input-port-summary-table').is(':visible')) { } else if ($('#input-port-summary-table').is(':visible')) {
$('#total-items').text(common.formatInteger(inputPortItems.length)); $('#total-items').text(nfCommon.formatInteger(inputPortItems.length));
} else if ($('#output-port-summary-table').is(':visible')) { } else if ($('#output-port-summary-table').is(':visible')) {
$('#total-items').text(common.formatInteger(outputPortItems.length)); $('#total-items').text(nfCommon.formatInteger(outputPortItems.length));
} else if ($('#process-group-summary-table').is(':visible')) { } else if ($('#process-group-summary-table').is(':visible')) {
$('#total-items').text(common.formatInteger(processGroupItems.length)); $('#total-items').text(nfCommon.formatInteger(processGroupItems.length));
} else { } else {
$('#total-items').text(common.formatInteger(remoteProcessGroupItems.length)); $('#total-items').text(nfCommon.formatInteger(remoteProcessGroupItems.length));
} }
} else { } else {
$('#total-items').text('0'); $('#total-items').text('0');
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };
})); }));

View File

@ -33,30 +33,30 @@
'nf.SummaryTable'], 'nf.SummaryTable'],
function ($, function ($,
angular, angular,
common, nfCommon,
clusterSummary, nfClusterSummary,
clusterSearch, nfClusterSearch,
appConfig, appConfig,
appCtrl, appCtrl,
serviceProvider, serviceProvider,
provenanceTable, provenanceTable,
angularBridge, nfNgBridge,
errorHandler, nfErrorHandler,
storage, nfStorage,
summaryTable) { nfSummaryTable) {
return (nf.Summary = return (nf.Summary =
factory($, factory($,
angular, angular,
common, nfCommon,
clusterSummary, nfClusterSummary,
clusterSearch, nfClusterSearch,
appConfig, appConfig,
appCtrl, appCtrl,
serviceProvider, serviceProvider,
angularBridge, nfNgBridge,
errorHandler, nfErrorHandler,
storage, nfStorage,
summaryTable)); nfSummaryTable));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Summary = module.exports = (nf.Summary =
@ -86,7 +86,7 @@
root.nf.Storage, root.nf.Storage,
root.nf.SummaryTable); root.nf.SummaryTable);
} }
}(this, function ($, angular, common, clusterSummary, clusterSearch, appConfig, appCtrl, serviceProvider, angularBridge, errorHandler, storage, summaryTable) { }(this, function ($, angular, nfCommon, nfClusterSummary, nfClusterSearch, appConfig, appCtrl, serviceProvider, nfNgBridge, nfErrorHandler, nfStorage, nfSummaryTable) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -108,10 +108,10 @@
app.service('serviceProvider', serviceProvider); app.service('serviceProvider', serviceProvider);
//Manually Boostrap Angular App //Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngSummaryApp'], {strictDi: true}); nfNgBridge.injector = angular.bootstrap($('body'), ['ngSummaryApp'], {strictDi: true});
// initialize the summary page // initialize the summary page
clusterSummary.loadClusterSummary().done(function () { nfClusterSummary.loadClusterSummary().done(function () {
nfSummary.init(); nfSummary.init();
}); });
}); });
@ -136,16 +136,16 @@
type: 'GET', type: 'GET',
url: config.urls.clusterSummary url: config.urls.clusterSummary
}).done(function (response) { }).done(function (response) {
summaryTable.init(response.clusterSummary.connectedToCluster).done(function () { nfSummaryTable.init(response.clusterSummary.connectedToCluster).done(function () {
// initialize the search field if applicable // initialize the search field if applicable
if (response.clusterSummary.connectedToCluster) { if (response.clusterSummary.connectedToCluster) {
clusterSearch.init(); nfClusterSearch.init();
} }
deferred.resolve(); deferred.resolve();
}).fail(function () { }).fail(function () {
deferred.reject(); deferred.reject();
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}).promise(); }).promise();
}; };
@ -155,8 +155,8 @@
var initializeSummaryPage = function () { var initializeSummaryPage = function () {
// define mouse over event for the refresh buttons // define mouse over event for the refresh buttons
$('#refresh-button').click(function () { $('#refresh-button').click(function () {
clusterSummary.loadClusterSummary().done(function () { nfClusterSummary.loadClusterSummary().done(function () {
summaryTable.loadSummaryTable(); nfSummaryTable.loadSummaryTable();
}); });
}); });
@ -170,8 +170,8 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -185,7 +185,7 @@
updateTop('summary'); updateTop('summary');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -201,7 +201,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -215,12 +215,12 @@
* Initializes the status page. * Initializes the status page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
// intialize the summary table // intialize the summary table
initializeSummaryTable().done(function () { initializeSummaryTable().done(function () {
// load the table // load the table
summaryTable.loadSummaryTable().done(function () { nfSummaryTable.loadSummaryTable().done(function () {
// once the table is initialized, finish initializing the page // once the table is initialized, finish initializing the page
initializeSummaryPage().done(function () { initializeSummaryPage().done(function () {
@ -241,7 +241,7 @@
}); });
} }
summaryTable.resetTableSize(); nfSummaryTable.resetTableSize();
}; };
// get the about details // get the about details
@ -259,7 +259,7 @@
// set the initial size // set the initial size
setBodySize(); setBodySize();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
$(window).on('resize', function (e) { $(window).on('resize', function (e) {
setBodySize(); setBodySize();
@ -292,7 +292,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
}); });
}); });

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Dialog', 'nf.Dialog',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, Slick, common, dialog, errorHandler) { function ($, Slick, nfCommon, nfDialog, nfErrorHandler) {
return (nf.TemplatesTable = factory($, Slick, common, dialog, errorHandler)); return (nf.TemplatesTable = factory($, Slick, nfCommon, nfDialog, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.TemplatesTable = module.exports = (nf.TemplatesTable =
@ -41,7 +41,7 @@
root.nf.Dialog, root.nf.Dialog,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, Slick, common, dialog, errorHandler) { }(this, function ($, Slick, nfCommon, nfDialog, nfErrorHandler) {
'use strict'; 'use strict';
/** /**
@ -65,12 +65,12 @@
var comparer = function (a, b) { var comparer = function (a, b) {
if (a.permissions.canRead && b.permissions.canRead) { if (a.permissions.canRead && b.permissions.canRead) {
if (sortDetails.columnId === 'timestamp') { if (sortDetails.columnId === 'timestamp') {
var aDate = common.parseDateTime(a.template[sortDetails.columnId]); var aDate = nfCommon.parseDateTime(a.template[sortDetails.columnId]);
var bDate = common.parseDateTime(b.template[sortDetails.columnId]); var bDate = nfCommon.parseDateTime(b.template[sortDetails.columnId]);
return aDate.getTime() - bDate.getTime(); return aDate.getTime() - bDate.getTime();
} else { } else {
var aString = common.isDefinedAndNotNull(a.template[sortDetails.columnId]) ? a.template[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a.template[sortDetails.columnId]) ? a.template[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.template[sortDetails.columnId]) ? b.template[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.template[sortDetails.columnId]) ? b.template[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} }
} else { } else {
@ -96,9 +96,9 @@
*/ */
var promptToDeleteTemplate = function (templateEntity) { var promptToDeleteTemplate = function (templateEntity) {
// prompt for deletion // prompt for deletion
dialog.showYesNoDialog({ nfDialog.showYesNoDialog({
headerText: 'Delete Template', headerText: 'Delete Template',
dialogContent: 'Delete template \'' + common.escapeHtml(templateEntity.template.name) + '\'?', dialogContent: 'Delete template \'' + nfCommon.escapeHtml(templateEntity.template.name) + '\'?',
yesHandler: function () { yesHandler: function () {
deleteTemplate(templateEntity); deleteTemplate(templateEntity);
} }
@ -114,7 +114,7 @@
// only attempt this if we're within a frame // only attempt this if we're within a frame
if (top !== window) { if (top !== window) {
// and our parent has canvas utils and shell defined // and our parent has canvas utils and shell defined
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.PolicyManagement) && common.isDefinedAndNotNull(parent.nf.Shell)) { if (nfCommon.isDefinedAndNotNull(parent.nf) && nfCommon.isDefinedAndNotNull(parent.nf.PolicyManagement) && nfCommon.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.PolicyManagement.showTemplatePolicy(templateEntity); parent.nf.PolicyManagement.showTemplatePolicy(templateEntity);
parent.$('#shell-close-button').click(); parent.$('#shell-close-button').click();
} }
@ -138,7 +138,7 @@
// update the total number of templates // update the total number of templates
$('#total-templates').text(templatesData.getItems().length); $('#total-templates').text(templatesData.getItems().length);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -158,7 +158,7 @@
var templatesGrid = $('#templates-table').data('gridInstance'); var templatesGrid = $('#templates-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(templatesGrid)) { if (nfCommon.isDefinedAndNotNull(templatesGrid)) {
var templatesData = templatesGrid.getData(); var templatesData = templatesGrid.getData();
// update the search criteria // update the search criteria
@ -200,11 +200,11 @@
* @param {object} templateEntity The template * @param {object} templateEntity The template
*/ */
var downloadTemplate = function (templateEntity) { var downloadTemplate = function (templateEntity) {
common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) { nfCommon.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
var parameters = {}; var parameters = {};
// conditionally include the download token // conditionally include the download token
if (!common.isBlank(downloadToken)) { if (!nfCommon.isBlank(downloadToken)) {
parameters['access_token'] = downloadToken; parameters['access_token'] = downloadToken;
} }
@ -215,7 +215,7 @@
window.open(templateEntity.template.uri + '/download' + '?' + $.param(parameters)); window.open(templateEntity.template.uri + '/download' + '?' + $.param(parameters));
} }
}).fail(function () { }).fail(function () {
dialog.showOkDialog({ nfDialog.showOkDialog({
headerText: 'Download Template', headerText: 'Download Template',
dialogContent: 'Unable to generate access token for downloading content.' dialogContent: 'Unable to generate access token for downloading content.'
}); });
@ -267,7 +267,7 @@
return ''; return '';
} }
return common.formatValue(dataContext.template.description); return nfCommon.formatValue(dataContext.template.description);
}; };
var groupIdFormatter = function (row, cell, value, columnDef, dataContext) { var groupIdFormatter = function (row, cell, value, columnDef, dataContext) {
@ -292,8 +292,8 @@
} }
// allow policy configuration conditionally if embedded in // allow policy configuration conditionally if embedded in
if (top !== window && common.canAccessTenants()) { if (top !== window && nfCommon.canAccessTenants()) {
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && parent.nf.CanvasUtils.isConfigurableAuthorizer()) { if (nfCommon.isDefinedAndNotNull(parent.nf) && nfCommon.isDefinedAndNotNull(parent.nf.CanvasUtils) && parent.nf.CanvasUtils.isConfigurableAuthorizer()) {
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>'; markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
} }
} }
@ -427,7 +427,7 @@
*/ */
resetTableSize: function () { resetTableSize: function () {
var templateGrid = $('#templates-table').data('gridInstance'); var templateGrid = $('#templates-table').data('gridInstance');
if (common.isDefinedAndNotNull(templateGrid)) { if (nfCommon.isDefinedAndNotNull(templateGrid)) {
templateGrid.resizeCanvas(); templateGrid.resizeCanvas();
} }
}, },
@ -442,7 +442,7 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure there are groups specified // ensure there are groups specified
if (common.isDefinedAndNotNull(response.templates)) { if (nfCommon.isDefinedAndNotNull(response.templates)) {
var templatesGrid = $('#templates-table').data('gridInstance'); var templatesGrid = $('#templates-table').data('gridInstance');
var templatesData = templatesGrid.getData(); var templatesData = templatesGrid.getData();
@ -459,7 +459,7 @@
} else { } else {
$('#total-templates').text('0'); $('#total-templates').text('0');
} }
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };
})); }));

View File

@ -24,8 +24,8 @@
'nf.TemplatesTable', 'nf.TemplatesTable',
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage'], 'nf.Storage'],
function ($, common, templatesTable, errorHandler, storage) { function ($, nfCommon, nfTemplatesTable, nfErrorHandler, nfStorage) {
return (nf.Templates = factory($, common, templatesTable, errorHandler, storage)); return (nf.Templates = factory($, nfCommon, nfTemplatesTable, nfErrorHandler, nfStorage));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Templates = module.exports = (nf.Templates =
@ -41,7 +41,7 @@
root.nf.ErrorHandler, root.nf.ErrorHandler,
root.nf.Storage); root.nf.Storage);
} }
}(this, function ($, common, templatesTable, errorHandler, storage) { }(this, function ($, nfCommon, nfTemplatesTable, nfErrorHandler, nfStorage) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -69,8 +69,8 @@
url: config.urls.currentUser, url: config.urls.currentUser,
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -79,7 +79,7 @@
var initializeTemplatesPage = function () { var initializeTemplatesPage = function () {
// define mouse over event for the refresh button // define mouse over event for the refresh button
$('#refresh-button').click(function () { $('#refresh-button').click(function () {
templatesTable.loadTemplatesTable(); nfTemplatesTable.loadTemplatesTable();
}); });
// get the banners if we're not in the shell // get the banners if we're not in the shell
@ -91,8 +91,8 @@
dataType: 'json' dataType: 'json'
}).done(function (response) { }).done(function (response) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(response.banners)) { if (nfCommon.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -106,7 +106,7 @@
updateTop('templates'); updateTop('templates');
} }
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -122,7 +122,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -136,16 +136,16 @@
* Initializes the templates page. * Initializes the templates page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
// load the current user // load the current user
loadCurrentUser().done(function () { loadCurrentUser().done(function () {
// create the templates table // create the templates table
templatesTable.init(); nfTemplatesTable.init();
// load the table // load the table
templatesTable.loadTemplatesTable().done(function () { nfTemplatesTable.loadTemplatesTable().done(function () {
// once the table is initialized, finish initializing the page // once the table is initialized, finish initializing the page
initializeTemplatesPage().done(function () { initializeTemplatesPage().done(function () {
var setBodySize = function () { var setBodySize = function () {
@ -162,7 +162,7 @@
} }
// configure the initial grid height // configure the initial grid height
templatesTable.resetTableSize(); nfTemplatesTable.resetTableSize();
}; };
// get the about details // get the about details
@ -180,7 +180,7 @@
// set the initial size // set the initial size
setBodySize(); setBodySize();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
$(window).on('resize', function (e) { $(window).on('resize', function (e) {
setBodySize(); setBodySize();
@ -213,7 +213,7 @@
} }
} }
$.each(tabsContents, function (index, tabsContent) { $.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0)); nfCommon.toggleScrollable(tabsContent.get(0));
}); });
}); });
}); });

View File

@ -24,8 +24,8 @@
'nf.Common', 'nf.Common',
'nf.Client', 'nf.Client',
'nf.ErrorHandler'], 'nf.ErrorHandler'],
function ($, Slick, common, client, errorHandler) { function ($, Slick, nfCommon, nfClient, nfErrorHandler) {
return (nf.UsersTable = factory($, Slick, common, client, errorHandler)); return (nf.UsersTable = factory($, Slick, nfCommon, nfClient, nfErrorHandler));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.UsersTable = module.exports = (nf.UsersTable =
@ -41,7 +41,7 @@
root.nf.Client, root.nf.Client,
root.nf.ErrorHandler); root.nf.ErrorHandler);
} }
}(this, function ($, Slick, common, client, errorHandler) { }(this, function ($, Slick, nfCommon, nfClient, nfErrorHandler) {
'use strict'; 'use strict';
/** /**
@ -76,11 +76,11 @@
// update the user // update the user
$.ajax({ $.ajax({
type: 'DELETE', type: 'DELETE',
url: user.uri + '?' + $.param(client.getRevision(user)), url: user.uri + '?' + $.param(nfClient.getRevision(user)),
dataType: 'json' dataType: 'json'
}).done(function () { }).done(function () {
nfUsersTable.loadUsersTable(); nfUsersTable.loadUsersTable();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
// hide the dialog // hide the dialog
$('#user-delete-dialog').modal('hide'); $('#user-delete-dialog').modal('hide');
@ -169,7 +169,7 @@
// build the request entity // build the request entity
var updatedGroupEntity = { var updatedGroupEntity = {
'revision': client.getRevision(groupEntity), 'revision': nfClient.getRevision(groupEntity),
'component': $.extend({}, groupEntity.component, { 'component': $.extend({}, groupEntity.component, {
'users': groupMembers 'users': groupMembers
}) })
@ -207,7 +207,7 @@
// build the request entity // build the request entity
var updatedGroupEntity = { var updatedGroupEntity = {
'revision': client.getRevision(groupEntity), 'revision': nfClient.getRevision(groupEntity),
'component': $.extend({}, groupEntity.component, { 'component': $.extend({}, groupEntity.component, {
'users': groupMembers 'users': groupMembers
}) })
@ -258,8 +258,8 @@
usersGrid.setSelectedRows([row]); usersGrid.setSelectedRows([row]);
usersGrid.scrollRowIntoView(row); usersGrid.scrollRowIntoView(row);
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -276,7 +276,7 @@
var userEntity = usersData.getItemById(userId); var userEntity = usersData.getItemById(userId);
var updatedUserEntity = { var updatedUserEntity = {
'revision': client.getRevision(userEntity), 'revision': nfClient.getRevision(userEntity),
'component': { 'component': {
'id': userId, 'id': userId,
'identity': userIdentity 'identity': userIdentity
@ -331,8 +331,8 @@
$.when.apply(window, xhrs).always(function () { $.when.apply(window, xhrs).always(function () {
nfUsersTable.loadUsersTable(); nfUsersTable.loadUsersTable();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -359,7 +359,7 @@
usersGrid.setSelectedRows([row]); usersGrid.setSelectedRows([row]);
usersGrid.scrollRowIntoView(row); usersGrid.scrollRowIntoView(row);
}); });
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var updateGroup = function (groupId, groupIdentity, selectedUsers) { var updateGroup = function (groupId, groupIdentity, selectedUsers) {
@ -369,7 +369,7 @@
var groupEntity = usersData.getItemById(groupId); var groupEntity = usersData.getItemById(groupId);
var updatedGroupoEntity = { var updatedGroupoEntity = {
'revision': client.getRevision(groupEntity), 'revision': nfClient.getRevision(groupEntity),
'component': { 'component': {
'id': groupId, 'id': groupId,
'identity': groupIdentity, 'identity': groupIdentity,
@ -386,7 +386,7 @@
contentType: 'application/json' contentType: 'application/json'
}).done(function (groupEntity) { }).done(function (groupEntity) {
nfUsersTable.loadUsersTable(); nfUsersTable.loadUsersTable();
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
/** /**
@ -410,7 +410,7 @@
// see if we should create or update this user // see if we should create or update this user
if ($.trim(userId) === '') { if ($.trim(userId) === '') {
var tenantEntity = { var tenantEntity = {
'revision': client.getRevision({ 'revision': nfClient.getRevision({
'revision': { 'revision': {
'version': 0 'version': 0
} }
@ -524,7 +524,7 @@
*/ */
var globalResourceParser = function (dataContext) { var globalResourceParser = function (dataContext) {
return 'Global policy to ' + return 'Global policy to ' +
common.getPolicyTypeListing(common.substringAfterFirst(dataContext.component.resource, '/')).text; nfCommon.getPolicyTypeListing(nfCommon.substringAfterFirst(dataContext.component.resource, '/')).text;
}; };
/** /**
@ -539,13 +539,13 @@
//determine policy type //determine policy type
if (resource.startsWith('/policies')) { if (resource.startsWith('/policies')) {
resource = common.substringAfterFirst(resource, '/policies'); resource = nfCommon.substringAfterFirst(resource, '/policies');
policyLabel += 'Admin policy for '; policyLabel += 'Admin policy for ';
} else if (resource.startsWith('/data-transfer')) { } else if (resource.startsWith('/data-transfer')) {
resource = common.substringAfterFirst(resource, '/data-transfer'); resource = nfCommon.substringAfterFirst(resource, '/data-transfer');
policyLabel += 'Site to site policy for '; policyLabel += 'Site to site policy for ';
} else if (resource.startsWith('/data')) { } else if (resource.startsWith('/data')) {
resource = common.substringAfterFirst(resource, '/data'); resource = nfCommon.substringAfterFirst(resource, '/data');
policyLabel += 'Data policy for '; policyLabel += 'Data policy for ';
} else { } else {
policyLabel += 'Component policy for '; policyLabel += 'Component policy for ';
@ -592,7 +592,7 @@
// if the user has permission to the policy // if the user has permission to the policy
if (dataContext.permissions.canRead === true) { if (dataContext.permissions.canRead === true) {
// check if Global policy // check if Global policy
if (common.isUndefinedOrNull(dataContext.component.componentReference)) { if (nfCommon.isUndefinedOrNull(dataContext.component.componentReference)) {
return globalResourceParser(dataContext); return globalResourceParser(dataContext);
} }
// not a global policy... check if user has access to the component reference // not a global policy... check if user has access to the component reference
@ -607,7 +607,7 @@
var markup = ''; var markup = '';
if (dataContext.permissions.canRead === true) { if (dataContext.permissions.canRead === true) {
if (common.isDefinedAndNotNull(dataContext.component.componentReference)) { if (nfCommon.isDefinedAndNotNull(dataContext.component.componentReference)) {
if (dataContext.component.resource.indexOf('/processors') >= 0) { if (dataContext.component.resource.indexOf('/processors') >= 0) {
markup += '<div title="Go To" class="pointer go-to-component fa fa-long-arrow-right" style="float: left;"></div>'; markup += '<div title="Go To" class="pointer go-to-component fa fa-long-arrow-right" style="float: left;"></div>';
} else if (dataContext.component.resource.indexOf('/controller-services') >= 0) { } else if (dataContext.component.resource.indexOf('/controller-services') >= 0) {
@ -797,12 +797,12 @@
var markup = ''; var markup = '';
// ensure user can modify the user // ensure user can modify the user
if (common.canModifyTenants()) { if (nfCommon.canModifyTenants()) {
markup += '<div title="Edit" class="pointer edit-user fa fa-pencil" style="margin-right: 3px;"></div>'; markup += '<div title="Edit" class="pointer edit-user fa fa-pencil" style="margin-right: 3px;"></div>';
markup += '<div title="Remove" class="pointer delete-user fa fa-trash"></div>'; markup += '<div title="Remove" class="pointer delete-user fa fa-trash"></div>';
} }
if (!common.isEmpty(dataContext.component.accessPolicies)) { if (!nfCommon.isEmpty(dataContext.component.accessPolicies)) {
markup += '<div title="View User Policies" class="pointer view-user-policies fa fa-key" style="margin-left: 3px;"></div>'; markup += '<div title="View User Policies" class="pointer view-user-policies fa fa-key" style="margin-left: 3px;"></div>';
} }
@ -923,8 +923,8 @@
// defines a function for sorting // defines a function for sorting
var comparer = function (a, b) { var comparer = function (a, b) {
if (a.permissions.canRead && b.permissions.canRead) { if (a.permissions.canRead && b.permissions.canRead) {
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} else { } else {
if (!a.permissions.canRead && !b.permissions.canRead) { if (!a.permissions.canRead && !b.permissions.canRead) {
@ -953,8 +953,8 @@
var comparer = function (a, b) { var comparer = function (a, b) {
if (a.permissions.canRead && b.permissions.canRead) { if (a.permissions.canRead && b.permissions.canRead) {
if (sortDetails.columnId === 'action') { if (sortDetails.columnId === 'action') {
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1; return aString === bString ? 0 : aString > bString ? 1 : -1;
} else if (sortDetails.columnId === 'policy') { } else if (sortDetails.columnId === 'policy') {
var aString = ''; var aString = '';
@ -963,7 +963,7 @@
// if the user has permission to the policy // if the user has permission to the policy
if (a.permissions.canRead === true) { if (a.permissions.canRead === true) {
// check if Global policy // check if Global policy
if (common.isUndefinedOrNull(a.component.componentReference)) { if (nfCommon.isUndefinedOrNull(a.component.componentReference)) {
aString = globalResourceParser(a); aString = globalResourceParser(a);
} else { } else {
// not a global policy... check if user has access to the component reference // not a global policy... check if user has access to the component reference
@ -976,7 +976,7 @@
// if the user has permission to the policy // if the user has permission to the policy
if (b.permissions.canRead === true) { if (b.permissions.canRead === true) {
// check if Global policy // check if Global policy
if (common.isUndefinedOrNull(b.component.componentReference)) { if (nfCommon.isUndefinedOrNull(b.component.componentReference)) {
bString = globalResourceParser(b); bString = globalResourceParser(b);
} else { } else {
// not a global policy... check if user has access to the component reference // not a global policy... check if user has access to the component reference
@ -1021,7 +1021,7 @@
var usersGrid = $('#users-table').data('gridInstance'); var usersGrid = $('#users-table').data('gridInstance');
// ensure the grid has been initialized // ensure the grid has been initialized
if (common.isDefinedAndNotNull(usersGrid)) { if (nfCommon.isDefinedAndNotNull(usersGrid)) {
var usersData = usersGrid.getData(); var usersData = usersGrid.getData();
// update the search criteria // update the search criteria
@ -1195,7 +1195,7 @@
userPoliciesData.beginUpdate(); userPoliciesData.beginUpdate();
// set the rows // set the rows
if (common.isDefinedAndNotNull(user.component.accessPolicies)) { if (nfCommon.isDefinedAndNotNull(user.component.accessPolicies)) {
userPoliciesData.setItems(user.component.accessPolicies); userPoliciesData.setItems(user.component.accessPolicies);
} }
@ -1222,7 +1222,7 @@
initUserDeleteDialog(); initUserDeleteDialog();
initUsersTable(); initUsersTable();
if (common.canModifyTenants()) { if (nfCommon.canModifyTenants()) {
$('#new-user-button').on('click', function () { $('#new-user-button').on('click', function () {
buildUsersList(); buildUsersList();
buildGroupsList(); buildGroupsList();
@ -1247,7 +1247,7 @@
var usersTable = $('#users-table'); var usersTable = $('#users-table');
if (usersTable.is(':visible')) { if (usersTable.is(':visible')) {
var grid = usersTable.data('gridInstance'); var grid = usersTable.data('gridInstance');
if (common.isDefinedAndNotNull(grid)) { if (nfCommon.isDefinedAndNotNull(grid)) {
grid.resizeCanvas(); grid.resizeCanvas();
} }
} }
@ -1310,7 +1310,7 @@
usersGrid.getSelectionModel().setSelectedRows([]); usersGrid.getSelectionModel().setSelectedRows([]);
$('#total-users').text(usersData.getLength()); $('#total-users').text(usersData.getLength());
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
} }
}; };

View File

@ -25,8 +25,8 @@
'nf.ErrorHandler', 'nf.ErrorHandler',
'nf.Storage', 'nf.Storage',
'nf.Client'], 'nf.Client'],
function ($, common, usersTable, errorHandler, storage, client) { function ($, nfCommon, nfUsersTable, nfErrorHandler, nfStorage, nfClient) {
return (nf.Users = factory($, common, usersTable, errorHandler, storage, client)); return (nf.Users = factory($, nfCommon, nfUsersTable, nfErrorHandler, nfStorage, nfClient));
}); });
} else if (typeof exports === 'object' && typeof module === 'object') { } else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Users = module.exports = (nf.Users =
@ -45,7 +45,7 @@
root.nf.Storage, root.nf.Storage,
root.nf.Client); root.nf.Client);
} }
}(this, function ($, common, usersTable, errorHandler, storage, client) { }(this, function ($, nfCommon, nfUsersTable, nfErrorHandler, nfStorage, nfClient) {
'use strict'; 'use strict';
$(document).ready(function () { $(document).ready(function () {
@ -79,14 +79,14 @@
url: config.urls.currentUser, url: config.urls.currentUser,
dataType: 'json' dataType: 'json'
}).done(function (currentUser) { }).done(function (currentUser) {
common.setCurrentUser(currentUser); nfCommon.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}; };
var initializeUsersPage = function () { var initializeUsersPage = function () {
// define mouse over event for the refresh button // define mouse over event for the refresh button
common.addHoverEffect('#user-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () { nfCommon.addHoverEffect('#user-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () {
usersTable.loadUsersTable(); nfUsersTable.loadUsersTable();
}); });
// get the banners if we're not in the shell // get the banners if we're not in the shell
@ -98,8 +98,8 @@
dataType: 'json' dataType: 'json'
}).done(function (bannerResponse) { }).done(function (bannerResponse) {
// ensure the banners response is specified // ensure the banners response is specified
if (common.isDefinedAndNotNull(bannerResponse.banners)) { if (nfCommon.isDefinedAndNotNull(bannerResponse.banners)) {
if (common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') { if (nfCommon.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') {
// update the header text // update the header text
var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show(); var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show();
@ -113,7 +113,7 @@
updateTop('users'); updateTop('users');
} }
if (common.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') { if (nfCommon.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') {
// update the footer text and show it // update the footer text and show it
var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show(); var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show();
@ -129,7 +129,7 @@
deferred.resolve(); deferred.resolve();
}).fail(function (xhr, status, error) { }).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error); nfErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject(); deferred.reject();
}); });
} else { } else {
@ -143,25 +143,25 @@
* Initializes the counters page. * Initializes the counters page.
*/ */
init: function () { init: function () {
storage.init(); nfStorage.init();
// initialize the client // initialize the client
client.init(); nfClient.init();
// load the users authorities // load the users authorities
ensureAccess().done(function () { ensureAccess().done(function () {
// create the counters table // create the counters table
usersTable.init(); nfUsersTable.init();
// load the users table // load the users table
usersTable.loadUsersTable().done(function () { nfUsersTable.loadUsersTable().done(function () {
// finish initializing users page // finish initializing users page
initializeUsersPage().done(function () { initializeUsersPage().done(function () {
// listen for browser resize events to update the page size // listen for browser resize events to update the page size
$(window).resize(usersTable.resetTableSize); $(window).resize(nfUsersTable.resetTableSize);
// configure the initial grid height // configure the initial grid height
usersTable.resetTableSize(); nfUsersTable.resetTableSize();
// get the about details // get the about details
$.ajax({ $.ajax({
@ -175,7 +175,7 @@
// set the document title and the about title // set the document title and the about title
document.title = countersTitle; document.title = countersTitle;
$('#users-header-text').text(countersTitle); $('#users-header-text').text(countersTitle);
}).fail(errorHandler.handleAjaxError); }).fail(nfErrorHandler.handleAjaxError);
}); });
$(window).on('resize', function (e) { $(window).on('resize', function (e) {