http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js index d2566e1..e214ca8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js @@ -32,8 +32,8 @@ 'nf.Shell', 'nf.ComponentState', 'nf.PolicyManagement'], - function ($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement) { - return (nf.Settings = factory($, 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, nfClient, nfDialog, nfCommon, nfCanvasUtils, nfControllerServices, nfErrorHandler, nfReportingTask, nfShell, nfComponentState, nfPolicyManagement)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Settings = @@ -65,7 +65,7 @@ root.nf.ComponentState, 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'; @@ -107,7 +107,7 @@ // marshal the configuration details var configuration = marshalConfiguration(); var entity = { - 'revision': client.getRevision({ + 'revision': nfClient.getRevision({ 'revision': { 'version': version } @@ -124,7 +124,7 @@ contentType: 'application/json' }).done(function (response) { // close the settings dialog - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Settings', dialogContent: 'Settings successfully applied.' }); @@ -133,7 +133,7 @@ $('#settings-save').off('click').on('click', function () { saveSettings(response.revision.version); }); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); } /** @@ -211,7 +211,7 @@ * @param item reporting task type */ var isSelectable = function (item) { - return common.isBlank(item.usageRestriction) || common.canAccessRestrictedComponents(); + return nfCommon.isBlank(item.usageRestriction) || nfCommon.canAccessRestrictedComponents(); }; /** @@ -247,7 +247,7 @@ 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 (sortDetails.columnId === 'moreDetails') { var aBulletins = 0; - if (!common.isEmpty(a.bulletins)) { + if (!nfCommon.isEmpty(a.bulletins)) { aBulletins = a.bulletins.length; } var bBulletins = 0; - if (!common.isEmpty(b.bulletins)) { + if (!nfCommon.isEmpty(b.bulletins)) { bBulletins = b.bulletins.length; } return aBulletins - bBulletins; } else if (sortDetails.columnId === 'type') { - var aType = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? common.substringAfterLast(a.component[sortDetails.columnId], '.') : ''; - var bType = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? common.substringAfterLast(b.component[sortDetails.columnId], '.') : ''; + var aType = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? nfCommon.substringAfterLast(a.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; } else if (sortDetails.columnId === 'state') { var aState = 'Invalid'; - if (common.isEmpty(a.component.validationErrors)) { - aState = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; + if (nfCommon.isEmpty(a.component.validationErrors)) { + aState = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; } var bState = 'Invalid'; - if (common.isEmpty(b.component.validationErrors)) { - bState = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; + if (nfCommon.isEmpty(b.component.validationErrors)) { + bState = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; } return aState === bState ? 0 : aState > bState ? 1 : -1; } else { - var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; - var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; + var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; + var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; } } else { @@ -322,7 +322,7 @@ var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance'); // ensure the grid has been initialized - if (common.isDefinedAndNotNull(reportingTaskTypesGrid)) { + if (nfCommon.isDefinedAndNotNull(reportingTaskTypesGrid)) { var reportingTaskTypesData = reportingTaskTypesGrid.getData(); // update the search criteria @@ -404,7 +404,7 @@ // ensure something was selected if (selectedTaskType === '') { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Settings', dialogContent: 'The type of reporting task to create must be selected.' }); @@ -421,7 +421,7 @@ var addReportingTask = function (reportingTaskType) { // build the reporting task entity var reportingTaskEntity = { - 'revision': client.getRevision({ + 'revision': nfClient.getRevision({ 'revision': { 'version': 0 } @@ -452,7 +452,7 @@ var row = reportingTaskData.getRowById(reportingTaskEntity.id); reportingTaskGrid.setSelectedRows([row]); reportingTaskGrid.scrollRowIntoView(row); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); // hide the dialog $('#new-reporting-task-dialog').modal('hide'); @@ -490,7 +490,7 @@ id: 'type', name: 'Type', field: 'label', - formatter: common.typeFormatter, + formatter: nfCommon.typeFormatter, sortable: false, resizable: true }, @@ -524,11 +524,11 @@ var reportingTaskType = reportingTaskTypesGrid.getDataItem(reportingTaskTypeIndex); // set the reporting task type description - if (common.isDefinedAndNotNull(reportingTaskType)) { + if (nfCommon.isDefinedAndNotNull(reportingTaskType)) { // show the selected reporting task $('#reporting-task-description-container').show(); - if (common.isBlank(reportingTaskType.description)) { + if (nfCommon.isBlank(reportingTaskType.description)) { $('#reporting-task-type-description') .attr('title', '') .html('<span class="unset">No description specified</span>'); @@ -557,7 +557,7 @@ } }); 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 @@ -584,8 +584,8 @@ var item = reportingTaskTypesData.getItemById(rowId); // show the tooltip - if (common.isDefinedAndNotNull(item.usageRestriction)) { - usageRestriction.qtip($.extend({}, common.config.tooltipConfig, { + if (nfCommon.isDefinedAndNotNull(item.usageRestriction)) { + usageRestriction.qtip($.extend({}, nfCommon.config.tooltipConfig, { content: item.usageRestriction, position: { container: $('#summary'), @@ -618,10 +618,10 @@ // add the documented type reportingTaskTypesData.addItem({ id: id++, - label: common.substringAfterLast(documentedType.type, '.'), + label: nfCommon.substringAfterLast(documentedType.type, '.'), type: documentedType.type, - description: common.escapeHtml(documentedType.description), - usageRestriction: common.escapeHtml(documentedType.usageRestriction), + description: nfCommon.escapeHtml(documentedType.description), + usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction), tags: documentedType.tags.join(', ') }); @@ -643,7 +643,7 @@ select: applyReportingTaskTypeFilter, remove: applyReportingTaskTypeFilter }); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); // initialize the reporting task dialog $('#new-reporting-task-dialog').modal({ @@ -732,8 +732,8 @@ // always include a button to view the usage markup += '<div title="Usage" class="pointer reporting-task-usage fa fa-book"></div>'; - var hasErrors = !common.isEmpty(dataContext.component.validationErrors); - var hasBulletins = !common.isEmpty(dataContext.bulletins); + var hasErrors = !nfCommon.isEmpty(dataContext.component.validationErrors); + var hasBulletins = !nfCommon.isEmpty(dataContext.bulletins); if (hasErrors) { markup += '<div class="pointer has-errors fa fa-warning" ></div>'; @@ -744,7 +744,7 @@ } 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; @@ -757,7 +757,7 @@ // determine the appropriate label var icon = '', label = ''; - if (!common.isEmpty(dataContext.component.validationErrors)) { + if (!nfCommon.isEmpty(dataContext.component.validationErrors)) { label = 'Invalid'; icon = 'invalid fa fa-warning'; } else { @@ -775,13 +775,13 @@ // include the active thread count if appropriate 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 + ')'; } // format the markup 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) { @@ -794,7 +794,7 @@ 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 - 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>'; } } @@ -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>'; } // 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>'; } @@ -884,33 +884,33 @@ // determine the desired action if (reportingTasksGrid.getColumns()[args.cell].id === 'actions') { if (target.hasClass('edit-reporting-task')) { - reportingTask.showConfiguration(reportingTaskEntity); + nfReportingTask.showConfiguration(reportingTaskEntity); } else if (target.hasClass('start-reporting-task')) { - reportingTask.start(reportingTaskEntity); + nfReportingTask.start(reportingTaskEntity); } else if (target.hasClass('stop-reporting-task')) { - reportingTask.stop(reportingTaskEntity); + nfReportingTask.stop(reportingTaskEntity); } else if (target.hasClass('delete-reporting-task')) { - reportingTask.promptToDeleteReportingTask(reportingTaskEntity); + nfReportingTask.promptToDeleteReportingTask(reportingTaskEntity); } else if (target.hasClass('view-state-reporting-task')) { 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')) { // show the policies for this service - policyManagement.showReportingTaskPolicy(reportingTaskEntity); + nfPolicyManagement.showReportingTaskPolicy(reportingTaskEntity); // close the settings dialog $('#shell-close-button').click(); } } else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') { if (target.hasClass('view-reporting-task')) { - reportingTask.showDetails(reportingTaskEntity); + nfReportingTask.showDetails(reportingTaskEntity); } else if (target.hasClass('reporting-task-usage')) { // close the settings dialog $('#shell-close-button').click(); // open the documentation for this reporting task - shell.showPage('../nifi-docs/documentation?' + $.param({ - select: common.substringAfterLast(reportingTaskEntity.component.type, '.') + nfShell.showPage('../nifi-docs/documentation?' + $.param({ + select: nfCommon.substringAfterLast(reportingTaskEntity.component.type, '.') })).done(function () { nfSettings.showSettings(); }); @@ -939,12 +939,12 @@ var reportingTaskEntity = reportingTasksData.getItemById(taskId); // format the errors - var tooltip = common.formatUnorderedList(reportingTaskEntity.component.validationErrors); + var tooltip = nfCommon.formatUnorderedList(reportingTaskEntity.component.validationErrors); // show the tooltip - if (common.isDefinedAndNotNull(tooltip)) { + if (nfCommon.isDefinedAndNotNull(tooltip)) { errorIcon.qtip($.extend({}, - common.config.tooltipConfig, + nfCommon.config.tooltipConfig, { content: tooltip, position: { @@ -968,13 +968,13 @@ var reportingTaskEntity = reportingTasksData.getItemById(taskId); // format the tooltip - var bulletins = common.getFormattedBulletins(reportingTaskEntity.bulletins); - var tooltip = common.formatUnorderedList(bulletins); + var bulletins = nfCommon.getFormattedBulletins(reportingTaskEntity.bulletins); + var tooltip = nfCommon.formatUnorderedList(bulletins); // show the tooltip - if (common.isDefinedAndNotNull(tooltip)) { + if (nfCommon.isDefinedAndNotNull(tooltip)) { bulletinIcon.qtip($.extend({}, - common.config.tooltipConfig, + nfCommon.config.tooltipConfig, { content: tooltip, position: { @@ -1055,7 +1055,7 @@ // load the 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 var reportingTasks = loadReportingTasks(); @@ -1066,7 +1066,7 @@ // update the current time $('#settings-last-refreshed').text(controllerServicesResponse.currentTime); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -1086,8 +1086,8 @@ }); var reportingTasksElement = $('#reporting-tasks-table'); - common.cleanUpTooltips(reportingTasksElement, 'div.has-errors'); - common.cleanUpTooltips(reportingTasksElement, 'div.has-bulletins'); + nfCommon.cleanUpTooltips(reportingTasksElement, 'div.has-errors'); + nfCommon.cleanUpTooltips(reportingTasksElement, 'div.has-bulletins'); var reportingTasksGrid = reportingTasksElement.data('gridInstance'); var reportingTasksData = reportingTasksGrid.getData(); @@ -1104,7 +1104,7 @@ */ var showSettings = function () { // show the settings dialog - shell.showContent('#settings').done(function () { + nfShell.showContent('#settings').done(function () { reset(); }); @@ -1150,9 +1150,9 @@ $('#settings-save').show(); } else { var canModifyController = false; - if (common.isDefinedAndNotNull(common.currentUser)) { + if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) { // 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) { @@ -1190,13 +1190,13 @@ var selectedTab = $('#settings-tabs li.selected-tab').text(); if (selectedTab === 'Controller Services') { var controllerServicesUri = config.urls.api + '/controller/controller-services'; - controllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable()); + nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable()); } else if (selectedTab === 'Reporting Tasks') { $('#new-reporting-task-dialog').modal('show'); // reset the canvas size after the dialog is shown var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance'); - if (common.isDefinedAndNotNull(reportingTaskTypesGrid)) { + if (nfCommon.isDefinedAndNotNull(reportingTaskTypesGrid)) { reportingTaskTypesGrid.setSelectedRows([0]); reportingTaskTypesGrid.resizeCanvas(); } @@ -1208,7 +1208,7 @@ // initialize each tab initGeneral(); - controllerServices.init(getControllerServicesTable(), nfSettings.showSettings); + nfControllerServices.init(getControllerServicesTable(), nfSettings.showSettings); initReportingTasks(); }, @@ -1216,10 +1216,10 @@ * Update the size of the grid based on its container's current size. */ resetTableSize: function () { - controllerServices.resetTableSize(getControllerServicesTable()); + nfControllerServices.resetTableSize(getControllerServicesTable()); var reportingTasksGrid = $('#reporting-tasks-table').data('gridInstance'); - if (common.isDefinedAndNotNull(reportingTasksGrid)) { + if (nfCommon.isDefinedAndNotNull(reportingTasksGrid)) { reportingTasksGrid.resizeCanvas(); } }, @@ -1264,7 +1264,7 @@ */ setBulletins: function (controllerServiceBulletins, reportingTaskBulletins) { if ($('#controller-services-table').data('gridInstance')) { - controllerServices.setBulletins(getControllerServicesTable(), controllerServiceBulletins); + nfControllerServices.setBulletins(getControllerServicesTable(), controllerServiceBulletins); } // reporting tasks @@ -1273,7 +1273,7 @@ reportingTasksData.beginUpdate(); // if there are some bulletins process them - if (!common.isEmpty(reportingTaskBulletins)) { + if (!nfCommon.isEmpty(reportingTaskBulletins)) { var reportingTaskBulletinsBySource = d3.nest() .key(function (d) { return d.sourceId; @@ -1282,7 +1282,7 @@ reportingTaskBulletinsBySource.forEach(function (sourceId, sourceBulletins) { var reportingTask = reportingTasksData.getItemById(sourceId); - if (common.isDefinedAndNotNull(reportingTask)) { + if (nfCommon.isDefinedAndNotNull(reportingTask)) { reportingTasksData.updateItem(sourceId, $.extend(reportingTask, { bulletins: sourceBulletins }));
http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js index f8c6f83..159c2d3 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-snippet.js @@ -23,8 +23,8 @@ 'd3', 'nf.CanvasUtils', 'nf.Client'], - function ($, d3, canvasUtils, client) { - return (nf.Snippet = factory($, d3, canvasUtils, client)); + function ($, d3, nfCanvasUtils, nfClient) { + return (nf.Snippet = factory($, d3, nfCanvasUtils, nfClient)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Snippet = @@ -38,7 +38,7 @@ root.nf.CanvasUtils, root.nf.Client); } -}(this, function ($, d3, canvasUtils, client) { +}(this, function ($, d3, nfCanvasUtils, nfClient) { 'use strict'; var config = { @@ -57,7 +57,7 @@ */ marshal: function (selection) { var snippet = { - parentGroupId: canvasUtils.getGroupId(), + parentGroupId: nfCanvasUtils.getGroupId(), processors: {}, funnels: {}, inputPorts: {}, @@ -72,22 +72,22 @@ selection.each(function (d) { var selected = d3.select(this); - if (canvasUtils.isProcessor(selected)) { - snippet.processors[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isFunnel(selected)) { - snippet.funnels[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isLabel(selected)) { - snippet.labels[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isInputPort(selected)) { - snippet.inputPorts[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isOutputPort(selected)) { - snippet.outputPorts[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isProcessGroup(selected)) { - snippet.processGroups[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isRemoteProcessGroup(selected)) { - snippet.remoteProcessGroups[d.id] = client.getRevision(selected.datum()); - } else if (canvasUtils.isConnection(selected)) { - snippet.connections[d.id] = client.getRevision(selected.datum()); + if (nfCanvasUtils.isProcessor(selected)) { + snippet.processors[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isFunnel(selected)) { + snippet.funnels[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isLabel(selected)) { + snippet.labels[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isInputPort(selected)) { + snippet.inputPorts[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isOutputPort(selected)) { + snippet.outputPorts[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isProcessGroup(selected)) { + snippet.processGroups[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isRemoteProcessGroup(selected)) { + snippet.remoteProcessGroups[d.id] = nfClient.getRevision(selected.datum()); + } else if (nfCanvasUtils.isConnection(selected)) { + snippet.connections[d.id] = nfClient.getRevision(selected.datum()); } }); @@ -128,7 +128,7 @@ return $.ajax({ type: 'POST', - url: config.urls.processGroups + '/' + encodeURIComponent(canvasUtils.getGroupId()) + '/snippet-instance', + url: config.urls.processGroups + '/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/snippet-instance', data: JSON.stringify(copySnippetRequestEntity), dataType: 'json', contentType: 'application/json' http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js index 6bb0d4a..c29f387 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster-table.js @@ -24,8 +24,8 @@ 'nf.Common', 'nf.Dialog', 'nf.ErrorHandler'], - function ($, Slick, common, dialog, errorHandler) { - return (nf.ClusterTable = factory($, Slick, common, dialog, errorHandler)); + function ($, Slick, nfCommon, nfDialog, nfErrorHandler) { + return (nf.ClusterTable = factory($, Slick, nfCommon, nfDialog, nfErrorHandler)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.ClusterTable = @@ -41,7 +41,7 @@ root.nf.Dialog, root.nf.ErrorHandler); } -}(this, function ($, Slick, common, dialog, errorHandler) { +}(this, function ($, Slick, nfCommon, nfDialog, nfErrorHandler) { 'use strict'; /** @@ -58,11 +58,11 @@ data: [{ name: 'cluster', update: refreshClusterData, - isAuthorized: common.canAccessController + isAuthorized: nfCommon.canAccessController }, { name: 'systemDiagnostics', update: refreshSystemDiagnosticsData, - isAuthorized: common.canAccessSystem + isAuthorized: nfCommon.canAccessSystem } ] }; @@ -452,7 +452,7 @@ // function for formatting the last accessed time var valueFormatter = function (row, cell, value, columnDef, dataContext) { - return common.formatValue(value); + return nfCommon.formatValue(value); }; // define a custom formatter for the status column @@ -523,7 +523,7 @@ ]; // only allow the admin to modify the cluster - if (common.canModifyController()) { + if (nfCommon.canModifyController()) { var actionFormatter = function (row, cell, value, columnDef, dataContext) { var canDisconnect = false; var canConnect = false; @@ -571,8 +571,8 @@ // defines a function for sorting var comparer = function (a, b) { if (sortDetails.columnId === 'heartbeat' || sortDetails.columnId === 'uptime') { - var aDate = common.parseDateTime(a[sortDetails.columnId]); - var bDate = common.parseDateTime(b[sortDetails.columnId]); + var aDate = nfCommon.parseDateTime(a[sortDetails.columnId]); + var bDate = nfCommon.parseDateTime(b[sortDetails.columnId]); return aDate.getTime() - bDate.getTime(); } else if (sortDetails.columnId === 'queued') { var aSplit = a[sortDetails.columnId].split(/ \/ /); @@ -580,13 +580,13 @@ var mod = count % 4; if (mod < 2) { $('#cluster-nodes-table span.queued-title').addClass('sorted'); - var aCount = common.parseCount(aSplit[0]); - var bCount = common.parseCount(bSplit[0]); + var aCount = nfCommon.parseCount(aSplit[0]); + var bCount = nfCommon.parseCount(bSplit[0]); return aCount - bCount; } else { $('#cluster-nodes-table span.queued-size-title').addClass('sorted'); - var aSize = common.parseSize(aSplit[1]); - var bSize = common.parseSize(bSplit[1]); + var aSize = nfCommon.parseSize(aSplit[1]); + var bSize = nfCommon.parseSize(bSplit[1]); return aSize - bSize; } } else if (sortDetails.columnId === 'maxHeap' || sortDetails.columnId === 'totalHeap' || sortDetails.columnId === 'usedHeap' @@ -594,19 +594,19 @@ || sortDetails.columnId === 'ffRepoTotal' || sortDetails.columnId === 'ffRepoUsed' || sortDetails.columnId === 'ffRepoFree' || sortDetails.columnId === 'contentRepoTotal' || sortDetails.columnId === 'contentRepoUsed' || sortDetails.columnId === 'contentRepoFree') { - var aSize = common.parseSize(a[sortDetails.columnId]); - var bSize = common.parseSize(b[sortDetails.columnId]); + var aSize = nfCommon.parseSize(a[sortDetails.columnId]); + var bSize = nfCommon.parseSize(b[sortDetails.columnId]); return aSize - bSize; } else if (sortDetails.columnId === 'totalThreads' || sortDetails.columnId === 'daemonThreads' || sortDetails.columnId === 'processors') { - var aCount = common.parseCount(a[sortDetails.columnId]); - var bCount = common.parseCount(b[sortDetails.columnId]); + var aCount = nfCommon.parseCount(a[sortDetails.columnId]); + var bCount = nfCommon.parseCount(b[sortDetails.columnId]); return aCount - bCount; } else if (sortDetails.columnId === 'gcOldGen' || sortDetails.columnId === 'gcNewGen') { var aSplit = a[sortDetails.columnId].split(/ /); var bSplit = b[sortDetails.columnId].split(/ /); - var aCount = common.parseCount(aSplit[0]); - var bCount = common.parseCount(bSplit[0]); + var aCount = nfCommon.parseCount(aSplit[0]); + var bCount = nfCommon.parseCount(bSplit[0]); return aCount - bCount; } else if (sortDetails.columnId === 'status') { var aStatus = formatNodeStatus(a); @@ -617,8 +617,8 @@ var bNode = formatNodeAddress(b); return aNode === bNode ? 0 : aNode > bNode ? 1 : -1; } else { - var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; - var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; + var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; + var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; } }; @@ -648,7 +648,7 @@ * @returns {string} */ 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) { // prompt to connect - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Connect Node', dialogContent: 'Connect \'' + formatNodeAddress(node) + '\' to this cluster?', yesHandler: function () { @@ -709,7 +709,7 @@ var clusterGrid = $('#cluster-nodes-table').data('gridInstance'); var clusterData = clusterGrid.getData(); clusterData.updateItem(node.nodeId, node); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -719,7 +719,7 @@ */ var promptForDisconnect = function (node) { // prompt for disconnect - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Disconnect Node', dialogContent: 'Disconnect \'' + formatNodeAddress(node) + '\' from the cluster?', yesHandler: function () { @@ -754,7 +754,7 @@ var clusterGrid = $('#cluster-nodes-table').data('gridInstance'); var clusterData = clusterGrid.getData(); clusterData.updateItem(node.nodeId, node); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -764,7 +764,7 @@ */ var promptForRemoval = function (node) { // prompt for disconnect - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ headerText: 'Remove Node', dialogContent: 'Remove \'' + formatNodeAddress(node) + '\' from the cluster?', yesHandler: function () { @@ -788,7 +788,7 @@ var clusterGrid = $('#cluster-nodes-table').data('gridInstance'); var clusterData = clusterGrid.getData(); clusterData.deleteItem(nodeId); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -812,7 +812,7 @@ var grid = visibleTab.grid; // ensure the grid has been initialized - if (common.isDefinedAndNotNull(grid)) { + if (nfCommon.isDefinedAndNotNull(grid)) { var gridData = grid.getData(); // update the search criteria @@ -912,22 +912,22 @@ $.each(node.events, function (i, event) { eventMessages.push(event.timestamp + ": " + event.message); }); - $('<div></div>').append(common.formatUnorderedList(eventMessages)).appendTo(events); + $('<div></div>').append(nfCommon.formatUnorderedList(eventMessages)).appendTo(events); } else { events.append('<div><span class="unset">None</span></div>'); } // show the dialog $('#node-details-dialog').modal('show'); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** * Applies system diagnostics data to the JVM tab. */ function updateJvmTableData(systemDiagnosticsResponse) { - if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) - && common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { + if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) + && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { var jvmTableRows = []; systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { @@ -970,8 +970,8 @@ * Applies system diagnostics data to the System tab. */ function updateSystemTableData(systemDiagnosticsResponse) { - if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) - && common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { + if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) + && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { var systemTableRows = []; systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { @@ -999,8 +999,8 @@ * Applies system diagnostics data to the FlowFile Storage tab. */ function updateFlowFileTableData(systemDiagnosticsResponse) { - if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) - && common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { + if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) + && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { var flowFileTableRows = []; systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { @@ -1028,8 +1028,8 @@ * Applies system diagnostics data to the Content Storage tab. */ function updateContentTableData(systemDiagnosticsResponse) { - if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) - && common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { + if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) + && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { var contentStorageTableRows = []; systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { @@ -1061,8 +1061,8 @@ * Applies system diagnostics data to the Versions tab. */ function updateVersionTableData(systemDiagnosticsResponse) { - if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) - && common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { + if (nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics) + && nfCommon.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) { var versionTableRows = []; systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) { @@ -1103,7 +1103,7 @@ handlers.forEach(function (handler) { handler(systemDiagnosticsResponse); }); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); return loadPromise; }; @@ -1176,7 +1176,7 @@ var cluster = clusterResponse.cluster; // ensure there are groups specified - if (common.isDefinedAndNotNull(cluster.nodes)) { + if (nfCommon.isDefinedAndNotNull(cluster.nodes)) { var clusterGrid = nodesTab.grid; var clusterData = clusterGrid.getData(); @@ -1206,7 +1206,7 @@ handlers.forEach(function (handler) { handler(response); }); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); return clusterNodesDataPromise; } @@ -1216,7 +1216,7 @@ function onSelectTab(tab) { // Resize table var tabGrid = tab.grid; - if (common.isDefinedAndNotNull(tabGrid)) { + if (nfCommon.isDefinedAndNotNull(tabGrid)) { tabGrid.resizeCanvas(); } http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster.js index 543c8dc..69e0d3e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/cluster/nf-cluster.js @@ -24,8 +24,8 @@ 'nf.ClusterTable', 'nf.ErrorHandler', 'nf.Storage'], - function ($, common, clusterTable, errorHandler, storage) { - return (nf.Cluster = factory($, common, clusterTable, errorHandler, storage)); + function ($, nfCommon, nfClusterTable, nfErrorHandler, nfStorage) { + return (nf.Cluster = factory($, nfCommon, nfClusterTable, nfErrorHandler, nfStorage)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Cluster = @@ -41,7 +41,7 @@ root.nf.ErrorHandler, root.nf.Storage); } -}(this, function ($, common, clusterTable, errorHandler, storage) { +}(this, function ($, nfCommon, nfClusterTable, nfErrorHandler, nfStorage) { 'use strict'; $(document).ready(function () { @@ -69,8 +69,8 @@ url: config.urls.currentUser, dataType: 'json' }).done(function (currentUser) { - common.setCurrentUser(currentUser); - }).fail(errorHandler.handleAjaxError); + nfCommon.setCurrentUser(currentUser); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -79,7 +79,7 @@ var initializeClusterPage = function () { // define mouse over event for the refresh button $('#refresh-button').click(function () { - clusterTable.loadClusterTable(); + nfClusterTable.loadClusterTable(); }); // return a deferred for page initialization @@ -92,8 +92,8 @@ dataType: 'json' }).done(function (bannerResponse) { // ensure the banners response is specified - if (common.isDefinedAndNotNull(bannerResponse.banners)) { - if (common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') { + if (nfCommon.isDefinedAndNotNull(bannerResponse.banners)) { + if (nfCommon.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') { // update the header text var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show(); @@ -107,7 +107,7 @@ 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 var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show(); @@ -123,7 +123,7 @@ deferred.resolve(); }).fail(function (xhr, status, error) { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); } else { @@ -137,7 +137,7 @@ * Initializes the counters page. */ init: function () { - storage.init(); + nfStorage.init(); // load the current user loadCurrentUser().done(function () { @@ -159,13 +159,13 @@ setBodySize(); // create the cluster table - clusterTable.init(); + nfClusterTable.init(); // resize to fit - clusterTable.resetTableSize(); + nfClusterTable.resetTableSize(); // load the table - clusterTable.loadClusterTable().done(function () { + nfClusterTable.loadClusterTable().done(function () { // once the table is initialized, finish initializing the page initializeClusterPage().done(function () { @@ -181,7 +181,7 @@ // set the document title and the about title document.title = countersTitle; $('#counters-header-text').text(countersTitle); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); $(window).on('resize', function (e) { setBodySize(); @@ -214,7 +214,7 @@ } } $.each(tabsContents, function (index, tabsContent) { - common.toggleScrollable(tabsContent.get(0)); + nfCommon.toggleScrollable(tabsContent.get(0)); }); }); }); http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js index 9594247..8cd04c7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters-table.js @@ -23,8 +23,8 @@ 'Slick', 'nf.Common', 'nf.ErrorHandler'], - function ($, Slick, common, errorHandler) { - return (nf.CountersTable = factory($, Slick, common, errorHandler)); + function ($, Slick, nfCommon, nfErrorHandler) { + return (nf.CountersTable = factory($, Slick, nfCommon, nfErrorHandler)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.CountersTable = @@ -38,7 +38,7 @@ root.nf.Common, root.nf.ErrorHandler); } -}(this, function ($, Slick, common, errorHandler) { +}(this, function ($, Slick, nfCommon, nfErrorHandler) { 'use strict'; /** @@ -60,12 +60,12 @@ // defines a function for sorting var comparer = function (a, b) { if (sortDetails.columnId === 'value') { - var aCount = common.parseCount(a[sortDetails.columnId]); - var bCount = common.parseCount(b[sortDetails.columnId]); + var aCount = nfCommon.parseCount(a[sortDetails.columnId]); + var bCount = nfCommon.parseCount(b[sortDetails.columnId]); return aCount - bCount; } else { - var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; - var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; + var aString = nfCommon.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : ''; + var bString = nfCommon.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; } }; @@ -91,7 +91,7 @@ var countersGrid = $('#counters-table').data('gridInstance'); // ensure the grid has been initialized - if (common.isDefinedAndNotNull(countersGrid)) { + if (nfCommon.isDefinedAndNotNull(countersGrid)) { var countersData = countersGrid.getData(); // update the search criteria @@ -144,7 +144,7 @@ var countersGrid = $('#counters-table').data('gridInstance'); var countersData = countersGrid.getData(); countersData.updateItem(counter.id, counter); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; return { @@ -198,7 +198,7 @@ ]; // only allow dfm's to reset counters - if (common.canModifyCounters()) { + if (nfCommon.canModifyCounters()) { // function for formatting the actions column 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>'; @@ -294,7 +294,7 @@ */ resetTableSize: function () { var countersGrid = $('#counters-table').data('gridInstance'); - if (common.isDefinedAndNotNull(countersGrid)) { + if (nfCommon.isDefinedAndNotNull(countersGrid)) { countersGrid.resizeCanvas(); } }, @@ -312,7 +312,7 @@ var aggregateSnapshot = report.aggregateSnapshot; // ensure there are groups specified - if (common.isDefinedAndNotNull(aggregateSnapshot.counters)) { + if (nfCommon.isDefinedAndNotNull(aggregateSnapshot.counters)) { var countersGrid = $('#counters-table').data('gridInstance'); var countersData = countersGrid.getData(); @@ -329,7 +329,7 @@ } else { $('#total-counters').text('0'); } - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); } }; })); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters.js index 0a16013..22c587e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/counters/nf-counters.js @@ -24,8 +24,8 @@ 'nf.CountersTable', 'nf.ErrorHandler', 'nf.Storage'], - function ($, common, countersTable, errorHandler, storage) { - return (nf.Counters = factory($, common, countersTable, errorHandler, storage)); + function ($, nfCommon, nfCountersTable, nfErrorHandler, nfStorage) { + return (nf.Counters = factory($, nfCommon, nfCountersTable, nfErrorHandler, nfStorage)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Counters = @@ -41,7 +41,7 @@ root.nf.ErrorHandler, root.nf.Storage); } -}(this, function ($, common, countersTable, errorHandler, storage) { +}(this, function ($, nfCommon, nfCountersTable, nfErrorHandler, nfStorage) { 'use strict'; $(document).ready(function () { @@ -69,9 +69,9 @@ url: config.urls.currentUser, dataType: 'json' }).done(function (currentUser) { - common.setCurrentUser(currentUser); + nfCommon.setCurrentUser(currentUser); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -80,7 +80,7 @@ var initializeCountersPage = function () { // define mouse over event for the refresh button $('#refresh-button').click(function () { - countersTable.loadCountersTable(); + nfCountersTable.loadCountersTable(); }); // return a deferred for page initialization @@ -93,8 +93,8 @@ dataType: 'json' }).done(function (response) { // ensure the banners response is specified - if (common.isDefinedAndNotNull(response.banners)) { - if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { + if (nfCommon.isDefinedAndNotNull(response.banners)) { + if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { // update the header text var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); @@ -108,7 +108,7 @@ 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 var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); @@ -124,7 +124,7 @@ deferred.resolve(); }).fail(function (xhr, status, error) { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); } else { @@ -138,15 +138,15 @@ * Initializes the counters page. */ init: function () { - storage.init(); + nfStorage.init(); // load the current user loadCurrentUser().done(function () { // create the counters table - countersTable.init(); + nfCountersTable.init(); // load the table - countersTable.loadCountersTable().done(function () { + nfCountersTable.loadCountersTable().done(function () { // once the table is initialized, finish initializing the page initializeCountersPage().done(function () { var setBodySize = function () { @@ -163,7 +163,7 @@ } // configure the initial grid height - countersTable.resetTableSize(); + nfCountersTable.resetTableSize(); }; // get the about details @@ -181,7 +181,7 @@ // set the initial size setBodySize(); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); $(window).on('resize', function (e) { setBodySize(); @@ -214,7 +214,7 @@ } } $.each(tabsContents, function (index, tabsContent) { - common.toggleScrollable(tabsContent.get(0)); + nfCommon.toggleScrollable(tabsContent.get(0)); }); }); }); http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-model.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-model.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-model.js index bf1e34a..43613fd 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-model.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-model.js @@ -23,8 +23,8 @@ 'Slick', 'nf.Common', 'nf.ErrorHandler'], - function ($, Slick, common, errorHandler) { - return (nf.HistoryModel = factory($, Slick, common, errorHandler)); + function ($, Slick, nfCommon, nfErrorHandler) { + return (nf.HistoryModel = factory($, Slick, nfCommon, nfErrorHandler)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.HistoryModel = @@ -38,7 +38,7 @@ root.nf.Common, root.nf.ErrorHandler); } -}(this, function ($, Slick, common, errorHandler) { +}(this, function ($, Slick, nfCommon, nfErrorHandler) { 'use strict'; // private @@ -164,7 +164,7 @@ $('#history-last-refreshed').text(history.lastRefreshed); // 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 if (query['sourceId'] || query['userIdentity'] || query['startDate'] || query['endDate']) { @@ -181,7 +181,7 @@ from: from, to: to }); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); xhr.fromPage = fromPage; xhr.toPage = toPage; http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-table.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-table.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-table.js index 16b0007..64bcab0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-table.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history-table.js @@ -25,8 +25,8 @@ 'nf.Dialog', 'nf.ErrorHandler', 'nf.HistoryModel'], - function ($, Slick, common, dialog, errorHandler, HistoryModel) { - return (nf.HistoryTable = factory($, Slick, common, dialog, errorHandler, HistoryModel)); + function ($, Slick, nfCommon, nfDialog, nfErrorHandler, nfHistoryModel) { + return (nf.HistoryTable = factory($, Slick, nfCommon, nfDialog, nfErrorHandler, nfHistoryModel)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.HistoryTable = @@ -44,7 +44,7 @@ root.nf.ErrorHandler, root.nf.HistoryModel); } -}(this, function ($, Slick, common, dialog, errorHandler, HistoryModel) { +}(this, function ($, Slick, nfCommon, nfDialog, nfErrorHandler, nfHistoryModel) { 'use strict'; /** @@ -240,15 +240,15 @@ } var endDateTime = endDate + ' ' + endTime; var timezone = $('.timezone:first').text(); - dialog.showYesNoDialog({ + nfDialog.showYesNoDialog({ 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 () { purgeHistory(endDateTime); } }); } else { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'History', dialogContent: 'The end date must be specified.' }); @@ -311,7 +311,7 @@ if (dataContext.canRead !== true) { 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 @@ -377,7 +377,7 @@ }; // create the remote model - var historyModel = new HistoryModel(); + var historyModel = new nfHistoryModel(); // initialize the grid var historyGrid = new Slick.Grid('#history-table', historyModel, historyColumns, historyOptions); @@ -429,7 +429,7 @@ $('#history-table').data('gridInstance', historyGrid); // add the purge button if appropriate - if (common.canModifyController()) { + if (nfCommon.canModifyController()) { $('#history-purge-button').on('click', function () { $('#history-purge-dialog').modal('show'); }).show(); @@ -450,7 +450,7 @@ dataType: 'json' }).done(function () { nfHistoryTable.loadHistoryTable(); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -461,19 +461,19 @@ var showActionDetails = function (action) { // create the markup for the dialog 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 var componentDetails = action.componentDetails; // 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') { 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') { 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; // inspect the operation to determine if there are any action details - if (common.isDefinedAndNotNull(actionDetails)) { + if (nfCommon.isDefinedAndNotNull(actionDetails)) { if (action.operation === 'Configure') { 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">Value</div>' + common.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">Name</div>' + nfCommon.formatValue(actionDetails.name) + '</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>' + nfCommon.formatValue(actionDetails.previousValue) + '</div>')); } else if (action.operation === 'Connect' || action.operation === 'Disconnect') { 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 Name</div>' + common.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">Relationship(s)</div>' + common.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 Name</div>' + common.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">Source Id</div>' + nfCommon.escapeHtml(actionDetails.sourceId) + '</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>' + nfCommon.escapeHtml(actionDetails.sourceType) + '</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>' + nfCommon.escapeHtml(actionDetails.destinationId) + '</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>' + nfCommon.escapeHtml(actionDetails.destinationType) + '</div>')); } else if (action.operation === 'Move') { 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 Id</div>' + common.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 Id</div>' + common.escapeHtml(actionDetails.previousGroupId) + '</div>')); + $('<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>' + nfCommon.escapeHtml(actionDetails.groupId) + '</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>' + nfCommon.escapeHtml(actionDetails.previousGroupId) + '</div>')); } else if (action.operation === 'Purge') { 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 () { var historyGrid = $('#history-table').data('gridInstance'); - if (common.isDefinedAndNotNull(historyGrid)) { + if (nfCommon.isDefinedAndNotNull(historyGrid)) { historyGrid.resizeCanvas(); } }, http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history.js index 9370c7a..85b2122 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/history/nf-history.js @@ -25,8 +25,8 @@ 'nf.ErrorHandler', 'nf.Storage', 'nf.ClusterSummary'], - function ($, common, historyTable, errorHandler, storage, clusterSummary) { - return (nf.History = factory($, common, historyTable, errorHandler, storage, clusterSummary)); + function ($, nfCommon, nfHistoryTable, nfErrorHandler, nfStorage, nfClusterSummary) { + return (nf.History = factory($, nfCommon, nfHistoryTable, nfErrorHandler, nfStorage, nfClusterSummary)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.History = @@ -44,7 +44,7 @@ root.nf.Storage, root.nf.ClusterSummary); } -}(this, function ($, common, historyTable, errorHandler, storage, clusterSummary) { +}(this, function ($, nfCommon, nfHistoryTable, nfErrorHandler, nfStorage, nfClusterSummary) { 'use strict'; $(document).ready(function () { @@ -72,8 +72,8 @@ url: config.urls.currentUser, dataType: 'json' }).done(function (currentUser) { - common.setCurrentUser(currentUser); - }).fail(errorHandler.handleAjaxError); + nfCommon.setCurrentUser(currentUser); + }).fail(nfErrorHandler.handleAjaxError); }; /** @@ -82,7 +82,7 @@ var initializeHistoryPage = function () { // define mouse over event for the refresh button $('#refresh-button').click(function () { - historyTable.loadHistoryTable(); + nfHistoryTable.loadHistoryTable(); }); // return a deferred for page initialization @@ -95,8 +95,8 @@ dataType: 'json' }).done(function (response) { // ensure the banners response is specified - if (common.isDefinedAndNotNull(response.banners)) { - if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { + if (nfCommon.isDefinedAndNotNull(response.banners)) { + if (nfCommon.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') { // update the header text var bannerHeader = $('#banner-header').text(response.banners.headerText).show(); @@ -110,7 +110,7 @@ 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 var bannerFooter = $('#banner-footer').text(response.banners.footerText).show(); @@ -126,7 +126,7 @@ deferred.resolve(); }).fail(function (xhr, status, error) { - errorHandler.handleAjaxError(xhr, status, error); + nfErrorHandler.handleAjaxError(xhr, status, error); deferred.reject(); }); } else { @@ -143,20 +143,20 @@ // load the current user var currentUser = loadCurrentUser() - storage.init(); + nfStorage.init(); // ensure the config requests are loaded $.when(currentUser).done(function (currentUserResult) { // if clustered, show message to indicate location of actions - if (clusterSummary.isClustered() === true) { + if (nfClusterSummary.isClustered() === true) { $('#cluster-history-message').show(); } // create the history table - historyTable.init(); + nfHistoryTable.init(); // load the history table - historyTable.loadHistoryTable(); + nfHistoryTable.loadHistoryTable(); // once the table is initialized, finish initializing the page initializeHistoryPage().done(function () { @@ -173,7 +173,7 @@ } // configure the initial grid height - historyTable.resetTableSize(); + nfHistoryTable.resetTableSize(); }; // get the about details @@ -191,7 +191,7 @@ // set the initial size setBodySize(); - }).fail(errorHandler.handleAjaxError); + }).fail(nfErrorHandler.handleAjaxError); $(window).on('resize', function (e) { setBodySize(); @@ -224,7 +224,7 @@ } } $.each(tabsContents, function (index, tabsContent) { - common.toggleScrollable(tabsContent.get(0)); + nfCommon.toggleScrollable(tabsContent.get(0)); }); }); }); http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js index 1cdab11..3c1b95f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/login/nf-login.js @@ -23,8 +23,8 @@ 'nf.Common', 'nf.Dialog', 'nf.Storage'], - function ($, common, dialog, storage) { - return (nf.Login = factory($, common, dialog, storage)); + function ($, nfCommon, nfDialog, nfStorage) { + return (nf.Login = factory($, nfCommon, nfDialog, nfStorage)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.Login = @@ -38,7 +38,7 @@ root.nf.Dialog, root.nf.Storage); } -}(this, function ($, common, dialog, storage) { +}(this, function ($, nfCommon, nfDialog, nfStorage) { 'use strict'; $(document).ready(function () { @@ -100,9 +100,9 @@ } }).done(function (jwt) { // get the payload and store the token with the appropirate expiration - var token = common.getJwtPayload(jwt); - var expiration = parseInt(token['exp'], 10) * common.MILLIS_PER_SECOND; - storage.setItem('jwt', jwt, expiration); + var token = nfCommon.getJwtPayload(jwt); + var expiration = parseInt(token['exp'], 10) * nfCommon.MILLIS_PER_SECOND; + nfStorage.setItem('jwt', jwt, expiration); // check to see if they actually have access now $.ajax({ @@ -144,9 +144,9 @@ $('#login-message-container').show(); }); }).fail(function (xhr, status, error) { - dialog.showOkDialog({ + nfDialog.showOkDialog({ headerText: 'Login', - dialogContent: common.escapeHtml(xhr.responseText) + dialogContent: nfCommon.escapeHtml(xhr.responseText) }); // update the form visibility @@ -156,7 +156,7 @@ }; var showLogoutLink = function () { - common.showLogoutLink(); + nfCommon.showLogoutLink(); }; var nfLogin = { @@ -164,9 +164,9 @@ * Initializes the login page. */ init: function () { - storage.init(); + nfStorage.init(); - if (storage.getItem('jwt') !== null) { + if (nfStorage.getItem('jwt') !== null) { showLogoutLink(); } http://git-wip-us.apache.org/repos/asf/nifi/blob/2c374baf/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ajax-setup.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ajax-setup.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ajax-setup.js index 16c20e3..ac5bc1c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ajax-setup.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-ajax-setup.js @@ -21,8 +21,8 @@ if (typeof define === 'function' && define.amd) { define(['jquery', 'nf.Storage'], - function ($, storage) { - return (nf.AjaxSetup = factory($, storage)); + function ($, nfStorage) { + return (nf.AjaxSetup = factory($, nfStorage)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.AjaxSetup = factory(require('jquery'), @@ -31,7 +31,7 @@ nf.AjaxSetup = factory(root.$, root.nf.Storage); } -}(this, function ($, storage) { +}(this, function ($, nfStorage) { /** * Performs ajax setup for use within NiFi. */ @@ -39,10 +39,10 @@ // include jwt when possible $.ajaxSetup({ 'beforeSend': function (xhr) { - var hadToken = storage.hasItem('jwt'); + var hadToken = nfStorage.hasItem('jwt'); // get the token to include in all requests - var token = storage.getItem('jwt'); + var token = nfStorage.getItem('jwt'); if (token !== null) { xhr.setRequestHeader('Authorization', 'Bearer ' + token); } else {
