http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml index 60e8bcf..6c2165f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/resources/nifi-web-api-context.xml @@ -163,6 +163,8 @@ </bean> <bean id="bulletinBoardResource" class="org.apache.nifi.web.api.BulletinBoardResource" scope="singleton"> <property name="serviceFacade" ref="serviceFacade"/> + <property name="properties" ref="nifiProperties"/> + <property name="clusterManager" ref="clusterManager"/> </bean> <bean id="templateResource" class="org.apache.nifi.web.api.TemplateResource" scope="singleton"> <property name="serviceFacade" ref="serviceFacade"/> @@ -252,6 +254,8 @@ </bean> <bean id="systemDiagnosticsResource" class="org.apache.nifi.web.api.SystemDiagnosticsResource" scope="singleton"> <property name="serviceFacade" ref="serviceFacade"/> + <property name="properties" ref="nifiProperties"/> + <property name="clusterManager" ref="clusterManager"/> </bean> <bean id="accessResource" class="org.apache.nifi.web.api.AccessResource" scope="singleton"> <property name="properties" ref="nifiProperties"/>
http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-connection-summary-dialog.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-connection-summary-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-connection-summary-dialog.jsp index d374459..6091c92 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-connection-summary-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-connection-summary-dialog.jsp @@ -28,6 +28,7 @@ <div id="cluster-connection-details"> <div id="cluster-connection-name"></div> <div id="cluster-connection-id"></div> + <div id="cluster-connection-group-id" class="hidden"></div> </div> </div> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-input-port-summary-dialog.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-input-port-summary-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-input-port-summary-dialog.jsp index 6241c3a..d87de98 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-input-port-summary-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-input-port-summary-dialog.jsp @@ -28,6 +28,7 @@ <div id="cluster-input-port-details"> <div id="cluster-input-port-name"></div> <div id="cluster-input-port-id"></div> + <div id="cluster-input-port-group-id" class="hidden"></div> </div> </div> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-output-port-summary-dialog.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-output-port-summary-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-output-port-summary-dialog.jsp index ef0d4a8..a6e3a1c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-output-port-summary-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-output-port-summary-dialog.jsp @@ -28,6 +28,7 @@ <div id="cluster-output-port-details"> <div id="cluster-output-port-name"></div> <div id="cluster-output-port-id"></div> + <div id="cluster-output-port-group-id" class="hidden"></div> </div> </div> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-processor-summary-dialog.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-processor-summary-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-processor-summary-dialog.jsp index a25ac31..7444bf5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-processor-summary-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-processor-summary-dialog.jsp @@ -28,6 +28,7 @@ <div id="cluster-processor-details"> <div id="cluster-processor-name"></div> <div id="cluster-processor-id"></div> + <div id="cluster-processor-group-id" class="hidden"></div> </div> </div> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-remote-process-group-summary-dialog.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-remote-process-group-summary-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-remote-process-group-summary-dialog.jsp index 3cd6438..e27fe2c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-remote-process-group-summary-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/cluster-remote-process-group-summary-dialog.jsp @@ -28,6 +28,7 @@ <div id="cluster-remote-process-group-details"> <div id="cluster-remote-process-group-name"></div> <div id="cluster-remote-process-group-id"></div> + <div id="cluster-remote-process-group-group-id" class="hidden"></div> </div> </div> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js index c0e4e61..d92ebc2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js @@ -722,26 +722,14 @@ nf.Actions = (function () { showStats: function (selection) { if (selection.size() === 1) { var selectionData = selection.datum(); - if (nf.Canvas.isClustered()) { - if (nf.CanvasUtils.isProcessor(selection)) { - nf.StatusHistory.showClusterProcessorChart(nf.Canvas.getGroupId(), selectionData.component.id); - } else if (nf.CanvasUtils.isProcessGroup(selection)) { - nf.StatusHistory.showClusterProcessGroupChart(nf.Canvas.getGroupId(), selectionData.component.id); - } else if (nf.CanvasUtils.isRemoteProcessGroup(selection)) { - nf.StatusHistory.showClusterRemoteProcessGroupChart(nf.Canvas.getGroupId(), selectionData.component.id); - } else if (nf.CanvasUtils.isConnection(selection)) { - nf.StatusHistory.showClusterConnectionChart(nf.Canvas.getGroupId(), selectionData.component.id); - } - } else { - if (nf.CanvasUtils.isProcessor(selection)) { - nf.StatusHistory.showStandaloneProcessorChart(nf.Canvas.getGroupId(), selectionData.component.id); - } else if (nf.CanvasUtils.isProcessGroup(selection)) { - nf.StatusHistory.showStandaloneProcessGroupChart(nf.Canvas.getGroupId(), selectionData.component.id); - } else if (nf.CanvasUtils.isRemoteProcessGroup(selection)) { - nf.StatusHistory.showStandaloneRemoteProcessGroupChart(nf.Canvas.getGroupId(), selectionData.component.id); - } else if (nf.CanvasUtils.isConnection(selection)) { - nf.StatusHistory.showStandaloneConnectionChart(nf.Canvas.getGroupId(), selectionData.component.id); - } + if (nf.CanvasUtils.isProcessor(selection)) { + nf.StatusHistory.showProcessorChart(nf.Canvas.getGroupId(), selectionData.component.id); + } else if (nf.CanvasUtils.isProcessGroup(selection)) { + nf.StatusHistory.showProcessGroupChart(nf.Canvas.getGroupId(), selectionData.component.id); + } else if (nf.CanvasUtils.isRemoteProcessGroup(selection)) { + nf.StatusHistory.showRemoteProcessGroupChart(nf.Canvas.getGroupId(), selectionData.component.id); + } else if (nf.CanvasUtils.isConnection(selection)) { + nf.StatusHistory.showConnectionChart(nf.Canvas.getGroupId(), selectionData.component.id); } } }, http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js index cfeb4a5..abe9f97 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas.js @@ -845,9 +845,10 @@ nf.Canvas = (function () { // report the updated stats if (nf.Common.isDefinedAndNotNull(response.processGroupStatus)) { var processGroupStatus = response.processGroupStatus; + var aggregateSnapshot = processGroupStatus.aggregateSnapshot; // update all the stats - nf.Graph.setStatus(processGroupStatus); + nf.Graph.setStatus(aggregateSnapshot); // update the timestamp $('#stats-last-refreshed').text(processGroupStatus.statsLastRefreshed); http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-graph.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-graph.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-graph.js index 99f978e..db720d0 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-graph.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-graph.js @@ -32,12 +32,12 @@ nf.Graph = (function () { }; var combinePortStatus = function (status) { - if (nf.Common.isDefinedAndNotNull(status.inputPortStatus) && nf.Common.isDefinedAndNotNull(status.outputPortStatus)) { - return status.inputPortStatus.concat(status.outputPortStatus); - } else if (nf.Common.isDefinedAndNotNull(status.inputPortStatus)) { - return status.inputPortStatus; - } else if (nf.Common.isDefinedAndNotNull(status.outputPortStatus)) { - return status.outputPortStatus; + if (nf.Common.isDefinedAndNotNull(status.inputPortStatusSnapshots) && nf.Common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) { + return status.inputPortStatusSnapshots.concat(status.outputPortStatusSnapshots); + } else if (nf.Common.isDefinedAndNotNull(status.inputPortStatusSnapshots)) { + return status.inputPortStatusSnapshots; + } else if (nf.Common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) { + return status.outputPortStatusSnapshots; } else { return []; } @@ -158,18 +158,18 @@ nf.Graph = (function () { * of the existing components on the graph and will not cause them to be repainted. * This operation must be very inexpensive due to the frequency it is called. * - * @argument {object} processGroupStatus The status of the process group + * @argument {object} aggregateSnapshot The status of the process group aggregated accross the cluster */ - setStatus: function (processGroupStatus) { + setStatus: function (aggregateSnapshot) { // merge the port status together - var portStatus = combinePortStatus(processGroupStatus); + var portStatus = combinePortStatus(aggregateSnapshot); // set the component status nf.Port.setStatus(portStatus); - nf.RemoteProcessGroup.setStatus(processGroupStatus.remoteProcessGroupStatus); - nf.ProcessGroup.setStatus(processGroupStatus.processGroupStatus); - nf.Processor.setStatus(processGroupStatus.processorStatus); - nf.Connection.setStatus(processGroupStatus.connectionStatus); + nf.RemoteProcessGroup.setStatus(aggregateSnapshot.remoteProcessGroupStatusSnapshots); + nf.ProcessGroup.setStatus(aggregateSnapshot.processGroupStatusSnapshots); + nf.Processor.setStatus(aggregateSnapshot.processorStatusSnapshots); + nf.Connection.setStatus(aggregateSnapshot.connectionStatusSnapshots); }, /** http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/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 5688118..c30c726 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 @@ -281,22 +281,23 @@ nf.CountersTable = (function () { dataType: 'json' }).done(function (response) { var report = response.counters; + var aggregateSnapshot = report.aggregateSnapshot; // ensure there are groups specified - if (nf.Common.isDefinedAndNotNull(report.counters)) { + if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.counters)) { var countersGrid = $('#counters-table').data('gridInstance'); var countersData = countersGrid.getData(); // set the items - countersData.setItems(report.counters); + countersData.setItems(aggregateSnapshot.counters); countersData.reSort(); countersGrid.invalidate(); // update the stats last refreshed timestamp - $('#counters-last-refreshed').text(report.generated); + $('#counters-last-refreshed').text(aggregateSnapshot.generated); // update the total number of processors - $('#total-counters').text(report.counters.length); + $('#total-counters').text(aggregateSnapshot.counters.length); } else { $('#total-counters').text('0'); } http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js index ac97726..57f91fb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-status-history.js @@ -19,8 +19,8 @@ nf.StatusHistory = (function () { var config = { - clusterInstanceId: 'cluster-instance-id', - clusterInstanceLabel: 'Cluster', + nifiInstanceId: 'nifi-instance-id', + nifiInstanceLabel: 'NiFi', type: { processor: 'Processor', inputPort: 'Input Port', @@ -33,11 +33,7 @@ nf.StatusHistory = (function () { label: 'Label' }, urls: { - processGroups: '../nifi-api/controller/process-groups/', - clusterProcessor: '../nifi-api/cluster/processors/', - clusterProcessGroup: '../nifi-api/cluster/process-groups/', - clusterRemoteProcessGroup: '../nifi-api/cluster/remote-process-groups/', - clusterConnection: '../nifi-api/cluster/connections/' + processGroups: '../nifi-api/controller/process-groups/' } }; @@ -83,73 +79,51 @@ nf.StatusHistory = (function () { var instances = null; /** - * Handles the status history response from a clustered NiFi. + * Handles the status history response. * - * @param {type} groupId - * @param {type} id - * @param {type} clusterStatusHistory - * @param {type} componentType - * @param {type} selectedDescriptor + * @param {string} groupId + * @param {string} id + * @param {object} componentStatusHistory + * @param {string} componentType + * @param {object} selectedDescriptor */ - var handleClusteredStatusHistoryResponse = function (groupId, id, clusterStatusHistory, componentType, selectedDescriptor) { + var handleStatusHistoryResponse = function (groupId, id, componentStatusHistory, componentType, selectedDescriptor) { // update the last refreshed - $('#status-history-last-refreshed').text(clusterStatusHistory.generated); + $('#status-history-last-refreshed').text(componentStatusHistory.generated); // initialize the status history var statusHistory = { groupId: groupId, id: id, type: componentType, - clustered: true, instances: [] }; - var descriptors = null; - - // get the status history for the entire cluster - var aggregateStatusHistory = clusterStatusHistory.clusterStatusHistory; + // get the descriptors + var descriptors = componentStatusHistory.fieldDescriptors; + statusHistory.details = componentStatusHistory.componentDetails; + statusHistory.selectedDescriptor = nf.Common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor; // ensure enough status snapshots - if (aggregateStatusHistory.statusSnapshots.length > 1) { - // only do these once - if (descriptors === null) { - // get the descriptors - descriptors = aggregateStatusHistory.fieldDescriptors; - - statusHistory.details = aggregateStatusHistory.details; - statusHistory.selectedDescriptor = nf.Common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor; - } - - // but ensure each instance is added + if (nf.Common.isDefinedAndNotNull(componentStatusHistory.aggregateSnapshots) && componentStatusHistory.aggregateSnapshots.length > 1) { statusHistory.instances.push({ - id: config.clusterInstanceId, - label: config.clusterInstanceLabel, - snapshots: aggregateStatusHistory.statusSnapshots + id: config.nifiInstanceId, + label: config.nifiInstanceLabel, + snapshots: componentStatusHistory.aggregateSnapshots }); + } else { + insufficientHistory(); + return; } - // get the status for each node in the cluster - $.each(clusterStatusHistory.nodeStatusHistory, function (_, nodeStatusHistory) { - var node = nodeStatusHistory.node; - var statusHistoryForNode = nodeStatusHistory.statusHistory; - + // get the status for each node in the cluster if applicable + $.each(componentStatusHistory.nodeSnapshots, function (_, nodeSnapshots) { // ensure enough status snapshots - if (statusHistoryForNode.statusSnapshots.length > 1) { - - // only do these once - if (descriptors === null) { - // get the descriptors - descriptors = statusHistoryForNode.fieldDescriptors; - - statusHistory.details = statusHistoryForNode.details; - statusHistory.selectedDescriptor = nf.Common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor; - } - - // but ensure each instance is added + if (nf.Common.isDefinedAndNotNull(nodeSnapshots.statusSnapshots) && nodeSnapshots.statusSnapshots.length > 1) { statusHistory.instances.push({ - id: node.nodeId, - label: node.address + ':' + node.apiPort, - snapshots: statusHistoryForNode.statusSnapshots + id: nodeSnapshots.nodeId, + label: nodeSnapshots.address + ':' + nodeSnapshots.apiPort, + snapshots: nodeSnapshots.statusSnapshots }); } }); @@ -167,50 +141,6 @@ nf.StatusHistory = (function () { }; /** - * Handles the status history response for a standalone NiFi. - * - * @param {type} groupId - * @param {type} id - * @param {type} statusHistory - * @param {type} componentType - * @param {type} selectedDescriptor - */ - var handleStandaloneStatusHistoryResponse = function (groupId, id, statusHistory, componentType, selectedDescriptor) { - // ensure there are sufficent snapshots - if (statusHistory.statusSnapshots.length > 1) { - // update the last refreshed - $('#status-history-last-refreshed').text(statusHistory.generated); - - // detect the available fields - var descriptors = statusHistory.fieldDescriptors; - - // build the status history - var statusHistory = { - groupId: groupId, - id: id, - details: statusHistory.details, - type: componentType, - clustered: false, - selectedDescriptor: nf.Common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor, - instances: [{ - id: '', - label: '', - snapshots: statusHistory.statusSnapshots - }] - }; - - // store the status history - $('#status-history-dialog').data('status-history', statusHistory); - - // chart the status history - chart(statusHistory, descriptors); - return; - } - - insufficientHistory(); - }; - - /** * Shows an error message stating there is insufficient history available. */ var insufficientHistory = function () { @@ -785,127 +715,107 @@ nf.StatusHistory = (function () { }); }); - if (statusHistory.clustered) { - // consider visible nodes with data in the brush - var nodes = $.grep(withinBrush, function (d) { - return d.id !== config.clusterInstanceId && d.visible && d.values.length > 0; - }); - - var nodeMinValue = nodes.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMinValue(nodes)); - var nodeMeanValue = nodes.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMeanValue(nodes)); - var nodeMaxValue = nodes.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMaxValue(nodes)); - - // update the currently displayed min/max/mean - $('#node-aggregate-statistics').text(nodeMinValue + ' / ' + nodeMaxValue + ' / ' + nodeMeanValue); + // consider visible nodes with data in the brush + var nodes = $.grep(withinBrush, function (d) { + return d.id !== config.nifiInstanceId && d.visible && d.values.length > 0; + }); - // only consider the cluster with data in the brush - var cluster = $.grep(withinBrush, function (d) { - return d.id === config.clusterInstanceId && d.visible && d.values.length > 0; - }); + var nodeMinValue = nodes.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMinValue(nodes)); + var nodeMeanValue = nodes.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMeanValue(nodes)); + var nodeMaxValue = nodes.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMaxValue(nodes)); - // determine the cluster values - var clusterMinValue = cluster.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMinValue(cluster)); - var clusterMeanValue = cluster.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMeanValue(cluster)); - var clusterMaxValue = cluster.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMaxValue(cluster)); + // update the currently displayed min/max/mean + $('#node-aggregate-statistics').text(nodeMinValue + ' / ' + nodeMaxValue + ' / ' + nodeMeanValue); - // update the cluster min/max/mean - $('#cluster-aggregate-statistics').text(clusterMinValue + ' / ' + clusterMaxValue + ' / ' + clusterMeanValue); - } else { - // only consider data in the brush - var instance = $.grep(withinBrush, function (d) { - return d.values.length > 0; - }); + // only consider the cluster with data in the brush + var cluster = $.grep(withinBrush, function (d) { + return d.id === config.nifiInstanceId && d.visible && d.values.length > 0; + }); - // determine the min, max, mean - var instanceMinValue = instance.length === 0 ? 0 : formatters[selectedDescriptor.formatter](getMinValue(instance)); - var instanceMeanValue = instance.length === 0 ? 0 : formatters[selectedDescriptor.formatter](getMeanValue(instance)); - var instanceMaxValue = instance.length === 0 ? 0 : formatters[selectedDescriptor.formatter](getMaxValue(instance)); + // determine the cluster values + var clusterMinValue = cluster.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMinValue(cluster)); + var clusterMeanValue = cluster.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMeanValue(cluster)); + var clusterMaxValue = cluster.length === 0 ? 'NA' : formatters[selectedDescriptor.formatter](getMaxValue(cluster)); - // update the instance min/max/mean - $('#instance-aggregate-statistics').text(instanceMinValue + ' / ' + instanceMaxValue + ' / ' + instanceMeanValue); - } + // update the cluster min/max/mean + $('#cluster-aggregate-statistics').text(clusterMinValue + ' / ' + clusterMaxValue + ' / ' + clusterMeanValue); }; // ---------------- // build the legend // ---------------- - if (statusHistory.clustered) { - // identify all nodes and sort - var nodes = $.grep(statusData, function (status) { - return status.id !== config.clusterInstanceId; - }).sort(function (a, b) { - return a.label < b.label ? -1 : a.label > b.label ? 1 : 0; - }); - - // adds a legend entry for the specified instance - var addLegendEntry = function (legend, instance) { - // create the label and the checkbox - var instanceLabelElement = $('<div></div>').addClass('legend-label').css('color', color(instance.label)).text(instance.label).ellipsis(); - var instanceCheckboxElement = $('<div class="nf-checkbox"></div>').on('click', function () { - // get the line and the control points for this instance (select all for the line to update control and main charts) - var chartLine = d3.selectAll('path.chart-line-' + instance.id); - var markGroup = d3.select('g.mark-group-' + instance.id); - - // determine if it was hidden - var isHidden = markGroup.classed('hidden'); - - // toggle the visibility - chartLine.classed('hidden', function () { - return !isHidden; - }); - markGroup.classed('hidden', function () { - return !isHidden; - }); - - // update whether its visible - instance.visible = isHidden; + // identify all nodes and sort + var nodes = $.grep(statusData, function (status) { + return status.id !== config.nifiInstanceId; + }).sort(function (a, b) { + return a.label < b.label ? -1 : a.label > b.label ? 1 : 0; + }); - // record the current status so it persists across refreshes - instances[instance.id] = instance.visible; + // adds a legend entry for the specified instance + var addLegendEntry = function (legend, instance) { + // create the label and the checkbox + var instanceLabelElement = $('<div></div>').addClass('legend-label').css('color', color(instance.label)).text(instance.label).ellipsis(); + var instanceCheckboxElement = $('<div class="nf-checkbox"></div>').on('click', function () { + // get the line and the control points for this instance (select all for the line to update control and main charts) + var chartLine = d3.selectAll('path.chart-line-' + instance.id); + var markGroup = d3.select('g.mark-group-' + instance.id); + + // determine if it was hidden + var isHidden = markGroup.classed('hidden'); + + // toggle the visibility + chartLine.classed('hidden', function () { + return !isHidden; + }); + markGroup.classed('hidden', function () { + return !isHidden; + }); - // update the brush - brushed(); - }).addClass(instance.visible ? 'checkbox-checked' : 'checkbox-unchecked'); + // update whether its visible + instance.visible = isHidden; - // add the legend entry - $('<div class="legend-entry"></div>').append(instanceCheckboxElement).append(instanceLabelElement).on('mouseenter', function () { - d3.selectAll('path.chart-line-' + instance.id).classed('over', true); - }).on('mouseleave', function () { - d3.selectAll('path.chart-line-' + instance.id).classed('over', false); - }).appendTo(legend); - }; + // record the current status so it persists across refreshes + instances[instance.id] = instance.visible; - // get the cluster instance - var cluster = $.grep(statusData, function (status) { - return status.id === config.clusterInstanceId; - }); + // update the brush + brushed(); + }).addClass(instance.visible ? 'checkbox-checked' : 'checkbox-unchecked'); + + // add the legend entry + $('<div class="legend-entry"></div>').append(instanceCheckboxElement).append(instanceLabelElement).on('mouseenter', function () { + d3.selectAll('path.chart-line-' + instance.id).classed('over', true); + }).on('mouseleave', function () { + d3.selectAll('path.chart-line-' + instance.id).classed('over', false); + }).appendTo(legend); + }; - // build the cluster container - var clusterDetailsContainer = buildDetailsContainer('Cluster'); + // get the cluster instance + var cluster = $.grep(statusData, function (status) { + return status.id === config.nifiInstanceId; + }); - // add the total cluster values - addDetailItem(clusterDetailsContainer, 'Min / Max / Mean', '', 'cluster-aggregate-statistics'); + // build the cluster container + var clusterDetailsContainer = buildDetailsContainer('NiFi'); - // build the cluster legend - addLegendEntry(clusterDetailsContainer, cluster[0]); + // add the total cluster values + addDetailItem(clusterDetailsContainer, 'Min / Max / Mean', '', 'cluster-aggregate-statistics'); - // if there are entries to render - if (nodes.length > 0) { - // build the cluster container - var nodeDetailsContainer = buildDetailsContainer('Nodes'); + // build the cluster legend + addLegendEntry(clusterDetailsContainer, cluster[0]); - // add the total cluster values - addDetailItem(nodeDetailsContainer, 'Min / Max / Mean', '', 'node-aggregate-statistics'); + // if there are entries to render + if (nodes.length > 0) { + // build the cluster container + var nodeDetailsContainer = buildDetailsContainer('Nodes'); - // add each legend entry - $.each(nodes, function (_, instance) { - addLegendEntry(nodeDetailsContainer, instance); - }); - } - } else { // add the total cluster values - addDetailItem(detailsContainer, 'Min / Max / Mean', '', 'instance-aggregate-statistics'); + addDetailItem(nodeDetailsContainer, 'Min / Max / Mean', '', 'node-aggregate-statistics'); + + // add each legend entry + $.each(nodes, function (_, instance) { + addLegendEntry(nodeDetailsContainer, instance); + }); } // update the brush @@ -1135,29 +1045,13 @@ nf.StatusHistory = (function () { var statusHistory = $('#status-history-dialog').data('status-history'); if (statusHistory !== null) { if (statusHistory.type === config.type.processor) { - if (statusHistory.clustered === true) { - nf.StatusHistory.showClusterProcessorChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } else { - nf.StatusHistory.showStandaloneProcessorChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } + nf.StatusHistory.showProcessorChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); } else if (statusHistory.type === config.type.processGroup) { - if (statusHistory.clustered === true) { - nf.StatusHistory.showClusterProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } else { - nf.StatusHistory.showStandaloneProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } + nf.StatusHistory.showProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); } else if (statusHistory.type === config.type.remoteProcessGroup) { - if (statusHistory.clustered === true) { - nf.StatusHistory.showClusterRemoteProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } else { - nf.StatusHistory.showStandaloneRemoteProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } + nf.StatusHistory.showRemoteProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); } else { - if (statusHistory.clustered === true) { - nf.StatusHistory.showClusterConnectionChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } else { - nf.StatusHistory.showStandaloneConnectionChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); - } + nf.StatusHistory.showConnectionChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor); } } }); @@ -1196,87 +1090,19 @@ nf.StatusHistory = (function () { }, /** - * Shows the status history for the specified connection across the cluster. - * - * @param {type} groupId - * @param {type} connectionId - * @param {type} selectedDescriptor - */ - showClusterConnectionChart: function (groupId, connectionId, selectedDescriptor) { - $.ajax({ - type: 'GET', - url: config.urls.clusterConnection + encodeURIComponent(connectionId) + '/status/history', - dataType: 'json' - }).done(function (response) { - handleClusteredStatusHistoryResponse(groupId, connectionId, response.clusterStatusHistory, config.type.connection, selectedDescriptor); - }).fail(nf.Common.handleAjaxError); - }, - - /** - * Shows the status history for the specified processor across the cluster. - * - * @param {type} groupId - * @param {type} processorId - * @param {type} selectedDescriptor - */ - showClusterProcessorChart: function (groupId, processorId, selectedDescriptor) { - $.ajax({ - type: 'GET', - url: config.urls.clusterProcessor + encodeURIComponent(processorId) + '/status/history', - dataType: 'json' - }).done(function (response) { - handleClusteredStatusHistoryResponse(groupId, processorId, response.clusterStatusHistory, config.type.processor, selectedDescriptor); - }).fail(nf.Common.handleAjaxError); - }, - - /** - * Shows the status history for the specified process group across the cluster. - * - * @param {type} groupId - * @param {type} processGroupId - * @param {type} selectedDescriptor - */ - showClusterProcessGroupChart: function (groupId, processGroupId, selectedDescriptor) { - $.ajax({ - type: 'GET', - url: config.urls.clusterProcessGroup + encodeURIComponent(processGroupId) + '/status/history', - dataType: 'json' - }).done(function (response) { - handleClusteredStatusHistoryResponse(groupId, processGroupId, response.clusterStatusHistory, config.type.processGroup, selectedDescriptor); - }).fail(nf.Common.handleAjaxError); - }, - - /** - * Shows the status history for the specified remote process group across the cluster. - * - * @param {type} groupId - * @param {type} remoteProcessGroupId - * @param {type} selectedDescriptor - */ - showClusterRemoteProcessGroupChart: function (groupId, remoteProcessGroupId, selectedDescriptor) { - $.ajax({ - type: 'GET', - url: config.urls.clusterRemoteProcessGroup + encodeURIComponent(remoteProcessGroupId) + '/status/history', - dataType: 'json' - }).done(function (response) { - handleClusteredStatusHistoryResponse(groupId, remoteProcessGroupId, response.clusterStatusHistory, config.type.remoteProcessGroup, selectedDescriptor); - }).fail(nf.Common.handleAjaxError); - }, - - /** * Shows the status history for the specified connection in this instance. * * @param {type} groupId * @param {type} connectionId * @param {type} selectedDescriptor */ - showStandaloneConnectionChart: function (groupId, connectionId, selectedDescriptor) { + showConnectionChart: function (groupId, connectionId, selectedDescriptor) { $.ajax({ type: 'GET', url: config.urls.processGroups + encodeURIComponent(groupId) + '/connections/' + encodeURIComponent(connectionId) + '/status/history', dataType: 'json' }).done(function (response) { - handleStandaloneStatusHistoryResponse(groupId, connectionId, response.statusHistory, config.type.connection, selectedDescriptor); + handleStatusHistoryResponse(groupId, connectionId, response.statusHistory, config.type.connection, selectedDescriptor); }).fail(nf.Common.handleAjaxError); }, @@ -1287,13 +1113,13 @@ nf.StatusHistory = (function () { * @param {type} processorId * @param {type} selectedDescriptor */ - showStandaloneProcessorChart: function (groupId, processorId, selectedDescriptor) { + showProcessorChart: function (groupId, processorId, selectedDescriptor) { $.ajax({ type: 'GET', url: config.urls.processGroups + encodeURIComponent(groupId) + '/processors/' + encodeURIComponent(processorId) + '/status/history', dataType: 'json' }).done(function (response) { - handleStandaloneStatusHistoryResponse(groupId, processorId, response.statusHistory, config.type.processor, selectedDescriptor); + handleStatusHistoryResponse(groupId, processorId, response.statusHistory, config.type.processor, selectedDescriptor); }).fail(nf.Common.handleAjaxError); }, @@ -1304,13 +1130,13 @@ nf.StatusHistory = (function () { * @param {type} processGroupId * @param {type} selectedDescriptor */ - showStandaloneProcessGroupChart: function (groupId, processGroupId, selectedDescriptor) { + showProcessGroupChart: function (groupId, processGroupId, selectedDescriptor) { $.ajax({ type: 'GET', url: config.urls.processGroups + encodeURIComponent(processGroupId) + '/status/history', dataType: 'json' }).done(function (response) { - handleStandaloneStatusHistoryResponse(groupId, processGroupId, response.statusHistory, config.type.processGroup, selectedDescriptor); + handleStatusHistoryResponse(groupId, processGroupId, response.statusHistory, config.type.processGroup, selectedDescriptor); }).fail(nf.Common.handleAjaxError); }, @@ -1321,13 +1147,13 @@ nf.StatusHistory = (function () { * @param {type} remoteProcessGroupId * @param {type} selectedDescriptor */ - showStandaloneRemoteProcessGroupChart: function (groupId, remoteProcessGroupId, selectedDescriptor) { + showRemoteProcessGroupChart: function (groupId, remoteProcessGroupId, selectedDescriptor) { $.ajax({ type: 'GET', url: config.urls.processGroups + encodeURIComponent(groupId) + '/remote-process-groups/' + encodeURIComponent(remoteProcessGroupId) + '/status/history', dataType: 'json' }).done(function (response) { - handleStandaloneStatusHistoryResponse(groupId, remoteProcessGroupId, response.statusHistory, config.type.remoteProcessGroup, selectedDescriptor); + handleStatusHistoryResponse(groupId, remoteProcessGroupId, response.statusHistory, config.type.remoteProcessGroup, selectedDescriptor); }).fail(nf.Common.handleAjaxError); } }; http://git-wip-us.apache.org/repos/asf/nifi/blob/0d3bd2c4/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js index 2254943..9bab660 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js @@ -68,11 +68,10 @@ nf.ClusterSearch = (function () { var node = searchResults[0]; // update the urls to point to this specific node of the cluster - nf.SummaryTable.url = '../nifi-api/cluster/nodes/' + encodeURIComponent(node.id) + '/status'; - nf.SummaryTable.systemDiagnosticsUrl = '../nifi-api/cluster/nodes/' + encodeURIComponent(node.id) + '/system-diagnostics'; + nf.SummaryTable.setClusterNodeId(node.id); // load the summary for the selected node - nf.SummaryTable.loadProcessorSummaryTable(); + nf.SummaryTable.loadSummaryTable(); // update the header $('#summary-header-text').text(node.address + ' Summary'); @@ -168,9 +167,8 @@ nf.ClusterSearch = (function () { // handle the view cluster click event $('#view-cluster-link').click(function () { // reset the urls and refresh the table - nf.SummaryTable.url = config.urls.status; - nf.SummaryTable.systemDiagnosticsUrl = config.urls.systemDiagnostics; - nf.SummaryTable.loadProcessorSummaryTable(); + nf.SummaryTable.setClusterNodeId(null); + nf.SummaryTable.loadSummaryTable(); // update the header $('#summary-header-text').text('NiFi Summary');
