[NIFI-3359] Modularize all of nifi-web-ui except canvas directory

- Removing shell.jsp from summary.jsp.
- This closes #1428
This commit is contained in:
Scott Aslan 2017-01-20 15:55:31 -05:00 committed by Matt Gilman
parent 516075de02
commit dc934cbb8e
88 changed files with 7042 additions and 5439 deletions

View File

@ -422,18 +422,23 @@
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/canvas/nf-canvas-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/canvas/nf-canvas-utils.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-shell.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/canvas/nf-context-menu.js</include>
<include>${staging.dir}/js/nf/nf-ng-bridge.js</include>
<include>${staging.dir}/js/nf/nf-cluster-summary.js</include>
<include>${staging.dir}/js/nf/canvas/nf-canvas.js</include>
<include>${staging.dir}/js/nf/canvas/nf-canvas-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-shell.js</include>
<include>${staging.dir}/js/nf/canvas/nf-snippet.js</include>
<include>${staging.dir}/js/nf/canvas/nf-custom-ui.js</include>
<include>${staging.dir}/js/nf/canvas/nf-queue-listing.js</include>
<include>${staging.dir}/js/nf/canvas/nf-component-state.js</include>
<include>${staging.dir}/js/nf/canvas/nf-custom-ui.js</include>
<include>${staging.dir}/js/nf/canvas/nf-controller-service.js</include>
<include>${staging.dir}/js/nf/canvas/nf-controller-services.js</include>
<include>${staging.dir}/js/nf/canvas/nf-reporting-task.js</include>
@ -449,6 +454,7 @@
<include>${staging.dir}/js/nf/canvas/nf-label-configuration.js</include>
<include>${staging.dir}/js/nf/canvas/nf-connection-configuration.js</include>
<include>${staging.dir}/js/nf/nf-connection-details.js</include>
<include>${staging.dir}/js/nf/nf-status-history.js</include>
<include>${staging.dir}/js/nf/canvas/nf-graph.js</include>
<include>${staging.dir}/js/nf/canvas/nf-processor.js</include>
<include>${staging.dir}/js/nf/canvas/nf-label.js</include>
@ -458,18 +464,14 @@
<include>${staging.dir}/js/nf/canvas/nf-funnel.js</include>
<include>${staging.dir}/js/nf/canvas/nf-connection.js</include>
<include>${staging.dir}/js/nf/canvas/nf-draggable.js</include>
<include>${staging.dir}/js/nf/canvas/nf-selectable.js</include>
<include>${staging.dir}/js/nf/canvas/nf-connectable.js</include>
<include>${staging.dir}/js/nf/canvas/nf-selectable.js</include>
<include>${staging.dir}/js/nf/canvas/nf-birdseye.js</include>
<include>${staging.dir}/js/nf/canvas/nf-settings.js</include>
<include>${staging.dir}/js/nf/canvas/nf-go-to.js</include>
<include>${staging.dir}/js/nf/canvas/nf-actions.js</include>
<include>${staging.dir}/js/nf/canvas/nf-context-menu.js</include>
<include>${staging.dir}/js/nf/nf-status-history.js</include>
<include>${staging.dir}/js/nf/canvas/nf-canvas.js</include>
<include>${staging.dir}/js/nf/canvas/nf-clipboard.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-controller.js</include>
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
<include>${staging.dir}/js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.js</include>
<include>${staging.dir}/js/nf/canvas/controllers/nf-ng-canvas-header-controller.js</include>
<include>${staging.dir}/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js</include>
@ -488,78 +490,84 @@
<include>${staging.dir}/js/nf/canvas/header/components/nf-ng-label-component.js</include>
<include>${staging.dir}/js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js</include>
<include>${staging.dir}/js/nf/canvas/directives/nf-ng-draggable-directive.js</include>
<include>${staging.dir}/js/nf/nf-ng-bridge.js</include>
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-controller.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/canvas/nf-canvas-utils.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/history/nf-history-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/history/nf-history.js</include>
<include>${staging.dir}/js/nf/history/nf-history-table.js</include>
<include>${staging.dir}/js/nf/nf-cluster-summary.js</include>
<include>${staging.dir}/js/nf/history/nf-history-model.js</include>
<include>${staging.dir}/js/nf/history/nf-history-table.js</include>
<include>${staging.dir}/js/nf/history/nf-history.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/provenance/nf-provenance-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/nf-ng-bridge.js</include>
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-controller.js</include>
<include>${staging.dir}/js/nf/provenance/nf-provenance.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/provenance/nf-provenance-table.js</include>
<include>${staging.dir}/js/nf/provenance/nf-provenance-lineage.js</include>
<include>${staging.dir}/js/nf/provenance/nf-provenance.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/summary/nf-summary-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/canvas/nf-custom-ui.js</include>
<include>${staging.dir}/js/nf/nf-cluster-summary.js</include>
<include>${staging.dir}/js/nf/nf-processor-details.js</include>
<include>${staging.dir}/js/nf/canvas/nf-settings.js</include>
<include>${staging.dir}/js/nf/canvas/nf-process-group-configuration.js</include>
<include>${staging.dir}/js/nf/nf-connection-details.js</include>
<include>${staging.dir}/js/nf/nf-status-history.js</include>
<include>${staging.dir}/js/nf/nf-ng-bridge.js</include>
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-controller.js</include>
<include>${staging.dir}/js/nf/summary/nf-summary.js</include>
<include>${staging.dir}/js/nf/summary/nf-summary-table.js</include>
<include>${staging.dir}/js/nf/summary/nf-cluster-search.js</include>
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-controller.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/summary/nf-summary.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/counters/nf-counters-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/counters/nf-counters.js</include>
<include>${staging.dir}/js/nf/counters/nf-counters-table.js</include>
<include>${staging.dir}/js/nf/counters/nf-counters.js</include>
</includes>
</aggregation>
<aggregation>
@ -567,57 +575,58 @@
<output>${project.build.directory}/${project.build.finalName}/js/nf/users/nf-users-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/users/nf-users.js</include>
<include>${staging.dir}/js/nf/users/nf-users-table.js</include>
<include>${staging.dir}/js/nf/users/nf-users.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/templates/nf-templates-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/templates/nf-templates.js</include>
<include>${staging.dir}/js/nf/templates/nf-templates-table.js</include>
<include>${staging.dir}/js/nf/templates/nf-templates.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/cluster/nf-cluster-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/cluster/nf-cluster.js</include>
<include>${staging.dir}/js/nf/cluster/nf-cluster-table.js</include>
<include>${staging.dir}/js/nf/cluster/nf-cluster.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/bulletin-board/nf-bulletin-board-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/nf-ng-bridge.js</include>
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-controller.js</include>
<include>${staging.dir}/js/nf/nf-ng-app-config.js</include>
<include>${staging.dir}/js/nf/bulletin-board/nf-bulletin-board.js</include>
</includes>
</aggregation>
@ -625,11 +634,11 @@
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/js/nf/login/nf-login-all.js</output>
<includes>
<include>${staging.dir}/js/nf/nf-client.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-dialog.js</include>
<include>${staging.dir}/js/nf/nf-storage.js</include>
<include>${staging.dir}/js/nf/nf-common.js</include>
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
<include>${staging.dir}/js/nf/nf-universal-capture.js</include>
<include>${staging.dir}/js/nf/nf-ajax-setup.js</include>
<include>${staging.dir}/js/nf/login/nf-login.js</include>
</includes>

View File

@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.bulletin.board.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.bulletin.board.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-service-provider.js?${project.version}"></script>\n\

View File

@ -13,14 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.canvas.script.tags=<script type="text/javascript" src="js/nf/nf-client.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-canvas-utils.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-shell.js?${project.version}"></script>\n\
nf.canvas.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-client.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-context-menu.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-cluster-summary.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-canvas.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-canvas-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-shell.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-snippet.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-queue-listing.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-component-state.js?${project.version}"></script>\n\
@ -56,10 +61,7 @@ nf.canvas.script.tags=<script type="text/javascript" src="js/nf/nf-client.js?${p
<script type="text/javascript" src="js/nf/canvas/nf-settings.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-go-to.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-actions.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-context-menu.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-canvas.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-clipboard.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-service-provider.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/controllers/nf-ng-canvas-header-controller.js?${project.version}"></script>\n\
@ -80,6 +82,7 @@ nf.canvas.script.tags=<script type="text/javascript" src="js/nf/nf-client.js?${p
<script type="text/javascript" src="js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/directives/nf-ng-draggable-directive.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-controller.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-config.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/nf-ng-app-config.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-canvas-utils.js?${project.version}"></script>
nf.canvas.style.tags=<link rel="stylesheet" href="css/canvas.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />

View File

@ -13,13 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.cluster.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.cluster.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/cluster/nf-cluster.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/cluster/nf-cluster-table.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/cluster/nf-cluster-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/cluster/nf-cluster.js?${project.version}"></script>
nf.cluster.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/dialog.css?${project.version}" type="text/css" />\n\

View File

@ -13,13 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.counters.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.counters.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/counters/nf-counters.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/counters/nf-counters-table.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/counters/nf-counters-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/counters/nf-counters.js?${project.version}"></script>
nf.counters.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\

View File

@ -13,14 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.history.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.history.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/history/nf-history.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-cluster-summary.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/history/nf-history-model.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/history/nf-history-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/history/nf-history-model.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/history/nf-history.js?${project.version}"></script>
nf.history.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\

View File

@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.login.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.login.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/login/nf-login.js?${project.version}"></script>
nf.login.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\

View File

@ -13,18 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.provenance.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.provenance.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/provenance/nf-provenance.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-controller.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-config.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/provenance/nf-provenance-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/provenance/nf-provenance-lineage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-service-provider.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-controller.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-config.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/provenance/nf-provenance.js?${project.version}"></script>
nf.provenance.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\

View File

@ -13,21 +13,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.summary.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.summary.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-client.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-custom-ui.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-cluster-summary.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-processor-details.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-settings.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/canvas/nf-process-group-configuration.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-connection-details.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-status-history.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-summary.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-summary-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-cluster-search.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-bridge.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-service-provider.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-controller.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ng-app-config.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/nf-ng-app-config.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/summary/nf-summary.js?${project.version}"></script>
nf.summary.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\

View File

@ -13,13 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
nf.templates.script.tags=<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
nf.templates.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/templates/nf-templates.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/templates/nf-templates-table.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/templates/nf-templates-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/templates/nf-templates.js?${project.version}"></script>
nf.templates.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\

View File

@ -14,13 +14,14 @@
# limitations under the License.
nf.users.script.tags=<script type="text/javascript" src="js/nf/nf-client.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-storage.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-common.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-error-handler.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-universal-capture.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/nf-ajax-setup.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/users/nf-users.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/users/nf-users-table.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/users/nf-users-table.js?${project.version}"></script>\n\
<script type="text/javascript" src="js/nf/users/nf-users.js?${project.version}"></script>
nf.users.style.tags=<link rel="stylesheet" href="css/main.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />\n\
<link rel="stylesheet" href="css/banner.css?${project.version}" type="text/css" />\n\

View File

@ -52,8 +52,6 @@
<script type="text/javascript" src="assets/jquery-form/jquery.form.js"></script>
<script type="text/javascript" src="js/jquery/tabbs/jquery.tabbs.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/combo/jquery.combo.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/propertytable/jquery.propertytable.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/tagcloud/jquery.tagcloud.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/modal/jquery.modal.js?${project.version}"></script>
<script type="text/javascript" src="assets/jquery-minicolors/jquery.minicolors.min.js"></script>
<script type="text/javascript" src="assets/qtip2/dist/jquery.qtip.min.js"></script>
@ -81,6 +79,8 @@
${nf.canvas.script.tags}
<script type="text/javascript" src="js/jquery/nfeditor/languages/nfel.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/nfeditor/jquery.nfeditor.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/propertytable/jquery.propertytable.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/tagcloud/jquery.tagcloud.js?${project.version}"></script>
</head>
<body ng-controller="ngCanvasAppCtrl" id="canvas-body">
<div id="splash">

View File

@ -46,7 +46,6 @@
<script type="text/javascript" src="js/jquery/jquery.center.js"></script>
<script type="text/javascript" src="js/jquery/tabbs/jquery.tabbs.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/combo/jquery.combo.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/propertytable/jquery.propertytable.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/modal/jquery.modal.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/jquery.ellipsis.js"></script>
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
@ -73,6 +72,7 @@
${nf.summary.script.tags}
<script type="text/javascript" src="js/jquery/nfeditor/languages/nfel.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/nfeditor/jquery.nfeditor.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/propertytable/jquery.propertytable.js?${project.version}"></script>
</head>
<body ng-controller="ngSummaryAppCtrl">
<jsp:include page="/WEB-INF/partials/message-pane.jsp"/>

View File

@ -39,7 +39,6 @@
<script type="text/javascript" src="js/jquery/jquery.center.js"></script>
<script type="text/javascript" src="js/jquery/tabbs/jquery.tabbs.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/combo/jquery.combo.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/propertytable/jquery.propertytable.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/modal/jquery.modal.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/jquery.ellipsis.js"></script>
<script type="text/javascript" src="js/jquery/jquery.each.js"></script>
@ -57,6 +56,7 @@
<script type="text/javascript" src="js/nf/nf-namespace.js?${project.version}"></script>
<script type="text/javascript" src="js/nf/nf-ng-namespace.js?${project.version}"></script>
${nf.users.script.tags}
<script type="text/javascript" src="js/jquery/propertytable/jquery.propertytable.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/nfeditor/languages/nfel.js?${project.version}"></script>
<script type="text/javascript" src="js/jquery/nfeditor/jquery.nfeditor.js?${project.version}"></script>
</head>

View File

@ -35,7 +35,7 @@
</div>
<p>
Apache NiFi is a framework to support highly scalable and flexible dataflows.
It can be run on on laptops up through clusters of enterprise class servers.
It can be run on laptops up through clusters of enterprise class servers.
Instead of dictating a particular dataflow or behavior it empowers you to design your own
optimal dataflow tailored to your specific environment.
</p>

View File

@ -17,7 +17,7 @@
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
<div id="flow-status" flex layout="row" layout-align="space-between center">
<div id="flow-status-container" layout="row" layout-align="space-around center">
<div class="fa fa-cubes" ng-if="appCtrl.nf.Canvas.isClustered()"><span id="connected-nodes-count">{{appCtrl.serviceProvider.headerCtrl.flowStatusCtrl.connectedNodesCount}}</span></div>
<div class="fa fa-cubes" ng-if="appCtrl.nf.ClusterSummary.isClustered()"><span id="connected-nodes-count">{{appCtrl.serviceProvider.headerCtrl.flowStatusCtrl.connectedNodesCount}}</span></div>
<div class="icon icon-threads"><span id="active-thread-count">{{appCtrl.serviceProvider.headerCtrl.flowStatusCtrl.activeThreadCount}}</span></div>
<div class="fa fa-list"><span id="total-queued">{{appCtrl.serviceProvider.headerCtrl.flowStatusCtrl.totalQueued}}</span></div>
<div class="fa fa-bullseye"><span id="controller-transmitting-count">{{appCtrl.serviceProvider.headerCtrl.flowStatusCtrl.controllerTransmittingCount}}</span></div>

View File

@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* requires qtip plugin to be loaded first*/
/**
* Create a new combo box. The options are specified in the following
* format:

View File

@ -15,27 +15,26 @@
* limitations under the License.
*/
/* global CodeMirror, nf */
/* global define, module, require, exports */
/**
* Create a new nf editor. The options are specified in the following
* format:
*
* {
* languageId: 'nfel',
* resizable: true,
* sensitive: false,
* readOnly: false,
* content: '${attribute}',
* width: 200,
* height: 200,
* minWidth: 150,
* minHeight: 150
* }
*
* @param {type} $
*/
(function ($) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'CodeMirror',
'nf'],
function ($, common) {
factory($, common);
});
} else if (typeof exports === 'object' && typeof module === 'object') {
factory(require('jquery'),
require('CodeMirror'),
require('nf'));
} else {
factory(root.$,
root.CodeMirror,
root.nf);
}
}(this, function ($, CodeMirror, nf) {
var isUndefined = function (obj) {
return typeof obj === 'undefined';
@ -58,10 +57,23 @@
};
var methods = {
/**
* Initializes the nf editor.
*
* Create a new nf editor. The options are specified in the following
* format:
*
* {
* languageId: 'nfel',
* resizable: true,
* sensitive: false,
* readOnly: false,
* content: '${attribute}',
* width: 200,
* height: 200,
* minWidth: 150,
* minHeight: 150
* }
*
* @param {object} options The options for this editor.
*/
init: function (options) {
@ -118,7 +130,7 @@
}
}
});
// set the size
var width = null;
if (isDefinedAndNotNull(options.width)) {
@ -192,7 +204,7 @@
}
});
},
/**
* Refreshes the editor.
*/
@ -206,10 +218,10 @@
}
});
},
/**
* Sets the size of the editor.
*
*
* @param {integer} width
* @param {integer} height
*/
@ -223,7 +235,7 @@
}
});
},
/**
* Gets the value of the editor in the first matching selector.
*/
@ -243,10 +255,10 @@
return value;
},
/**
* Sets the value of the editor.
*
*
* @param {string} value
*/
setValue: function (value) {
@ -262,7 +274,7 @@
}
});
},
/**
* Sets the focus.
*/
@ -276,7 +288,7 @@
}
});
},
/**
* Sets the focus.
*/
@ -290,7 +302,7 @@
}
});
},
/**
* Gets whether the value of the editor in the first matching selector has been modified.
*/
@ -304,7 +316,7 @@
return modified;
},
/**
* Destroys the editor.
*/
@ -320,4 +332,4 @@
return methods.init.apply(this, arguments);
}
};
})(jQuery);
}));

View File

@ -15,9 +15,27 @@
* limitations under the License.
*/
/* global nf, CodeMirror */
/* global nf, define, module, require, exports */
nf.nfel = (function() {
/* requires qtip plugin to be loaded first*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'CodeMirror'],
function ($, CodeMirror) {
return (nf.nfel = factory($, CodeMirror));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.nfel =
factory(require('jquery'),
require('CodeMirror')));
} else {
nf.nfel = factory(root.$,
root.CodeMirror);
}
}(this, function ($, CodeMirror) {
'use strict';
/**
* Formats the specified arguments for the EL function tooltip.
@ -853,4 +871,4 @@ nf.nfel = (function() {
return completions;
}
};
}());
}));

View File

@ -15,34 +15,71 @@
* limitations under the License.
*/
/* global nf, Slick */
/* global define, module, require, exports */
/**
* Create a property table. The options are specified in the following
* format:
*
* {
* readOnly: true,
* dialogContainer: 'body',
* descriptorDeferred: function () {
* return $.Deferred(function (deferred) {
* deferred.resolve();
* }).promise;
* },
* goToServiceDeferred: function () {
* return $.Deferred(function (deferred) {
* deferred.resolve();
* }).promise;
* }
* }
*/
/* requires modal, combo, qtip, and nfeditor plugins to be loaded first*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.UniversalCapture',
'nf.Dialog',
'nf.Client',
'nf.ErrorHandler',
'nf.ProcessGroupConfiguration',
'nf.Settings'],
function ($,
Slick,
common,
universalCapture,
dialog,
client,
errorHandler,
processGroupConfiguration,
settings) {
factory($,
Slick,
common,
universalCapture,
dialog,
client,
errorHandler,
processGroupConfiguration,
settings);
});
} else if (typeof exports === 'object' && typeof module === 'object') {
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.UniversalCapture'),
require('nf.Dialog'),
require('nf.Client'),
require('nf.ErrorHandler'),
require('nf.ProcessGroupConfiguration'),
require('nf.Settings'));
} else {
factory(root.$,
root.Slick,
root.nf.Common,
root.nf.UniversalCapture,
root.nf.Dialog,
root.nf.Client,
root.nf.ErrorHandler,
root.nf.ProcessGroupConfiguration,
root.nf.Settings);
}
}(this, function ($,
Slick,
common,
universalCapture,
dialog,
client,
errorHandler,
processGroupConfiguration,
settings) {
/**
* jQuery plugin for a property table.
*
* @param {type} $
*/
(function ($) {
var languageId = 'nfel';
var editorClass = languageId + '-editor';
var groupId = null;
@ -182,12 +219,12 @@
this.loadValue = function (item) {
// determine if this is a sensitive property
var isEmptyChecked = false;
var sensitive = nf.Common.isSensitiveProperty(propertyDescriptor);
var sensitive = common.isSensitiveProperty(propertyDescriptor);
// determine the value to use when populating the text field
if (nf.Common.isDefinedAndNotNull(item[args.column.field])) {
if (common.isDefinedAndNotNull(item[args.column.field])) {
if (sensitive) {
initialValue = nf.Common.config.sensitiveText;
initialValue = common.config.sensitiveText;
} else {
initialValue = item[args.column.field];
isEmptyChecked = initialValue === '';
@ -204,7 +241,7 @@
var sensitiveInput = $(this);
if (sensitiveInput.hasClass('sensitive')) {
sensitiveInput.removeClass('sensitive');
if (sensitiveInput.val() === nf.Common.config.sensitiveText) {
if (sensitiveInput.val() === common.config.sensitiveText) {
sensitiveInput.val('');
}
}
@ -223,8 +260,8 @@
return '';
} else {
// otherwise if the property is required
if (nf.Common.isRequiredProperty(propertyDescriptor)) {
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
if (common.isRequiredProperty(propertyDescriptor)) {
if (common.isBlank(propertyDescriptor.defaultValue)) {
return previousValue;
} else {
return propertyDescriptor.defaultValue;
@ -285,7 +322,7 @@
propertyDescriptor = descriptors[args.item.property];
// determine if this is a sensitive property
var sensitive = nf.Common.isSensitiveProperty(propertyDescriptor);
var sensitive = common.isSensitiveProperty(propertyDescriptor);
// record the previous value
previousValue = args.item[args.column.field];
@ -402,12 +439,12 @@
this.loadValue = function (item) {
// determine if this is a sensitive property
var isEmptyChecked = false;
var sensitive = nf.Common.isSensitiveProperty(propertyDescriptor);
var sensitive = common.isSensitiveProperty(propertyDescriptor);
// determine the value to use when populating the text field
if (nf.Common.isDefinedAndNotNull(item[args.column.field])) {
if (common.isDefinedAndNotNull(item[args.column.field])) {
if (sensitive) {
initialValue = nf.Common.config.sensitiveText;
initialValue = common.config.sensitiveText;
} else {
initialValue = item[args.column.field];
isEmptyChecked = initialValue === '';
@ -431,8 +468,8 @@
return '';
} else {
// otherwise if the property is required
if (nf.Common.isRequiredProperty(propertyDescriptor)) {
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
if (common.isRequiredProperty(propertyDescriptor)) {
if (common.isBlank(propertyDescriptor.defaultValue)) {
return previousValue;
} else {
return propertyDescriptor.defaultValue;
@ -516,7 +553,7 @@
}).appendTo(container);
// check for allowable values which will drive which editor to use
var allowableValues = nf.Common.getAllowableValues(propertyDescriptor);
var allowableValues = common.getAllowableValues(propertyDescriptor);
// show the output port options
var options = [];
@ -534,7 +571,7 @@
text: allowableValue.displayName,
value: allowableValue.value,
disabled: allowableValueEntity.canRead === false && allowableValue.value !== args.item['previousValue'],
description: nf.Common.escapeHtml(allowableValue.description)
description: common.escapeHtml(allowableValue.description)
});
});
}
@ -550,7 +587,7 @@
}
// if this descriptor identifies a controller service, provide a way to create one
if (nf.Common.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService)) {
if (common.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService)) {
options.push({
text: 'Create new service...',
value: undefined,
@ -579,7 +616,8 @@
}).css({
'margin-top': '10px',
'margin-bottom': '10px',
'width': ((position.width - 16) < 212) ? 212 : (position.width - 16) + 'px'}).appendTo(wrapper);
'width': ((position.width - 16) < 212) ? 212 : (position.width - 16) + 'px'
}).appendTo(wrapper);
// add buttons for handling user input
var cancel = $('<div class="secondary-button">Cancel</div>').css({
@ -647,13 +685,13 @@
this.loadValue = function (item) {
// select as appropriate
if (!nf.Common.isUndefined(item.value)) {
if (!common.isUndefined(item.value)) {
initialValue = item.value;
combo.combo('setSelectedOption', {
value: item.value
});
} else if (nf.Common.isDefinedAndNotNull(propertyDescriptor.defaultValue)) {
} else if (common.isDefinedAndNotNull(propertyDescriptor.defaultValue)) {
initialValue = propertyDescriptor.defaultValue;
combo.combo('setSelectedOption', {
@ -697,20 +735,20 @@
*/
var showPropertyValue = function (propertyGrid, descriptors, row, cell) {
// remove any currently open detail dialogs
nf.UniversalCapture.removeAllPropertyDetailDialogs();
universalCapture.removeAllPropertyDetailDialogs();
// get the property in question
var propertyData = propertyGrid.getData();
var property = propertyData.getItem(row);
// ensure there is a value
if (nf.Common.isDefinedAndNotNull(property.value)) {
if (common.isDefinedAndNotNull(property.value)) {
// get the descriptor to insert the description tooltip
var propertyDescriptor = descriptors[property.property];
// ensure we're not dealing with a sensitive property
if (!nf.Common.isSensitiveProperty(propertyDescriptor)) {
if (!common.isSensitiveProperty(propertyDescriptor)) {
// get details about the location of the cell
var cellNode = $(propertyGrid.getCellNode(row, cell));
@ -731,7 +769,7 @@
'left': offset.left - 20
}).appendTo('body');
var allowableValues = nf.Common.getAllowableValues(propertyDescriptor);
var allowableValues = common.getAllowableValues(propertyDescriptor);
if ($.isArray(allowableValues)) {
// prevent dragging over the combo
wrapper.draggable({
@ -746,7 +784,7 @@
options.push({
text: allowableValue.displayName,
value: allowableValue.value,
description: nf.Common.escapeHtml(allowableValue.description),
description: common.escapeHtml(allowableValue.description),
disabled: true
});
});
@ -795,7 +833,7 @@
var editor = null;
// so the nfel editor is appropriate
if (nf.Common.supportsEl(propertyDescriptor)) {
if (common.supportsEl(propertyDescriptor)) {
var languageId = 'nfel';
var editorClass = languageId + '-editor';
@ -919,41 +957,41 @@
var options = [];
$.each(response.controllerServiceTypes, function (i, controllerServiceType) {
options.push({
text: nf.Common.substringAfterLast(controllerServiceType.type, '.'),
text: common.substringAfterLast(controllerServiceType.type, '.'),
value: controllerServiceType.type,
description: nf.Common.escapeHtml(controllerServiceType.description)
description: common.escapeHtml(controllerServiceType.description)
});
});
// ensure there are some applicable controller services
if (options.length === 0) {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Controller Service',
dialogContent: 'No controller service types found that are applicable for this property.'
});
} else {
var newControllerServiceDialogMarkup =
'<div id="new-inline-controller-service-dialog" class="hidden dialog medium-dialog cancellable">' +
'<div class="dialog-content">' +
'<div>' +
'<div class="setting-name">Controller Service</div>' +
'<div class="setting-field">' +
'<div class="new-inline-controller-service-combo"></div>' +
'</div>' +
'</div>' +
'<div>' +
'<div class="setting-name">Tags</div>' +
'<div class="setting-field">' +
'<div class="new-inline-controller-service-tags"></div>' +
'</div>' +
'</div>' +
'<div>' +
'<div class="setting-name">Description</div>' +
'<div class="setting-field">' +
'<div class="new-inline-controller-service-description"></div>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="dialog-content">' +
'<div>' +
'<div class="setting-name">Controller Service</div>' +
'<div class="setting-field">' +
'<div class="new-inline-controller-service-combo"></div>' +
'</div>' +
'</div>' +
'<div>' +
'<div class="setting-name">Tags</div>' +
'<div class="setting-field">' +
'<div class="new-inline-controller-service-tags"></div>' +
'</div>' +
'</div>' +
'<div>' +
'<div class="setting-name">Description</div>' +
'<div class="setting-field">' +
'<div class="new-inline-controller-service-description"></div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
var newControllerServiceDialog = $(newControllerServiceDialogMarkup).appendTo(configurationOptions.dialogContainer);
@ -1015,7 +1053,7 @@
// build the controller service entity
var controllerServiceEntity = {
'revision': nf.Client.getRevision({
'revision': client.getRevision({
'revision': {
'version': 0,
}
@ -1027,7 +1065,7 @@
// determine the appropriate uri for creating the controller service
var uri = '../nifi-api/controller/controller-services';
if (nf.Common.isDefinedAndNotNull(groupId)) {
if (common.isDefinedAndNotNull(groupId)) {
uri = '../nifi-api/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
}
@ -1045,7 +1083,7 @@
// store the descriptor for use later
var descriptors = gridContainer.data('descriptors');
if (!nf.Common.isUndefined(descriptors)) {
if (!common.isUndefined(descriptors)) {
descriptors[descriptor.name] = descriptor;
}
@ -1054,7 +1092,7 @@
data.updateItem(item.id, $.extend(item, {
value: response.component.id
}));
// close the dialog
newControllerServiceDialog.modal('hide');
});
@ -1063,7 +1101,7 @@
if (typeof configurationOptions.controllerServiceCreatedDeferred === 'function') {
configurationOptions.controllerServiceCreatedDeferred(response);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
var cancel = function () {
@ -1072,7 +1110,7 @@
newControllerServiceDialog.modal('show');
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
var initPropertiesTable = function (table, options) {
@ -1092,8 +1130,8 @@
var propertyDescriptor = descriptors[dataContext.property];
// show the property description if applicable
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (!nf.Common.isBlank(propertyDescriptor.description) || !nf.Common.isBlank(propertyDescriptor.defaultValue) || !nf.Common.isBlank(propertyDescriptor.supportsEl)) {
if (common.isDefinedAndNotNull(propertyDescriptor)) {
if (!common.isBlank(propertyDescriptor.description) || !common.isBlank(propertyDescriptor.defaultValue) || !common.isBlank(propertyDescriptor.supportsEl)) {
$('<div class="fa fa-question-circle" alt="Info" style="float: right; margin-right: 6px; margin-top: 4px;"></div>').appendTo(cellContent);
$('<span class="hidden property-descriptor-name"></span>').text(dataContext.property).appendTo(cellContent);
nameWidthOffset = 46; // 10 + icon width (10) + icon margin (6) + padding (20)
@ -1110,17 +1148,17 @@
// function for formatting the property value
var valueFormatter = function (row, cell, value, columnDef, dataContext) {
var valueMarkup;
if (nf.Common.isDefinedAndNotNull(value)) {
if (common.isDefinedAndNotNull(value)) {
// get the property descriptor
var descriptors = table.data('descriptors');
var propertyDescriptor = descriptors[dataContext.property];
// determine if the property is sensitive
if (nf.Common.isSensitiveProperty(propertyDescriptor)) {
if (common.isSensitiveProperty(propertyDescriptor)) {
valueMarkup = '<span class="table-cell sensitive">Sensitive value set</span>';
} else {
// if there are allowable values, attempt to swap out for the display name
var allowableValues = nf.Common.getAllowableValues(propertyDescriptor);
var allowableValues = common.getAllowableValues(propertyDescriptor);
if ($.isArray(allowableValues)) {
$.each(allowableValues, function (_, allowableValueEntity) {
var allowableValue = allowableValueEntity.allowableValue;
@ -1134,7 +1172,7 @@
if (value === '') {
valueMarkup = '<span class="table-cell blank">Empty string set</span>';
} else {
valueMarkup = '<div class="table-cell value"><pre class="ellipsis">' + nf.Common.escapeHtml(value) + '</pre></div>';
valueMarkup = '<div class="table-cell value"><pre class="ellipsis">' + common.escapeHtml(value) + '</pre></div>';
}
}
} else {
@ -1182,12 +1220,11 @@
var descriptors = table.data('descriptors');
var propertyDescriptor = descriptors[dataContext.property];
var identifiesControllerService = nf.Common.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService);
var isConfigured = nf.Common.isDefinedAndNotNull(dataContext.value);
var isOnCanvas = nf.Common.isDefinedAndNotNull(nf.Canvas);
var identifiesControllerService = common.isDefinedAndNotNull(propertyDescriptor.identifiesControllerService);
var isConfigured = common.isDefinedAndNotNull(dataContext.value);
// check to see if we should provide a button for going to a controller service
if (identifiesControllerService && isConfigured && isOnCanvas) {
if (identifiesControllerService && isConfigured && (options.supportsGoTo === true)) {
// ensure the configured value is referencing a valid service
$.each(propertyDescriptor.allowableValues, function (_, allowableValueEntity) {
var allowableValue = allowableValueEntity.allowableValue;
@ -1236,7 +1273,7 @@
var propertyDescriptor = descriptors[item.property];
// support el if specified or unsure yet (likely a dynamic property)
if (nf.Common.isUndefinedOrNull(propertyDescriptor) || nf.Common.supportsEl(propertyDescriptor)) {
if (common.isUndefinedOrNull(propertyDescriptor) || common.supportsEl(propertyDescriptor)) {
return {
columns: {
value: {
@ -1246,7 +1283,7 @@
};
} else {
// check for allowable values which will drive which editor to use
var allowableValues = nf.Common.getAllowableValues(propertyDescriptor);
var allowableValues = common.getAllowableValues(propertyDescriptor);
if ($.isArray(allowableValues)) {
return {
columns: {
@ -1283,37 +1320,37 @@
var controllerService = controllerServiceEntity.component;
$.Deferred(function (deferred) {
if (nf.Common.isDefinedAndNotNull(controllerService.parentGroupId)) {
if (common.isDefinedAndNotNull(controllerService.parentGroupId)) {
if ($('#process-group-configuration').is(':visible')) {
nf.ProcessGroupConfiguration.loadConfiguration(controllerService.parentGroupId).done(function () {
processGroupConfiguration.loadConfiguration(controllerService.parentGroupId).done(function () {
deferred.resolve();
});
} else {
nf.ProcessGroupConfiguration.showConfiguration(controllerService.parentGroupId).done(function () {
processGroupConfiguration.showConfiguration(controllerService.parentGroupId).done(function () {
deferred.resolve();
});
}
} else {
if ($('#settings').is(':visible')) {
// reload the settings
nf.Settings.loadSettings().done(function () {
settings.loadSettings().done(function () {
deferred.resolve();
});
} else {
// reload the settings and show
nf.Settings.showSettings().done(function () {
settings.showSettings().done(function () {
deferred.resolve();
});
}
}
}).done(function () {
if (nf.Common.isDefinedAndNotNull(controllerService.parentGroupId)) {
nf.ProcessGroupConfiguration.selectControllerService(property.value);
if (common.isDefinedAndNotNull(controllerService.parentGroupId)) {
processGroupConfiguration.selectControllerService(property.value);
} else {
nf.Settings.selectControllerService(property.value);
settings.selectControllerService(property.value);
}
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
// initialize the grid
@ -1396,11 +1433,11 @@
var propertyHistory = history[property];
// format the tooltip
var tooltip = nf.Common.formatPropertyTooltip(propertyDescriptor, propertyHistory);
var tooltip = common.formatPropertyTooltip(propertyDescriptor, propertyHistory);
if (nf.Common.isDefinedAndNotNull(tooltip)) {
if (common.isDefinedAndNotNull(tooltip)) {
infoIcon.qtip($.extend({},
nf.Common.config.tooltipConfig,
common.config.tooltipConfig,
{
content: tooltip
}));
@ -1412,7 +1449,7 @@
var saveRow = function (table) {
// get the property grid to commit the current edit
var propertyGrid = table.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(propertyGrid)) {
if (common.isDefinedAndNotNull(propertyGrid)) {
var editController = propertyGrid.getEditController();
editController.commitCurrentEdit();
}
@ -1449,7 +1486,7 @@
var propertyData = propertyGrid.getData();
// generate the properties
if (nf.Common.isDefinedAndNotNull(properties)) {
if (common.isDefinedAndNotNull(properties)) {
propertyData.beginUpdate();
var i = 0;
@ -1460,10 +1497,10 @@
// determine the property type
var type = 'userDefined';
var displayName = name;
if (nf.Common.isDefinedAndNotNull(descriptor)) {
if (nf.Common.isRequiredProperty(descriptor)) {
if (common.isDefinedAndNotNull(descriptor)) {
if (common.isRequiredProperty(descriptor)) {
type = 'required';
} else if (nf.Common.isDynamicProperty(descriptor)) {
} else if (common.isDynamicProperty(descriptor)) {
type = 'userDefined';
} else {
type = 'optional';
@ -1473,7 +1510,7 @@
displayName = descriptor.displayName;
// determine the value
if (nf.Common.isNull(value) && nf.Common.isDefinedAndNotNull(descriptor.defaultValue)) {
if (common.isNull(value) && common.isDefinedAndNotNull(descriptor.defaultValue)) {
value = descriptor.defaultValue;
}
}
@ -1502,10 +1539,10 @@
var clear = function (propertyTableContainer) {
var options = propertyTableContainer.data('options');
if (options.readOnly === true) {
nf.UniversalCapture.removeAllPropertyDetailDialogs();
universalCapture.removeAllPropertyDetailDialogs();
} else {
// clear any existing new property dialogs
if (nf.Common.isDefinedAndNotNull(options.dialogContainer)) {
if (common.isDefinedAndNotNull(options.dialogContainer)) {
$('#new-property-dialog').modal("hide");
}
}
@ -1515,7 +1552,7 @@
table.removeData('descriptors history');
// clean up any tooltips that may have been generated
nf.Common.cleanUpTooltips(table, 'div.fa-question-circle');
common.cleanUpTooltips(table, 'div.fa-question-circle');
// clear the data in the grid
var propertyGrid = table.data('gridInstance');
@ -1525,14 +1562,31 @@
var methods = {
/**
* Initializes the tag cloud.
* Create a property table. The options are specified in the following
* format:
*
* {
* readOnly: true,
* dialogContainer: 'body',
* descriptorDeferred: function () {
* return $.Deferred(function (deferred) {
* deferred.resolve();
* }).promise;
* },
* supportsGoTo: true,
* goToServiceDeferred: function () {
* return $.Deferred(function (deferred) {
* deferred.resolve();
* }).promise;
* }
* }
*
* @argument {object} options The options for the tag cloud
*/
init: function (options) {
return this.each(function () {
// ensure the options have been properly specified
if (nf.Common.isDefinedAndNotNull(options)) {
if (common.isDefinedAndNotNull(options)) {
// get the tag cloud
var propertyTableContainer = $(this);
@ -1547,18 +1601,18 @@
var table = $('<div class="property-table"></div>').appendTo(propertyTableContainer);
// optionally add a add new property button
if (options.readOnly !== true && nf.Common.isDefinedAndNotNull(options.dialogContainer)) {
if (options.readOnly !== true && common.isDefinedAndNotNull(options.dialogContainer)) {
// build the new property dialog
var newPropertyDialogMarkup =
'<div id="new-property-dialog" class="dialog cancellable small-dialog hidden">' +
'<div class="dialog-content">' +
'<div>' +
'<div class="setting-name">Property name</div>' +
'<div class="setting-field new-property-name-container">' +
'<input class="new-property-name" type="text"/>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="dialog-content">' +
'<div>' +
'<div class="setting-name">Property name</div>' +
'<div class="setting-field new-property-name-container">' +
'<input class="new-property-name" type="text"/>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
var newPropertyDialog = $(newPropertyDialogMarkup).appendTo(options.dialogContainer);
@ -1619,7 +1673,7 @@
// store the descriptor for use later
var descriptors = table.data('descriptors');
if (!nf.Common.isUndefined(descriptors)) {
if (!common.isUndefined(descriptors)) {
descriptors[descriptor.name] = descriptor;
}
@ -1654,7 +1708,7 @@
propertyGrid.setActiveCell(row, propertyGrid.getColumnIndex('value'));
propertyGrid.editActiveCell();
} else {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Property Exists',
dialogContent: 'A property with this name already exists.'
});
@ -1666,7 +1720,7 @@
}
}
} else {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Property Name',
dialogContent: 'Property name must be specified.'
});
@ -1749,7 +1803,7 @@
return this.each(function () {
var table = $(this).find('div.property-table');
var propertyGrid = table.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(propertyGrid)) {
if (common.isDefinedAndNotNull(propertyGrid)) {
propertyGrid.resizeCanvas();
}
});
@ -1762,7 +1816,7 @@
return this.each(function () {
var table = $(this).find('div.property-table');
var propertyGrid = table.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(propertyGrid)) {
if (common.isDefinedAndNotNull(propertyGrid)) {
var editController = propertyGrid.getEditController();
editController.cancelCurrentEdit();
}
@ -1777,12 +1831,12 @@
var propertyTableContainer = $(this);
var options = propertyTableContainer.data('options');
if (nf.Common.isDefinedAndNotNull(options)) {
if (common.isDefinedAndNotNull(options)) {
// clear the property table container
clear(propertyTableContainer);
// clear any existing new property dialogs
if (nf.Common.isDefinedAndNotNull(options.dialogContainer)) {
if (common.isDefinedAndNotNull(options.dialogContainer)) {
$('#new-property-dialog').modal("hide");
$(options.dialogContainer).children('div.new-inline-controller-service-dialog').remove();
}
@ -1870,4 +1924,4 @@
return methods.init.apply(this, arguments);
}
};
})(jQuery);
}));

View File

@ -127,7 +127,7 @@
$.each(options.tags, function (i, tag) {
var normalizedTagName = tag.toLowerCase();
if (nf.Common.isDefinedAndNotNull(tagCloud[normalizedTagName])) {
if (isDefinedAndNotNull(tagCloud[normalizedTagName])) {
tagCloud[normalizedTagName].count = tagCloud[normalizedTagName].count + 1;
} else {
var tagCloudEntry = {

View File

@ -15,421 +15,480 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, define, module, require, exports */
$(document).ready(function () {
//Create Angular App
var app = angular.module('ngBulletinBoardApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
//Define Dependency Injection Annotations
nf.ng.AppConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
nf.ng.AppCtrl.$inject = ['$scope', 'serviceProvider', 'bulletinBoardCtrl'];
nf.ng.BulletinBoardCtrl.$inject = ['serviceProvider'];
nf.ng.ServiceProvider.$inject = [];
//Configure Angular App
app.config(nf.ng.AppConfig);
//Define Angular App Controllers
app.controller('ngBulletinBoardAppCtrl', nf.ng.AppCtrl);
//Define Angular App Services
app.service('serviceProvider', nf.ng.ServiceProvider);
app.service('bulletinBoardCtrl', nf.ng.BulletinBoardCtrl);
//Manually Boostrap Angular App
nf.ng.Bridge.injector = angular.bootstrap($('body'), ['ngBulletinBoardApp'], { strictDi: true });
// initialize the bulletin board
nf.ng.Bridge.injector.get('bulletinBoardCtrl').init();
});
nf.ng.BulletinBoardCtrl = function (serviceProvider) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'angular',
'nf.Common',
'nf.ng.AppConfig',
'nf.ng.AppCtrl',
'nf.ng.ServiceProvider',
'nf.ng.Bridge',
'nf.ErrorHandler',
'nf.Storage'],
function ($,
angular,
common,
appConfig,
appCtrl,
serviceProvider,
angularBridge,
errorHandler,
storage) {
return (nf.ng.BulletinBoardCtrl =
factory($,
angular,
common,
appConfig,
appCtrl,
serviceProvider,
angularBridge,
errorHandler,
storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.BulletinBoardCtrl =
factory(require('jquery'),
require('angular'),
require('nf.Common'),
require('nf.ng.AppConfig'),
require('nf.ng.AppCtrl'),
require('nf.ng.ServiceProvider'),
require('nf.ng.Bridge'),
require('nf.ErrorHandler'),
require('nf.Storage')));
} else {
nf.ng.BulletinBoardCtrl = factory(root.$,
root.angular,
root.nf.Common,
root.nf.ng.AppConfig,
root.nf.ng.AppCtrl,
root.nf.ng.ServiceProvider,
root.nf.ng.Bridge,
root.nf.ErrorHandler,
root.nf.Storage);
}
}(this, function ($, angular, common, appConfig, appCtrl, serviceProvider, angularBridge, errorHandler, storage) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
*/
var config = {
pollInterval: 3,
maxBulletins: 1000,
urls: {
banners: '../nifi-api/flow/banners',
about: '../nifi-api/flow/about',
bulletinBoard: '../nifi-api/flow/bulletin-board'
}
};
$(document).ready(function () {
var lastBulletin = null;
var filterText = null;
var filterType = null;
//Create Angular App
var app = angular.module('ngBulletinBoardApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
/**
* Initializes the bulletin board.
*/
var initializePage = function () {
// add hover effect and click handler for clearing the bulletins
$('#clear-bulletins-button').click(function () {
$('#bulletin-board-container').empty();
});
//Define Dependency Injection Annotations
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
appCtrl.$inject = ['$scope', 'serviceProvider', 'bulletinBoardCtrl'];
nfBulletinBoard.$inject = ['serviceProvider'];
serviceProvider.$inject = [];
// filter type
$('#bulletin-board-filter-type').combo({
options: [{
text: 'by message',
value: 'message'
}, {
text: 'by name',
value: 'sourceName'
}, {
text: 'by id',
value: 'sourceId'
}, {
text: 'by group id',
value: 'groupId'
}]
});
//Configure Angular App
app.config(appConfig);
// get the about details
var getTitle = $.ajax({
type: 'GET',
url: config.urls.about,
dataType: 'json'
}).done(function (response) {
var aboutDetails = response.about;
var bulletinBoardTitle = aboutDetails.title + ' Bulletin Board';
//Define Angular App Controllers
app.controller('ngBulletinBoardAppCtrl', appCtrl);
// set the document title and the about title
document.title = bulletinBoardTitle;
$('#bulletin-board-header-text').text(bulletinBoardTitle);
}).fail(nf.Common.handleAjaxError);
//Define Angular App Services
app.service('serviceProvider', serviceProvider);
app.service('bulletinBoardCtrl', nfBulletinBoard);
// get the banners if we're not in the shell
var loadBanners = $.Deferred(function (deferred) {
if (top === window) {
$.ajax({
type: 'GET',
url: config.urls.banners,
dataType: 'json'
}).done(function (response) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(response.banners)) {
if (nf.Common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
//Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngBulletinBoardApp'], {strictDi: true});
// show the banner
var updateTop = function (elementId) {
var element = $('#' + elementId);
element.css('top', (parseInt(bannerHeader.css('height'), 10) + parseInt(element.css('top'), 10)) + 'px');
};
// initialize the bulletin board
angularBridge.injector.get('bulletinBoardCtrl').init();
});
// update the position of elements affected by top banners
updateTop('bulletin-board');
}
var nfBulletinBoard = function (serviceProvider) {
if (nf.Common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
var updateBottom = function (elementId) {
var element = $('#' + elementId);
element.css('bottom', parseInt(bannerFooter.css('height'), 10) + 'px');
};
// update the position of elements affected by bottom banners
updateBottom('bulletin-board');
}
}
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
deferred.resolve();
/**
* Configuration object used to hold a number of configuration items.
*/
var config = {
pollInterval: 3,
maxBulletins: 1000,
urls: {
banners: '../nifi-api/flow/banners',
about: '../nifi-api/flow/about',
bulletinBoard: '../nifi-api/flow/bulletin-board'
}
});
};
return $.Deferred(function (deferred) {
$.when(getTitle, loadBanners).done(function () {
deferred.resolve();
}).fail(function () {
deferred.reject();
var lastBulletin = null;
var filterText = null;
var filterType = null;
/**
* Initializes the bulletin board.
*/
var initializePage = function () {
// add hover effect and click handler for clearing the bulletins
$('#clear-bulletins-button').click(function () {
$('#bulletin-board-container').empty();
});
}).promise();
};
/**
* Starts polling for new bulletins.
*/
var start = function () {
var refreshButton = $('#refresh-button');
var bulletinContainer = $('#bulletin-board-container');
appendAndScroll(bulletinContainer, '<div class="bulletin-action">Auto refresh started</div>');
// clear any error messages
$('#bulletin-error-message').text('').hide();
poll();
};
/**
* Stops polling for new bulletins.
*/
var stop = function () {
var refreshButton = $('#refresh-button');
var bulletinContainer = $('#bulletin-board-container');
appendAndScroll(bulletinContainer, '<div class="bulletin-action">Auto refresh stopped</div>');
// reset state
lastBulletin = null;
filterText = null;
filterType = null;
};
/**
* Polls for new bulletins
*/
var poll = function () {
// if the page is no longer open, stop polling
var isOpen = $('#bulletin-board').is(':visible');
if (!isOpen) {
bulletinBoardCtrl.polling = false;
}
// if polling, reload the bulletins
if (bulletinBoardCtrl.polling) {
bulletinBoardCtrl.loadBulletins().done(function () {
if (bulletinBoardCtrl.polling) {
setTimeout(poll, config.pollInterval * 1000);
}
// filter type
$('#bulletin-board-filter-type').combo({
options: [{
text: 'by message',
value: 'message'
}, {
text: 'by name',
value: 'sourceName'
}, {
text: 'by id',
value: 'sourceId'
}, {
text: 'by group id',
value: 'groupId'
}]
});
}
};
/**
* Appends the specified string to the specified container and scrolls to the bottom.
*
* @argument {jQuery} bulletinContainer The container for the bulletins
* @argument {string} content The content to added to the bulletin container
*/
var appendAndScroll = function (bulletinContainer, content) {
bulletinContainer.append(content).animate({scrollTop: bulletinContainer[0].scrollHeight}, 'slow');
};
/**
* Goes to the specified source on the graph.
*
* @argument {string} groupId The id of the group
* @argument {string} sourceId The id of the source component
*/
var goToSource = function (groupId, sourceId) {
// only attempt this if we're within a frame
if (top !== window) {
// and our parent has canvas utils and shell defined
if (nf.Common.isDefinedAndNotNull(parent.nf) && nf.Common.isDefinedAndNotNull(parent.nf.CanvasUtils) && nf.Common.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.showComponent(groupId, sourceId);
parent.$('#shell-close-button').click();
}
}
};
function BulletinBoardCtrl() {
/**
* Toggle state
*/
this.polling = true;
}
BulletinBoardCtrl.prototype = {
constructor: BulletinBoardCtrl,
/**
* Register the bulletin board controller.
*/
register: function() {
if (serviceProvider.bulletinBoardCtrl === undefined) {
serviceProvider.register('bulletinBoardCtrl', bulletinBoardCtrl);
}
},
/**
* Initializes the bulletin board page.
*/
init: function () {
//alter styles if we're not in the shell
if (top === window) {
$('#bulletin-board').css({
"position": "absolute",
"bottom": "40px",
"left": "40px",
"right": "40px",
"top": "40px"
});
$('#bulletin-board-refresh-container').css({
"position": "absolute",
"bottom": "40px",
"left": "40px",
"right": "40px"
});
}
nf.Storage.init();
initializePage().done(function () {
start();
});
},
/**
* Loads the bulletins since the last refresh.
*/
loadBulletins: function () {
var data = {};
// include the timestamp if appropriate
if (nf.Common.isDefinedAndNotNull(lastBulletin)) {
data['after'] = lastBulletin;
} else {
data['limit'] = 10;
}
var bulletinContainer = $('#bulletin-board-container');
// get the filter text
var filter = $('#bulletin-board-filter').val();
if (filter !== '') {
// determine which field to filter on
var filterOption = $('#bulletin-board-filter-type').combo('getSelectedOption');
data[filterOption.value] = filter;
// append filtering message if necessary
if (filterText !== filter || filterType !== filterOption.text) {
var filterContent = $('<div class="bulletin-action"></div>').text('Filter ' + filterOption.text + ' matching \'' + filter + '\'');
appendAndScroll(bulletinContainer, filterContent.get(0));
filterText = filter;
filterType = filterOption.text;
}
} else if (filterText !== null) {
appendAndScroll(bulletinContainer, '<div class="bulletin-action">Filter removed</div>');
filterText = null;
filterType = null;
}
return $.ajax({
// get the about details
var getTitle = $.ajax({
type: 'GET',
url: config.urls.bulletinBoard,
data: data,
url: config.urls.about,
dataType: 'json'
}).done(function (response) {
// ensure the bulletin board was specified
if (nf.Common.isDefinedAndNotNull(response.bulletinBoard)) {
var bulletinBoard = response.bulletinBoard;
var aboutDetails = response.about;
var bulletinBoardTitle = aboutDetails.title + ' Bulletin Board';
// update the stats last refreshed timestamp
$('#bulletin-board-last-refreshed').text(bulletinBoard.generated);
// set the document title and the about title
document.title = bulletinBoardTitle;
$('#bulletin-board-header-text').text(bulletinBoardTitle);
}).fail(errorHandler.handleAjaxError);
// process the bulletins
var bulletinEntities = response.bulletinBoard.bulletins;
var content = [];
// get the banners if we're not in the shell
var loadBanners = $.Deferred(function (deferred) {
if (top === window) {
$.ajax({
type: 'GET',
url: config.urls.banners,
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 !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
// append each bulletin
$.each(bulletinEntities, function (i, bulletinEntity) {
if (bulletinEntity.canRead === true) {
var bulletin = bulletinEntity.bulletin;
// show the banner
var updateTop = function (elementId) {
var element = $('#' + elementId);
element.css('top', (parseInt(bannerHeader.css('height'), 10) + parseInt(element.css('top'), 10)) + 'px');
};
// format the severity
var severityStyle = 'bulletin-normal';
if (bulletin.level === 'ERROR') {
severityStyle = 'bulletin-error';
} else if (bulletin.level === 'WARN' || bulletin.level === 'WARNING') {
severityStyle = 'bulletin-warn';
// update the position of elements affected by top banners
updateTop('bulletin-board');
}
// format the source id
var source;
if (nf.Common.isDefinedAndNotNull(bulletin.sourceId) && nf.Common.isDefinedAndNotNull(bulletin.groupId) && top !== window) {
source = $('<div class="bulletin-source bulletin-link"></div>').text(bulletin.sourceId).on('click', function () {
goToSource(bulletin.groupId, bulletin.sourceId);
});
} else {
var sourceId = bulletin.sourceId;
if (nf.Common.isUndefined(sourceId) || nf.Common.isNull(sourceId)) {
sourceId = '';
}
source = $('<div class="bulletin-source"></div>').text(sourceId);
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
var updateBottom = function (elementId) {
var element = $('#' + elementId);
element.css('bottom', parseInt(bannerFooter.css('height'), 10) + 'px');
};
// update the position of elements affected by bottom banners
updateBottom('bulletin-board');
}
// build the markup for this bulletin
var bulletinMarkup = $('<div class="bulletin"></div>');
// build the markup for this bulletins info
var bulletinInfoMarkup = $('<div class="bulletin-info"></div>').appendTo(bulletinMarkup);
$('<div class="bulletin-timestamp"></div>').text(bulletin.timestamp).appendTo(bulletinInfoMarkup);
$('<div class="bulletin-severity"></div>').addClass(severityStyle).text(bulletin.level).appendTo(bulletinInfoMarkup);
source.appendTo(bulletinInfoMarkup);
$('<div class="clear"></div>').appendTo(bulletinInfoMarkup);
// format the node address if applicable
if (nf.Common.isDefinedAndNotNull(bulletin.nodeAddress)) {
$('<div class="bulletin-node"></div>').text(bulletin.nodeAddress).appendTo(bulletinMarkup);
}
// add the bulletin message (treat as text)
$('<pre class="bulletin-message"></pre>').text(bulletin.message).appendTo(bulletinMarkup);
$('<div class="clear"></div>').appendTo(bulletinMarkup);
// append the content
content.push(bulletinMarkup.get(0));
}
// record the id of the last bulletin in this request
if (i + 1 === bulletinEntities.length) {
lastBulletin = bulletinEntity.id;
}
deferred.resolve();
}).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
// add the content to the scroll pane
appendAndScroll(bulletinContainer, content);
// trim the container as necessary
var contents = bulletinContainer.contents();
var length = contents.length;
if (length > config.maxBulletins) {
contents.slice(0, length - config.maxBulletins).remove();
bulletinContainer.prepend('<div class="bulletin-action">&#8230;</div>');
}
}
}).fail(function (xhr, status, error) {
// likely caused by a invalid regex
if (xhr.status === 404) {
$('#bulletin-error-message').text(xhr.responseText).show();
// stop future polling
togglePolling();
} else {
nf.Common.handleAjaxError(xhr, status, error);
deferred.resolve();
}
});
},
return $.Deferred(function (deferred) {
$.when(getTitle, loadBanners).done(function () {
deferred.resolve();
}).fail(function () {
deferred.reject();
});
}).promise();
};
/**
* Toggles whether the page is actively polling for new bulletins.
* Starts polling for new bulletins.
*/
togglePolling: function () {
// conditionally start or stop
if (bulletinBoardCtrl.polling === true) {
start();
} else {
stop();
var start = function () {
var refreshButton = $('#refresh-button');
var bulletinContainer = $('#bulletin-board-container');
appendAndScroll(bulletinContainer, '<div class="bulletin-action">Auto refresh started</div>');
// clear any error messages
$('#bulletin-error-message').text('').hide();
poll();
};
/**
* Stops polling for new bulletins.
*/
var stop = function () {
var refreshButton = $('#refresh-button');
var bulletinContainer = $('#bulletin-board-container');
appendAndScroll(bulletinContainer, '<div class="bulletin-action">Auto refresh stopped</div>');
// reset state
lastBulletin = null;
filterText = null;
filterType = null;
};
/**
* Polls for new bulletins
*/
var poll = function () {
// if the page is no longer open, stop polling
var isOpen = $('#bulletin-board').is(':visible');
if (!isOpen) {
bulletinBoardCtrl.polling = false;
}
// if polling, reload the bulletins
if (bulletinBoardCtrl.polling) {
bulletinBoardCtrl.loadBulletins().done(function () {
if (bulletinBoardCtrl.polling) {
setTimeout(poll, config.pollInterval * 1000);
}
});
}
};
/**
* Appends the specified string to the specified container and scrolls to the bottom.
*
* @argument {jQuery} bulletinContainer The container for the bulletins
* @argument {string} content The content to added to the bulletin container
*/
var appendAndScroll = function (bulletinContainer, content) {
bulletinContainer.append(content).animate({scrollTop: bulletinContainer[0].scrollHeight}, 'slow');
};
/**
* Goes to the specified source on the graph.
*
* @argument {string} groupId The id of the group
* @argument {string} sourceId The id of the source component
*/
var goToSource = function (groupId, sourceId) {
// only attempt this if we're within a frame
if (top !== window) {
// and our parent has canvas utils and shell defined
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.showComponent(groupId, sourceId);
parent.$('#shell-close-button').click();
}
}
};
function BulletinBoardCtrl() {
/**
* Toggle state
*/
this.polling = true;
}
BulletinBoardCtrl.prototype = {
constructor: BulletinBoardCtrl,
/**
* Register the bulletin board controller.
*/
register: function () {
if (serviceProvider.bulletinBoardCtrl === undefined) {
serviceProvider.register('bulletinBoardCtrl', bulletinBoardCtrl);
}
},
/**
* Initializes the bulletin board page.
*/
init: function () {
//alter styles if we're not in the shell
if (top === window) {
$('#bulletin-board').css({
"position": "absolute",
"bottom": "40px",
"left": "40px",
"right": "40px",
"top": "40px"
});
$('#bulletin-board-refresh-container').css({
"position": "absolute",
"bottom": "40px",
"left": "40px",
"right": "40px"
});
}
storage.init();
initializePage().done(function () {
start();
});
},
/**
* Loads the bulletins since the last refresh.
*/
loadBulletins: function () {
var data = {};
// include the timestamp if appropriate
if (common.isDefinedAndNotNull(lastBulletin)) {
data['after'] = lastBulletin;
} else {
data['limit'] = 10;
}
var bulletinContainer = $('#bulletin-board-container');
// get the filter text
var filter = $('#bulletin-board-filter').val();
if (filter !== '') {
// determine which field to filter on
var filterOption = $('#bulletin-board-filter-type').combo('getSelectedOption');
data[filterOption.value] = filter;
// append filtering message if necessary
if (filterText !== filter || filterType !== filterOption.text) {
var filterContent = $('<div class="bulletin-action"></div>').text('Filter ' + filterOption.text + ' matching \'' + filter + '\'');
appendAndScroll(bulletinContainer, filterContent.get(0));
filterText = filter;
filterType = filterOption.text;
}
} else if (filterText !== null) {
appendAndScroll(bulletinContainer, '<div class="bulletin-action">Filter removed</div>');
filterText = null;
filterType = null;
}
return $.ajax({
type: 'GET',
url: config.urls.bulletinBoard,
data: data,
dataType: 'json'
}).done(function (response) {
// ensure the bulletin board was specified
if (common.isDefinedAndNotNull(response.bulletinBoard)) {
var bulletinBoard = response.bulletinBoard;
// update the stats last refreshed timestamp
$('#bulletin-board-last-refreshed').text(bulletinBoard.generated);
// process the bulletins
var bulletinEntities = response.bulletinBoard.bulletins;
var content = [];
// append each bulletin
$.each(bulletinEntities, function (i, bulletinEntity) {
if (bulletinEntity.canRead === true) {
var bulletin = bulletinEntity.bulletin;
// format the severity
var severityStyle = 'bulletin-normal';
if (bulletin.level === 'ERROR') {
severityStyle = 'bulletin-error';
} else if (bulletin.level === 'WARN' || bulletin.level === 'WARNING') {
severityStyle = 'bulletin-warn';
}
// format the source id
var source;
if (common.isDefinedAndNotNull(bulletin.sourceId) && common.isDefinedAndNotNull(bulletin.groupId) && top !== window) {
source = $('<div class="bulletin-source bulletin-link"></div>').text(bulletin.sourceId).on('click', function () {
goToSource(bulletin.groupId, bulletin.sourceId);
});
} else {
var sourceId = bulletin.sourceId;
if (common.isUndefined(sourceId) || common.isNull(sourceId)) {
sourceId = '';
}
source = $('<div class="bulletin-source"></div>').text(sourceId);
}
// build the markup for this bulletin
var bulletinMarkup = $('<div class="bulletin"></div>');
// build the markup for this bulletins info
var bulletinInfoMarkup = $('<div class="bulletin-info"></div>').appendTo(bulletinMarkup);
$('<div class="bulletin-timestamp"></div>').text(bulletin.timestamp).appendTo(bulletinInfoMarkup);
$('<div class="bulletin-severity"></div>').addClass(severityStyle).text(bulletin.level).appendTo(bulletinInfoMarkup);
source.appendTo(bulletinInfoMarkup);
$('<div class="clear"></div>').appendTo(bulletinInfoMarkup);
// format the node address if applicable
if (common.isDefinedAndNotNull(bulletin.nodeAddress)) {
$('<div class="bulletin-node"></div>').text(bulletin.nodeAddress).appendTo(bulletinMarkup);
}
// add the bulletin message (treat as text)
$('<pre class="bulletin-message"></pre>').text(bulletin.message).appendTo(bulletinMarkup);
$('<div class="clear"></div>').appendTo(bulletinMarkup);
// append the content
content.push(bulletinMarkup.get(0));
}
// record the id of the last bulletin in this request
if (i + 1 === bulletinEntities.length) {
lastBulletin = bulletinEntity.id;
}
});
// add the content to the scroll pane
appendAndScroll(bulletinContainer, content);
// trim the container as necessary
var contents = bulletinContainer.contents();
var length = contents.length;
if (length > config.maxBulletins) {
contents.slice(0, length - config.maxBulletins).remove();
bulletinContainer.prepend('<div class="bulletin-action">&#8230;</div>');
}
}
}).fail(function (xhr, status, error) {
// likely caused by a invalid regex
if (xhr.status === 404) {
$('#bulletin-error-message').text(xhr.responseText).show();
// stop future polling
bulletinBoardCtrl.togglePolling();
} else {
errorHandler.handleAjaxError(xhr, status, error);
}
});
},
/**
* Toggles whether the page is actively polling for new bulletins.
*/
togglePolling: function () {
// conditionally start or stop
if (bulletinBoardCtrl.polling === true) {
start();
} else {
stop();
}
}
}
}
var bulletinBoardCtrl = new BulletinBoardCtrl();
bulletinBoardCtrl.register();
return bulletinBoardCtrl;
};
var bulletinBoardCtrl = new BulletinBoardCtrl();
bulletinBoardCtrl.register();
return bulletinBoardCtrl;
};
return nfBulletinBoard;
}));

View File

@ -71,7 +71,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
*/
init: function () {
var self = this;
var searchCtrl = this;
// Create new jQuery UI widget
$.widget('nf.searchAutocomplete', $.ui.autocomplete, {
@ -92,7 +92,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
return items;
},
_renderMenu: function (ul, items) {
var self = this;
var nfSearchAutocomplete = this;
// the object that holds the search results is normalized into a single element array
var searchResults = items[0];
@ -101,7 +101,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.processorResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-processor"></div>Processors</li>');
$.each(searchResults.processorResults, function (i, processorMatch) {
self._renderItem(ul, processorMatch);
nfSearchAutocomplete._renderItem(ul, processorMatch);
});
}
@ -109,7 +109,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.processGroupResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-group"></div>Process Groups</li>');
$.each(searchResults.processGroupResults, function (i, processGroupMatch) {
self._renderItem(ul, processGroupMatch);
nfSearchAutocomplete._renderItem(ul, processGroupMatch);
});
}
@ -117,7 +117,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.remoteProcessGroupResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-group-remote"></div>Remote Process Groups</li>');
$.each(searchResults.remoteProcessGroupResults, function (i, remoteProcessGroupMatch) {
self._renderItem(ul, remoteProcessGroupMatch);
nfSearchAutocomplete._renderItem(ul, remoteProcessGroupMatch);
});
}
@ -125,7 +125,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.connectionResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-connect"></div>Connections</li>');
$.each(searchResults.connectionResults, function (i, connectionMatch) {
self._renderItem(ul, connectionMatch);
nfSearchAutocomplete._renderItem(ul, connectionMatch);
});
}
@ -133,7 +133,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.inputPortResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-in"></div>Input Ports</li>');
$.each(searchResults.inputPortResults, function (i, inputPortMatch) {
self._renderItem(ul, inputPortMatch);
nfSearchAutocomplete._renderItem(ul, inputPortMatch);
});
}
@ -141,7 +141,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.outputPortResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-out"></div>Output Ports</li>');
$.each(searchResults.outputPortResults, function (i, outputPortMatch) {
self._renderItem(ul, outputPortMatch);
nfSearchAutocomplete._renderItem(ul, outputPortMatch);
});
}
@ -149,7 +149,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
if (!nf.Common.isEmpty(searchResults.funnelResults)) {
ul.append('<li class="search-header"><div class="search-result-icon icon icon-funnel"></div>Funnels</li>');
$.each(searchResults.funnelResults, function (i, funnelMatch) {
self._renderItem(ul, funnelMatch);
nfSearchAutocomplete._renderItem(ul, funnelMatch);
});
}
@ -194,7 +194,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
// show the selected component
nf.CanvasUtils.showComponent(item.groupId, item.id);
self.getInputElement().val('').blur();
searchCtrl.getInputElement().val('').blur();
// stop event propagation
return false;
@ -208,7 +208,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
close: function (event, ui) {
// set the input text to '' and reset the cached term
$(this).searchAutocomplete('reset');
self.getInputElement().val('');
searchCtrl.getInputElement().val('');
// remove the glass pane
$('div.search-glass-pane').remove();
@ -216,38 +216,38 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
});
// hide the search input
self.toggleSearchField();
searchCtrl.toggleSearchField();
},
/**
* Toggle/Slide the search field open/closed.
*/
toggleSearchField: function () {
var self = this;
var searchCtrl = this;
// hide the context menu if necessary
nf.ContextMenu.hide();
var isVisible = self.getInputElement().is(':visible');
var isVisible = searchCtrl.getInputElement().is(':visible');
var display = 'none';
var class1 = 'search-container-opened';
var class2 = 'search-container-closed';
if (!isVisible) {
self.getButtonElement().css('background-color', '#FFFFFF');
searchCtrl.getButtonElement().css('background-color', '#FFFFFF');
display = 'inline-block';
class1 = 'search-container-closed';
class2 = 'search-container-opened';
} else {
self.getInputElement().css('display', display);
searchCtrl.getInputElement().css('display', display);
}
this.getSearchContainerElement().switchClass(class1, class2, 500, function () {
self.getInputElement().css('display', display);
searchCtrl.getInputElement().css('display', display);
if (!isVisible) {
self.getButtonElement().css('background-color', '#FFFFFF');
self.getInputElement().focus();
searchCtrl.getButtonElement().css('background-color', '#FFFFFF');
searchCtrl.getInputElement().focus();
} else {
self.getButtonElement().css('background-color', '#E3E8EB');
searchCtrl.getButtonElement().css('background-color', '#E3E8EB');
}
});
}
@ -327,7 +327,7 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
* Reloads the current status of the flow.
*/
reloadFlowStatus: function () {
var self = this;
var flowStatusCtrl = this;
return $.ajax({
type: 'GET',
@ -336,9 +336,9 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
}).done(function (response) {
// report the updated status
if (nf.Common.isDefinedAndNotNull(response.controllerStatus)) {
self.update(response.controllerStatus);
flowStatusCtrl.update(response.controllerStatus);
}
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**
@ -348,11 +348,11 @@ nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
*/
updateClusterSummary: function (clusterSummary) {
// see if this node has been (dis)connected
if (nf.Canvas.isConnectedToCluster() !== clusterSummary.connectedToCluster) {
if (nf.ClusterSummary.isConnectedToCluster() !== clusterSummary.connectedToCluster) {
if (clusterSummary.connectedToCluster) {
nf.Canvas.showConnectedToClusterMessage();
nf.Dialog.showConnectedToClusterMessage();
} else {
nf.Canvas.showDisconnectedFromClusterMessage();
nf.Dialog.showDisconnectedFromClusterMessage();
}
}

View File

@ -139,7 +139,7 @@ nf.ng.Canvas.GlobalMenuCtrl = function (serviceProvider) {
* @returns {*|boolean}
*/
visible: function () {
return nf.Canvas.isConnectedToCluster();
return nf.ClusterSummary.isConnectedToCluster();
},
/**
@ -304,7 +304,7 @@ nf.ng.Canvas.GlobalMenuCtrl = function (serviceProvider) {
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
nf.QueueListing.initFlowFileDetailsDialog();
}
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
this.modal.init();
},
@ -327,7 +327,7 @@ nf.ng.Canvas.GlobalMenuCtrl = function (serviceProvider) {
* Initialize the modal.
*/
init: function () {
var self = this;
var aboutModal = this;
var resizeAbout = function(){
var dialog = $(this);
@ -350,7 +350,7 @@ nf.ng.Canvas.GlobalMenuCtrl = function (serviceProvider) {
},
handler: {
click: function () {
self.hide();
aboutModal.hide();
}
}
}]

View File

@ -42,7 +42,7 @@ nf.ng.Canvas.HeaderCtrl = function (serviceProvider, toolboxCtrl, globalMenuCtrl
* Initialize the login controller.
*/
init: function () {
var self = this;
var loginCtrl = this;
// if the user is not anonymous or accessing via http
if ($('#current-user').text() !== nf.Common.ANONYMOUS_USER_TEXT || location.protocol === 'http:') {
@ -62,8 +62,8 @@ nf.ng.Canvas.HeaderCtrl = function (serviceProvider, toolboxCtrl, globalMenuCtrl
});
$.when(loginXhr).done(function (loginResult) {
self.supportsLogin = loginResult.config.supportsLogin;
}).fail(nf.Common.handleAjaxError);
loginCtrl.supportsLogin = loginResult.config.supportsLogin;
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**

View File

@ -107,7 +107,7 @@ nf.ng.FunnelComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}

View File

@ -62,7 +62,7 @@ nf.ng.GroupComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
function GroupComponent() {
@ -178,14 +178,14 @@ nf.ng.GroupComponent = function (serviceProvider) {
* @argument {object} pt The point that the group was dropped.
*/
promptForGroupName: function (pt) {
var self = this;
var groupComponent = this;
return $.Deferred(function (deferred) {
var addGroup = function () {
// get the name of the group and clear the textfield
var groupName = $('#new-process-group-name').val();
// hide the dialog
self.modal.hide();
groupComponent.modal.hide();
// create the group and resolve the deferred accordingly
createGroup(groupName, pt).done(function (response) {
@ -195,7 +195,7 @@ nf.ng.GroupComponent = function (serviceProvider) {
});
};
self.modal.update('setButtonModel', [{
groupComponent.modal.update('setButtonModel', [{
buttonText: 'Add',
color: {
base: '#728E9B',
@ -219,13 +219,13 @@ nf.ng.GroupComponent = function (serviceProvider) {
deferred.reject();
// close the dialog
self.modal.hide();
groupComponent.modal.hide();
}
}
}]);
// show the dialog
self.modal.show();
groupComponent.modal.show();
// set up the focus and key handlers
$('#new-process-group-name').focus().off('keyup').on('keyup', function (e) {

View File

@ -62,7 +62,7 @@ nf.ng.InputPortComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
function InputPortComponent() {
@ -178,13 +178,13 @@ nf.ng.InputPortComponent = function (serviceProvider) {
* @argument {object} pt The point that the input port was dropped.
*/
promptForInputPortName: function (pt) {
var self = this;
var inputPortComponent = this;
var addInputPort = function () {
// get the name of the input port and clear the textfield
var portName = $('#new-port-name').val();
// hide the dialog
self.modal.hide();
inputPortComponent.modal.hide();
// create the input port
createInputPort(portName, pt);
@ -210,7 +210,7 @@ nf.ng.InputPortComponent = function (serviceProvider) {
},
handler: {
click: function () {
self.modal.hide();
inputPortComponent.modal.hide();
}
}
}]);

View File

@ -109,7 +109,7 @@ nf.ng.LabelComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}

View File

@ -62,7 +62,7 @@ nf.ng.OutputPortComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
function OutputPortComponent() {
@ -169,13 +169,13 @@ nf.ng.OutputPortComponent = function (serviceProvider) {
* @argument {object} pt The point that the output port was dropped.
*/
promptForOutputPortName: function (pt) {
var self = this;
var outputPortComponent = this;
var addOutputPort = function () {
// get the name of the output port and clear the textfield
var portName = $('#new-port-name').val();
// hide the dialog
self.modal.hide();
outputPortComponent.modal.hide();
// create the output port
createOutputPort(portName, pt);
@ -201,7 +201,7 @@ nf.ng.OutputPortComponent = function (serviceProvider) {
},
handler: {
click: function () {
self.modal.hide();
outputPortComponent.modal.hide();
}
}
}]);

View File

@ -235,7 +235,7 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -269,9 +269,23 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
init: function () {
// initialize the processor type table
var processorTypesColumns = [
{id: 'type', name: 'Type', field: 'label', formatter: nf.Common.typeFormatter, sortable: true, resizable: true},
{id: 'tags', name: 'Tags', field: 'tags', sortable: true, resizable: true}
{
id: 'type',
name: 'Type',
field: 'label',
formatter: nf.Common.typeFormatter,
sortable: true,
resizable: true
},
{
id: 'tags',
name: 'Tags',
field: 'tags',
sortable: true,
resizable: true
}
];
var processorTypesOptions = {
forceFitColumns: true,
enableTextSelectionOnCells: true,
@ -426,7 +440,7 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
select: applyFilter,
remove: applyFilter
});
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
},
@ -443,8 +457,6 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
* Initialize the modal.
*/
init: function () {
var self = this;
this.filter.init();
// configure the new processor dialog
@ -539,7 +551,7 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
* @argument {object} pt The point that the processor was dropped
*/
promptForProcessorType: function (pt) {
var self = this;
var processorComponent = this;
// handles adding the selected processor at the specified point
var addProcessor = function () {
@ -559,7 +571,7 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
}
// hide the dialog
self.modal.hide();
processorComponent.modal.hide();
};
// get the grid reference

View File

@ -88,7 +88,7 @@ nf.ng.RemoteProcessGroupComponent = function (serviceProvider) {
headerText: 'Configuration Error'
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
};
@ -230,7 +230,7 @@ nf.ng.RemoteProcessGroupComponent = function (serviceProvider) {
* @argument {object} pt The point that the remote group was dropped.
*/
promptForRemoteProcessGroupUri: function (pt) {
var self = this;
var remoteProcessGroupComponent = this;
var addRemoteProcessGroup = function () {
// create the remote process group
createRemoteProcessGroup(pt);
@ -256,7 +256,7 @@ nf.ng.RemoteProcessGroupComponent = function (serviceProvider) {
},
handler: {
click: function () {
self.modal.hide();
remoteProcessGroupComponent.modal.hide();
}
}
}]);

View File

@ -51,7 +51,7 @@ nf.ng.TemplateComponent = function (serviceProvider) {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
function TemplateComponent() {
@ -162,7 +162,7 @@ nf.ng.TemplateComponent = function (serviceProvider) {
* @argument {object} pt The point that the template was dropped.
*/
promptForTemplate: function (pt) {
var self = this;
var templateComponent = this;
$.ajax({
type: 'GET',
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/flow/templates',
@ -197,7 +197,7 @@ nf.ng.TemplateComponent = function (serviceProvider) {
});
// update the button model
self.modal.update('setButtonModel', [{
templateComponent.modal.update('setButtonModel', [{
buttonText: 'Add',
color: {
base: '#728E9B',
@ -211,7 +211,7 @@ nf.ng.TemplateComponent = function (serviceProvider) {
var templateId = selectedOption.value;
// hide the dialog
self.modal.hide();
templateComponent.modal.hide();
// instantiate the specified template
createTemplate(templateId, pt);
@ -227,13 +227,13 @@ nf.ng.TemplateComponent = function (serviceProvider) {
},
handler: {
click: function () {
self.modal.hide();
templateComponent.modal.hide();
}
}
}]);
// show the dialog
self.modal.show();
templateComponent.modal.show();
} else {
nf.Dialog.showOkDialog({
headerText: 'Instantiate Template',
@ -241,7 +241,7 @@ nf.ng.TemplateComponent = function (serviceProvider) {
});
}
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}

View File

@ -827,7 +827,7 @@ nf.Actions = (function () {
nf.Birdseye.refresh();
// inform Angular app values have changed
nf.ng.Bridge.digest();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
} else {
// create a snippet for the specified component and link to the data flow
var snippet = nf.Snippet.marshal(selection);
@ -877,8 +877,8 @@ nf.Actions = (function () {
// inform Angular app values have changed
nf.ng.Bridge.digest();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}
},
@ -1033,7 +1033,7 @@ nf.Actions = (function () {
processDropRequest(nextDelay);
}).fail(function (xhr, status, error) {
if (xhr.status === 403) {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
} else {
completeDropRequest()
}
@ -1058,7 +1058,7 @@ nf.Actions = (function () {
processDropRequest(1);
}).fail(function (xhr, status, error) {
if (xhr.status === 403) {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
} else {
completeDropRequest()
}
@ -1417,8 +1417,8 @@ nf.Actions = (function () {
// clear the template dialog fields
$('#new-template-name').val('');
$('#new-template-description').val('');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}
}, {

View File

@ -0,0 +1,60 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* global nf, define, module, require, exports */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['nf.ErrorHandler', 'nf.Common', 'nf.Canvas', 'nf.ContextMenu'], function (ajaxErrorHandler, common, canvas, contextMenu) {
return (nf.ErrorHandler = factory(ajaxErrorHandler, common, canvas, contextMenu));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ErrorHandler = factory(require('nf.ErrorHandler'), require('nf.Common'), require('nf.Canvas'), require('nf.ContextMenu')));
} else {
nf.ErrorHandler = factory(root.nf.ErrorHandler, root.nf.Common, root.nf.Canvas, root.nf.ContextMenu);
}
}(this, function (ajaxErrorHandler, common, canvas, contextMenu) {
'use strict';
return {
/**
* Method for handling ajax errors. This also closes the canvas.
*
* @argument {object} xhr The XmlHttpRequest
* @argument {string} status The status of the request
* @argument {string} error The error
*/
handleAjaxError: function (xhr, status, error) {
ajaxErrorHandler.handleAjaxError(xhr, status, error);
common.showLogoutLink();
// hide the splash screen if required
if ($('#splash').is(':visible')) {
canvas.hideSplash();
}
// hide the context menu
contextMenu.hide();
// shut off the auto refresh
canvas.stopPolling();
// allow page refresh with ctrl-r
canvas.disableRefreshHotKey();
}
};
}));

View File

@ -117,8 +117,6 @@ nf.Canvas = (function () {
var groupName = null;
var permissions = null;
var parentGroupId = null;
var clustered = false;
var connectedToCluster = false;
var configurableAuthorizer = false;
var svg = null;
var canvas = null;
@ -134,9 +132,7 @@ nf.Canvas = (function () {
kerberos: '../nifi-api/access/kerberos',
revision: '../nifi-api/flow/revision',
banners: '../nifi-api/flow/banners',
flowConfig: '../nifi-api/flow/config',
clusterSummary: '../nifi-api/flow/cluster/summary',
cluster: '../nifi-api/controller/cluster'
flowConfig: '../nifi-api/flow/config'
}
};
@ -659,7 +655,7 @@ nf.Canvas = (function () {
// update the graph dimensions
updateGraphSize();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -720,7 +716,7 @@ nf.Canvas = (function () {
// update the birdseye
nf.Birdseye.refresh();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -740,19 +736,6 @@ nf.Canvas = (function () {
});
};
/**
* Loads the flow configuration and updated the cluster state.
*
* @returns xhr
*/
var loadClusterSummary = function () {
return $.ajax({
type: 'GET',
url: config.urls.clusterSummary,
dataType: 'json'
});
};
return {
CANVAS_OFFSET: 0,
@ -800,15 +783,11 @@ nf.Canvas = (function () {
}).done(function (response) {
nf.ng.Bridge.injector.get('flowStatusCtrl').updateBulletins(response);
});
var clusterSummary = loadClusterSummary().done(function (response) {
var clusterSummary = nf.ClusterSummary.loadClusterSummary().done(function (response) {
var clusterSummary = response.clusterSummary;
// update the cluster summary
nf.ng.Bridge.injector.get('flowStatusCtrl').updateClusterSummary(clusterSummary);
// update the clustered flag
clustered = clusterSummary.clustered;
connectedToCluster = clusterSummary.connectedToCluster;
});
// wait for all requests to complete
@ -824,26 +803,6 @@ nf.Canvas = (function () {
}).promise();
},
/**
* Shows a message when disconnected from the cluster.
*/
showDisconnectedFromClusterMessage: function () {
nf.Dialog.showOkDialog({
headerText: 'Cluster Connection',
dialogContent: 'This node is currently not connected to the cluster. Any modifications to the data flow made here will not replicate across the cluster.'
});
},
/**
* Shows a message when connected to the cluster.
*/
showConnectedToClusterMessage: function () {
nf.Dialog.showOkDialog({
headerText: 'Cluster Connection',
dialogContent: 'This node just joined the cluster. Any modifications to the data flow made here will replicate across the cluster.'
});
},
/**
* Initialize NiFi.
*/
@ -909,13 +868,9 @@ nf.Canvas = (function () {
dataType: 'json'
});
// get the initial cluster summary
var clusterSummary = loadClusterSummary();
// ensure the config requests are loaded
$.when(configXhr, clusterSummary, userXhr, clientXhr).done(function (configResult, clusterSummaryResult) {
$.when(configXhr, nf.ClusterSummary.loadClusterSummary(), userXhr, clientXhr).done(function (configResult) {
var configResponse = configResult[0];
var clusterSummaryResponse = clusterSummaryResult[0];
// calculate the canvas offset
var canvasContainer = $('#canvas-container');
@ -923,20 +878,12 @@ nf.Canvas = (function () {
// get the config details
var configDetails = configResponse.flowConfiguration;
var clusterSummary = clusterSummaryResponse.clusterSummary;
// show disconnected message on load if necessary
if (clusterSummary.clustered && !clusterSummary.connectedToCluster) {
nf.Canvas.showDisconnectedFromClusterMessage();
if (nf.ClusterSummary.isClustered() && !nf.ClusterSummary.isConnectedToCluster()) {
nf.Dialog.showDisconnectedFromClusterMessage();
}
// establish the initial cluster state
clustered = clusterSummary.clustered;
connectedToCluster = clusterSummary.connectedToCluster;
// update the cluster summary
nf.ng.Bridge.injector.get('flowStatusCtrl').updateClusterSummary(clusterSummary);
// get the auto refresh interval
var autoRefreshIntervalSeconds = parseInt(configDetails.autoRefreshIntervalSeconds, 10);
@ -978,7 +925,7 @@ nf.Canvas = (function () {
nf.RemoteProcessGroupPorts.init();
nf.PortConfiguration.init();
nf.LabelConfiguration.init();
nf.ProcessorDetails.init();
nf.ProcessorDetails.init(true);
nf.PortDetails.init();
nf.ConnectionDetails.init();
nf.RemoteProcessGroupDetails.init();
@ -996,27 +943,9 @@ nf.Canvas = (function () {
// hide the splash screen
nf.Canvas.hideSplash();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.Common.handleAjaxError);
},
/**
* Return whether this instance of NiFi is clustered.
*
* @returns {Boolean}
*/
isClustered: function () {
return clustered === true;
},
/**
* Return whether this instance is connected to a cluster.
*
* @returns {boolean}
*/
isConnectedToCluster: function () {
return connectedToCluster === true;
}).fail(nf.ErrorHandler.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**

View File

@ -253,7 +253,7 @@ nf.ComponentState = (function () {
// reload the table with no state
loadComponentState()
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
} else {
nf.Dialog.showOkDialog({
headerText: 'Component State',
@ -265,12 +265,24 @@ nf.ComponentState = (function () {
// initialize the queue listing table
var componentStateColumns = [
{id: 'key', field: 'key', name: 'Key', sortable: true, resizable: true},
{id: 'value', field: 'value', name: 'Value', sortable: true, resizable: true}
{
id: 'key',
field: 'key',
name: 'Key',
sortable: true,
resizable: true
},
{
id: 'value',
field: 'value',
name: 'Value',
sortable: true,
resizable: true
}
];
// conditionally show the cluster node identifier
if (nf.Canvas.isClustered()) {
if (nf.ClusterSummary.isClustered()) {
componentStateColumns.push({
id: 'scope',
field: 'scope',
@ -378,7 +390,7 @@ nf.ComponentState = (function () {
// reset the grid size
var componentStateGrid = componentStateTable.data('gridInstance');
componentStateGrid.resizeCanvas();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
};
}());

View File

@ -340,7 +340,7 @@ nf.ConnectionConfiguration = (function () {
}
}).fail(function (xhr, status, error) {
// handle the error
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
@ -416,7 +416,7 @@ nf.ConnectionConfiguration = (function () {
}
}).fail(function (xhr, status, error) {
// handle the error
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
@ -565,7 +565,7 @@ nf.ConnectionConfiguration = (function () {
}
}).fail(function (xhr, status, error) {
// handle the error
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
@ -641,7 +641,7 @@ nf.ConnectionConfiguration = (function () {
}
}).fail(function (xhr, status, error) {
// handle the error
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
@ -926,7 +926,7 @@ nf.ConnectionConfiguration = (function () {
nf.Birdseye.refresh();
}).fail(function (xhr, status, error) {
// handle the error
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
});
}
};
@ -1000,7 +1000,7 @@ nf.ConnectionConfiguration = (function () {
dialogContent: nf.Common.escapeHtml(xhr.responseText),
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
} else {
@ -1179,7 +1179,7 @@ nf.ConnectionConfiguration = (function () {
opacity: 0.6
});
$('#prioritizer-available, #prioritizer-selected').disableSelection();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**

View File

@ -1483,7 +1483,7 @@ nf.Connection = (function () {
dialogContent: nf.Common.escapeHtml(xhr.responseText)
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
};
@ -1706,7 +1706,7 @@ nf.Connection = (function () {
'updateLabel': false
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
}

View File

@ -52,7 +52,7 @@ nf.ControllerService = (function () {
headerText: 'Controller Service'
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
};
@ -140,7 +140,7 @@ nf.ControllerService = (function () {
dataType: 'json'
}).done(function (response) {
renderControllerService(serviceTable, response);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -583,7 +583,7 @@ nf.ControllerService = (function () {
sourceId: ids
},
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -612,7 +612,7 @@ nf.ControllerService = (function () {
contentType: 'application/json'
}).done(function (response) {
renderControllerService(serviceTable, response);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// wait until the polling of each service finished
return $.Deferred(function (deferred) {
@ -730,7 +730,7 @@ nf.ControllerService = (function () {
data: JSON.stringify(referenceEntity),
dataType: 'json',
contentType: 'application/json'
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// Note: updated revisions will be retrieved after updateReferencingSchedulableComponents is invoked
@ -810,7 +810,7 @@ nf.ControllerService = (function () {
conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins);
}).fail(function (xhr, status, error) {
deferred.reject();
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
});
};
@ -832,7 +832,7 @@ nf.ControllerService = (function () {
conditionMet(controllerService, response.bulletinBoard.bulletins);
}).fail(function (xhr, status, error) {
deferred.reject();
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
});
}).promise();
};
@ -1002,7 +1002,7 @@ nf.ControllerService = (function () {
data: JSON.stringify(referenceEntity),
dataType: 'json',
contentType: 'application/json'
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// Note: updated revisions will be retrieved after updateReferencingServices is invoked
@ -1448,7 +1448,7 @@ nf.ControllerService = (function () {
propertyName: propertyName
},
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -1737,6 +1737,7 @@ nf.ControllerService = (function () {
// initialize the property table
$('#controller-service-properties').propertytable('destroy').propertytable({
readOnly: false,
supportsGoTo: true,
dialogContainer: '#new-controller-service-property-container',
descriptorDeferred: getControllerServicePropertyDescriptor,
controllerServiceCreatedDeferred: function(response) {
@ -1909,7 +1910,7 @@ nf.ControllerService = (function () {
updateReferencingComponentsBorder(referenceContainer);
$('#controller-service-properties').propertytable('resetTableSize');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**
@ -1927,6 +1928,7 @@ nf.ControllerService = (function () {
// initialize the property table
$('#controller-service-properties').propertytable('destroy').propertytable({
supportsGoTo: true,
readOnly: true
});
@ -2108,7 +2110,7 @@ nf.ControllerService = (function () {
if (controllerServiceEntity.permissions.canRead) {
reloadControllerServiceReferences(serviceTable, controllerServiceEntity.component);
}
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
};
}());

View File

@ -252,7 +252,7 @@ nf.ControllerServices = (function () {
var row = controllerServicesData.getRowById(controllerServiceEntity.id);
controllerServicesGrid.setSelectedRows([row]);
controllerServicesGrid.scrollRowIntoView(row);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// hide the dialog
$('#new-controller-service-dialog').modal('hide');
@ -266,8 +266,21 @@ nf.ControllerServices = (function () {
var initNewControllerServiceDialog = function () {
// initialize the processor type table
var controllerServiceTypesColumns = [
{id: 'type', name: 'Type', field: 'label', formatter: nf.Common.typeFormatter, sortable: false, resizable: true},
{id: 'tags', name: 'Tags', field: 'tags', sortable: false, resizable: true}
{
id: 'type',
name: 'Type',
field: 'label',
formatter: nf.Common.typeFormatter,
sortable: false,
resizable: true
},
{
id: 'tags',
name: 'Tags',
field: 'tags',
sortable: false,
resizable: true
}
];
// initialize the dataview
@ -403,7 +416,7 @@ nf.ControllerServices = (function () {
select: applyControllerServiceTypeFilter,
remove: applyControllerServiceTypeFilter
});
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// initialize the controller service dialog
$('#new-controller-service-dialog').modal({
@ -651,11 +664,44 @@ nf.ControllerServices = (function () {
// define the column model for the controller services table
var controllerServicesColumns = [
{id: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreControllerServiceDetails, sortable: true, width: 90, maxWidth: 90, toolTip: 'Sorts based on presence of bulletins'},
{id: 'name', name: 'Name', formatter: nameFormatter, sortable: true, resizable: true},
{id: 'type', name: 'Type', formatter: typeFormatter, sortable: true, resizable: true},
{id: 'state', name: 'State', formatter: controllerServiceStateFormatter, sortable: true, resizeable: true},
{id: 'parentGroupId', name: 'Process Group', formatter: groupIdFormatter, sortable: true, resizeable: true}
{
id: 'moreDetails',
name: '&nbsp;',
resizable: false,
formatter: moreControllerServiceDetails,
sortable: true,
width: 90,
maxWidth: 90,
toolTip: 'Sorts based on presence of bulletins'
},
{
id: 'name',
name: 'Name',
formatter: nameFormatter,
sortable: true,
resizable: true
},
{
id: 'type',
name: 'Type',
formatter: typeFormatter,
sortable: true,
resizable: true
},
{
id: 'state',
name: 'State',
formatter: controllerServiceStateFormatter,
sortable: true,
resizeable: true
},
{
id: 'parentGroupId',
name: 'Process Group',
formatter: groupIdFormatter,
sortable: true,
resizeable: true
}
];
// action column should always be last

View File

@ -15,48 +15,74 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
nf.CustomUi = {
/**
* Shows the custom ui.
*
* @argument {object} entity The component id
* @arugment {string} uri The custom ui uri
* @argument {boolean} editable Whether the custom ui should support editing
*/
showCustomUi: function (entity, uri, editable) {
return $.Deferred(function (deferred) {
nf.Common.getAccessToken('../nifi-api/access/ui-extension-token').done(function (uiExtensionToken) {
// record the processor id
$('#shell-close-button');
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.Shell',
'nf.Dialog',
'nf.Client'], function ($, common, shell, dialog, client) {
return (nf.CustomUi = factory($, common, shell, dialog, client));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.CustomUi = factory(require('jquery'),
require('nf.Common'),
require('nf.Shell'),
require('nf.Dialog'),
require('nf.Client')));
} else {
nf.CustomUi = factory(root.$,
root.nf.Common,
root.nf.Shell,
root.nf.Dialog,
root.nf.Client);
}
}(this, function ($, common, shell, dialog, client) {
'use strict';
var revision = nf.Client.getRevision(entity);
return {
/**
* Shows the custom ui.
*
* @argument {object} entity The component id
* @arugment {string} uri The custom ui uri
* @argument {boolean} editable Whether the custom ui should support editing
*/
showCustomUi: function (entity, uri, editable) {
return $.Deferred(function (deferred) {
common.getAccessToken('../nifi-api/access/ui-extension-token').done(function (uiExtensionToken) {
// record the processor id
$('#shell-close-button');
// build the customer ui params
var customUiParams = {
'id': entity.id,
'revision': revision.version,
'clientId': revision.clientId,
'editable': editable
};
var revision = client.getRevision(entity);
// conditionally include the ui extension token
if (!nf.Common.isBlank(uiExtensionToken)) {
customUiParams['access_token'] = uiExtensionToken;
}
// build the customer ui params
var customUiParams = {
'id': entity.id,
'revision': revision.version,
'clientId': revision.clientId,
'editable': editable
};
// show the shell
nf.Shell.showPage('..' + uri + '?' + $.param(customUiParams), false).done(function () {
// conditionally include the ui extension token
if (!common.isBlank(uiExtensionToken)) {
customUiParams['access_token'] = uiExtensionToken;
}
// show the shell
shell.showPage('..' + uri + '?' + $.param(customUiParams), false).done(function () {
deferred.resolve();
});
}).fail(function () {
dialog.showOkDialog({
headerText: 'Advanced Configuration',
dialogContent: 'Unable to generate access token for accessing the advanced configuration dialog.'
});
deferred.resolve();
});
}).fail(function () {
nf.Dialog.showOkDialog({
headerText: 'Advanced Configuration',
dialogContent: 'Unable to generate access token for accessing the advanced configuration dialog.'
});
deferred.resolve();
});
}).promise();
}).promise();
}
}
};
}));

View File

@ -248,7 +248,7 @@ nf.Draggable = (function () {
dialogContent: nf.Common.escapeHtml(xhr.responseText)
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
deferred.reject();
@ -309,7 +309,7 @@ nf.Draggable = (function () {
dialogContent: nf.Common.escapeHtml(xhr.responseText)
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
deferred.reject();

View File

@ -683,7 +683,7 @@ nf.GoTo = (function () {
// show the upstream dialog
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**
@ -734,7 +734,7 @@ nf.GoTo = (function () {
// show the downstream dialog
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**

View File

@ -71,7 +71,7 @@ nf.LabelConfiguration = (function () {
// inform Angular app values have changed
nf.ng.Bridge.digest();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// reset and hide the dialog
this.modal('hide');

View File

@ -129,11 +129,11 @@ nf.PolicyManagement = (function () {
var allowedGroups = getAllAllowedGroups();
var allowedUsers = getAllAllowedUsers();
var self = this;
var nfUserSearchAutocomplete = this;
$.each(searchResults.userGroups, function (_, tenant) {
// see if this match is not already selected
if ($.inArray(tenant.id, allowedGroups) === -1) {
self._renderGroup(ul, $.extend({
nfUserSearchAutocomplete._renderGroup(ul, $.extend({
type: 'group'
}, tenant));
}
@ -141,7 +141,7 @@ nf.PolicyManagement = (function () {
$.each(searchResults.users, function (_, tenant) {
// see if this match is not already selected
if ($.inArray(tenant.id, allowedUsers) === -1) {
self._renderUser(ul, $.extend({
nfUserSearchAutocomplete._renderUser(ul, $.extend({
type: 'user'
}, tenant));
}
@ -504,9 +504,24 @@ nf.PolicyManagement = (function () {
// initialize the templates table
var usersColumns = [
{id: 'identity', name: 'User', sortable: true, resizable: true, formatter: identityFormatter},
{id: 'actions', name: '&nbsp;', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100}
{
id: 'identity',
name: 'User',
sortable: true,
resizable: true,
formatter: identityFormatter
},
{
id: 'actions',
name: '&nbsp;',
sortable: false,
resizable: false,
formatter: actionFormatter,
width: 100,
maxWidth: 100
}
];
var usersOptions = {
forceFitColumns: true,
enableTextSelectionOnCells: true,
@ -669,7 +684,7 @@ nf.PolicyManagement = (function () {
}).done(function () {
loadPolicy();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
resetPolicy();
loadPolicy();
});
@ -896,7 +911,7 @@ nf.PolicyManagement = (function () {
resetPolicy();
deferred.reject();
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
}).promise();
@ -954,7 +969,7 @@ nf.PolicyManagement = (function () {
resetPolicy();
deferred.reject();
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
}).promise();
@ -1022,7 +1037,7 @@ nf.PolicyManagement = (function () {
resetPolicy();
loadPolicy();
}
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -1077,7 +1092,7 @@ nf.PolicyManagement = (function () {
loadPolicy();
}
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
resetPolicy();
loadPolicy();
}).always(function () {

View File

@ -103,7 +103,7 @@ nf.PortConfiguration = (function () {
$('#port-configuration').modal('hide');
// handle the error
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
}

View File

@ -86,7 +86,7 @@ nf.ProcessGroupConfiguration = (function () {
});
nf.Canvas.reload();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -179,7 +179,7 @@ nf.ProcessGroupConfiguration = (function () {
// update the current time
$('#process-group-configuration-last-refreshed').text(controllerServicesResponse.currentTime);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**

View File

@ -87,7 +87,7 @@ nf.ProcessorConfiguration = (function () {
text: 'Primary node',
value: 'PRIMARY',
description: 'Processor will be scheduled to run only on the primary node',
disabled: !nf.Canvas.isClustered() && processor.config['executionNode'] === 'PRIMARY'
disabled: !nf.ClusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY'
}];
};
@ -114,7 +114,7 @@ nf.ProcessorConfiguration = (function () {
headerText: 'Processor Configuration'
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
};
@ -562,6 +562,7 @@ nf.ProcessorConfiguration = (function () {
// initialize the property table
$('#processor-properties').propertytable({
readOnly: false,
supportsGoTo: true,
dialogContainer: '#new-processor-property-container',
descriptorDeferred: function (propertyName) {
var processor = $('#processor-configuration').data('processorDetails');
@ -573,7 +574,7 @@ nf.ProcessorConfiguration = (function () {
propertyName: propertyName
},
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
goToServiceDeferred: goToServiceFromProperty
});
@ -689,7 +690,7 @@ nf.ProcessorConfiguration = (function () {
});
// show the execution node option if we're cluster or we're currently configured to run on the primary node only
if (nf.Canvas.isClustered() || executionNode === 'PRIMARY') {
if (nf.ClusterSummary.isClustered() || executionNode === 'PRIMARY') {
$('#execution-node-options').show();
} else {
$('#execution-node-options').hide();
@ -852,7 +853,7 @@ nf.ProcessorConfiguration = (function () {
if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > processorRelationships.innerHeight()) {
processorRelationships.css('border-width', '1px');
}
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}
};

View File

@ -316,7 +316,7 @@ nf.QueueListing = (function () {
}).done(function (response) {
listingRequest = response.listingRequest;
processListingRequest(nextDelay);
}).fail(completeListingRequest).fail(nf.Common.handleAjaxError);
}).fail(completeListingRequest).fail(nf.ErrorHandler.handleAjaxError);
};
// issue the request to list the flow files
@ -335,7 +335,7 @@ nf.QueueListing = (function () {
// process the drop request
listingRequest = response.listingRequest;
processListingRequest(1);
}).fail(completeListingRequest).fail(nf.Common.handleAjaxError);
}).fail(completeListingRequest).fail(nf.ErrorHandler.handleAjaxError);
}).promise();
};
@ -436,7 +436,7 @@ nf.QueueListing = (function () {
// show the dialog
$('#flowfile-details-dialog').modal('show');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
return {
@ -496,8 +496,20 @@ nf.QueueListing = (function () {
width: 75,
maxWidth: 75
},
{id: 'uuid', name: 'UUID', field: 'uuid', sortable: false, resizable: true},
{id: 'filename', name: 'Filename', field: 'filename', sortable: false, resizable: true},
{
id: 'uuid',
name: 'UUID',
field: 'uuid',
sortable: false,
resizable: true
},
{
id: 'filename',
name: 'Filename',
field: 'filename',
sortable: false,
resizable: true
},
{
id: 'size',
name: 'File Size',
@ -536,7 +548,7 @@ nf.QueueListing = (function () {
];
// conditionally show the cluster node identifier
if (nf.Canvas.isClustered()) {
if (nf.ClusterSummary.isClustered()) {
queueListingColumns.push({
id: 'clusterNodeAddress',
name: 'Node',

View File

@ -82,7 +82,7 @@ nf.RemoteProcessGroupConfiguration = (function () {
headerText: 'Remote Process Group Configuration'
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
}

View File

@ -100,7 +100,7 @@ nf.RemoteProcessGroupPorts = (function () {
headerText: 'Remote Process Group Ports'
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
}).always(function () {
// close the dialog
@ -351,7 +351,7 @@ nf.RemoteProcessGroupPorts = (function () {
dialogContent: content
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
});
});
@ -548,7 +548,7 @@ nf.RemoteProcessGroupPorts = (function () {
// show the details
$('#remote-process-group-ports').modal('show');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
}
};

View File

@ -62,7 +62,7 @@ nf.ReportingTask = (function () {
headerText: 'Reporting Task'
});
} else {
nf.Common.handleAjaxError(xhr, status, error);
nf.ErrorHandler.handleAjaxError(xhr, status, error);
}
};
@ -219,7 +219,7 @@ nf.ReportingTask = (function () {
// update the task
renderReportingTask(response);
nf.ControllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**
@ -299,7 +299,7 @@ nf.ReportingTask = (function () {
propertyName: propertyName
},
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
return {
@ -363,6 +363,7 @@ nf.ReportingTask = (function () {
// initialize the property table
$('#reporting-task-properties').propertytable({
readOnly: false,
supportsGoTo: true,
dialogContainer: '#new-reporting-task-property-container',
descriptorDeferred: getReportingTaskPropertyDescriptor,
controllerServiceCreatedDeferred: function(response){
@ -387,6 +388,7 @@ nf.ReportingTask = (function () {
// initialize the property table
$('#reporting-task-properties').propertytable('destroy').propertytable({
readOnly: false,
supportsGoTo: true,
dialogContainer: '#new-reporting-task-property-container',
descriptorDeferred: getReportingTaskPropertyDescriptor,
controllerServiceCreatedDeferred: function(response){
@ -581,7 +583,7 @@ nf.ReportingTask = (function () {
$('#reporting-task-configuration').modal('show');
$('#reporting-task-properties').propertytable('resetTableSize');
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**
@ -598,6 +600,7 @@ nf.ReportingTask = (function () {
// initialize the property table
$('#reporting-task-properties').propertytable('destroy').propertytable({
supportsGoTo: true,
readOnly: true
});
@ -733,7 +736,7 @@ nf.ReportingTask = (function () {
dataType: 'json'
}).done(function (response) {
renderReportingTask(response);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
},
/**
@ -773,7 +776,7 @@ nf.ReportingTask = (function () {
var reportingTaskGrid = $('#reporting-tasks-table').data('gridInstance');
var reportingTaskData = reportingTaskGrid.getData();
reportingTaskData.deleteItem(reportingTaskEntity.id);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
};
}());

View File

@ -83,7 +83,7 @@ nf.Settings = (function () {
$('#settings-save').off('click').on('click', function () {
saveSettings(response.revision.version);
});
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
}
/**
@ -402,7 +402,7 @@ nf.Settings = (function () {
var row = reportingTaskData.getRowById(reportingTaskEntity.id);
reportingTaskGrid.setSelectedRows([row]);
reportingTaskGrid.scrollRowIntoView(row);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// hide the dialog
$('#new-reporting-task-dialog').modal('hide');
@ -436,8 +436,21 @@ nf.Settings = (function () {
// initialize the processor type table
var reportingTaskTypesColumns = [
{id: 'type', name: 'Type', field: 'label', formatter: nf.Common.typeFormatter, sortable: false, resizable: true},
{id: 'tags', name: 'Tags', field: 'tags', sortable: false, resizable: true}
{
id: 'type',
name: 'Type',
field: 'label',
formatter: nf.Common.typeFormatter,
sortable: false,
resizable: true
},
{
id: 'tags',
name: 'Tags',
field: 'tags',
sortable: false,
resizable: true
}
];
// initialize the dataview
@ -580,7 +593,7 @@ nf.Settings = (function () {
select: applyReportingTaskTypeFilter,
remove: applyReportingTaskTypeFilter
});
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
// initialize the reporting task dialog
$('#new-reporting-task-dialog').modal({
@ -980,7 +993,7 @@ nf.Settings = (function () {
// update the current time
$('#settings-last-refreshed').text(controllerServicesResponse.currentTime);
}).fail(nf.Common.handleAjaxError);
}).fail(nf.ErrorHandler.handleAjaxError);
};
/**

View File

@ -15,9 +15,34 @@
* limitations under the License.
*/
/* global nf, Slick */
/* global nf, define, module, require, exports */
nf.ClusterTable = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.Dialog',
'nf.ErrorHandler'],
function ($, Slick, common, dialog, errorHandler) {
return (nf.ClusterTable = factory($, Slick, common, dialog, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ClusterTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.ErrorHandler')));
} else {
nf.ClusterTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.Dialog,
root.nf.ErrorHandler);
}
}(this, function ($, Slick, common, dialog, errorHandler) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
@ -31,14 +56,14 @@ nf.ClusterTable = (function () {
systemDiagnostics: '../nifi-api/system-diagnostics'
},
data: [{
name: 'cluster',
update: refreshClusterData,
isAuthorized: nf.Common.canAccessController
},{
name: 'systemDiagnostics',
update: refreshSystemDiagnosticsData,
isAuthorized: nf.Common.canAccessSystem
}
name: 'cluster',
update: refreshClusterData,
isAuthorized: common.canAccessController
}, {
name: 'systemDiagnostics',
update: refreshSystemDiagnosticsData,
isAuthorized: common.canAccessSystem
}
]
};
@ -51,7 +76,7 @@ nf.ClusterTable = (function () {
rowHeight: 24
};
var nodesTab = {
var nodesTab = {
name: 'Nodes',
data: {
dataSet: 'cluster',
@ -85,14 +110,78 @@ nf.ClusterTable = (function () {
tableId: 'cluster-jvm-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{id: 'heapMax', field: 'maxHeap', name: 'Heap Max', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'heapTotal', field: 'totalHeap', name: 'Heap Total', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'heapUsed', field: 'usedHeap', name: 'Heap Used', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'heapUtilPct', field: 'heapUtilization', name: 'Heap Utilization', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'nonHeapTotal', field: 'totalNonHeap', name: 'Non-Heap Total', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'nonHeapUsed', field: 'usedNonHeap', name: 'Non-Heap Used', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'gcOldGen', field: 'gcOldGen', name: 'G1 Old Generation', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'gcNewGen', field: 'gcNewGen', name: 'G1 Young Generation', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'}
{
id: 'heapMax',
field: 'maxHeap',
name: 'Heap Max',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'heapTotal',
field: 'totalHeap',
name: 'Heap Total',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'heapUsed',
field: 'usedHeap',
name: 'Heap Used',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'heapUtilPct',
field: 'heapUtilization',
name: 'Heap Utilization',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'nonHeapTotal',
field: 'totalNonHeap',
name: 'Non-Heap Total',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'nonHeapUsed',
field: 'usedNonHeap',
name: 'Non-Heap Used',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'gcOldGen',
field: 'gcOldGen',
name: 'G1 Old Generation',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'gcNewGen',
field: 'gcNewGen',
name: 'G1 Young Generation',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
}
],
tableIdColumn: 'id',
tableOptions: commonTableOptions,
@ -116,10 +205,42 @@ nf.ClusterTable = (function () {
tableId: 'cluster-system-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{id: 'processors', field: 'processors', name: 'Processors', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'processorLoadAverage', field: 'processorLoadAverage', name: 'Processor Load Average', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'totalThreads', field: 'totalThreads', name: 'Total Threads', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'daemonThreads', field: 'daemonThreads', name: 'Daemon Threads', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'}
{
id: 'processors',
field: 'processors',
name: 'Processors',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'processorLoadAverage',
field: 'processorLoadAverage',
name: 'Processor Load Average',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'totalThreads',
field: 'totalThreads',
name: 'Total Threads',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'daemonThreads',
field: 'daemonThreads',
name: 'Daemon Threads',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
}
],
tableIdColumn: 'id',
tableOptions: commonTableOptions,
@ -143,10 +264,42 @@ nf.ClusterTable = (function () {
tableId: 'cluster-flowfile-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{id: 'ffRepoTotal', field: 'ffRepoTotal', name: 'Total Space', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'ffRepoUsed', field: 'ffRepoUsed', name: 'Used Space', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'ffRepoFree', field: 'ffRepoFree', name: 'Free Space', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'ffStoreUtil', field: 'ffRepoUtil', name: 'Utilization', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'}
{
id: 'ffRepoTotal',
field: 'ffRepoTotal',
name: 'Total Space',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'ffRepoUsed',
field: 'ffRepoUsed',
name: 'Used Space',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'ffRepoFree',
field: 'ffRepoFree',
name: 'Free Space',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'ffStoreUtil',
field: 'ffRepoUtil',
name: 'Utilization',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
}
],
tableIdColumn: 'id',
tableOptions: commonTableOptions,
@ -171,10 +324,42 @@ nf.ClusterTable = (function () {
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{id: 'contentRepoId', field: 'contentRepoId', name: 'Content Repository', sortable: true, resizable: true},
{id: 'contentRepoTotal', field: 'contentRepoTotal', name: 'Total Space', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'contentRepoUsed', field: 'contentRepoUsed', name: 'Used Space', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'contentRepoFree', field: 'contentRepoFree', name: 'Free Space', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'},
{id: 'contentRepoUtil', field: 'contentRepoUtil', name: 'Utilization', sortable: true, resizable: true, cssClass: 'cell-right', headerCssClass: 'header-right'}
{
id: 'contentRepoTotal',
field: 'contentRepoTotal',
name: 'Total Space',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'contentRepoUsed',
field: 'contentRepoUsed',
name: 'Used Space',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'contentRepoFree',
field: 'contentRepoFree',
name: 'Free Space',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
},
{
id: 'contentRepoUtil',
field: 'contentRepoUtil',
name: 'Utilization',
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
}
],
tableIdColumn: 'id',
tableOptions: commonTableOptions,
@ -186,9 +371,9 @@ nf.ClusterTable = (function () {
text: 'by address',
value: 'node'
}, {
text: 'by repository',
value: 'contentRepoId'
}]
text: 'by repository',
value: 'contentRepoId'
}]
};
var versionTab = {
@ -227,7 +412,7 @@ nf.ClusterTable = (function () {
/**
* Click handler for the Nodes table options.
*/
function nodesTableOnClick (e, args, target, item) {
function nodesTableOnClick(e, args, target, item) {
if (nodesTab.grid.getColumns()[args.cell].id === 'actions') {
if (target.hasClass('prompt-for-connect')) {
promptForConnect(item);
@ -246,7 +431,7 @@ nf.ClusterTable = (function () {
/**
* Creates the Slick Grid column model for the Nodes table.
*/
function createNodeTableColumnModel () {
function createNodeTableColumnModel() {
var moreDetailsFormatter = function (row, cell, value, columnDef, dataContext) {
return '<div title="View Details" class="pointer show-node-details fa fa-info-circle" style="margin-top: 2px;"></div>';
};
@ -258,7 +443,7 @@ nf.ClusterTable = (function () {
// function for formatting the last accessed time
var valueFormatter = function (row, cell, value, columnDef, dataContext) {
return nf.Common.formatValue(value);
return common.formatValue(value);
};
// define a custom formatter for the status column
@ -267,17 +452,69 @@ nf.ClusterTable = (function () {
};
var columnModel = [
{id: 'moreDetails', name: '&nbsp;', sortable: false, resizable: false, formatter: moreDetailsFormatter, width: 50, maxWidth: 50},
{id: 'formattedNodeAddress', field: 'formattedNodeAddress', name: 'Node Address', formatter: nodeFormatter, resizable: true, sortable: true},
{id: 'activeThreadCount', field: 'activeThreadCount', name: 'Active Thread Count', resizable: true, sortable: true, defaultSortAsc: false},
{id: 'queued', field: 'queued', name: '<span class="queued-title">Queue</span>&nbsp;/&nbsp;<span class="queued-size-title">Size</span>', resizable: true, sortable: true, defaultSortAsc: false},
{id: 'status', field: 'status', name: 'Status', formatter: statusFormatter, resizable: true, sortable: true},
{id: 'uptime', field: 'nodeStartTime', name: 'Uptime', formatter: valueFormatter, resizable: true, sortable: true, defaultSortAsc: false},
{id: 'heartbeat', field: 'heartbeat', name: 'Last Heartbeat', formatter: valueFormatter, resizable: true, sortable: true, defaultSortAsc: false}
{
id: 'moreDetails',
name: '&nbsp;',
sortable: false,
resizable: false,
formatter: moreDetailsFormatter,
width: 50,
maxWidth: 50
},
{
id: 'formattedNodeAddress',
field: 'formattedNodeAddress',
name: 'Node Address',
formatter: nodeFormatter,
resizable: true,
sortable: true
},
{
id: 'activeThreadCount',
field: 'activeThreadCount',
name: 'Active Thread Count',
resizable: true,
sortable: true,
defaultSortAsc: false
},
{
id: 'queued',
field: 'queued',
name: '<span class="queued-title">Queue</span>&nbsp;/&nbsp;<span class="queued-size-title">Size</span>',
resizable: true,
sortable: true,
defaultSortAsc: false
},
{
id: 'status',
field: 'status',
name: 'Status',
formatter: statusFormatter,
resizable: true,
sortable: true
},
{
id: 'uptime',
field: 'nodeStartTime',
name: 'Uptime',
formatter: valueFormatter,
resizable: true,
sortable: true,
defaultSortAsc: false
},
{
id: 'heartbeat',
field: 'heartbeat',
name: 'Last Heartbeat',
formatter: valueFormatter,
resizable: true,
sortable: true,
defaultSortAsc: false
}
];
// only allow the admin to modify the cluster
if (nf.Common.canModifyController()) {
if (common.canModifyController()) {
var actionFormatter = function (row, cell, value, columnDef, dataContext) {
var canDisconnect = false;
var canConnect = false;
@ -299,7 +536,15 @@ nf.ClusterTable = (function () {
}
};
columnModel.push({id: 'actions', label: '&nbsp;', formatter: actionFormatter, resizable: false, sortable: false, width: 80, maxWidth: 80});
columnModel.push({
id: 'actions',
label: '&nbsp;',
formatter: actionFormatter,
resizable: false,
sortable: false,
width: 80,
maxWidth: 80
});
}
return columnModel;
@ -313,12 +558,12 @@ nf.ClusterTable = (function () {
* @param {object} sortDetails
* @param {object} data
*/
function sort (sortDetails, dataView, tab) {
function sort(sortDetails, dataView, tab) {
// defines a function for sorting
var comparer = function (a, b) {
if (sortDetails.columnId === 'heartbeat' || sortDetails.columnId === 'uptime') {
var aDate = nf.Common.parseDateTime(a[sortDetails.columnId]);
var bDate = nf.Common.parseDateTime(b[sortDetails.columnId]);
var aDate = common.parseDateTime(a[sortDetails.columnId]);
var bDate = common.parseDateTime(b[sortDetails.columnId]);
return aDate.getTime() - bDate.getTime();
} else if (sortDetails.columnId === 'queued') {
var aSplit = a[sortDetails.columnId].split(/ \/ /);
@ -326,33 +571,33 @@ nf.ClusterTable = (function () {
var mod = count % 4;
if (mod < 2) {
$('#cluster-nodes-table span.queued-title').addClass('sorted');
var aCount = nf.Common.parseCount(aSplit[0]);
var bCount = nf.Common.parseCount(bSplit[0]);
var aCount = common.parseCount(aSplit[0]);
var bCount = common.parseCount(bSplit[0]);
return aCount - bCount;
} else {
$('#cluster-nodes-table span.queued-size-title').addClass('sorted');
var aSize = nf.Common.parseSize(aSplit[1]);
var bSize = nf.Common.parseSize(bSplit[1]);
var aSize = common.parseSize(aSplit[1]);
var bSize = common.parseSize(bSplit[1]);
return aSize - bSize;
}
} else if (sortDetails.columnId === 'maxHeap' || sortDetails.columnId === 'totalHeap' || sortDetails.columnId === 'usedHeap'
|| sortDetails.columnId === 'totalNonHeap' || sortDetails.columnId === 'usedNonHeap'
|| sortDetails.columnId === 'ffRepoTotal' || sortDetails.columnId === 'ffRepoUsed'
|| sortDetails.columnId === 'ffRepoFree' || sortDetails.columnId === 'contentRepoTotal'
|| sortDetails.columnId === 'contentRepoUsed' || sortDetails.columnId === 'contentRepoFree') {
var aSize = nf.Common.parseSize(a[sortDetails.columnId]);
var bSize = nf.Common.parseSize(b[sortDetails.columnId]);
|| sortDetails.columnId === 'totalNonHeap' || sortDetails.columnId === 'usedNonHeap'
|| 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]);
return aSize - bSize;
} else if (sortDetails.columnId === 'totalThreads' || sortDetails.columnId === 'daemonThreads'
|| sortDetails.columnId === 'processors') {
var aCount = nf.Common.parseCount(a[sortDetails.columnId]);
var bCount = nf.Common.parseCount(b[sortDetails.columnId]);
|| sortDetails.columnId === 'processors') {
var aCount = common.parseCount(a[sortDetails.columnId]);
var bCount = common.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 = nf.Common.parseCount(aSplit[0]);
var bCount = nf.Common.parseCount(bSplit[0]);
var aCount = common.parseCount(aSplit[0]);
var bCount = common.parseCount(bSplit[0]);
return aCount - bCount;
} else if (sortDetails.columnId === 'status') {
var aStatus = formatNodeStatus(a);
@ -363,8 +608,8 @@ nf.ClusterTable = (function () {
var bNode = formatNodeAddress(b);
return aNode === bNode ? 0 : aNode > bNode ? 1 : -1;
} else {
var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1;
}
};
@ -394,7 +639,7 @@ nf.ClusterTable = (function () {
* @returns {string}
*/
var formatNodeAddress = function (node) {
return nf.Common.escapeHtml(node.address) + ':' + nf.Common.escapeHtml(node.apiPort);
return common.escapeHtml(node.address) + ':' + common.escapeHtml(node.apiPort);
};
/**
@ -421,7 +666,7 @@ nf.ClusterTable = (function () {
*/
var promptForConnect = function (node) {
// prompt to connect
nf.Dialog.showYesNoDialog({
dialog.showYesNoDialog({
headerText: 'Connect Node',
dialogContent: 'Connect \'' + formatNodeAddress(node) + '\' to this cluster?',
yesHandler: function () {
@ -455,7 +700,7 @@ nf.ClusterTable = (function () {
var clusterGrid = $('#cluster-nodes-table').data('gridInstance');
var clusterData = clusterGrid.getData();
clusterData.updateItem(node.nodeId, node);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -465,7 +710,7 @@ nf.ClusterTable = (function () {
*/
var promptForDisconnect = function (node) {
// prompt for disconnect
nf.Dialog.showYesNoDialog({
dialog.showYesNoDialog({
headerText: 'Disconnect Node',
dialogContent: 'Disconnect \'' + formatNodeAddress(node) + '\' from the cluster?',
yesHandler: function () {
@ -500,7 +745,7 @@ nf.ClusterTable = (function () {
var clusterGrid = $('#cluster-nodes-table').data('gridInstance');
var clusterData = clusterGrid.getData();
clusterData.updateItem(node.nodeId, node);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -510,7 +755,7 @@ nf.ClusterTable = (function () {
*/
var promptForRemoval = function (node) {
// prompt for disconnect
nf.Dialog.showYesNoDialog({
dialog.showYesNoDialog({
headerText: 'Remove Node',
dialogContent: 'Remove \'' + formatNodeAddress(node) + '\' from the cluster?',
yesHandler: function () {
@ -534,7 +779,7 @@ nf.ClusterTable = (function () {
var clusterGrid = $('#cluster-nodes-table').data('gridInstance');
var clusterData = clusterGrid.getData();
clusterData.deleteItem(nodeId);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -558,7 +803,7 @@ nf.ClusterTable = (function () {
var grid = visibleTab.grid;
// ensure the grid has been initialized
if (nf.Common.isDefinedAndNotNull(grid)) {
if (common.isDefinedAndNotNull(grid)) {
var gridData = grid.getData();
// update the search criteria
@ -614,7 +859,7 @@ nf.ClusterTable = (function () {
/**
* Updates count of displayed and total rows.
*/
function updateFilterStats (selectedTab) {
function updateFilterStats(selectedTab) {
if (!selectedTab) {
selectedTab = getSelectedTab();
}
@ -658,22 +903,22 @@ nf.ClusterTable = (function () {
$.each(node.events, function (i, event) {
eventMessages.push(event.timestamp + ": " + event.message);
});
$('<div></div>').append(nf.Common.formatUnorderedList(eventMessages)).appendTo(events);
$('<div></div>').append(common.formatUnorderedList(eventMessages)).appendTo(events);
} else {
events.append('<div><span class="unset">None</span></div>');
}
// show the dialog
$('#node-details-dialog').modal('show');
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
* Applies system diagnostics data to the JVM tab.
*/
function updateJvmTableData (systemDiagnosticsResponse) {
if (nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
function updateJvmTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var jvmTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -697,9 +942,9 @@ nf.ClusterTable = (function () {
totalNonHeap: snapshot.totalNonHeap,
usedNonHeap: snapshot.usedNonHeap,
gcOldGen: garbageCollection[0].collectionCount + ' times (' +
garbageCollection[0].collectionTime + ')',
garbageCollection[0].collectionTime + ')',
gcNewGen: garbageCollection[1].collectionCount + ' times (' +
garbageCollection[1].collectionTime + ')'
garbageCollection[1].collectionTime + ')'
});
});
jvmTab.rowCount = jvmTableRows.length;
@ -714,9 +959,9 @@ nf.ClusterTable = (function () {
/**
* Applies system diagnostics data to the System tab.
*/
function updateSystemTableData (systemDiagnosticsResponse) {
if (nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
function updateSystemTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var systemTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -743,9 +988,9 @@ nf.ClusterTable = (function () {
/**
* Applies system diagnostics data to the FlowFile Storage tab.
*/
function updateFlowFileTableData (systemDiagnosticsResponse) {
if (nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
function updateFlowFileTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var flowFileTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -772,9 +1017,9 @@ nf.ClusterTable = (function () {
/**
* Applies system diagnostics data to the Content Storage tab.
*/
function updateContentTableData (systemDiagnosticsResponse) {
if (nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
function updateContentTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var contentStorageTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -805,9 +1050,9 @@ nf.ClusterTable = (function () {
/**
* Applies system diagnostics data to the Versions tab.
*/
function updateVersionTableData (systemDiagnosticsResponse) {
if (nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& nf.Common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
function updateVersionTableData(systemDiagnosticsResponse) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var versionTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -834,7 +1079,7 @@ nf.ClusterTable = (function () {
/**
* Loads system diagnostics data for the cluster.
*/
function refreshSystemDiagnosticsData () {
function refreshSystemDiagnosticsData() {
var systemDiagnosticsUri = config.urls.systemDiagnostics
var loadPromise = $.ajax({
type: 'GET',
@ -848,14 +1093,14 @@ nf.ClusterTable = (function () {
handlers.forEach(function (handler) {
handler(systemDiagnosticsResponse);
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
return loadPromise;
};
/**
* Generic initialization for Slick Grid tables
*/
function commonTableInit (tab) {
function commonTableInit(tab) {
var dataView = new Slick.Data.DataView({
inlineFilters: false
});
@ -917,11 +1162,11 @@ nf.ClusterTable = (function () {
/**
* Apply the cluster nodes data set to the table.
*/
function updateNodesTableData (clusterResponse) {
function updateNodesTableData(clusterResponse) {
var cluster = clusterResponse.cluster;
// ensure there are groups specified
if (nf.Common.isDefinedAndNotNull(cluster.nodes)) {
if (common.isDefinedAndNotNull(cluster.nodes)) {
var clusterGrid = nodesTab.grid;
var clusterData = clusterGrid.getData();
@ -941,7 +1186,7 @@ nf.ClusterTable = (function () {
/**
* Refreshes cluster data sets from the server.
*/
function refreshClusterData () {
function refreshClusterData() {
var clusterNodesDataPromise = $.ajax({
type: 'GET',
url: config.urls.cluster,
@ -951,17 +1196,17 @@ nf.ClusterTable = (function () {
handlers.forEach(function (handler) {
handler(response);
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
return clusterNodesDataPromise;
}
/**
* Event handler triggered when the user switches tabs.
*/
function onSelectTab (tab) {
function onSelectTab(tab) {
// Resize table
var tabGrid = tab.grid;
if (nf.Common.isDefinedAndNotNull(tabGrid)) {
if (common.isDefinedAndNotNull(tabGrid)) {
tabGrid.resizeCanvas();
}
@ -979,7 +1224,7 @@ nf.ClusterTable = (function () {
updateFilterStats(tab);
}
return {
var nfClusterTable = {
/**
* Initializes the cluster list.
*/
@ -1066,7 +1311,7 @@ nf.ClusterTable = (function () {
// listen for browser resize events to update the page size
$(window).resize(function () {
nf.ClusterTable.resetTableSize();
nfClusterTable.resetTableSize();
});
// initialize tabs
@ -1106,4 +1351,5 @@ nf.ClusterTable = (function () {
}
};
}());
return nfClusterTable;
}));

View File

@ -15,14 +15,39 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
$(document).ready(function () {
// initialize the counters page
nf.Cluster.init();
});
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.ClusterTable',
'nf.ErrorHandler',
'nf.Storage'],
function ($, common, clusterTable, errorHandler, storage) {
return (nf.Cluster = factory($, common, clusterTable, errorHandler, storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Cluster =
factory(require('jquery'),
require('nf.Common'),
require('nf.ClusterTable'),
require('nf.ErrorHandler'),
require('nf.Storage')));
} else {
nf.Cluster = factory(root.$,
root.nf.Common,
root.nf.ClusterTable,
root.nf.ErrorHandler,
root.nf.Storage);
}
}(this, function ($, common, clusterTable, errorHandler, storage) {
'use strict';
nf.Cluster = (function () {
$(document).ready(function () {
// initialize the counters page
nfCluster.init();
});
/**
* Configuration object used to hold a number of configuration items.
@ -44,8 +69,8 @@ nf.Cluster = (function () {
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
common.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -54,7 +79,7 @@ nf.Cluster = (function () {
var initializeClusterPage = function () {
// define mouse over event for the refresh button
$('#refresh-button').click(function () {
nf.ClusterTable.loadClusterTable();
clusterTable.loadClusterTable();
});
// return a deferred for page initialization
@ -67,8 +92,8 @@ nf.Cluster = (function () {
dataType: 'json'
}).done(function (bannerResponse) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(bannerResponse.banners)) {
if (nf.Common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') {
if (common.isDefinedAndNotNull(bannerResponse.banners)) {
if (common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show();
@ -82,7 +107,7 @@ nf.Cluster = (function () {
updateTop('counters');
}
if (nf.Common.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') {
if (common.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show();
@ -98,7 +123,7 @@ nf.Cluster = (function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -107,13 +132,13 @@ nf.Cluster = (function () {
}).promise();
};
return {
var nfCluster = {
/**
* Initializes the counters page.
*/
init: function () {
nf.Storage.init();
storage.init();
// load the current user
loadCurrentUser().done(function () {
var setBodySize = function () {
@ -134,13 +159,13 @@ nf.Cluster = (function () {
setBodySize();
// create the cluster table
nf.ClusterTable.init();
clusterTable.init();
// resize to fit
nf.ClusterTable.resetTableSize();
clusterTable.resetTableSize();
// load the table
nf.ClusterTable.loadClusterTable().done(function () {
clusterTable.loadClusterTable().done(function () {
// once the table is initialized, finish initializing the page
initializeClusterPage().done(function () {
@ -156,15 +181,15 @@ nf.Cluster = (function () {
// set the document title and the about title
document.title = countersTitle;
$('#counters-header-text').text(countersTitle);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
@ -173,8 +198,8 @@ nf.Cluster = (function () {
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
@ -184,12 +209,12 @@ nf.Cluster = (function () {
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')){
if ($(tabsContainers[k]).is(':visible')) {
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
@ -197,4 +222,6 @@ nf.Cluster = (function () {
});
}
};
}());
return nfCluster;
}));

View File

@ -15,9 +15,31 @@
* limitations under the License.
*/
/* global nf, Slick */
/* global nf, define, module, require, exports */
nf.CountersTable = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.ErrorHandler'],
function ($, Slick, common, errorHandler) {
return (nf.CountersTable = factory($, Slick, common, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.CountersTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.ErrorHandler')));
} else {
nf.CountersTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.ErrorHandler);
}
}(this, function ($, Slick, common, errorHandler) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
@ -30,7 +52,7 @@ nf.CountersTable = (function () {
/**
* Sorts the specified data using the specified sort details.
*
*
* @param {object} sortDetails
* @param {object} data
*/
@ -38,12 +60,12 @@ nf.CountersTable = (function () {
// defines a function for sorting
var comparer = function (a, b) {
if (sortDetails.columnId === 'value') {
var aCount = nf.Common.parseCount(a[sortDetails.columnId]);
var bCount = nf.Common.parseCount(b[sortDetails.columnId]);
var aCount = common.parseCount(a[sortDetails.columnId]);
var bCount = common.parseCount(b[sortDetails.columnId]);
return aCount - bCount;
} else {
var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1;
}
};
@ -69,7 +91,7 @@ nf.CountersTable = (function () {
var countersGrid = $('#counters-table').data('gridInstance');
// ensure the grid has been initialized
if (nf.Common.isDefinedAndNotNull(countersGrid)) {
if (common.isDefinedAndNotNull(countersGrid)) {
var countersData = countersGrid.getData();
// update the search criteria
@ -83,7 +105,7 @@ nf.CountersTable = (function () {
/**
* Performs the filtering.
*
*
* @param {object} item The item subject to filtering
* @param {object} args Filter arguments
* @returns {Boolean} Whether or not to include the item
@ -104,10 +126,10 @@ nf.CountersTable = (function () {
// perform the filter
return item[args.property].search(filterExp) >= 0;
};
/**
* Resets the specified counter.
*
*
* @argument {object} item The counter item
*/
var resetCounter = function (item) {
@ -122,7 +144,7 @@ nf.CountersTable = (function () {
var countersGrid = $('#counters-table').data('gridInstance');
var countersData = countersGrid.getData();
countersData.updateItem(counter.id, counter);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
return {
@ -138,12 +160,12 @@ nf.CountersTable = (function () {
// filter type
$('#counters-filter-type').combo({
options: [{
text: 'by name',
value: 'name'
}, {
text: 'by context',
value: 'context'
}],
text: 'by name',
value: 'name'
}, {
text: 'by context',
value: 'context'
}],
select: function (option) {
applyFilter();
}
@ -151,20 +173,47 @@ nf.CountersTable = (function () {
// initialize the templates table
var countersColumns = [
{id: 'context', name: 'Context', field: 'context', sortable: true, resizable: true},
{id: 'name', name: 'Name', field: 'name', sortable: true, resizable: true},
{id: 'value', name: 'Value', field: 'value', sortable: true, resizable: true, defaultSortAsc: false}
{
id: 'context',
name: 'Context',
field: 'context',
sortable: true,
resizable: true
},
{
id: 'name',
name: 'Name',
field: 'name',
sortable: true,
resizable: true
},
{
id: 'value',
name: 'Value',
field: 'value',
sortable: true,
resizable: true,
defaultSortAsc: false
}
];
// only allow dfm's to reset counters
if (nf.Common.canModifyCounters()) {
if (common.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>';
};
// add the action column
countersColumns.push({id: 'actions', name: '&nbsp;', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100});
countersColumns.push({
id: 'actions',
name: '&nbsp;',
sortable: false,
resizable: false,
formatter: actionFormatter,
width: 100,
maxWidth: 100
});
}
var countersOptions = {
@ -204,7 +253,7 @@ nf.CountersTable = (function () {
sortAsc: args.sortAsc
}, countersData);
});
// configure a click listener
countersGrid.onClick.subscribe(function (e, args) {
var target = $(e.target);
@ -239,17 +288,17 @@ nf.CountersTable = (function () {
// initialize the number of display items
$('#displayed-counters').text('0');
},
/**
* Update the size of the grid based on its container's current size.
*/
resetTableSize: function () {
var countersGrid = $('#counters-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(countersGrid)) {
if (common.isDefinedAndNotNull(countersGrid)) {
countersGrid.resizeCanvas();
}
},
/**
* Load the processor counters table.
*/
@ -263,7 +312,7 @@ nf.CountersTable = (function () {
var aggregateSnapshot = report.aggregateSnapshot;
// ensure there are groups specified
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.counters)) {
if (common.isDefinedAndNotNull(aggregateSnapshot.counters)) {
var countersGrid = $('#counters-table').data('gridInstance');
var countersData = countersGrid.getData();
@ -280,7 +329,7 @@ nf.CountersTable = (function () {
} else {
$('#total-counters').text('0');
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}
};
}());
}));

View File

@ -15,14 +15,39 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
$(document).ready(function () {
// initialize the counters page
nf.Counters.init();
});
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.CountersTable',
'nf.ErrorHandler',
'nf.Storage'],
function ($, common, countersTable, errorHandler, storage) {
return (nf.Counters = factory($, common, countersTable, errorHandler, storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Counters =
factory(require('jquery'),
require('nf.Common'),
require('nf.CountersTable'),
require('nf.ErrorHandler'),
require('nf.Storage')));
} else {
nf.Counters = factory(root.$,
root.nf.Common,
root.nf.CountersTable,
root.nf.ErrorHandler,
root.nf.Storage);
}
}(this, function ($, common, countersTable, errorHandler, storage) {
'use strict';
nf.Counters = (function () {
$(document).ready(function () {
// initialize the counters page
nfCounters.init();
});
/**
* Configuration object used to hold a number of configuration items.
@ -44,9 +69,9 @@ nf.Counters = (function () {
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -55,7 +80,7 @@ nf.Counters = (function () {
var initializeCountersPage = function () {
// define mouse over event for the refresh button
$('#refresh-button').click(function () {
nf.CountersTable.loadCountersTable();
countersTable.loadCountersTable();
});
// return a deferred for page initialization
@ -68,8 +93,8 @@ nf.Counters = (function () {
dataType: 'json'
}).done(function (response) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(response.banners)) {
if (nf.Common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
if (common.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -83,7 +108,7 @@ nf.Counters = (function () {
updateTop('counters');
}
if (nf.Common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -99,7 +124,7 @@ nf.Counters = (function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -108,20 +133,20 @@ nf.Counters = (function () {
}).promise();
};
return {
var nfCounters = {
/**
* Initializes the counters page.
*/
init: function () {
nf.Storage.init();
storage.init();
// load the current user
loadCurrentUser().done(function () {
// create the counters table
nf.CountersTable.init();
countersTable.init();
// load the table
nf.CountersTable.loadCountersTable().done(function () {
countersTable.loadCountersTable().done(function () {
// once the table is initialized, finish initializing the page
initializeCountersPage().done(function () {
var setBodySize = function () {
@ -131,14 +156,14 @@ nf.Counters = (function () {
'height': $(window).height() + 'px',
'width': $(window).width() + 'px'
});
$('#counters').css('margin', 40);
$('#counters-table').css('bottom', 127);
$('#counters-refresh-container').css('margin', 40);
}
// configure the initial grid height
nf.CountersTable.resetTableSize();
countersTable.resetTableSize();
};
// get the about details
@ -156,15 +181,15 @@ nf.Counters = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
@ -173,8 +198,8 @@ nf.Counters = (function () {
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
@ -184,12 +209,12 @@ nf.Counters = (function () {
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')){
if ($(tabsContainers[k]).is(':visible')) {
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
@ -197,4 +222,6 @@ nf.Counters = (function () {
});
}
};
}());
return nfCounters;
}));

View File

@ -15,207 +15,225 @@
* limitations under the License.
*/
/* global Slick, nf */
/* global nf, define, module, require, exports */
(function ($) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.ErrorHandler'],
function ($, Slick, common, errorHandler) {
return (nf.HistoryModel = factory($, Slick, common, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.HistoryModel =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.ErrorHandler')));
} else {
nf.HistoryModel = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.ErrorHandler);
}
}(this, function ($, Slick, common, errorHandler) {
'use strict';
function HistoryModel() {
// private
var PAGESIZE = 50;
// private
var PAGESIZE = 50;
var data = {
length: 0
};
var data = {
length: 0
};
var filter = {};
var sortcol = null;
var sortdir = 1;
var filter = {};
var sortcol = null;
var sortdir = 1;
var h_request = null;
var xhr = null; // ajax request
var h_request = null;
var xhr = null; // ajax request
// events
var onDataLoading = new Slick.Event();
var onDataLoaded = new Slick.Event();
// events
var onDataLoading = new Slick.Event();
var onDataLoaded = new Slick.Event();
var init = function () {
};
var isDataLoaded = function (from, to) {
for (var i = from; i <= to; i++) {
if (data[i] === undefined || data[i] === null) {
return false;
}
}
var isDataLoaded = function (from, to) {
for (var i = from; i <= to; i++) {
if (data[i] === undefined || data[i] === null) {
return false;
}
return true;
};
var clear = function () {
for (var key in data) {
delete data[key];
}
data.length = 0;
};
var ensureData = function (from, to) {
if (xhr) {
xhr.abort();
for (var i = xhr.fromPage; i <= xhr.toPage; i++) {
data[i * PAGESIZE] = undefined;
}
}
if (from < 0) {
from = 0;
}
var fromPage = Math.floor(from / PAGESIZE);
var toPage = Math.floor(to / PAGESIZE);
while (data[fromPage * PAGESIZE] !== undefined && fromPage < toPage) {
fromPage++;
}
while (data[toPage * PAGESIZE] !== undefined && fromPage < toPage) {
toPage--;
}
if (fromPage > toPage || ((fromPage === toPage) && data[fromPage * PAGESIZE] !== undefined)) {
// TODO: look-ahead
return;
}
var query = {};
// add the start and end date to the query params
query = $.extend({
count: ((toPage - fromPage) * PAGESIZE) + PAGESIZE,
offset: fromPage * PAGESIZE
}, query);
// conditionally add the sort details
if (sortcol !== null) {
query['sortColumn'] = sortcol;
query['sortOrder'] = (sortdir > 0) ? "asc" : "desc";
}
// add the filter
query = $.extend(query, filter);
// if there is an request currently scheduled, cancel it
if (h_request !== null) {
clearTimeout(h_request);
}
// schedule the request for data
h_request = setTimeout(function () {
for (var i = fromPage; i <= toPage; i++) {
data[i * PAGESIZE] = null; // null indicates a 'requested but not available yet'
}
return true;
};
// notify that loading is about to occur
onDataLoading.notify({
from: from,
to: to
});
var clear = function () {
for (var key in data) {
delete data[key];
}
data.length = 0;
};
// perform query...
var xhr = $.ajax({
type: 'GET',
url: '../nifi-api/flow/history',
data: query,
dataType: 'json'
}).done(function (response) {
var history = response.history;
var ensureData = function (from, to) {
if (xhr) {
xhr.abort();
for (var i = xhr.fromPage; i <= xhr.toPage; i++) {
data[i * PAGESIZE] = undefined;
}
}
// calculate the indices
var from = fromPage * PAGESIZE;
var to = from + history.actions.length;
if (from < 0) {
from = 0;
}
// update the data length
data.length = history.total;
var fromPage = Math.floor(from / PAGESIZE);
var toPage = Math.floor(to / PAGESIZE);
while (data[fromPage * PAGESIZE] !== undefined && fromPage < toPage) {
fromPage++;
}
while (data[toPage * PAGESIZE] !== undefined && fromPage < toPage) {
toPage--;
}
if (fromPage > toPage || ((fromPage === toPage) && data[fromPage * PAGESIZE] !== undefined)) {
// TODO: look-ahead
return;
}
var query = {};
// add the start and end date to the query params
query = $.extend({
count: ((toPage - fromPage) * PAGESIZE) + PAGESIZE,
offset: fromPage * PAGESIZE
}, query);
// conditionally add the sort details
if (sortcol !== null) {
query['sortColumn'] = sortcol;
query['sortOrder'] = (sortdir > 0) ? "asc" : "desc";
}
// add the filter
query = $.extend(query, filter);
// if there is an request currently scheduled, cancel it
if (h_request !== null) {
clearTimeout(h_request);
}
// schedule the request for data
h_request = setTimeout(function () {
for (var i = fromPage; i <= toPage; i++) {
data[i * PAGESIZE] = null; // null indicates a 'requested but not available yet'
// populate the history actions
for (var i = 0; i < history.actions.length; i++) {
data[from + i] = history.actions[i];
data[from + i].index = from + i;
}
// notify that loading is about to occur
onDataLoading.notify({
// update the stats last refreshed timestamp
$('#history-last-refreshed').text(history.lastRefreshed);
// set the timezone for the start and end time
$('.timezone').text(common.substringAfterLast(history.lastRefreshed, ' '));
// show the filter message if applicable
if (query['sourceId'] || query['userIdentity'] || query['startDate'] || query['endDate']) {
$('#history-filter-overview').css('visibility', 'visible');
} else {
$('#history-filter-overview').css('visibility', 'hidden');
}
// clear the current request
xhr = null;
// notify data loaded
onDataLoaded.notify({
from: from,
to: to
});
}).fail(errorHandler.handleAjaxError);
xhr.fromPage = fromPage;
xhr.toPage = toPage;
// perform query...
var xhr = $.ajax({
type: 'GET',
url: '../nifi-api/flow/history',
data: query,
dataType: 'json'
}).done(function (response) {
var history = response.history;
}, 50);
};
// calculate the indices
var from = fromPage * PAGESIZE;
var to = from + history.actions.length;
var reloadData = function (from, to) {
for (var i = from; i <= to; i++)
delete data[i];
// update the data length
data.length = history.total;
ensureData(from, to);
};
// populate the history actions
for (var i = 0; i < history.actions.length; i++) {
data[from + i] = history.actions[i];
data[from + i].index = from + i;
}
var setSort = function (column, dir) {
sortcol = column;
sortdir = dir;
clear();
};
// update the stats last refreshed timestamp
$('#history-last-refreshed').text(history.lastRefreshed);
var setFilterArgs = function (newFilter) {
filter = newFilter;
clear();
};
// set the timezone for the start and end time
$('.timezone').text(nf.Common.substringAfterLast(history.lastRefreshed, ' '));
var getItem = function (i) {
return data[i];
};
// show the filter message if applicable
if (query['sourceId'] || query['userIdentity'] || query['startDate'] || query['endDate']) {
$('#history-filter-overview').css('visibility', 'visible');
} else {
$('#history-filter-overview').css('visibility', 'hidden');
}
var getLength = function () {
return data.length;
};
// clear the current request
xhr = null;
// notify data loaded
onDataLoaded.notify({
from: from,
to: to
});
}).fail(nf.Common.handleAjaxError);
xhr.fromPage = fromPage;
xhr.toPage = toPage;
}, 50);
};
var reloadData = function (from, to) {
for (var i = from; i <= to; i++)
delete data[i];
ensureData(from, to);
};
var setSort = function (column, dir) {
sortcol = column;
sortdir = dir;
clear();
};
var setFilterArgs = function (newFilter) {
filter = newFilter;
clear();
};
var getItem = function (i) {
return data[i];
};
var getLength = function () {
return data.length;
};
init();
return {
// properties
data: data,
// methods
clear: clear,
isDataLoaded: isDataLoaded,
ensureData: ensureData,
reloadData: reloadData,
setSort: setSort,
setFilterArgs: setFilterArgs,
getItem: getItem,
getLength: getLength,
// events
onDataLoading: onDataLoading,
onDataLoaded: onDataLoaded
};
function HistoryModel() {
}
// nf.HistoryModel
$.extend(true, window, {nf: {HistoryModel: HistoryModel}});
})(jQuery);
HistoryModel.prototype = {
constructor: HistoryModel,
// properties
data: data,
// methods
clear: clear,
isDataLoaded: isDataLoaded,
ensureData: ensureData,
reloadData: reloadData,
setSort: setSort,
setFilterArgs: setFilterArgs,
getItem: getItem,
getLength: getLength,
// events
onDataLoading: onDataLoading,
onDataLoaded: onDataLoaded
}
return HistoryModel;
}));

View File

@ -15,9 +15,37 @@
* limitations under the License.
*/
/* global nf, Slick */
/* global nf, top, define, module, require, exports */
nf.HistoryTable = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.Dialog',
'nf.ErrorHandler',
'nf.HistoryModel'],
function ($, Slick, common, dialog, errorHandler, HistoryModel) {
return (nf.HistoryTable = factory($, Slick, common, dialog, errorHandler, HistoryModel));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.HistoryTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.ErrorHandler'),
require('nf.HistoryModel')));
} else {
nf.HistoryTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.Dialog,
root.nf.ErrorHandler,
root.nf.HistoryModel);
}
}(this, function ($, Slick, common, dialog, errorHandler, HistoryModel) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
@ -151,7 +179,7 @@ nf.HistoryTable = (function () {
historyModel.setFilterArgs(filter);
// reload the table
nf.HistoryTable.loadHistoryTable();
nfHistoryTable.loadHistoryTable();
}
}
},
@ -212,15 +240,15 @@ nf.HistoryTable = (function () {
}
var endDateTime = endDate + ' ' + endTime;
var timezone = $('.timezone:first').text();
nf.Dialog.showYesNoDialog({
dialog.showYesNoDialog({
headerText: 'History',
dialogContent: "Are you sure you want to delete all history before '" + nf.Common.escapeHtml(endDateTime) + " " + nf.Common.escapeHtml(timezone) + "'?",
dialogContent: "Are you sure you want to delete all history before '" + common.escapeHtml(endDateTime) + " " + common.escapeHtml(timezone) + "'?",
yesHandler: function () {
purgeHistory(endDateTime);
}
});
} else {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'History',
dialogContent: 'The end date must be specified.'
});
@ -262,7 +290,7 @@ nf.HistoryTable = (function () {
historyModel.setFilterArgs({});
// refresh the table
nf.HistoryTable.loadHistoryTable();
nfHistoryTable.loadHistoryTable();
});
// add hover effect and click handler for opening the dialog
@ -272,7 +300,7 @@ nf.HistoryTable = (function () {
// define a custom formatter for the more details column
var moreDetailsFormatter = function (row, cell, value, columnDef, dataContext) {
if(dataContext.canRead === true) {
if (dataContext.canRead === true) {
return '<div title="View Details" class="pointer show-action-details fa fa-info-circle" style="margin-top: 4px;"></div>';
}
return "";
@ -280,10 +308,10 @@ nf.HistoryTable = (function () {
// define how general values are formatted
var valueFormatter = function (row, cell, value, columnDef, dataContext) {
if(dataContext.canRead !== true) {
if (dataContext.canRead !== true) {
return '<span class="unset" style="font-size: 13px; padding-top: 2px;">Not authorized</span>';
}
return nf.Common.formatValue(dataContext.action[columnDef.field]);
return common.formatValue(dataContext.action[columnDef.field]);
};
// initialize the templates table
@ -297,12 +325,48 @@ nf.HistoryTable = (function () {
width: 50,
maxWidth: 50
},
{id: 'timestamp', name: 'Date/Time', field: 'timestamp', sortable: true, resizable: true, formatter: valueFormatter},
{id: 'sourceName', name: 'Name', field: 'sourceName', sortable: true, resizable: true, formatter: valueFormatter},
{id: 'sourceType', name: 'Type', field: 'sourceType', sortable: true, resizable: true, formatter: valueFormatter},
{id: 'operation', name: 'Operation', field: 'operation', sortable: true, resizable: true, formatter: valueFormatter},
{id: 'userIdentity', name: 'User', field: 'userIdentity', sortable: true, resizable: true, formatter: valueFormatter}
{
id: 'timestamp',
name: 'Date/Time',
field: 'timestamp',
sortable: true,
resizable: true,
formatter: valueFormatter
},
{
id: 'sourceName',
name: 'Name',
field: 'sourceName',
sortable: true,
resizable: true,
formatter: valueFormatter
},
{
id: 'sourceType',
name: 'Type',
field: 'sourceType',
sortable: true,
resizable: true,
formatter: valueFormatter
},
{
id: 'operation',
name: 'Operation',
field: 'operation',
sortable: true,
resizable: true,
formatter: valueFormatter
},
{
id: 'userIdentity',
name: 'User',
field: 'userIdentity',
sortable: true,
resizable: true,
formatter: valueFormatter
}
];
var historyOptions = {
forceFitColumns: true,
enableTextSelectionOnCells: true,
@ -313,7 +377,7 @@ nf.HistoryTable = (function () {
};
// create the remote model
var historyModel = new nf.HistoryModel();
var historyModel = new HistoryModel();
// initialize the grid
var historyGrid = new Slick.Grid('#history-table', historyModel, historyColumns, historyOptions);
@ -365,7 +429,7 @@ nf.HistoryTable = (function () {
$('#history-table').data('gridInstance', historyGrid);
// add the purge button if appropriate
if (nf.Common.canModifyController()) {
if (common.canModifyController()) {
$('#history-purge-button').on('click', function () {
$('#history-purge-dialog').modal('show');
}).show();
@ -385,8 +449,8 @@ nf.HistoryTable = (function () {
}),
dataType: 'json'
}).done(function () {
nf.HistoryTable.loadHistoryTable();
}).fail(nf.Common.handleAjaxError);
nfHistoryTable.loadHistoryTable();
}).fail(errorHandler.handleAjaxError);
};
/**
@ -397,19 +461,19 @@ nf.HistoryTable = (function () {
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>' + nf.Common.escapeHtml(action.sourceId) + '</div>'));
$('<div class="action-detail"><div class="history-details-name">Id</div>' + common.escapeHtml(action.sourceId) + '</div>'));
// get any component details
var componentDetails = action.componentDetails;
// inspect the operation to determine if there are any component details
if (nf.Common.isDefinedAndNotNull(componentDetails)) {
if (common.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>' + nf.Common.escapeHtml(componentDetails.type) + '</div>'));
$('<div class="action-detail"><div class="history-details-name">Type</div>' + common.escapeHtml(componentDetails.type) + '</div>'));
} else if (action.sourceType === 'RemoteProcessGroup') {
detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Uri</div>' + nf.Common.formatValue(componentDetails.uri) + '</div>'));
$('<div class="action-detail"><div class="history-details-name">Uri</div>' + common.formatValue(componentDetails.uri) + '</div>'));
}
}
@ -417,30 +481,30 @@ nf.HistoryTable = (function () {
var actionDetails = action.actionDetails;
// inspect the operation to determine if there are any action details
if (nf.Common.isDefinedAndNotNull(actionDetails)) {
if (common.isDefinedAndNotNull(actionDetails)) {
if (action.operation === 'Configure') {
detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Name</div>' + nf.Common.formatValue(actionDetails.name) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Value</div>' + nf.Common.formatValue(actionDetails.value) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Previous Value</div>' + nf.Common.formatValue(actionDetails.previousValue) + '</div>'));
$('<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>'));
} else if (action.operation === 'Connect' || action.operation === 'Disconnect') {
detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Source Id</div>' + nf.Common.escapeHtml(actionDetails.sourceId) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Source Name</div>' + nf.Common.formatValue(actionDetails.sourceName) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Source Type</div>' + nf.Common.escapeHtml(actionDetails.sourceType) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Relationship(s)</div>' + nf.Common.formatValue(actionDetails.relationship) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Destination Id</div>' + nf.Common.escapeHtml(actionDetails.destinationId) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Destination Name</div>' + nf.Common.formatValue(actionDetails.destinationName) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Destination Type</div>' + nf.Common.escapeHtml(actionDetails.destinationType) + '</div>'));
$('<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>'));
} else if (action.operation === 'Move') {
detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">Group</div>' + nf.Common.formatValue(actionDetails.group) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Group Id</div>' + nf.Common.escapeHtml(actionDetails.groupId) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Previous Group</div>' + nf.Common.formatValue(actionDetails.previousGroup) + '</div>')).append(
$('<div class="action-detail"><div class="history-details-name">Previous Group Id</div>' + nf.Common.escapeHtml(actionDetails.previousGroupId) + '</div>'));
$('<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>'));
} else if (action.operation === 'Purge') {
detailsMarkup.append(
$('<div class="action-detail"><div class="history-details-name">End Date</div>' + nf.Common.escapeHtml(actionDetails.endDate) + '</div>'));
$('<div class="action-detail"><div class="history-details-name">End Date</div>' + common.escapeHtml(actionDetails.endDate) + '</div>'));
}
}
@ -451,7 +515,7 @@ nf.HistoryTable = (function () {
$('#action-details-dialog').modal('show');
};
return {
var nfHistoryTable = {
init: function () {
initDetailsDialog();
initFilterDialog();
@ -464,7 +528,7 @@ nf.HistoryTable = (function () {
*/
resetTableSize: function () {
var historyGrid = $('#history-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(historyGrid)) {
if (common.isDefinedAndNotNull(historyGrid)) {
historyGrid.resizeCanvas();
}
},
@ -483,4 +547,6 @@ nf.HistoryTable = (function () {
historyGrid.onViewportChanged.notify();
}
};
}());
return nfHistoryTable;
}));

View File

@ -15,14 +15,42 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
$(document).ready(function () {
// initialize the status page
nf.History.init();
});
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.HistoryTable',
'nf.ErrorHandler',
'nf.Storage',
'nf.ClusterSummary'],
function ($, common, historyTable, errorHandler, storage, clusterSummary) {
return (nf.History = factory($, common, historyTable, errorHandler, storage, clusterSummary));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.History =
factory(require('jquery'),
require('nf.Common'),
require('nf.HistoryTable'),
require('nf.ErrorHandler'),
require('nf.Storage'),
require('nf.ClusterSummary')));
} else {
nf.History = factory(root.$,
root.nf.Common,
root.nf.HistoryTable,
root.nf.ErrorHandler,
root.nf.Storage,
root.nf.ClusterSummary);
}
}(this, function ($, common, historyTable, errorHandler, storage, clusterSummary) {
'use strict';
nf.History = (function () {
$(document).ready(function () {
// initialize the status page
nfHistory.init();
});
/**
* Configuration object used to hold a number of configuration items.
@ -31,8 +59,7 @@ nf.History = (function () {
urls: {
banners: '../nifi-api/flow/banners',
about: '../nifi-api/flow/about',
currentUser: '../nifi-api/flow/current-user',
clusterSummary: '../nifi-api/flow/cluster/summary'
currentUser: '../nifi-api/flow/current-user'
}
};
@ -45,28 +72,8 @@ nf.History = (function () {
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
};
/**
* Loads the flow configuration and updated the cluster state.
*
* @returns xhr
*/
var loadClusterSummary = function () {
return $.ajax({
type: 'GET',
url: config.urls.clusterSummary,
dataType: 'json'
}).done(function (response) {
var clusterSummary = response.clusterSummary;
// if clustered, show message to indicate location of actions
if (clusterSummary.clustered === true) {
$('#cluster-history-message').show();
}
});
common.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -75,7 +82,7 @@ nf.History = (function () {
var initializeHistoryPage = function () {
// define mouse over event for the refresh button
$('#refresh-button').click(function () {
nf.HistoryTable.loadHistoryTable();
historyTable.loadHistoryTable();
});
// return a deferred for page initialization
@ -88,8 +95,8 @@ nf.History = (function () {
dataType: 'json'
}).done(function (response) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(response.banners)) {
if (nf.Common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
if (common.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -103,7 +110,7 @@ nf.History = (function () {
updateTop('history');
}
if (nf.Common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -119,7 +126,7 @@ nf.History = (function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -128,22 +135,28 @@ nf.History = (function () {
}).promise();
};
return {
var nfHistory = {
/**
* Initializes the status page.
*/
init: function () {
nf.Storage.init();
// load the current user
loadCurrentUser().done(function () {
loadClusterSummary();
var currentUser = loadCurrentUser()
storage.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) {
$('#cluster-history-message').show();
}
// create the history table
nf.HistoryTable.init();
historyTable.init();
// load the history table
nf.HistoryTable.loadHistoryTable();
historyTable.loadHistoryTable();
// once the table is initialized, finish initializing the page
initializeHistoryPage().done(function () {
@ -154,13 +167,13 @@ nf.History = (function () {
'height': $(window).height() + 'px',
'width': $(window).width() + 'px'
});
$('#history').css('margin', 40);
$('#history-refresh-container').css('margin', 40);
}
// configure the initial grid height
nf.HistoryTable.resetTableSize();
historyTable.resetTableSize();
};
// get the about details
@ -178,15 +191,15 @@ nf.History = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
@ -195,8 +208,8 @@ nf.History = (function () {
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
@ -206,16 +219,18 @@ nf.History = (function () {
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')){
if ($(tabsContainers[k]).is(':visible')) {
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
});
}
};
}());
return nfHistory;
}));

View File

@ -15,13 +15,32 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
$(document).ready(function () {
nf.Login.init();
});
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.Dialog',
'nf.Storage'],
function ($, common, dialog, storage) {
return (nf.Login = factory($, common, dialog, storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Login =
factory(require('jquery'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.Storage')));
} else {
nf.Login = factory(root.$, root.nf.Common, root.nf.Dialog, root.nf.Storage);
}
}(this, function ($, common, dialog, storage) {
'use strict';
nf.Login = (function () {
$(document).ready(function () {
nfLogin.init();
});
var config = {
urls: {
@ -62,12 +81,12 @@ nf.Login = (function () {
var login = function () {
// remove focus
$('#username, #password').blur();
// show the logging message...
$('#login-progress-label').text('Logging in...');
$('#login-progress-container').show();
$('#login-submission-container').hide();
// login submit
$.ajax({
type: 'POST',
@ -78,9 +97,9 @@ nf.Login = (function () {
}
}).done(function (jwt) {
// get the payload and store the token with the appropirate expiration
var token = nf.Common.getJwtPayload(jwt);
var expiration = parseInt(token['exp'], 10) * nf.Common.MILLIS_PER_SECOND;
nf.Storage.setItem('jwt', jwt, expiration);
var token = common.getJwtPayload(jwt);
var expiration = parseInt(token['exp'], 10) * common.MILLIS_PER_SECOND;
storage.setItem('jwt', jwt, expiration);
// check to see if they actually have access now
$.ajax({
@ -89,10 +108,10 @@ nf.Login = (function () {
dataType: 'json'
}).done(function (response) {
var accessStatus = response.accessStatus;
// update the logout link appropriately
showLogoutLink();
// update according to the access status
if (accessStatus.status === 'ACTIVE') {
// reload as appropriate - no need to schedule token refresh as the page is reloading
@ -122,9 +141,9 @@ nf.Login = (function () {
$('#login-message-container').show();
});
}).fail(function (xhr, status, error) {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Login',
dialogContent: nf.Common.escapeHtml(xhr.responseText)
dialogContent: common.escapeHtml(xhr.responseText)
});
// update the form visibility
@ -134,20 +153,20 @@ nf.Login = (function () {
};
var showLogoutLink = function () {
nf.Common.showLogoutLink();
common.showLogoutLink();
};
return {
var nfLogin = {
/**
* Initializes the login page.
*/
init: function () {
nf.Storage.init();
storage.init();
if (nf.Storage.getItem('jwt') !== null) {
if (storage.getItem('jwt') !== null) {
showLogoutLink();
}
// supporting logging in via enter press
$('#username, #password').on('keyup', function (e) {
var code = e.keyCode ? e.keyCode : e.which;
@ -166,7 +185,7 @@ nf.Login = (function () {
$('#login-message').text(xhr.responseText);
initializeMessage();
});
// access config
var accessConfigXhr = $.ajax({
type: 'GET',
@ -180,22 +199,22 @@ nf.Login = (function () {
var accessConfigResponse = accessConfigResult[0];
var accessConfig = accessConfigResponse.config;
// possible login states
var needsLogin = true;
var showMessage = false;
// handle the status appropriately
if (accessStatus.status === 'UNKNOWN') {
needsLogin = true;
} else if (accessStatus.status === 'ACTIVE') {
showMessage = true;
needsLogin = false;
$('#login-message-title').text('Success');
$('#login-message').text(accessStatus.message);
}
// if login is required, verify its supported
if (accessConfig.supportsLogin === false && needsLogin === true) {
$('#login-message-title').text('Access Denied');
@ -214,4 +233,6 @@ nf.Login = (function () {
});
}
};
}());
return nfLogin;
}));

View File

@ -15,25 +15,43 @@
* limitations under the License.
*/
/**
* Performs ajax setup for use within NiFi.
*/
$(document).ready(function ($) {
// include jwt when possible
$.ajaxSetup({
'beforeSend': function(xhr) {
var hadToken = nf.Storage.hasItem('jwt');
/* global nf, define, module, require, exports */
// get the token to include in all requests
var token = nf.Storage.getItem('jwt');
if (token !== null) {
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
} else {
// if the current user was logged in with a token and the token just expired, cancel the request
if (hadToken === true) {
return false;
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Storage'],
function ($, storage) {
return (nf.AjaxSetup = factory($, storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.AjaxSetup = factory(require('jquery'),
require('nf.Storage')));
} else {
nf.AjaxSetup = factory(root.$,
root.nf.Storage);
}
}(this, function ($, storage) {
/**
* Performs ajax setup for use within NiFi.
*/
$(document).ready(function ($) {
// include jwt when possible
$.ajaxSetup({
'beforeSend': function (xhr) {
var hadToken = storage.hasItem('jwt');
// get the token to include in all requests
var token = storage.getItem('jwt');
if (token !== null) {
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
} else {
// if the current user was logged in with a token and the token just expired, cancel the request
if (hadToken === true) {
return false;
}
}
}
}
});
});
});
}));

View File

@ -15,15 +15,33 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common'],
function ($, common) {
return (nf.Client = factory($, common));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Client =
factory(require('jquery'),
require('nf.Common')));
} else {
nf.Client =
factory(root.$,
root.nf.Common);
}
}(this, function ($, common) {
'use strict';
nf.Client = (function() {
var clientId = null;
return {
/**
* Initializes the client.
*
*
* @returns deferred
*/
init: function () {
@ -55,7 +73,7 @@ nf.Client = (function() {
* @return {boolean} whether proposedData is newer than currentData
*/
isNewerRevision: function (currentData, proposedData) {
if (nf.Common.isDefinedAndNotNull(currentData)) {
if (common.isDefinedAndNotNull(currentData)) {
var currentRevision = currentData.revision;
var proposedRevision = proposedData.revision;
@ -66,4 +84,4 @@ nf.Client = (function() {
}
}
};
}());
}));

View File

@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* global nf, define, module, require, exports */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], function ($) {
return (nf.ClusterSummary = factory($));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ClusterSummary =
factory(require('jquery')));
} else {
nf.ClusterSummary = factory(root.$);
}
}(this, function ($) {
var clustered = false;
var connectedToCluster = false;
var config = {
urls: {
clusterSummary: '../nifi-api/flow/cluster/summary'
}
};
return {
/**
* Loads the flow configuration and updated the cluster state.
*
* @returns xhr
*/
loadClusterSummary: function () {
return $.ajax({
type: 'GET',
url: config.urls.clusterSummary,
dataType: 'json'
}).done(function (clusterSummaryResult) {
var clusterSummaryResponse = clusterSummaryResult;
var clusterSummary = clusterSummaryResponse.clusterSummary;
// establish the initial cluster state
clustered = clusterSummary.clustered;
connectedToCluster = clusterSummary.connectedToCluster;
});
},
/**
* Return whether this instance of NiFi is clustered.
*
* @returns {Boolean}
*/
isClustered: function () {
return clustered === true;
},
/**
* Return whether this instance is connected to a cluster.
*
* @returns {boolean}
*/
isConnectedToCluster: function () {
return connectedToCluster === true;
}
};
}));

View File

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

View File

@ -15,36 +15,47 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
$(document).ready(function () {
// configure the ok dialog
$('#nf-ok-dialog').modal({
scrollableContentStyle: 'scrollable',
handler: {
close: function () {
// clear the content
$('#nf-ok-dialog-content').empty();
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], function ($) {
return (nf.Dialog = factory($));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Dialog = factory(require('jquery')));
} else {
nf.Dialog = factory(root.$);
}
}(this, function ($) {
'use strict';
$(document).ready(function () {
// configure the ok dialog
$('#nf-ok-dialog').modal({
scrollableContentStyle: 'scrollable',
handler: {
close: function () {
// clear the content
$('#nf-ok-dialog-content').empty();
}
}
}
});
// configure the yes/no dialog
$('#nf-yes-no-dialog').modal({
scrollableContentStyle: 'scrollable',
handler: {
close: function () {
// clear the content and reset the button model
$('#nf-yes-no-dialog-content').empty();
$('#nf-yes-no-dialog').modal('setButtonModel', []);
}
}
});
});
// configure the yes/no dialog
$('#nf-yes-no-dialog').modal({
scrollableContentStyle: 'scrollable',
handler: {
close: function () {
// clear the content and reset the button model
$('#nf-yes-no-dialog-content').empty();
$('#nf-yes-no-dialog').modal('setButtonModel', []);
}
}
});
});
nf.Dialog = (function () {
return {
var nfDialog = {
/**
* Shows an general dialog with an Okay button populated with the
* specified dialog content.
@ -140,6 +151,28 @@ nf.Dialog = (function () {
// show the dialog
$('#nf-yes-no-dialog').modal('setHeaderText', options.headerText).modal('show');
},
/**
* Shows a message when disconnected from the cluster.
*/
showDisconnectedFromClusterMessage: function () {
nfDialog.showOkDialog({
headerText: 'Cluster Connection',
dialogContent: 'This node is currently not connected to the cluster. Any modifications to the data flow made here will not replicate across the cluster.'
});
},
/**
* Shows a message when connected to the cluster.
*/
showConnectedToClusterMessage: function () {
nfDialog.showOkDialog({
headerText: 'Cluster Connection',
dialogContent: 'This node just joined the cluster. Any modifications to the data flow made here will replicate across the cluster.'
});
}
};
}());
return nfDialog;
}));

View File

@ -0,0 +1,147 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* global nf, define, module, require, exports */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Dialog',
'nf.Common'],
function ($, dialog, common) {
return (nf.ErrorHandler = factory($, dialog, common));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ErrorHandler = factory(require('jquery'),
require('nf.Dialog'),
require('nf.Common')));
} else {
nf.ErrorHandler = factory(root.$,
root.nf.Dialog,
root.nf.Common);
}
}(this, function ($, dialog, common) {
'use strict';
return {
/**
* Method for handling ajax errors.
*
* @argument {object} xhr The XmlHttpRequest
* @argument {string} status The status of the request
* @argument {string} error The error
*/
handleAjaxError: function (xhr, status, error) {
if (status === 'canceled') {
if ($('#splash').is(':visible')) {
$('#message-title').text('Session Expired');
$('#message-content').text('Your session has expired. Please reload to log in again.');
// show the error pane
$('#message-pane').show();
} else {
dialog.showOkDialog({
headerText: 'Session Expired',
dialogContent: 'Your session has expired. Please press Ok to log in again.',
okHandler: function () {
window.location = '/nifi';
}
});
}
return;
}
// if an error occurs while the splash screen is visible close the canvas show the error message
if ($('#splash').is(':visible')) {
if (xhr.status === 401) {
$('#message-title').text('Unauthorized');
} else if (xhr.status === 403) {
$('#message-title').text('Insufficient Permissions');
} else if (xhr.status === 409) {
$('#message-title').text('Invalid State');
} else {
$('#message-title').text('An unexpected error has occurred');
}
if ($.trim(xhr.responseText) === '') {
$('#message-content').text('Please check the logs.');
} else {
$('#message-content').text(xhr.responseText);
}
// show the error pane
$('#message-pane').show();
return;
}
// status code 400, 404, and 409 are expected response codes for common errors.
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409 || xhr.status === 503) {
dialog.showOkDialog({
headerText: 'Error',
dialogContent: common.escapeHtml(xhr.responseText)
});
} else if (xhr.status === 403) {
dialog.showOkDialog({
headerText: 'Insufficient Permissions',
dialogContent: common.escapeHtml(xhr.responseText)
});
} else {
if (xhr.status < 99 || xhr.status === 12007 || xhr.status === 12029) {
var content = 'Please ensure the application is running and check the logs for any errors.';
if (common.isDefinedAndNotNull(status)) {
if (status === 'timeout') {
content = 'Request has timed out. Please ensure the application is running and check the logs for any errors.';
} else if (status === 'abort') {
content = 'Request has been aborted.';
} else if (status === 'No Transport') {
content = 'Request transport mechanism failed. Please ensure the host where the application is running is accessible.';
}
}
$('#message-title').text('Unable to communicate with NiFi');
$('#message-content').text(content);
} else if (xhr.status === 401) {
$('#message-title').text('Unauthorized');
if ($.trim(xhr.responseText) === '') {
$('#message-content').text('Authentication is required to use this NiFi.');
} else {
$('#message-content').text(xhr.responseText);
}
} else if (xhr.status === 500) {
$('#message-title').text('An unexpected error has occurred');
if ($.trim(xhr.responseText) === '') {
$('#message-content').text('An error occurred communicating with the application core. Please check the logs and fix any configuration issues before restarting.');
} else {
$('#message-content').text(xhr.responseText);
}
} else if (xhr.status === 200 || xhr.status === 201) {
$('#message-title').text('Parse Error');
if ($.trim(xhr.responseText) === '') {
$('#message-content').text('Unable to interpret response from NiFi.');
} else {
$('#message-content').text(xhr.responseText);
}
} else {
$('#message-title').text(xhr.status + ': Unexpected Response');
$('#message-content').text('An unexpected error has occurred. Please check the logs.');
}
// show the error pane
$('#message-pane').show();
}
}
};
}));

View File

@ -15,81 +15,95 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.ng.AppConfig = function ($mdThemingProvider, $compileProvider) {
//Enable production mode, to re-enable debug mode open up a
//console and call 'angular.reloadWithDebugInfo();'
$compileProvider.debugInfoEnabled(false);
//Define app palettes
$mdThemingProvider.definePalette('basePalette', {
'50': '728E9B',
'100': '728E9B',
'200': '004849', /* link-color */
'300': '775351', /* value-color */
'400': '728E9B',
'500': '728E9B', /* base-color */
'600': '728E9B',
'700': '728E9B',
'800': '728E9B',
'900': 'rgba(249,250,251,0.97)', /* tint base-color 96% */
'A100': '728E9B',
'A200': '728E9B',
'A400': '728E9B',
'A700': '728E9B',
'contrastDefaultColor': 'light',
'contrastDarkColors': ['A100'],
'contrastLightColors': undefined
});
$mdThemingProvider.definePalette('tintPalette', {
'50': '728E9B',
'100': '728E9B',
'200': 'CCDADB', /* tint link-color 20% */
'300': '728E9B',
'400': 'AABBC3', /* tint base-color 40% */
'500': '728E9B',
'600': 'C7D2D7', /* tint base-color 60% */
'700': '728E9B',
'800': 'E3E8EB', /* tint base-color 80% */
'900': '728E9B',
'A100': '728E9B',
'A200': '728E9B',
'A400': '728E9B',
'A700': '728E9B',
'contrastDefaultColor': 'light',
'contrastDarkColors': ['A100'],
'contrastLightColors': undefined
});
$mdThemingProvider.definePalette('warnPalette', {
'50': 'BA554A',
'100': 'BA554A',
'200': 'BA554A',
'300': 'BA554A',
'400': 'BA554A',
'500': 'BA554A', /* warn-color */
'600': 'BA554A',
'700': 'BA554A',
'800': 'BA554A',
'900': 'BA554A',
'A100': 'BA554A',
'A200': 'BA554A',
'A400': 'BA554A',
'A700': 'BA554A',
'contrastDefaultColor': 'light',
'contrastDarkColors': ['A100'],
'contrastLightColors': undefined
});
$mdThemingProvider.theme("default").primaryPalette("basePalette", {
"default": "500",
"hue-1": "200",
"hue-2": "300",
"hue-3": "900"
}).accentPalette("tintPalette", {
"default": "200",
"hue-1": "400",
"hue-2": "600",
"hue-3": "800"
}).warnPalette("warnPalette", {
"default": "500"
});
};
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], function () {
return (nf.ng.AppConfig = factory());
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.AppConfig = factory());
} else {
nf.ng.AppConfig = factory();
}
}(this, function () {
'use strict';
return function ($mdThemingProvider, $compileProvider) {
//Enable production mode, to re-enable debug mode open up a
//console and call 'angular.reloadWithDebugInfo();'
$compileProvider.debugInfoEnabled(false);
//Define app palettes
$mdThemingProvider.definePalette('basePalette', {
'50': '728E9B',
'100': '728E9B',
'200': '004849', /* link-color */
'300': '775351', /* value-color */
'400': '728E9B',
'500': '728E9B', /* base-color */
'600': '728E9B',
'700': '728E9B',
'800': '728E9B',
'900': 'rgba(249,250,251,0.97)', /* tint base-color 96% */
'A100': '728E9B',
'A200': '728E9B',
'A400': '728E9B',
'A700': '728E9B',
'contrastDefaultColor': 'light',
'contrastDarkColors': ['A100'],
'contrastLightColors': undefined
});
$mdThemingProvider.definePalette('tintPalette', {
'50': '728E9B',
'100': '728E9B',
'200': 'CCDADB', /* tint link-color 20% */
'300': '728E9B',
'400': 'AABBC3', /* tint base-color 40% */
'500': '728E9B',
'600': 'C7D2D7', /* tint base-color 60% */
'700': '728E9B',
'800': 'E3E8EB', /* tint base-color 80% */
'900': '728E9B',
'A100': '728E9B',
'A200': '728E9B',
'A400': '728E9B',
'A700': '728E9B',
'contrastDefaultColor': 'light',
'contrastDarkColors': ['A100'],
'contrastLightColors': undefined
});
$mdThemingProvider.definePalette('warnPalette', {
'50': 'BA554A',
'100': 'BA554A',
'200': 'BA554A',
'300': 'BA554A',
'400': 'BA554A',
'500': 'BA554A', /* warn-color */
'600': 'BA554A',
'700': 'BA554A',
'800': 'BA554A',
'900': 'BA554A',
'A100': 'BA554A',
'A200': 'BA554A',
'A400': 'BA554A',
'A700': 'BA554A',
'contrastDefaultColor': 'light',
'contrastDarkColors': ['A100'],
'contrastLightColors': undefined
});
$mdThemingProvider.theme("default").primaryPalette("basePalette", {
"default": "500",
"hue-1": "200",
"hue-2": "300",
"hue-3": "900"
}).accentPalette("tintPalette", {
"default": "200",
"hue-1": "400",
"hue-2": "600",
"hue-3": "800"
}).warnPalette("warnPalette", {
"default": "500"
});
}
}));

View File

@ -15,25 +15,41 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.ng.AppCtrl = function ($scope, serviceProvider) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['nf.ng.Bridge'],
function (angularBridge) {
return (nf.ng.AppCtrl = factory(angularBridge));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.AppCtrl = factory(require('nf.ng.Bridge')));
} else {
nf.ng.AppCtrl = factory(root.nf.ng.Bridge);
}
}(this, function (angularBridge) {
'use strict';
function AppCtrl(serviceProvider) {
//global nf namespace for reference throughout angular app
this.nf = nf;
//any registered angular service is available through the serviceProvider
this.serviceProvider = serviceProvider;
}
AppCtrl.prototype = {
constructor: AppCtrl
}
return function ($scope, serviceProvider) {
'use strict';
var appCtrl = new AppCtrl(serviceProvider);
$scope.appCtrl = appCtrl;
function AppCtrl(serviceProvider) {
//global nf namespace for reference throughout angular app
this.nf = nf;
//any registered angular service is available through the serviceProvider
this.serviceProvider = serviceProvider;
}
//For production angular applications .scope() is unavailable so we set
//the root scope of the bootstrapped app on the bridge
nf.ng.Bridge.rootScope = $scope;
};
AppCtrl.prototype = {
constructor: AppCtrl
}
var appCtrl = new AppCtrl(serviceProvider);
$scope.appCtrl = appCtrl;
//For production angular applications .scope() is unavailable so we set
//the root scope of the bootstrapped app on the bridge
angularBridge.rootScope = $scope;
}
}));

View File

@ -15,9 +15,19 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.ng.Bridge = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['angular'], function (angular) {
return (nf.ng.Bridge = factory(angular));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Bridge = factory(require('angular')));
} else {
nf.ng.Bridge = factory(root.angular);
}
}(this, function (angular) {
'use strict';
function AngularBridge() {
@ -84,7 +94,5 @@ nf.ng.Bridge = (function () {
}
};
var angularBridge = new AngularBridge();
return angularBridge;
}());
return new AngularBridge();
}));

View File

@ -15,37 +15,48 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.ng.ServiceProvider = function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], function () {
return (nf.ng.ServiceProvider = factory());
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.ServiceProvider = factory());
} else {
nf.ng.ServiceProvider = factory();
}
}(this, function () {
'use strict';
function ServiceProvider() {
}
ServiceProvider.prototype = {
constructor: ServiceProvider,
/**
* Registers the given `object` by `name`.
*
* @param {string} name The lookup name of the object being registered
* @param {object} object The object to register
*/
register: function(name, object) {
serviceProvider[name] = object;
},
/**
* Removes the given object from the registry.
*
* @param {string objectName The lookup name of the object to remove from the registry
*/
remove: function(objectName) {
delete serviceProvider[objectName];
return function () {
function ServiceProvider() {
}
}
var serviceProvider = new ServiceProvider();
return serviceProvider;
};
ServiceProvider.prototype = {
constructor: ServiceProvider,
/**
* Registers the given `object` by `name`.
*
* @param {string} name The lookup name of the object being registered
* @param {object} object The object to register
*/
register: function (name, object) {
this[name] = object;
},
/**
* Removes the given object from the registry.
*
* @param {string} objectName The lookup name of the object to remove from the registry
*/
remove: function (objectName) {
delete this[objectName];
}
}
return new ServiceProvider();
}
}));

View File

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

View File

@ -15,46 +15,64 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
$(document).ready(function () {
// configure the dialog
$('#shell-dialog').modal({
scrollableContentStyle: 'scrollable',
header: false,
footer: false,
responsive: {
x: false,
y: false
}
});
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.ContextMenu'],
function ($, common, contextMenu) {
return (nf.Shell = factory($, common, contextMenu));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Shell = factory(require('jquery'),
require('nf.Common'),
require('nf.ContextMenu')));
} else {
nf.Shell = factory(root.$,
root.nf.Common,
root.nf.ContextMenu);
}
}(this, function ($, common, contextMenu) {
'use strict';
// register a listener when the frame is closed
$('#shell-close-button').click(function () {
// close the shell
$('#shell-dialog').modal('hide');
});
// register a listener when the frame is undocked
$('#shell-undock-button').click(function () {
var uri = $('#shell-iframe').attr('src');
if (!nf.Common.isBlank(uri)) {
// open the page and close the shell
window.open(uri);
$(document).ready(function () {
// configure the dialog
$('#shell-dialog').modal({
scrollableContentStyle: 'scrollable',
header: false,
footer: false,
responsive: {
x: false,
y: false
}
});
// register a listener when the frame is closed
$('#shell-close-button').click(function () {
// close the shell
$('#shell-dialog').modal('hide');
}
});
});
});
nf.Shell = (function () {
// register a listener when the frame is undocked
$('#shell-undock-button').click(function () {
var uri = $('#shell-iframe').attr('src');
if (!common.isBlank(uri)) {
// open the page and close the shell
window.open(uri);
// close the shell
$('#shell-dialog').modal('hide');
}
});
});
var showPageResize = null;
var showContentResize = null;
return {
resizeContent: function (shell) {
var contentContainer = shell.find('.shell-content-container');
contentContainer.css({
@ -73,24 +91,24 @@ nf.Shell = (function () {
});
shell.trigger("shell:iframe:resize");
},
/**
* Shows a page in the shell.
*
*
* @argument {string} uri The URI to show
* @argument {boolean} canUndock Whether or not the shell is undockable
*/
showPage: function (uri, canUndock) {
// if the context menu is on this page, attempt to close
if (nf.Common.isDefinedAndNotNull(nf.ContextMenu)) {
nf.ContextMenu.hide();
if (common.isDefinedAndNotNull(contextMenu)) {
contextMenu.hide();
}
return $.Deferred(function (deferred) {
var shell = $('#shell');
// default undockable to true
if (nf.Common.isNull(canUndock) || nf.Common.isUndefined(canUndock)) {
if (common.isNull(canUndock) || common.isUndefined(canUndock)) {
canUndock = true;
}
@ -103,7 +121,7 @@ nf.Shell = (function () {
// register a new open handler
$('#shell-dialog').modal('setOpenHandler', function () {
nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
});
// show the custom processor ui
@ -127,19 +145,19 @@ nf.Shell = (function () {
}).appendTo(shell);
}).promise();
},
/**
* Shows the specified content in the shell. When the shell is closed, the content
* will be hidden and returned to its previous location in the dom.
*
*
* @argument {string} domId The id of the element to show in the shell
*/
showContent: function (domId) {
// if the context menu is on this page, attempt to close
if (nf.Common.isDefinedAndNotNull(nf.ContextMenu)) {
nf.ContextMenu.hide();
if (common.isDefinedAndNotNull(contextMenu)) {
contextMenu.hide();
}
return $.Deferred(function (deferred) {
var content = $(domId);
if (content.length) {
@ -154,7 +172,7 @@ nf.Shell = (function () {
// close any open combos
var combos = $('.combo');
for (var i = 0, len = combos.length; i < len; i++) {
if ($(combos[i]).is(':visible')){
if ($(combos[i]).is(':visible')) {
$(combos[i]).combo('close');
}
}
@ -179,11 +197,11 @@ nf.Shell = (function () {
width: shell.width(),
height: shell.height()
}).append(content).appendTo(shell);
// show the content
content.show();
}
}).promise();
}
};
}());
}));

View File

@ -15,9 +15,32 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.StatusHistory = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'd3',
'nf.Common',
'nf.Dialog',
'nf.ErrorHandler'],
function ($, d3, common, dialog, errorHandler) {
return (nf.StatusHistory = factory($, d3, common, dialog, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.StatusHistory = factory(require('jquery'),
require('d3'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.ErrorHandler')));
} else {
nf.StatusHistory = factory(root.$,
root.d3,
root.nf.Common,
root.nf.Dialog,
root.nf.ErrorHandler);
}
}(this, function ($, d3, common, dialog, errorHandler) {
var config = {
nifiInstanceId: 'nifi-instance-id',
nifiInstanceLabel: 'NiFi',
@ -42,19 +65,19 @@ nf.StatusHistory = (function () {
*/
var formatters = {
'DURATION': function (d) {
return nf.Common.formatDuration(d);
return common.formatDuration(d);
},
'COUNT': function (d) {
// need to handle floating point number since this formatter
// will also be used for average values
if (d % 1 === 0) {
return nf.Common.formatInteger(d);
return common.formatInteger(d);
} else {
return nf.Common.formatFloat(d);
return common.formatFloat(d);
}
},
'DATA_SIZE': function (d) {
return nf.Common.formatDataSize(d);
return common.formatDataSize(d);
}
};
@ -102,10 +125,10 @@ nf.StatusHistory = (function () {
// get the descriptors
var descriptors = componentStatusHistory.fieldDescriptors;
statusHistory.details = componentStatusHistory.componentDetails;
statusHistory.selectedDescriptor = nf.Common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor;
statusHistory.selectedDescriptor = common.isUndefined(selectedDescriptor) ? descriptors[0] : selectedDescriptor;
// ensure enough status snapshots
if (nf.Common.isDefinedAndNotNull(componentStatusHistory.aggregateSnapshots) && componentStatusHistory.aggregateSnapshots.length > 1) {
if (common.isDefinedAndNotNull(componentStatusHistory.aggregateSnapshots) && componentStatusHistory.aggregateSnapshots.length > 1) {
statusHistory.instances.push({
id: config.nifiInstanceId,
label: config.nifiInstanceLabel,
@ -119,7 +142,7 @@ nf.StatusHistory = (function () {
// get the status for each node in the cluster if applicable
$.each(componentStatusHistory.nodeSnapshots, function (_, nodeSnapshots) {
// ensure enough status snapshots
if (nf.Common.isDefinedAndNotNull(nodeSnapshots.statusSnapshots) && nodeSnapshots.statusSnapshots.length > 1) {
if (common.isDefinedAndNotNull(nodeSnapshots.statusSnapshots) && nodeSnapshots.statusSnapshots.length > 1) {
statusHistory.instances.push({
id: nodeSnapshots.nodeId,
label: nodeSnapshots.address + ':' + nodeSnapshots.apiPort,
@ -145,7 +168,7 @@ nf.StatusHistory = (function () {
*/
var insufficientHistory = function () {
// notify the user
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Status History',
dialogContent: 'Insufficient history, please try again later.'
});
@ -193,7 +216,7 @@ nf.StatusHistory = (function () {
options.push({
text: d.label,
value: d.field,
description: nf.Common.escapeHtml(d.description)
description: common.escapeHtml(d.description)
});
});
@ -306,7 +329,7 @@ nf.StatusHistory = (function () {
// go through each instance of this status history
$.each(statusHistory.instances, function (_, instance) {
// if this is the first time this instance is being rendered, make it visible
if (nf.Common.isUndefinedOrNull(instances[instance.id])) {
if (common.isUndefinedOrNull(instances[instance.id])) {
instances[instance.id] = true;
}
@ -363,7 +386,7 @@ nf.StatusHistory = (function () {
var chartContainer = $('#status-history-chart-container').empty();
if (chartContainer.hasClass('ui-resizable')) {
chartContainer.resizable('destroy');
chartContainer.removeAttr( "style" );
chartContainer.removeAttr("style");
}
// calculate the dimensions
@ -440,8 +463,8 @@ nf.StatusHistory = (function () {
return s.timestamp;
});
});
addDetailItem(detailsContainer, 'Start', nf.Common.formatDateTime(minDate));
addDetailItem(detailsContainer, 'End', nf.Common.formatDateTime(maxDate));
addDetailItem(detailsContainer, 'Start', common.formatDateTime(minDate));
addDetailItem(detailsContainer, 'End', common.formatDateTime(maxDate));
// determine the x axis range
x.domain([minDate, maxDate]);
@ -721,7 +744,7 @@ nf.StatusHistory = (function () {
.on('brush', brushed);
// conditionally set the brush extent
if (nf.Common.isDefinedAndNotNull(brushExtent)) {
if (common.isDefinedAndNotNull(brushExtent)) {
brush = brush.extent(brushExtent);
}
@ -902,7 +925,7 @@ nf.StatusHistory = (function () {
// -----------
dialog = $('#status-history-dialog');
var nfDialog = {};
if (nf.Common.isDefinedAndNotNull(dialog.data('nf-dialog'))) {
if (common.isDefinedAndNotNull(dialog.data('nf-dialog'))) {
nfDialog = dialog.data('nf-dialog');
}
nfDialog['min-width'] = (dialog.width() / $(window).width()) * 100 + '%';
@ -1019,12 +1042,12 @@ nf.StatusHistory = (function () {
$('<div class="setting-name"></div>').text(label).appendTo(detailContainer);
var detailElement = $('<div class="setting-field"></div>').text(value).appendTo(detailContainer);
if (nf.Common.isDefinedAndNotNull(valueElementId)) {
if (common.isDefinedAndNotNull(valueElementId)) {
detailElement.attr('id', valueElementId);
}
};
return {
var nfStatusHistory = {
/**
* Initializes the lineage graph.
*
@ -1037,13 +1060,13 @@ nf.StatusHistory = (function () {
var statusHistory = $('#status-history-dialog').data('status-history');
if (statusHistory !== null) {
if (statusHistory.type === config.type.processor) {
nf.StatusHistory.showProcessorChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
nfStatusHistory.showProcessorChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
} else if (statusHistory.type === config.type.processGroup) {
nf.StatusHistory.showProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
nfStatusHistory.showProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
} else if (statusHistory.type === config.type.remoteProcessGroup) {
nf.StatusHistory.showRemoteProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
nfStatusHistory.showRemoteProcessGroupChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
} else {
nf.StatusHistory.showConnectionChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
nfStatusHistory.showConnectionChart(statusHistory.groupId, statusHistory.id, statusHistory.selectedDescriptor);
}
}
});
@ -1088,7 +1111,7 @@ nf.StatusHistory = (function () {
if (e.target === window) {
updateChart();
}
nf.Common.toggleScrollable($('#status-history-details').get(0));
common.toggleScrollable($('#status-history-details').get(0));
})
},
@ -1106,7 +1129,7 @@ nf.StatusHistory = (function () {
dataType: 'json'
}).done(function (response) {
handleStatusHistoryResponse(groupId, connectionId, response.statusHistory, config.type.connection, selectedDescriptor);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
},
/**
@ -1123,7 +1146,7 @@ nf.StatusHistory = (function () {
dataType: 'json'
}).done(function (response) {
handleStatusHistoryResponse(groupId, processorId, response.statusHistory, config.type.processor, selectedDescriptor);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
},
/**
@ -1140,7 +1163,7 @@ nf.StatusHistory = (function () {
dataType: 'json'
}).done(function (response) {
handleStatusHistoryResponse(groupId, processGroupId, response.statusHistory, config.type.processGroup, selectedDescriptor);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
},
/**
@ -1157,7 +1180,9 @@ nf.StatusHistory = (function () {
dataType: 'json'
}).done(function (response) {
handleStatusHistoryResponse(groupId, remoteProcessGroupId, response.statusHistory, config.type.remoteProcessGroup, selectedDescriptor);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}
};
}());
return nfStatusHistory;
}));

View File

@ -15,9 +15,19 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.Storage = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], function () {
return (nf.Storage = factory());
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Storage = factory());
} else {
nf.Storage = factory();
}
}(this, function () {
// Store items for two days before being eligible for removal.
var MILLIS_PER_DAY = 86400000;
@ -37,7 +47,7 @@ nf.Storage = (function () {
/**
* Checks the expiration for the specified entry.
*
*
* @param {object} entry
* @returns {boolean}
*/
@ -53,10 +63,10 @@ nf.Storage = (function () {
return false;
}
};
/**
* Gets an enty for the key. The entry expiration is not checked.
*
*
* @param {string} key
*/
var getEntry = function (key) {
@ -74,7 +84,7 @@ nf.Storage = (function () {
return null;
}
};
return {
/**
* Initializes the storage. Items will be persisted for two days. Once the scripts runs
@ -85,17 +95,17 @@ nf.Storage = (function () {
try {
// get the next item
var key = localStorage.key(i);
// attempt to get the item which will expire if necessary
nf.Storage.getItem(key);
this.getItem(key);
} catch (e) {
}
}
},
/**
* Stores the specified item.
*
*
* @param {string} key
* @param {object} item
* @param {integer} expires
@ -113,23 +123,23 @@ nf.Storage = (function () {
// store the item
localStorage.setItem(key, JSON.stringify(entry));
},
/**
* Returns whether there is an entry for this key. This will not check the expiration. If
* the entry is expired, it will return null on a subsequent getItem invocation.
*
*
* @param {string} key
* @returns {boolean}
*/
hasItem: function (key) {
return getEntry(key) !== null;
},
/**
* Gets the item with the specified key. If an item with this key does
* not exist, null is returned. If an item exists but cannot be parsed
* or is malformed/unrecognized, null is returned.
*
*
* @param {type} key
*/
getItem: function (key) {
@ -140,7 +150,7 @@ nf.Storage = (function () {
// if the entry is expired, drop it and return null
if (checkExpiration(entry)) {
nf.Storage.removeItem(key);
this.removeItem(key);
return null;
}
@ -151,11 +161,11 @@ nf.Storage = (function () {
return null;
}
},
/**
* Gets the expiration for the specified item. This will not check the expiration. If
* the entry is expired, it will return null on a subsequent getItem invocation.
*
*
* @param {string} key
* @returns {integer}
*/
@ -172,14 +182,14 @@ nf.Storage = (function () {
return null;
}
},
/**
* Removes the item with the specified key.
*
*
* @param {type} key
*/
removeItem: function (key) {
localStorage.removeItem(key);
}
};
}());
}));

View File

@ -15,108 +15,122 @@
* limitations under the License.
*/
/**
* Captures keydown on the window to ensure certain keystrokes are handled in a consistent manner, particularly those
* that can lead to browser navigation/reload.
*/
$(document).ready(function ($) {
// setup a listener to ensure keystrokes are being overridden in a consistent manner
$(window).on('keydown', function (evt) {
// consider escape, before checking dialogs
var isCtrl = evt.ctrlKey || evt.metaKey;
if (!isCtrl && evt.keyCode === 27) {
// esc
/* global nf, define, module, require, exports */
// prevent escape when editing a property with allowable values - that component does not handle key
// events so it can bubble up to here. once here we are unable to cancel the current edit so we simply
// return. this is not an issue for viewing in read only mode as the table is not in an edit mode. this
// is not an issue for other fields as they can handle key events locally and cancel the edit appropriately
var visibleCombo = $('div.value-combo');
if (visibleCombo.is(':visible') && visibleCombo.parent().hasClass('combo-editor')) {
return;
}
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], function ($) {
return (nf.UniversalCapture = factory($));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.UniversalCapture = factory(require('jquery')));
} else {
nf.UniversalCapture = factory(root.$);
}
}(this, function ($) {
'use strict';
// consider property detail dialogs
if ($('div.property-detail').is(':visible')) {
nf.UniversalCapture.removeAllPropertyDetailDialogs();
/**
* Captures keydown on the window to ensure certain keystrokes are handled in a consistent manner, particularly those
* that can lead to browser navigation/reload.
*/
$(document).ready(function ($) {
// setup a listener to ensure keystrokes are being overridden in a consistent manner
$(window).on('keydown', function (evt) {
// consider escape, before checking dialogs
var isCtrl = evt.ctrlKey || evt.metaKey;
if (!isCtrl && evt.keyCode === 27) {
// esc
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
evt.preventDefault();
} else {
var target = $(evt.target);
if (target.length) {
// special handling for body as the target
var cancellables = $('.cancellable');
if (cancellables.length) {
var zIndexMax = null;
var dialogMax = null;
// prevent escape when editing a property with allowable values - that component does not handle key
// events so it can bubble up to here. once here we are unable to cancel the current edit so we simply
// return. this is not an issue for viewing in read only mode as the table is not in an edit mode. this
// is not an issue for other fields as they can handle key events locally and cancel the edit appropriately
var visibleCombo = $('div.value-combo');
if (visibleCombo.is(':visible') && visibleCombo.parent().hasClass('combo-editor')) {
return;
}
// identify the top most cancellable
$.each(cancellables, function (_, cancellable) {
var dialog = $(cancellable);
var zIndex = dialog.css('zIndex');
// consider property detail dialogs
if ($('div.property-detail').is(':visible')) {
nfUniversalDialog.removeAllPropertyDetailDialogs();
// if the dialog has a zIndex consider it
if (dialog.is(':visible') && (zIndex !== null && typeof zIndex !== 'undefined')) {
zIndex = parseInt(zIndex, 10);
if (zIndexMax === null || zIndex > zIndexMax) {
zIndexMax = zIndex;
dialogMax = dialog;
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
evt.preventDefault();
} else {
var target = $(evt.target);
if (target.length) {
// special handling for body as the target
var cancellables = $('.cancellable');
if (cancellables.length) {
var zIndexMax = null;
var dialogMax = null;
// identify the top most cancellable
$.each(cancellables, function (_, cancellable) {
var dialog = $(cancellable);
var zIndex = dialog.css('zIndex');
// if the dialog has a zIndex consider it
if (dialog.is(':visible') && (zIndex !== null && typeof zIndex !== 'undefined')) {
zIndex = parseInt(zIndex, 10);
if (zIndexMax === null || zIndex > zIndexMax) {
zIndexMax = zIndex;
dialogMax = dialog;
}
}
});
// if we've identified a dialog to close do so and stop propagation
if (dialogMax !== null) {
// hide the cancellable
if (dialogMax.hasClass('modal')) {
dialogMax.modal('hide');
} else {
dialogMax.hide();
}
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
evt.preventDefault();
return;
}
});
}
// if we've identified a dialog to close do so and stop propagation
if (dialogMax !== null) {
// hide the cancellable
if (dialogMax.hasClass('modal')) {
dialogMax.modal('hide');
} else {
dialogMax.hide();
// now see if we're in a frame
if (top !== window) {
// and our parent has shell defined
if (typeof parent.nf !== 'undefined' && typeof parent.nf.Shell !== 'undefined') {
parent.$('#shell-close-button').click();
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
evt.preventDefault();
return;
}
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
evt.preventDefault();
return;
}
}
// now see if we're in a frame
if (top !== window) {
// and our parent has shell defined
if (typeof parent.nf !== 'undefined' && typeof parent.nf.Shell !== 'undefined') {
parent.$('#shell-close-button').click();
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
evt.preventDefault();
return;
}
}
}
}
} else {
if (isCtrl) {
if (evt.keyCode === 82) {
// ctrl-r
evt.preventDefault();
}
} else {
if (!$('input, textarea').is(':focus') && (evt.keyCode == 8 || evt.keyCode === 46)) {
// backspace or delete
evt.preventDefault();
if (isCtrl) {
if (evt.keyCode === 82) {
// ctrl-r
evt.preventDefault();
}
} else {
if (!$('input, textarea').is(':focus') && (evt.keyCode == 8 || evt.keyCode === 46)) {
// backspace or delete
evt.preventDefault();
}
}
}
}
});
});
});
nf.UniversalCapture = (function() {
return {
var nfUniversalDialog = {
/**
* Removes all read only property detail dialogs.
*/
@ -127,4 +141,6 @@ nf.UniversalCapture = (function() {
propertyDetails.hide().remove();
}
};
}());
return nfUniversalDialog;
}));

View File

@ -15,285 +15,348 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
$(document).ready(function () {
//Create Angular App
var app = angular.module('ngProvenanceApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
//Define Dependency Injection Annotations
nf.ng.AppConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
nf.ng.AppCtrl.$inject = ['$scope'];
nf.ng.Provenance.$inject = ['provenanceTableCtrl'];
nf.ng.ProvenanceLineage.$inject = [];
nf.ng.ProvenanceTable.$inject = ['provenanceLineageCtrl'];
//Configure Angular App
app.config(nf.ng.AppConfig);
//Define Angular App Controllers
app.controller('ngProvenanceAppCtrl', nf.ng.AppCtrl);
//Define Angular App Services
app.service('provenanceCtrl', nf.ng.Provenance);
app.service('provenanceLineageCtrl', nf.ng.ProvenanceLineage);
app.service('provenanceTableCtrl', nf.ng.ProvenanceTable);
//Manually Boostrap Angular App
nf.ng.Bridge.injector = angular.bootstrap($('body'), ['ngProvenanceApp'], { strictDi: true });
// initialize the status page
nf.ng.Bridge.injector.get('provenanceCtrl').init();
});
nf.ng.Provenance = function (provenanceTableCtrl) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'angular',
'nf.Common',
'nf.ng.AppConfig',
'nf.ng.AppCtrl',
'nf.ng.ProvenanceLineage',
'nf.ng.ProvenanceTable',
'nf.ng.Bridge',
'nf.ErrorHandler',
'nf.Storage'],
function ($,
angular,
common,
appConfig,
appCtrl,
provenanceLineage,
provenanceTable,
angularBridge,
errorHandler,
storage) {
return (nf.ng.Provenance =
factory($,
angular,
common,
appConfig,
appCtrl,
provenanceLineage,
provenanceTable,
angularBridge,
errorHandler,
storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.Provenance =
factory(require('jquery'),
require('angular'),
require('nf.Common'),
require('nf.ng.AppConfig'),
require('nf.ng.AppCtrl'),
require('nf.ng.ProvenanceLineage'),
require('nf.ng.ProvenanceTable'),
require('nf.ng.Bridge'),
require('nf.ErrorHandler'),
require('nf.Storage')));
} else {
nf.ng.Provenance = factory(root.$,
root.angular,
root.nf.Common,
root.nf.ng.AppConfig,
root.nf.ng.AppCtrl,
root.nf.ng.ProvenanceLineage,
root.nf.ng.ProvenanceTable,
root.nf.ng.Bridge,
root.nf.ErrorHandler,
root.nf.Storage);
}
}(this, function ($, angular, common, appConfig, appCtrl, provenanceLineage, provenanceTable, angularBridge, errorHandler, storage) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
*/
var config = {
urls: {
clusterSummary: '../nifi-api/flow/cluster/summary',
banners: '../nifi-api/flow/banners',
about: '../nifi-api/flow/about',
currentUser: '../nifi-api/flow/current-user'
}
};
$(document).ready(function () {
//Create Angular App
var app = angular.module('ngProvenanceApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
/**
* Whether or not this NiFi is clustered.
*/
var isClustered = null;
//Define Dependency Injection Annotations
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
appCtrl.$inject = ['$scope'];
nfProvenance.$inject = ['provenanceTableCtrl'];
provenanceLineage.$inject = [];
provenanceTable.$inject = ['provenanceLineageCtrl'];
/**
* Determines if this NiFi is clustered.
*/
var detectedCluster = function () {
return $.ajax({
type: 'GET',
url: config.urls.clusterSummary
}).done(function (response) {
isClustered = response.clusterSummary.connectedToCluster;
}).fail(nf.Common.handleAjaxError);
};
//Configure Angular App
app.config(appConfig);
/**
* Loads the controller configuration.
*/
var loadAbout = function () {
// get the about details
return $.ajax({
type: 'GET',
url: config.urls.about,
dataType: 'json'
}).done(function (response) {
var aboutDetails = response.about;
var provenanceTitle = aboutDetails.title + ' Data Provenance';
//Define Angular App Controllers
app.controller('ngProvenanceAppCtrl', appCtrl);
// store the controller name
$('#nifi-controller-uri').text(aboutDetails.uri);
//Define Angular App Services
app.service('provenanceCtrl', nfProvenance);
app.service('provenanceLineageCtrl', provenanceLineage);
app.service('provenanceTableCtrl', provenanceTable);
// set the timezone for the start and end time
$('.timezone').text(aboutDetails.timezone);
//Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngProvenanceApp'], {strictDi: true});
// store the content viewer url if available
if (!nf.Common.isBlank(aboutDetails.contentViewerUrl)) {
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
}
// initialize the status page
angularBridge.injector.get('provenanceCtrl').init();
});
// set the document title and the about title
document.title = provenanceTitle;
$('#provenance-header-text').text(provenanceTitle);
}).fail(nf.Common.handleAjaxError);
};
/**
* Loads the current user.
*/
var loadCurrentUser = function () {
return $.ajax({
type: 'GET',
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
};
/**
* Initializes the provenance page.
*/
var initializeProvenancePage = function () {
// define mouse over event for the refresh button
$('#refresh-button').click(function () {
provenanceTableCtrl.loadProvenanceTable();
});
// return a deferred for page initialization
return $.Deferred(function (deferred) {
// get the banners if we're not in the shell
if (top === window) {
$.ajax({
type: 'GET',
url: config.urls.banners,
dataType: 'json'
}).done(function (response) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(response.banners)) {
if (nf.Common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
// show the banner
var updateTop = function (elementId) {
var element = $('#' + elementId);
element.css('top', (parseInt(bannerHeader.css('height'), 10) + parseInt(element.css('top'), 10)) + 'px');
};
// update the position of elements affected by top banners
updateTop('provenance');
}
if (nf.Common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
var updateBottom = function (elementId) {
var element = $('#' + elementId);
element.css('bottom', parseInt(bannerFooter.css('height'), 10) + 'px');
};
// update the position of elements affected by bottom banners
updateBottom('provenance');
}
}
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
deferred.resolve();
}
}).promise();
};
function ProvenanceCtrl() {
}
ProvenanceCtrl.prototype = {
constructor: ProvenanceCtrl,
var nfProvenance = function (provenanceTableCtrl) {
/**
* Initializes the status page.
* Configuration object used to hold a number of configuration items.
*/
init: function () {
nf.Storage.init();
var config = {
urls: {
clusterSummary: '../nifi-api/flow/cluster/summary',
banners: '../nifi-api/flow/banners',
about: '../nifi-api/flow/about',
currentUser: '../nifi-api/flow/current-user'
}
};
// load the user and detect if the NiFi is clustered
$.when(loadAbout(), loadCurrentUser(), detectedCluster()).done(function () {
// create the provenance table
provenanceTableCtrl.init(isClustered).done(function () {
var searchTerms = {};
/**
* Whether or not this NiFi is clustered.
*/
var isClustered = null;
// look for a processor id in the query search
var initialComponentId = $('#initial-component-query').text();
if ($.trim(initialComponentId) !== '') {
// populate initial search component
$('input.searchable-component-id').val(initialComponentId);
/**
* Determines if this NiFi is clustered.
*/
var detectedCluster = function () {
return $.ajax({
type: 'GET',
url: config.urls.clusterSummary
}).done(function (response) {
isClustered = response.clusterSummary.connectedToCluster;
}).fail(errorHandler.handleAjaxError);
};
// build the search criteria
searchTerms['ProcessorID'] = initialComponentId;
}
/**
* Loads the controller configuration.
*/
var loadAbout = function () {
// get the about details
return $.ajax({
type: 'GET',
url: config.urls.about,
dataType: 'json'
}).done(function (response) {
var aboutDetails = response.about;
var provenanceTitle = aboutDetails.title + ' Data Provenance';
// look for a flowfile uuid in the query search
var initialFlowFileUuid = $('#initial-flowfile-query').text();
if ($.trim(initialFlowFileUuid) !== '') {
// populate initial search component
$('input.searchable-flowfile-uuid').val(initialFlowFileUuid);
// store the controller name
$('#nifi-controller-uri').text(aboutDetails.uri);
// build the search criteria
searchTerms['FlowFileUUID'] = initialFlowFileUuid;
}
// set the timezone for the start and end time
$('.timezone').text(aboutDetails.timezone);
// load the provenance table
if ($.isEmptyObject(searchTerms)) {
// load the provenance table
provenanceTableCtrl.loadProvenanceTable();
} else {
// load the provenance table
provenanceTableCtrl.loadProvenanceTable({
'searchTerms': searchTerms
});
}
// store the content viewer url if available
if (!common.isBlank(aboutDetails.contentViewerUrl)) {
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
}
var setBodySize = function () {
//alter styles if we're not in the shell
if (top === window) {
$('body').css({
'height': $(window).height() + 'px',
'width': $(window).width() + 'px'
});
// set the document title and the about title
document.title = provenanceTitle;
$('#provenance-header-text').text(provenanceTitle);
}).fail(errorHandler.handleAjaxError);
};
$('#provenance').css('margin', 40);
$('#provenance-refresh-container').css({
'bottom': '0px',
'left': '0px',
'right': '0px'
});
/**
* Loads the current user.
*/
var loadCurrentUser = function () {
return $.ajax({
type: 'GET',
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
common.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError);
};
/**
* Initializes the provenance page.
*/
var initializeProvenancePage = function () {
// define mouse over event for the refresh button
$('#refresh-button').click(function () {
provenanceTableCtrl.loadProvenanceTable();
});
// return a deferred for page initialization
return $.Deferred(function (deferred) {
// get the banners if we're not in the shell
if (top === window) {
$.ajax({
type: 'GET',
url: config.urls.banners,
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 !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
// show the banner
var updateTop = function (elementId) {
var element = $('#' + elementId);
element.css('top', (parseInt(bannerHeader.css('height'), 10) + parseInt(element.css('top'), 10)) + 'px');
};
// update the position of elements affected by top banners
updateTop('provenance');
}
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
var updateBottom = function (elementId) {
var element = $('#' + elementId);
element.css('bottom', parseInt(bannerFooter.css('height'), 10) + 'px');
};
// update the position of elements affected by bottom banners
updateBottom('provenance');
}
}
// configure the initial grid height
provenanceTableCtrl.resetTableSize();
};
// once the table is initialized, finish initializing the page
initializeProvenancePage().done(function () {
// set the initial size
setBodySize();
deferred.resolve();
}).fail(function (xhr, status, error) {
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
deferred.resolve();
}
}).promise();
};
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
function ProvenanceCtrl() {
}
ProvenanceCtrl.prototype = {
constructor: ProvenanceCtrl,
/**
* Initializes the status page.
*/
init: function () {
storage.init();
// load the user and detect if the NiFi is clustered
$.when(loadAbout(), loadCurrentUser(), detectedCluster()).done(function () {
// create the provenance table
provenanceTableCtrl.init(isClustered).done(function () {
var searchTerms = {};
// look for a processor id in the query search
var initialComponentId = $('#initial-component-query').text();
if ($.trim(initialComponentId) !== '') {
// populate initial search component
$('input.searchable-component-id').val(initialComponentId);
// build the search criteria
searchTerms['ProcessorID'] = initialComponentId;
}
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
// look for a flowfile uuid in the query search
var initialFlowFileUuid = $('#initial-flowfile-query').text();
if ($.trim(initialFlowFileUuid) !== '') {
// populate initial search component
$('input.searchable-flowfile-uuid').val(initialFlowFileUuid);
// build the search criteria
searchTerms['FlowFileUUID'] = initialFlowFileUuid;
}
// toggle tabs .scrollable when appropriate
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')){
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
// load the provenance table
if ($.isEmptyObject(searchTerms)) {
// load the provenance table
provenanceTableCtrl.loadProvenanceTable();
} else {
// load the provenance table
provenanceTableCtrl.loadProvenanceTable({
'searchTerms': searchTerms
});
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
var setBodySize = function () {
//alter styles if we're not in the shell
if (top === window) {
$('body').css({
'height': $(window).height() + 'px',
'width': $(window).width() + 'px'
});
$('#provenance').css('margin', 40);
$('#provenance-refresh-container').css({
'bottom': '0px',
'left': '0px',
'right': '0px'
});
}
// configure the initial grid height
provenanceTableCtrl.resetTableSize();
};
// once the table is initialized, finish initializing the page
initializeProvenancePage().done(function () {
// set the initial size
setBodySize();
});
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
}
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
}
// toggle tabs .scrollable when appropriate
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')) {
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
}
$.each(tabsContents, function (index, tabsContent) {
common.toggleScrollable(tabsContent.get(0));
});
});
});
});
});
}
}
var provenanceCtrl = new ProvenanceCtrl();
return provenanceCtrl;
}
var provenanceCtrl = new ProvenanceCtrl();
return provenanceCtrl;
};
return nfProvenance;
}));

View File

@ -14,7 +14,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
nf.ClusterSearch = (function () {
/* global nf, define, module, require, exports */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.Dialog',
'nf.SummaryTable'],
function ($, common, dialog, summaryTable) {
return (nf.ClusterSearch = factory($, common, dialog, summaryTable));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ClusterSearch =
factory(require('jquery'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.SummaryTable')));
} else {
nf.ClusterSearch = factory(root.$,
root.nf.Common,
root.nf.Dialog,
root.nf.SummaryTable);
}
}(this, function ($, common, dialog, summaryTable) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
*/
@ -59,10 +85,10 @@ nf.ClusterSearch = (function () {
// selects the specified node
var selectNode = function (node) {
// update the urls to point to this specific node of the cluster
nf.SummaryTable.setClusterNodeId(node.id);
summaryTable.setClusterNodeId(node.id);
// load the summary for the selected node
nf.SummaryTable.loadSummaryTable();
summaryTable.loadSummaryTable();
// update the header
$('#summary-header-text').text(node.address + ' Summary');
@ -70,9 +96,9 @@ nf.ClusterSearch = (function () {
// ensure the search found some results
if (!$.isArray(searchResults) || searchResults.length === 0) {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Cluster Search',
dialogContent: 'No nodes match \'' + nf.Common.escapeHtml(clusterSearchTerm) + '\'.'
dialogContent: 'No nodes match \'' + common.escapeHtml(clusterSearchTerm) + '\'.'
});
} else if (searchResults.length > 1) {
var exactMatch = false;
@ -91,9 +117,9 @@ nf.ClusterSearch = (function () {
// close the dialog
$('#view-single-node-dialog').modal('hide');
} else {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Cluster Search',
dialogContent: 'More than one node matches \'' + nf.Common.escapeHtml(clusterSearchTerm) + '\'.'
dialogContent: 'More than one node matches \'' + common.escapeHtml(clusterSearchTerm) + '\'.'
});
}
} else if (searchResults.length === 1) {
@ -146,9 +172,9 @@ nf.ClusterSearch = (function () {
// results are normalized into a single element array
var searchResults = items[0];
var self = this;
var nfClusterSearchAutocomplete = this;
$.each(searchResults.nodeResults, function (_, node) {
self._renderItem(ul, {
nfClusterSearchAutocomplete._renderItem(ul, {
label: node.address,
value: node.address
});
@ -208,8 +234,8 @@ nf.ClusterSearch = (function () {
// handle the view cluster click event
$('#view-cluster-link').click(function () {
// reset the urls and refresh the table
nf.SummaryTable.setClusterNodeId(null);
nf.SummaryTable.loadSummaryTable();
summaryTable.setClusterNodeId(null);
summaryTable.loadSummaryTable();
// update the header
$('#summary-header-text').text('NiFi Summary');
@ -219,4 +245,4 @@ nf.ClusterSearch = (function () {
$('#view-options-container').show();
}
};
}());
}));

View File

@ -14,9 +14,43 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* global nf, top, Slick */
/* global nf, top, define, module, require, exports */
nf.SummaryTable = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.ErrorHandler',
'nf.StatusHistory',
'nf.ProcessorDetails',
'nf.ConnectionDetails',
'nf.ng.Bridge'],
function ($, Slick, common, errorHandler, statusHistory, processorDetails, connectionDetails, angularBridge) {
return (nf.SummaryTable = factory($, Slick, common, errorHandler, statusHistory, processorDetails, connectionDetails, angularBridge));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.SummaryTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.ErrorHandler'),
require('nf.StatusHistory'),
require('nf.ProcessorDetails'),
require('nf.ConnectionDetails'),
require('nf.ng.Bridge')));
} else {
nf.SummaryTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.ErrorHandler,
root.nf.StatusHistory,
root.nf.ProcessorDetails,
root.nf.ConnectionDetails,
root.nf.ng.Bridge);
}
}(this, function ($, Slick, common, errorHandler, statusHistory, processorDetails, connectionDetails, angularBridge) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
@ -40,7 +74,7 @@ nf.SummaryTable = (function () {
// only attempt this if we're within a frame
if (top !== window) {
// and our parent has canvas utils and shell defined
if (nf.Common.isDefinedAndNotNull(parent.nf) && nf.Common.isDefinedAndNotNull(parent.nf.CanvasUtils) && nf.Common.isDefinedAndNotNull(parent.nf.Shell)) {
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.showComponent(groupId, componentId);
parent.$('#shell-close-button').click();
}
@ -87,12 +121,12 @@ nf.SummaryTable = (function () {
if (tab === 'Processors') {
// ensure the processor table is sized properly
var processorsGrid = $('#processor-summary-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(processorsGrid)) {
if (common.isDefinedAndNotNull(processorsGrid)) {
processorsGrid.resizeCanvas();
// update the total number of processors
$('#displayed-items').text(nf.Common.formatInteger(processorsGrid.getData().getLength()));
$('#total-items').text(nf.Common.formatInteger(processorsGrid.getData().getLength()));
$('#displayed-items').text(common.formatInteger(processorsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(processorsGrid.getData().getLength()));
}
// update the combo for processors
@ -111,12 +145,12 @@ nf.SummaryTable = (function () {
} else if (tab === 'Connections') {
// ensure the connection table is size properly
var connectionsGrid = $('#connection-summary-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(connectionsGrid)) {
if (common.isDefinedAndNotNull(connectionsGrid)) {
connectionsGrid.resizeCanvas();
// update the total number of connections
$('#displayed-items').text(nf.Common.formatInteger(connectionsGrid.getData().getLength()));
$('#total-items').text(nf.Common.formatInteger(connectionsGrid.getData().getLength()));
$('#displayed-items').text(common.formatInteger(connectionsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(connectionsGrid.getData().getLength()));
}
// update the combo for connections
@ -138,12 +172,12 @@ nf.SummaryTable = (function () {
} else if (tab === 'Input Ports') {
// ensure the connection table is size properly
var inputPortsGrid = $('#input-port-summary-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(inputPortsGrid)) {
if (common.isDefinedAndNotNull(inputPortsGrid)) {
inputPortsGrid.resizeCanvas();
// update the total number of input ports
$('#displayed-items').text(nf.Common.formatInteger(inputPortsGrid.getData().getLength()));
$('#total-items').text(nf.Common.formatInteger(inputPortsGrid.getData().getLength()));
$('#displayed-items').text(common.formatInteger(inputPortsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(inputPortsGrid.getData().getLength()));
}
// update the combo for input ports
@ -159,12 +193,12 @@ nf.SummaryTable = (function () {
} else if (tab === 'Output Ports') {
// ensure the connection table is size properly
var outputPortsGrid = $('#output-port-summary-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(outputPortsGrid)) {
if (common.isDefinedAndNotNull(outputPortsGrid)) {
outputPortsGrid.resizeCanvas();
// update the total number of output ports
$('#displayed-items').text(nf.Common.formatInteger(outputPortsGrid.getData().getLength()));
$('#total-items').text(nf.Common.formatInteger(outputPortsGrid.getData().getLength()));
$('#displayed-items').text(common.formatInteger(outputPortsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(outputPortsGrid.getData().getLength()));
}
// update the combo for output ports
@ -180,12 +214,12 @@ nf.SummaryTable = (function () {
} else if (tab === 'Remote Process Groups') {
// ensure the connection table is size properly
var remoteProcessGroupsGrid = $('#remote-process-group-summary-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(remoteProcessGroupsGrid)) {
if (common.isDefinedAndNotNull(remoteProcessGroupsGrid)) {
remoteProcessGroupsGrid.resizeCanvas();
// update the total number of remote process groups
$('#displayed-items').text(nf.Common.formatInteger(remoteProcessGroupsGrid.getData().getLength()));
$('#total-items').text(nf.Common.formatInteger(remoteProcessGroupsGrid.getData().getLength()));
$('#displayed-items').text(common.formatInteger(remoteProcessGroupsGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(remoteProcessGroupsGrid.getData().getLength()));
}
// update the combo for remote process groups
@ -204,12 +238,12 @@ nf.SummaryTable = (function () {
} else {
// ensure the connection table is size properly
var processGroupGrid = $('#process-group-summary-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(processGroupGrid)) {
if (common.isDefinedAndNotNull(processGroupGrid)) {
processGroupGrid.resizeCanvas();
// update the total number of process groups
$('#displayed-items').text(nf.Common.formatInteger(processGroupGrid.getData().getLength()));
$('#total-items').text(nf.Common.formatInteger(processGroupGrid.getData().getLength()));
$('#displayed-items').text(common.formatInteger(processGroupGrid.getData().getLength()));
$('#total-items').text(common.formatInteger(processGroupGrid.getData().getLength()));
}
// update the combo for process groups
@ -235,8 +269,8 @@ nf.SummaryTable = (function () {
var markup = '<div title="View Processor Details" class="pointer show-processor-details fa fa-info-circle" style="margin-right: 3px;"></div>';
// if there are bulletins, render them on the graph
if (!nf.Common.isEmpty(dataContext.bulletins)) {
markup += '<div class="has-bulletins fa fa-sticky-note-o"></div><span class="hidden row-id">' + nf.Common.escapeHtml(dataContext.id) + '</span>';
if (!common.isEmpty(dataContext.bulletins)) {
markup += '<div class="has-bulletins fa fa-sticky-note-o"></div><span class="hidden row-id">' + common.escapeHtml(dataContext.id) + '</span>';
}
return markup;
@ -249,22 +283,22 @@ nf.SummaryTable = (function () {
// formatter for tasks
var taskTimeFormatter = function (row, cell, value, columnDef, dataContext) {
return nf.Common.formatInteger(dataContext.tasks) + ' / ' + dataContext.tasksDuration;
return common.formatInteger(dataContext.tasks) + ' / ' + dataContext.tasksDuration;
};
// function for formatting the last accessed time
var valueFormatter = function (row, cell, value, columnDef, dataContext) {
return nf.Common.formatValue(value);
return common.formatValue(value);
};
// define a custom formatter for the run status column
var runStatusFormatter = function (row, cell, value, columnDef, dataContext) {
var activeThreadCount = '';
if (nf.Common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
if (common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.activeThreadCount + ')';
}
var classes = nf.Common.escapeHtml(value.toLowerCase());
switch(nf.Common.escapeHtml(value.toLowerCase())) {
var classes = common.escapeHtml(value.toLowerCase());
switch (common.escapeHtml(value.toLowerCase())) {
case 'running':
classes += ' fa fa-play running';
break;
@ -284,7 +318,7 @@ nf.SummaryTable = (function () {
classes += '';
}
var formattedValue = '<div layout="row"><div class="' + classes + '"></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + nf.Common.escapeHtml(value) + '</div><div style="float: left; margin-left: 4px;">' + nf.Common.escapeHtml(activeThreadCount) + '</div></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + common.escapeHtml(value) + '</div><div style="float: left; margin-left: 4px;">' + common.escapeHtml(activeThreadCount) + '</div></div>';
};
// define the input, read, written, and output columns (reused between both tables)
@ -357,16 +391,11 @@ nf.SummaryTable = (function () {
tasksTimeColumn
];
// initialize the search field if applicable
if (isClustered) {
nf.ClusterSearch.init();
}
// determine if the this page is in the shell
var isInShell = (top !== window);
// add an action column if appropriate
if (isClustered || isInShell || nf.Common.SUPPORTS_SVG) {
if (isClustered || isInShell || common.SUPPORTS_SVG) {
// define how the column is formatted
var processorActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = '';
@ -375,7 +404,7 @@ nf.SummaryTable = (function () {
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Processor" style="margin-right: 3px;"></div>';
}
if (nf.Common.SUPPORTS_SVG) {
if (common.SUPPORTS_SVG) {
markup += '<div class="pointer show-processor-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
}
@ -450,7 +479,7 @@ nf.SummaryTable = (function () {
if (target.hasClass('go-to')) {
goTo(item.groupId, item.id);
} else if (target.hasClass('show-processor-status-history')) {
nf.StatusHistory.showProcessorChart(item.groupId, item.id);
statusHistory.showProcessorChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-processor-summary')) {
// load the cluster processor summary
loadClusterProcessorSummary(item.groupId, item.id);
@ -466,7 +495,7 @@ nf.SummaryTable = (function () {
}
} else if (processorsGrid.getColumns()[args.cell].id === 'moreDetails') {
if (target.hasClass('show-processor-details')) {
nf.ProcessorDetails.showDetails(item.groupId, item.id);
processorDetails.showDetails(item.groupId, item.id);
}
}
});
@ -478,7 +507,7 @@ nf.SummaryTable = (function () {
// update the total number of displayed processors if necessary
if ($('#processor-summary-table').is(':visible')) {
$('#displayed-items').text(nf.Common.formatInteger(args.current));
$('#displayed-items').text(common.formatInteger(args.current));
}
});
processorsData.onRowsChanged.subscribe(function (e, args) {
@ -496,12 +525,12 @@ nf.SummaryTable = (function () {
var item = processorsData.getItemById(processorId);
// format the tooltip
var bulletins = nf.Common.getFormattedBulletins(item.bulletins);
var tooltip = nf.Common.formatUnorderedList(bulletins);
var bulletins = common.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins);
// show the tooltip
if (nf.Common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, nf.Common.config.tooltipConfig, {
if (common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, {
content: tooltip,
position: {
container: $('#summary'),
@ -617,11 +646,11 @@ nf.SummaryTable = (function () {
var backpressureFormatter = function (row, cell, value, columnDef, dataContext) {
var percentUseCount = 'NA';
if (nf.Common.isDefinedAndNotNull(dataContext.percentUseCount)) {
if (common.isDefinedAndNotNull(dataContext.percentUseCount)) {
percentUseCount = dataContext.percentUseCount + '%';
}
var percentUseBytes = 'NA';
if (nf.Common.isDefinedAndNotNull(dataContext.percentUseBytes)) {
if (common.isDefinedAndNotNull(dataContext.percentUseBytes)) {
percentUseBytes = dataContext.percentUseBytes + '%';
}
return percentUseCount + ' / ' + percentUseBytes;
@ -675,7 +704,7 @@ nf.SummaryTable = (function () {
];
// add an action column if appropriate
if (isClustered || isInShell || nf.Common.SUPPORTS_SVG) {
if (isClustered || isInShell || common.SUPPORTS_SVG) {
// define how the column is formatted
var connectionActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = '';
@ -684,7 +713,7 @@ nf.SummaryTable = (function () {
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Connection" style="margin-right: 3px;"></div>';
}
if (nf.Common.SUPPORTS_SVG) {
if (common.SUPPORTS_SVG) {
markup += '<div class="pointer show-connection-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
}
@ -759,7 +788,7 @@ nf.SummaryTable = (function () {
if (target.hasClass('go-to')) {
goTo(item.groupId, item.id);
} else if (target.hasClass('show-connection-status-history')) {
nf.StatusHistory.showConnectionChart(item.groupId, item.id);
statusHistory.showConnectionChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-connection-summary')) {
// load the cluster processor summary
loadClusterConnectionSummary(item.groupId, item.id);
@ -775,7 +804,7 @@ nf.SummaryTable = (function () {
}
} else if (connectionsGrid.getColumns()[args.cell].id === 'moreDetails') {
if (target.hasClass('show-connection-details')) {
nf.ConnectionDetails.showDetails(item.groupId, item.id);
connectionDetails.showDetails(item.groupId, item.id);
}
}
});
@ -787,7 +816,7 @@ nf.SummaryTable = (function () {
// update the total number of displayed processors, if necessary
if ($('#connection-summary-table').is(':visible')) {
$('#displayed-items').text(nf.Common.formatInteger(args.current));
$('#displayed-items').text(common.formatInteger(args.current));
}
});
connectionsData.onRowsChanged.subscribe(function (e, args) {
@ -895,8 +924,8 @@ nf.SummaryTable = (function () {
var markup = '';
// if there are bulletins, render them on the graph
if (!nf.Common.isEmpty(dataContext.bulletins)) {
markup += '<div class="has-bulletins fa fa-sticky-note-o" style="margin-top: 5px; margin-left: 5px; float: left;"></div><span class="hidden row-id">' + nf.Common.escapeHtml(dataContext.id) + '</span>';
if (!common.isEmpty(dataContext.bulletins)) {
markup += '<div class="has-bulletins fa fa-sticky-note-o" style="margin-top: 5px; margin-left: 5px; float: left;"></div><span class="hidden row-id">' + common.escapeHtml(dataContext.id) + '</span>';
}
return markup;
@ -954,7 +983,7 @@ nf.SummaryTable = (function () {
];
// add an action column if appropriate
if (isClustered || isInShell || nf.Common.SUPPORTS_SVG) {
if (isClustered || isInShell || common.SUPPORTS_SVG) {
// define how the column is formatted
var processGroupActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = '';
@ -963,7 +992,7 @@ nf.SummaryTable = (function () {
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Process Group" style="margin-right: 3px;"></div>';
}
if (nf.Common.SUPPORTS_SVG) {
if (common.SUPPORTS_SVG) {
markup += '<div class="pointer show-process-group-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
}
@ -1036,12 +1065,12 @@ nf.SummaryTable = (function () {
// determine the desired action
if (processGroupsGrid.getColumns()[args.cell].id === 'actions') {
if (target.hasClass('go-to')) {
if (nf.Common.isDefinedAndNotNull(parent.nf) && nf.Common.isDefinedAndNotNull(parent.nf.CanvasUtils) && nf.Common.isDefinedAndNotNull(parent.nf.Shell)) {
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.CanvasUtils.enterGroup(item.id);
parent.$('#shell-close-button').click();
}
} else if (target.hasClass('show-process-group-status-history')) {
nf.StatusHistory.showProcessGroupChart(item.groupId, item.id);
statusHistory.showProcessGroupChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-process-group-summary')) {
// load the cluster processor summary
loadClusterProcessGroupSummary(item.id);
@ -1065,7 +1094,7 @@ nf.SummaryTable = (function () {
// update the total number of displayed process groups if necessary
if ($('#process-group-summary-table').is(':visible')) {
$('#displayed-items').text(nf.Common.formatInteger(args.current));
$('#displayed-items').text(common.formatInteger(args.current));
}
});
processGroupsData.onRowsChanged.subscribe(function (e, args) {
@ -1083,12 +1112,12 @@ nf.SummaryTable = (function () {
var item = processGroupsData.getItemById(processGroupId);
// format the tooltip
var bulletins = nf.Common.getFormattedBulletins(item.bulletins);
var tooltip = nf.Common.formatUnorderedList(bulletins);
var bulletins = common.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins);
// show the tooltip
if (nf.Common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, nf.Common.config.tooltipConfig, {
if (common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, {
content: tooltip,
position: {
container: $('#summary'),
@ -1309,7 +1338,7 @@ nf.SummaryTable = (function () {
// update the total number of displayed processors, if necessary
if ($('#input-port-summary-table').is(':visible')) {
$('#display-items').text(nf.Common.formatInteger(args.current));
$('#display-items').text(common.formatInteger(args.current));
}
});
inputPortsData.onRowsChanged.subscribe(function (e, args) {
@ -1327,12 +1356,12 @@ nf.SummaryTable = (function () {
var item = inputPortsData.getItemById(portId);
// format the tooltip
var bulletins = nf.Common.getFormattedBulletins(item.bulletins);
var tooltip = nf.Common.formatUnorderedList(bulletins);
var bulletins = common.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins);
// show the tooltip
if (nf.Common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, nf.Common.config.tooltipConfig, {
if (common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, {
content: tooltip,
position: {
container: $('#summary'),
@ -1549,7 +1578,7 @@ nf.SummaryTable = (function () {
// update the total number of displayed processors, if necessary
if ($('#output-port-summary-table').is(':visible')) {
$('#display-items').text(nf.Common.formatInteger(args.current));
$('#display-items').text(common.formatInteger(args.current));
}
});
outputPortsData.onRowsChanged.subscribe(function (e, args) {
@ -1567,12 +1596,12 @@ nf.SummaryTable = (function () {
var item = outputPortsData.getItemById(portId);
// format the tooltip
var bulletins = nf.Common.getFormattedBulletins(item.bulletins);
var tooltip = nf.Common.formatUnorderedList(bulletins);
var bulletins = common.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins);
// show the tooltip
if (nf.Common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, nf.Common.config.tooltipConfig, {
if (common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, {
content: tooltip,
position: {
container: $('#summary'),
@ -1681,7 +1710,7 @@ nf.SummaryTable = (function () {
// define a custom formatter for the run status column
var transmissionStatusFormatter = function (row, cell, value, columnDef, dataContext) {
var activeThreadCount = '';
if (nf.Common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
if (common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.activeThreadCount + ')';
}
@ -1698,7 +1727,7 @@ nf.SummaryTable = (function () {
// generate the mark up
var formattedValue = '<div layout="row"><div class="' + transmissionClass + '"></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + transmissionLabel + '</div><div style="float: left; margin-left: 4px;">' + nf.Common.escapeHtml(activeThreadCount) + '</div></div>';
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + transmissionLabel + '</div><div style="float: left; margin-left: 4px;">' + common.escapeHtml(activeThreadCount) + '</div></div>';
};
var transmissionStatusColumn = {
@ -1738,7 +1767,7 @@ nf.SummaryTable = (function () {
];
// add an action column if appropriate
if (isClustered || isInShell || nf.Common.SUPPORTS_SVG) {
if (isClustered || isInShell || common.SUPPORTS_SVG) {
// define how the column is formatted
var remoteProcessGroupActionFormatter = function (row, cell, value, columnDef, dataContext) {
var markup = '';
@ -1747,7 +1776,7 @@ nf.SummaryTable = (function () {
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To Process Group" style="margin-right: 3px;"></div>';
}
if (nf.Common.SUPPORTS_SVG) {
if (common.SUPPORTS_SVG) {
markup += '<div class="pointer show-remote-process-group-status-history fa fa-area-chart" title="View Status History" style="margin-right: 3px;"></div>';
}
@ -1822,7 +1851,7 @@ nf.SummaryTable = (function () {
if (target.hasClass('go-to')) {
goTo(item.groupId, item.id);
} else if (target.hasClass('show-remote-process-group-status-history')) {
nf.StatusHistory.showRemoteProcessGroupChart(item.groupId, item.id);
statusHistory.showRemoteProcessGroupChart(item.groupId, item.id);
} else if (target.hasClass('show-cluster-remote-process-group-summary')) {
// load the cluster processor summary
loadClusterRemoteProcessGroupSummary(item.groupId, item.id);
@ -1846,7 +1875,7 @@ nf.SummaryTable = (function () {
// update the total number of displayed processors, if necessary
if ($('#remote-process-group-summary-table').is(':visible')) {
$('#displayed-items').text(nf.Common.formatInteger(args.current));
$('#displayed-items').text(common.formatInteger(args.current));
}
});
remoteProcessGroupsData.onRowsChanged.subscribe(function (e, args) {
@ -1864,12 +1893,12 @@ nf.SummaryTable = (function () {
var item = remoteProcessGroupsData.getItemById(remoteProcessGroupId);
// format the tooltip
var bulletins = nf.Common.getFormattedBulletins(item.bulletins);
var tooltip = nf.Common.formatUnorderedList(bulletins);
var bulletins = common.getFormattedBulletins(item.bulletins);
var tooltip = common.formatUnorderedList(bulletins);
// show the tooltip
if (nf.Common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, nf.Common.config.tooltipConfig, {
if (common.isDefinedAndNotNull(tooltip)) {
bulletinIcon.qtip($.extend({}, common.config.tooltipConfig, {
content: tooltip,
position: {
container: $('#summary'),
@ -2027,7 +2056,7 @@ nf.SummaryTable = (function () {
$('#summary-loading-container').show();
},
open: function () {
nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
}
}
});
@ -2052,7 +2081,7 @@ nf.SummaryTable = (function () {
*/
var sort = function (tableId, sortDetails, data) {
// ensure there is a state object for this table
if (nf.Common.isUndefined(sortState[tableId])) {
if (common.isUndefined(sortState[tableId])) {
sortState[tableId] = {};
}
@ -2060,17 +2089,17 @@ nf.SummaryTable = (function () {
var comparer = function (a, b) {
if (sortDetails.columnId === 'moreDetails') {
var aBulletins = 0;
if (!nf.Common.isEmpty(a.bulletins)) {
if (!common.isEmpty(a.bulletins)) {
aBulletins = a.bulletins.length;
}
var bBulletins = 0;
if (!nf.Common.isEmpty(b.bulletins)) {
if (!common.isEmpty(b.bulletins)) {
bBulletins = b.bulletins.length;
}
return aBulletins - bBulletins;
} else if (sortDetails.columnId === 'runStatus' || sortDetails.columnId === 'transmissionStatus') {
var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
if (aString === bString) {
return a.activeThreadCount - b.activeThreadCount;
} else {
@ -2080,26 +2109,26 @@ nf.SummaryTable = (function () {
var mod = sortState[tableId].count % 4;
if (mod < 2) {
$('#' + tableId + ' span.queued-title').addClass('sorted');
var aQueueCount = nf.Common.parseCount(a['queuedCount']);
var bQueueCount = nf.Common.parseCount(b['queuedCount']);
var aQueueCount = common.parseCount(a['queuedCount']);
var bQueueCount = common.parseCount(b['queuedCount']);
return aQueueCount - bQueueCount;
} else {
$('#' + tableId + ' span.queued-size-title').addClass('sorted');
var aQueueSize = nf.Common.parseSize(a['queuedSize']);
var bQueueSize = nf.Common.parseSize(b['queuedSize']);
var aQueueSize = common.parseSize(a['queuedSize']);
var bQueueSize = common.parseSize(b['queuedSize']);
return aQueueSize - bQueueSize;
}
} else if (sortDetails.columnId === 'backpressure') {
var mod = sortState[tableId].count % 4;
if (mod < 2) {
$('#' + tableId + ' span.backpressure-object-title').addClass('sorted');
var aPercentUseObject = nf.Common.isDefinedAndNotNull(a['percentUseCount']) ? a['percentUseCount'] : -1;
var bPercentUseObject = nf.Common.isDefinedAndNotNull(b['percentUseCount']) ? b['percentUseCount'] : -1;
var aPercentUseObject = common.isDefinedAndNotNull(a['percentUseCount']) ? a['percentUseCount'] : -1;
var bPercentUseObject = common.isDefinedAndNotNull(b['percentUseCount']) ? b['percentUseCount'] : -1;
return aPercentUseObject - bPercentUseObject;
} else {
$('#' + tableId + ' span.backpressure-data-size-title').addClass('sorted');
var aPercentUseDataSize = nf.Common.isDefinedAndNotNull(a['percentUseBytes']) ? a['percentUseBytes'] : -1;
var bPercentUseDataSize = nf.Common.isDefinedAndNotNull(b['percentUseBytes']) ? b['percentUseBytes'] : -1;
var aPercentUseDataSize = common.isDefinedAndNotNull(a['percentUseBytes']) ? a['percentUseBytes'] : -1;
var bPercentUseDataSize = common.isDefinedAndNotNull(b['percentUseBytes']) ? b['percentUseBytes'] : -1;
return aPercentUseDataSize - bPercentUseDataSize;
}
} else if (sortDetails.columnId === 'sent' || sortDetails.columnId === 'received' || sortDetails.columnId === 'input' || sortDetails.columnId === 'output' || sortDetails.columnId === 'transferred') {
@ -2108,44 +2137,44 @@ nf.SummaryTable = (function () {
var mod = sortState[tableId].count % 4;
if (mod < 2) {
$('#' + tableId + ' span.' + sortDetails.columnId + '-title').addClass('sorted');
var aCount = nf.Common.parseCount(aSplit[0]);
var bCount = nf.Common.parseCount(bSplit[0]);
var aCount = common.parseCount(aSplit[0]);
var bCount = common.parseCount(bSplit[0]);
return aCount - bCount;
} else {
$('#' + tableId + ' span.' + sortDetails.columnId + '-size-title').addClass('sorted');
var aSize = nf.Common.parseSize(aSplit[1]);
var bSize = nf.Common.parseSize(bSplit[1]);
var aSize = common.parseSize(aSplit[1]);
var bSize = common.parseSize(bSplit[1]);
return aSize - bSize;
}
} else if (sortDetails.columnId === 'io') {
var mod = sortState[tableId].count % 4;
if (mod < 2) {
$('#' + tableId + ' span.read-title').addClass('sorted');
var aReadSize = nf.Common.parseSize(a['read']);
var bReadSize = nf.Common.parseSize(b['read']);
var aReadSize = common.parseSize(a['read']);
var bReadSize = common.parseSize(b['read']);
return aReadSize - bReadSize;
} else {
$('#' + tableId + ' span.written-title').addClass('sorted');
var aWriteSize = nf.Common.parseSize(a['written']);
var bWriteSize = nf.Common.parseSize(b['written']);
var aWriteSize = common.parseSize(a['written']);
var bWriteSize = common.parseSize(b['written']);
return aWriteSize - bWriteSize;
}
} else if (sortDetails.columnId === 'tasks') {
var mod = sortState[tableId].count % 4;
if (mod < 2) {
$('#' + tableId + ' span.tasks-title').addClass('sorted');
var aTasks = nf.Common.parseCount(a['tasks']);
var bTasks = nf.Common.parseCount(b['tasks']);
var aTasks = common.parseCount(a['tasks']);
var bTasks = common.parseCount(b['tasks']);
return aTasks - bTasks;
} else {
$('#' + tableId + ' span.time-title').addClass('sorted');
var aDuration = nf.Common.parseDuration(a['tasksDuration']);
var bDuration = nf.Common.parseDuration(b['tasksDuration']);
var aDuration = common.parseDuration(a['tasksDuration']);
var bDuration = common.parseDuration(b['tasksDuration']);
return aDuration - bDuration;
}
} else {
var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1;
}
};
@ -2215,7 +2244,7 @@ nf.SummaryTable = (function () {
// add the parameter if appropriate
var parameters = {};
if (!nf.Common.isNull(clusterNodeId)) {
if (!common.isNull(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId;
}
@ -2239,7 +2268,7 @@ nf.SummaryTable = (function () {
$('#free-heap').text(aggregateSnapshot.freeHeap);
// ensure the heap utilization could be calculated
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.heapUtilization)) {
if (common.isDefinedAndNotNull(aggregateSnapshot.heapUtilization)) {
$('#utilization-heap').text('(' + aggregateSnapshot.heapUtilization + ')');
} else {
$('#utilization-heap').text('');
@ -2252,7 +2281,7 @@ nf.SummaryTable = (function () {
$('#free-non-heap').text(aggregateSnapshot.freeNonHeap);
// enure the non heap utilization could be calculated
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.nonHeapUtilization)) {
if (common.isDefinedAndNotNull(aggregateSnapshot.nonHeapUtilization)) {
$('#utilization-non-heap').text('(' + aggregateSnapshot.nonHeapUtilization + ')');
} else {
$('#utilization-non-heap').text('');
@ -2260,9 +2289,9 @@ nf.SummaryTable = (function () {
// garbage collection
var garbageCollectionContainer = $('#garbage-collection-table tbody').empty();
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.garbageCollection)) {
if (common.isDefinedAndNotNull(aggregateSnapshot.garbageCollection)) {
// sort the garbage collections
var sortedGarbageCollection = aggregateSnapshot.garbageCollection.sort(function(a, b) {
var sortedGarbageCollection = aggregateSnapshot.garbageCollection.sort(function (a, b) {
return a.name === b.name ? 0 : a.name > b.name ? 1 : -1;
});
// add each to the UI
@ -2275,10 +2304,10 @@ nf.SummaryTable = (function () {
$('#available-processors').text(aggregateSnapshot.availableProcessors);
// load
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.processorLoadAverage)) {
$('#processor-load-average').text(nf.Common.formatFloat(aggregateSnapshot.processorLoadAverage));
if (common.isDefinedAndNotNull(aggregateSnapshot.processorLoadAverage)) {
$('#processor-load-average').text(common.formatFloat(aggregateSnapshot.processorLoadAverage));
} else {
$('#processor-load-average').html(nf.Common.formatValue(aggregateSnapshot.processorLoadAverage));
$('#processor-load-average').html(common.formatValue(aggregateSnapshot.processorLoadAverage));
}
// flow file storage usage
@ -2287,9 +2316,9 @@ nf.SummaryTable = (function () {
// content repo storage usage
var contentRepositoryUsageContainer = $('#content-repository-storage-usage-container').empty();
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot.contentRepositoryStorageUsage)) {
if (common.isDefinedAndNotNull(aggregateSnapshot.contentRepositoryStorageUsage)) {
// sort the content repos
var sortedContentRepositoryStorageUsage = aggregateSnapshot.contentRepositoryStorageUsage.sort(function(a, b) {
var sortedContentRepositoryStorageUsage = aggregateSnapshot.contentRepositoryStorageUsage.sort(function (a, b) {
return a.identifier === b.identifier ? 0 : a.identifier > b.identifier ? 1 : -1;
});
// add each to the UI
@ -2311,7 +2340,7 @@ nf.SummaryTable = (function () {
'#version-os-version': aggregateSnapshot.versionInfo.osVersion,
'#version-os-arch': aggregateSnapshot.versionInfo.osArchitecture
};
for (versionSpanSelector in versionSpanSelectorToFieldMap) {
for (var versionSpanSelector in versionSpanSelectorToFieldMap) {
var dataField = versionSpanSelectorToFieldMap[versionSpanSelector];
if (dataField) {
$(versionSpanSelector).text(dataField);
@ -2322,7 +2351,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#system-diagnostics-last-refreshed').text(aggregateSnapshot.statsLastRefreshed);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -2351,14 +2380,14 @@ nf.SummaryTable = (function () {
var storage = $('<div class="storage-identifier setting-name"></div>');
storage.text('Usage:');
if (nf.Common.isDefinedAndNotNull(storageUsage.identifier)) {
if (common.isDefinedAndNotNull(storageUsage.identifier)) {
storage.text('Usage for ' + storageUsage.identifier + ':');
}
storage.appendTo(storageUsageContainer);
(nf.ng.Bridge.injector.get('$compile')($('<md-progress-linear class="md-hue-2" md-mode="determinate" value="' + (used/total)*100 + '" aria-label="FlowFile Repository Storage Usage"></md-progress-linear>'))(nf.ng.Bridge.rootScope)).appendTo(storageUsageContainer);
(angularBridge.injector.get('$compile')($('<md-progress-linear class="md-hue-2" md-mode="determinate" value="' + (used / total) * 100 + '" aria-label="FlowFile Repository Storage Usage"></md-progress-linear>'))(angularBridge.rootScope)).appendTo(storageUsageContainer);
var usageDetails = $('<div class="storage-usage-details"></div>').text(' (' + storageUsage.usedSpace + ' of ' + storageUsage.totalSpace + ')').prepend($('<b></b>').text(Math.round((used/total)*100) + '%'));
var usageDetails = $('<div class="storage-usage-details"></div>').text(' (' + storageUsage.usedSpace + ' of ' + storageUsage.totalSpace + ')').prepend($('<b></b>').text(Math.round((used / total) * 100) + '%'));
$('<div class="storage-usage-header"></div>').append(usageDetails).append('<div class="clear"></div>').appendTo(storageUsageContainer);
};
@ -2437,7 +2466,7 @@ nf.SummaryTable = (function () {
}
// ensure the grid has been initialized
if (nf.Common.isDefinedAndNotNull(grid)) {
if (common.isDefinedAndNotNull(grid)) {
var data = grid.getData();
// update the search criteria
@ -2465,7 +2494,7 @@ nf.SummaryTable = (function () {
},
dataType: 'json'
}).done(function (response) {
if (nf.Common.isDefinedAndNotNull(response.processorStatus)) {
if (common.isDefinedAndNotNull(response.processorStatus)) {
var processorStatus = response.processorStatus;
var clusterProcessorsGrid = $('#cluster-processor-summary-table').data('gridInstance');
@ -2504,7 +2533,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#cluster-processor-summary-last-refreshed').text(processorStatus.statsLastRefreshed);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -2523,7 +2552,7 @@ nf.SummaryTable = (function () {
},
dataType: 'json'
}).done(function (response) {
if (nf.Common.isDefinedAndNotNull(response.connectionStatus)) {
if (common.isDefinedAndNotNull(response.connectionStatus)) {
var connectionStatus = response.connectionStatus;
var clusterConnectionsGrid = $('#cluster-connection-summary-table').data('gridInstance');
@ -2561,7 +2590,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#cluster-connection-summary-last-refreshed').text(connectionStatus.statsLastRefreshed);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -2580,7 +2609,7 @@ nf.SummaryTable = (function () {
},
dataType: 'json'
}).done(function (response) {
if (nf.Common.isDefinedAndNotNull(response.processGroupStatus)) {
if (common.isDefinedAndNotNull(response.processGroupStatus)) {
var processGroupStatus = response.processGroupStatus;
var clusterProcessGroupsGrid = $('#cluster-process-group-summary-table').data('gridInstance');
@ -2621,7 +2650,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#cluster-process-group-summary-last-refreshed').text(processGroupStatus.statsLastRefreshed);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -2640,7 +2669,7 @@ nf.SummaryTable = (function () {
},
dataType: 'json'
}).done(function (response) {
if (nf.Common.isDefinedAndNotNull(response.portStatus)) {
if (common.isDefinedAndNotNull(response.portStatus)) {
var inputPortStatus = response.portStatus;
var clusterInputPortsGrid = $('#cluster-input-port-summary-table').data('gridInstance');
@ -2674,7 +2703,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#cluster-input-port-summary-last-refreshed').text(inputPortStatus.statsLastRefreshed);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -2693,7 +2722,7 @@ nf.SummaryTable = (function () {
},
dataType: 'json'
}).done(function (response) {
if (nf.Common.isDefinedAndNotNull(response.portStatus)) {
if (common.isDefinedAndNotNull(response.portStatus)) {
var outputPortStatus = response.portStatus;
var clusterOutputPortsGrid = $('#cluster-output-port-summary-table').data('gridInstance');
@ -2727,7 +2756,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#cluster-output-port-summary-last-refreshed').text(outputPortStatus.statsLastRefreshed);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -2746,7 +2775,7 @@ nf.SummaryTable = (function () {
},
dataType: 'json'
}).done(function (response) {
if (nf.Common.isDefinedAndNotNull(response.remoteProcessGroupStatus)) {
if (common.isDefinedAndNotNull(response.remoteProcessGroupStatus)) {
var remoteProcessGroupStatus = response.remoteProcessGroupStatus;
var clusterRemoteProcessGroupsGrid = $('#cluster-remote-process-group-summary-table').data('gridInstance');
@ -2782,7 +2811,7 @@ nf.SummaryTable = (function () {
// update the stats last refreshed timestamp
$('#cluster-remote-process-group-summary-last-refreshed').text(remoteProcessGroupStatus.statsLastRefreshed);
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
var clusterNodeId = null;
@ -2805,11 +2834,11 @@ nf.SummaryTable = (function () {
var configDetails = configResponse.flowConfiguration;
// initialize the chart
nf.StatusHistory.init(configDetails.timeOffset);
statusHistory.init(configDetails.timeOffset);
// initialize the processor/connection details dialog
nf.ProcessorDetails.init(false);
nf.ConnectionDetails.init();
processorDetails.init(false);
connectionDetails.init();
initSummaryTable(isClustered);
deferred.resolve();
@ -2835,7 +2864,7 @@ nf.SummaryTable = (function () {
var processorsTable = $('#processor-summary-table');
if (processorsTable.is(':visible')) {
var processorsGrid = processorsTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(processorsGrid)) {
if (common.isDefinedAndNotNull(processorsGrid)) {
processorsGrid.resizeCanvas();
}
}
@ -2843,7 +2872,7 @@ nf.SummaryTable = (function () {
var connectionsTable = $('#connection-summary-table');
if (connectionsTable.is(':visible')) {
var connectionsGrid = connectionsTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(connectionsGrid)) {
if (common.isDefinedAndNotNull(connectionsGrid)) {
connectionsGrid.resizeCanvas();
}
}
@ -2851,7 +2880,7 @@ nf.SummaryTable = (function () {
var processGroupsTable = $('#process-group-summary-table');
if (processGroupsTable.is(':visible')) {
var processGroupsGrid = processGroupsTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(processGroupsGrid)) {
if (common.isDefinedAndNotNull(processGroupsGrid)) {
processGroupsGrid.resizeCanvas();
}
}
@ -2859,7 +2888,7 @@ nf.SummaryTable = (function () {
var inputPortsTable = $('#input-port-summary-table');
if (inputPortsTable.is(':visible')) {
var inputPortGrid = inputPortsTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(inputPortGrid)) {
if (common.isDefinedAndNotNull(inputPortGrid)) {
inputPortGrid.resizeCanvas();
}
}
@ -2867,7 +2896,7 @@ nf.SummaryTable = (function () {
var outputPortsTable = $('#output-port-summary-table');
if (outputPortsTable.is(':visible')) {
var outputPortGrid = outputPortsTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(outputPortGrid)) {
if (common.isDefinedAndNotNull(outputPortGrid)) {
outputPortGrid.resizeCanvas();
}
}
@ -2875,7 +2904,7 @@ nf.SummaryTable = (function () {
var remoteProcessGroupsTable = $('#remote-process-group-summary-table');
if (remoteProcessGroupsTable.is(':visible')) {
var remoteProcessGroupGrid = remoteProcessGroupsTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(remoteProcessGroupGrid)) {
if (common.isDefinedAndNotNull(remoteProcessGroupGrid)) {
remoteProcessGroupGrid.resizeCanvas();
}
}
@ -2889,7 +2918,7 @@ nf.SummaryTable = (function () {
// add the parameter if appropriate
var parameters = {};
if (!nf.Common.isNull(clusterNodeId)) {
if (!common.isNull(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId;
}
@ -2909,10 +2938,10 @@ nf.SummaryTable = (function () {
var processGroupStatus = response.processGroupStatus;
var aggregateSnapshot = processGroupStatus.aggregateSnapshot;
if (nf.Common.isDefinedAndNotNull(aggregateSnapshot)) {
if (common.isDefinedAndNotNull(aggregateSnapshot)) {
// remove any tooltips from the processor table
var processorsGridElement = $('#processor-summary-table');
nf.Common.cleanUpTooltips(processorsGridElement, 'div.has-bulletins');
common.cleanUpTooltips(processorsGridElement, 'div.has-bulletins');
// get the processor grid/data
var processorsGrid = processorsGridElement.data('gridInstance');
@ -2924,7 +2953,7 @@ nf.SummaryTable = (function () {
// remove any tooltips from the process group table
var processGroupGridElement = $('#process-group-summary-table');
nf.Common.cleanUpTooltips(processGroupGridElement, 'div.has-bulletins');
common.cleanUpTooltips(processGroupGridElement, 'div.has-bulletins');
// get the process group grid/data
var processGroupGrid = processGroupGridElement.data('gridInstance');
@ -2932,7 +2961,7 @@ nf.SummaryTable = (function () {
// remove any tooltips from the input port table
var inputPortsGridElement = $('#input-port-summary-table');
nf.Common.cleanUpTooltips(inputPortsGridElement, 'div.has-bulletins');
common.cleanUpTooltips(inputPortsGridElement, 'div.has-bulletins');
// get the input ports grid/data
var inputPortsGrid = inputPortsGridElement.data('gridInstance');
@ -2940,7 +2969,7 @@ nf.SummaryTable = (function () {
// remove any tooltips from the output port table
var outputPortsGridElement = $('#output-port-summary-table');
nf.Common.cleanUpTooltips(outputPortsGridElement, 'div.has-bulletins');
common.cleanUpTooltips(outputPortsGridElement, 'div.has-bulletins');
// get the output ports grid/data
var outputPortsGrid = outputPortsGridElement.data('gridInstance');
@ -2948,7 +2977,7 @@ nf.SummaryTable = (function () {
// remove any tooltips from the remote process group table
var remoteProcessGroupsGridElement = $('#remote-process-group-summary-table');
nf.Common.cleanUpTooltips(remoteProcessGroupsGridElement, 'div.has-bulletins');
common.cleanUpTooltips(remoteProcessGroupsGridElement, 'div.has-bulletins');
// get the remote process groups grid
var remoteProcessGroupsGrid = remoteProcessGroupsGridElement.data('gridInstance');
@ -2999,22 +3028,22 @@ nf.SummaryTable = (function () {
// update the total number of processors
if ($('#processor-summary-table').is(':visible')) {
$('#total-items').text(nf.Common.formatInteger(processorItems.length));
$('#total-items').text(common.formatInteger(processorItems.length));
} else if ($('#connection-summary-table').is(':visible')) {
$('#total-items').text(nf.Common.formatInteger(connectionItems.length));
$('#total-items').text(common.formatInteger(connectionItems.length));
} else if ($('#input-port-summary-table').is(':visible')) {
$('#total-items').text(nf.Common.formatInteger(inputPortItems.length));
$('#total-items').text(common.formatInteger(inputPortItems.length));
} else if ($('#output-port-summary-table').is(':visible')) {
$('#total-items').text(nf.Common.formatInteger(outputPortItems.length));
$('#total-items').text(common.formatInteger(outputPortItems.length));
} else if ($('#process-group-summary-table').is(':visible')) {
$('#total-items').text(nf.Common.formatInteger(processGroupItems.length));
$('#total-items').text(common.formatInteger(processGroupItems.length));
} else {
$('#total-items').text(nf.Common.formatInteger(remoteProcessGroupItems.length));
$('#total-items').text(common.formatInteger(remoteProcessGroupItems.length));
}
} else {
$('#total-items').text('0');
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}
};
}());
}));

View File

@ -15,34 +15,106 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
$(document).ready(function () {
//Create Angular App
var app = angular.module('ngSummaryApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'angular',
'nf.Common',
'nf.ClusterSummary',
'nf.ClusterSearch',
'nf.ng.AppConfig',
'nf.ng.AppCtrl',
'nf.ng.ServiceProvider',
'nf.ng.Bridge',
'nf.ErrorHandler',
'nf.Storage',
'nf.SummaryTable'],
function ($,
angular,
common,
clusterSummary,
clusterSearch,
appConfig,
appCtrl,
serviceProvider,
provenanceTable,
angularBridge,
errorHandler,
storage,
summaryTable) {
return (nf.Summary =
factory($,
angular,
common,
clusterSummary,
clusterSearch,
appConfig,
appCtrl,
serviceProvider,
angularBridge,
errorHandler,
storage,
summaryTable));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Summary =
factory(require('jquery'),
require('angular'),
require('nf.Common'),
require('nf.ClusterSummary'),
require('nf.ClusterSearch'),
require('nf.ng.AppConfig'),
require('nf.ng.AppCtrl'),
require('nf.ng.ServiceProvider'),
require('nf.ng.Bridge'),
require('nf.ErrorHandler'),
require('nf.Storage'),
require('nf.SummaryTable')));
} else {
nf.Summary = factory(root.$,
root.angular,
root.nf.Common,
root.nf.ClusterSummary,
root.nf.ClusterSearch,
root.nf.ng.AppConfig,
root.nf.ng.AppCtrl,
root.nf.ng.ServiceProvider,
root.nf.ng.Bridge,
root.nf.ErrorHandler,
root.nf.Storage,
root.nf.SummaryTable);
}
}(this, function ($, angular, common, clusterSummary, clusterSearch, appConfig, appCtrl, serviceProvider, angularBridge, errorHandler, storage, summaryTable) {
'use strict';
//Define Dependency Injection Annotations
nf.ng.AppConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
nf.ng.AppCtrl.$inject = ['$scope', 'serviceProvider'];
nf.ng.ServiceProvider.$inject = [];
$(document).ready(function () {
//Create Angular App
var app = angular.module('ngSummaryApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
//Configure Angular App
app.config(nf.ng.AppConfig);
//Define Dependency Injection Annotations
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
appCtrl.$inject = ['$scope', 'serviceProvider'];
serviceProvider.$inject = [];
//Define Angular App Controllers
app.controller('ngSummaryAppCtrl', nf.ng.AppCtrl);
//Configure Angular App
app.config(appConfig);
//Define Angular App Services
app.service('serviceProvider', nf.ng.ServiceProvider);
//Define Angular App Controllers
app.controller('ngSummaryAppCtrl', appCtrl);
//Manually Boostrap Angular App
nf.ng.Bridge.injector = angular.bootstrap($('body'), ['ngSummaryApp'], { strictDi: true });
//Define Angular App Services
app.service('serviceProvider', serviceProvider);
// initialize the summary page
nf.Summary.init();
});
//Manually Boostrap Angular App
angularBridge.injector = angular.bootstrap($('body'), ['ngSummaryApp'], {strictDi: true});
nf.Summary = (function () {
// initialize the summary page
clusterSummary.loadClusterSummary().done(function () {
nfSummary.init();
});
});
/**
* Configuration object used to hold a number of configuration items.
@ -64,12 +136,16 @@ nf.Summary = (function () {
type: 'GET',
url: config.urls.clusterSummary
}).done(function (response) {
nf.SummaryTable.init(response.clusterSummary.connectedToCluster).done(function () {
summaryTable.init(response.clusterSummary.connectedToCluster).done(function () {
// initialize the search field if applicable
if (response.clusterSummary.connectedToCluster) {
clusterSearch.init();
}
deferred.resolve();
}).fail(function () {
deferred.reject();
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}).promise();
};
@ -79,7 +155,9 @@ nf.Summary = (function () {
var initializeSummaryPage = function () {
// define mouse over event for the refresh buttons
$('#refresh-button').click(function () {
nf.SummaryTable.loadSummaryTable();
clusterSummary.loadClusterSummary().done(function () {
summaryTable.loadSummaryTable();
});
});
// return a deferred for page initialization
@ -92,8 +170,8 @@ nf.Summary = (function () {
dataType: 'json'
}).done(function (response) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(response.banners)) {
if (nf.Common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
if (common.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -107,7 +185,7 @@ nf.Summary = (function () {
updateTop('summary');
}
if (nf.Common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -123,7 +201,7 @@ nf.Summary = (function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -132,17 +210,17 @@ nf.Summary = (function () {
}).promise();
};
return {
var nfSummary = {
/**
* Initializes the status page.
*/
init: function () {
nf.Storage.init();
storage.init();
// intialize the summary table
initializeSummaryTable().done(function () {
// load the table
nf.SummaryTable.loadSummaryTable().done(function () {
summaryTable.loadSummaryTable().done(function () {
// once the table is initialized, finish initializing the page
initializeSummaryPage().done(function () {
@ -153,7 +231,7 @@ nf.Summary = (function () {
'height': $(window).height() + 'px',
'width': $(window).width() + 'px'
});
$('#summary').css('margin', 40);
$('div.summary-table').css('bottom', 127);
$('#flow-summary-refresh-container').css({
@ -163,7 +241,7 @@ nf.Summary = (function () {
});
}
nf.SummaryTable.resetTableSize();
summaryTable.resetTableSize();
};
// get the about details
@ -181,15 +259,15 @@ nf.Summary = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
@ -198,8 +276,8 @@ nf.Summary = (function () {
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
@ -209,12 +287,12 @@ nf.Summary = (function () {
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')){
if ($(tabsContainers[k]).is(':visible')) {
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
@ -222,4 +300,6 @@ nf.Summary = (function () {
});
}
};
}());
return nfSummary;
}));

View File

@ -15,9 +15,34 @@
* limitations under the License.
*/
/* global nf, Slick */
/* global nf, define, module, require, exports */
nf.TemplatesTable = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.Dialog',
'nf.ErrorHandler'],
function ($, Slick, common, dialog, errorHandler) {
return (nf.TemplatesTable = factory($, Slick, common, dialog, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.TemplatesTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.ErrorHandler')));
} else {
nf.TemplatesTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.Dialog,
root.nf.ErrorHandler);
}
}(this, function ($, Slick, common, dialog, errorHandler) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
@ -31,28 +56,28 @@ nf.TemplatesTable = (function () {
/**
* Sorts the specified data using the specified sort details.
*
*
* @param {object} sortDetails
* @param {object} data
*/
var sort = function (sortDetails, data) {
// defines a function for sorting
var comparer = function (a, b) {
if(a.permissions.canRead && b.permissions.canRead) {
if (a.permissions.canRead && b.permissions.canRead) {
if (sortDetails.columnId === 'timestamp') {
var aDate = nf.Common.parseDateTime(a.template[sortDetails.columnId]);
var bDate = nf.Common.parseDateTime(b.template[sortDetails.columnId]);
var aDate = common.parseDateTime(a.template[sortDetails.columnId]);
var bDate = common.parseDateTime(b.template[sortDetails.columnId]);
return aDate.getTime() - bDate.getTime();
} else {
var aString = nf.Common.isDefinedAndNotNull(a.template[sortDetails.columnId]) ? a.template[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b.template[sortDetails.columnId]) ? b.template[sortDetails.columnId] : '';
var aString = common.isDefinedAndNotNull(a.template[sortDetails.columnId]) ? a.template[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.template[sortDetails.columnId]) ? b.template[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1;
}
} else {
if (!a.permissions.canRead && !b.permissions.canRead){
if (!a.permissions.canRead && !b.permissions.canRead) {
return 0;
}
if(a.permissions.canRead){
if (a.permissions.canRead) {
return 1;
} else {
return -1;
@ -66,14 +91,14 @@ nf.TemplatesTable = (function () {
/**
* Prompts the user before attempting to delete the specified template.
*
*
* @argument {object} templateEntity The template
*/
var promptToDeleteTemplate = function (templateEntity) {
// prompt for deletion
nf.Dialog.showYesNoDialog({
dialog.showYesNoDialog({
headerText: 'Delete Template',
dialogContent: 'Delete template \'' + nf.Common.escapeHtml(templateEntity.template.name) + '\'?',
dialogContent: 'Delete template \'' + common.escapeHtml(templateEntity.template.name) + '\'?',
yesHandler: function () {
deleteTemplate(templateEntity);
}
@ -82,14 +107,14 @@ nf.TemplatesTable = (function () {
/**
* Opens the access policies for the specified template.
*
*
* @param templateEntity
*/
var openAccessPolicies = function (templateEntity) {
// only attempt this if we're within a frame
if (top !== window) {
// and our parent has canvas utils and shell defined
if (nf.Common.isDefinedAndNotNull(parent.nf) && nf.Common.isDefinedAndNotNull(parent.nf.PolicyManagement) && nf.Common.isDefinedAndNotNull(parent.nf.Shell)) {
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.PolicyManagement) && common.isDefinedAndNotNull(parent.nf.Shell)) {
parent.nf.PolicyManagement.showTemplatePolicy(templateEntity);
parent.$('#shell-close-button').click();
}
@ -98,7 +123,7 @@ nf.TemplatesTable = (function () {
/**
* Deletes the template with the specified id.
*
*
* @argument {string} templateEntity The template
*/
var deleteTemplate = function (templateEntity) {
@ -110,10 +135,10 @@ nf.TemplatesTable = (function () {
var templatesGrid = $('#templates-table').data('gridInstance');
var templatesData = templatesGrid.getData();
templatesData.deleteItem(templateEntity.id);
// update the total number of templates
$('#total-templates').text(templatesData.getItems().length);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -133,7 +158,7 @@ nf.TemplatesTable = (function () {
var templatesGrid = $('#templates-table').data('gridInstance');
// ensure the grid has been initialized
if (nf.Common.isDefinedAndNotNull(templatesGrid)) {
if (common.isDefinedAndNotNull(templatesGrid)) {
var templatesData = templatesGrid.getData();
// update the search criteria
@ -147,7 +172,7 @@ nf.TemplatesTable = (function () {
/**
* Performs the filtering.
*
*
* @param {object} item The item subject to filtering
* @param {object} args Filter arguments
* @returns {Boolean} Whether or not to include the item
@ -175,11 +200,11 @@ nf.TemplatesTable = (function () {
* @param {object} templateEntity The template
*/
var downloadTemplate = function (templateEntity) {
nf.Common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
var parameters = {};
// conditionally include the download token
if (!nf.Common.isBlank(downloadToken)) {
if (!common.isBlank(downloadToken)) {
parameters['access_token'] = downloadToken;
}
@ -190,7 +215,7 @@ nf.TemplatesTable = (function () {
window.open(templateEntity.template.uri + '/download' + '?' + $.param(parameters));
}
}).fail(function () {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Download Template',
dialogContent: 'Unable to generate access token for downloading content.'
});
@ -210,12 +235,12 @@ nf.TemplatesTable = (function () {
// filter type
$('#templates-filter-type').combo({
options: [{
text: 'by name',
value: 'name'
}, {
text: 'by description',
value: 'description'
}],
text: 'by name',
value: 'name'
}, {
text: 'by description',
value: 'description'
}],
select: function (option) {
applyFilter();
}
@ -242,7 +267,7 @@ nf.TemplatesTable = (function () {
return '';
}
return nf.Common.formatValue(dataContext.template.description);
return common.formatValue(dataContext.template.description);
};
var groupIdFormatter = function (row, cell, value, columnDef, dataContext) {
@ -266,9 +291,9 @@ nf.TemplatesTable = (function () {
markup += '<div title="Remove Template" class="pointer prompt-to-delete-template fa fa-trash" style="margin-top: 2px; margin-right: 3px;"></div>';
}
// allow policy configuration conditionally
if (top !== window && nf.Common.canAccessTenants()) {
if (nf.Common.isDefinedAndNotNull(parent.nf) && nf.Common.isDefinedAndNotNull(parent.nf.Canvas) && parent.nf.Canvas.isConfigurableAuthorizer()) {
// allow policy configuration conditionally if embedded in
if (top !== window && common.canAccessTenants()) {
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.Canvas) && parent.nf.Canvas.isConfigurableAuthorizer()) {
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
}
}
@ -278,12 +303,48 @@ nf.TemplatesTable = (function () {
// initialize the templates table
var templatesColumns = [
{id: 'timestamp', name: 'Date/Time', sortable: true, defaultSortAsc: false, resizable: false, formatter: timestampFormatter, width: 225, maxWidth: 225},
{id: 'name', name: 'Name', sortable: true, resizable: true, formatter: nameFormatter},
{id: 'description', name: 'Description', sortable: true, resizable: true, formatter: descriptionFormatter},
{id: 'groupId', name: 'Process Group Id', sortable: true, resizable: true, formatter: groupIdFormatter},
{id: 'actions', name: '&nbsp;', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100}
{
id: 'timestamp',
name: 'Date/Time',
sortable: true,
defaultSortAsc: false,
resizable: false,
formatter: timestampFormatter,
width: 225,
maxWidth: 225
},
{
id: 'name',
name: 'Name',
sortable: true,
resizable: true,
formatter: nameFormatter
},
{
id: 'description',
name: 'Description',
sortable: true,
resizable: true,
formatter: descriptionFormatter
},
{
id: 'groupId',
name: 'Process Group Id',
sortable: true,
resizable: true,
formatter: groupIdFormatter
},
{
id: 'actions',
name: '&nbsp;',
sortable: false,
resizable: false,
formatter: actionFormatter,
width: 100,
maxWidth: 100
}
];
var templatesOptions = {
forceFitColumns: true,
enableTextSelectionOnCells: true,
@ -360,17 +421,17 @@ nf.TemplatesTable = (function () {
// initialize the number of displayed items
$('#displayed-templates').text('0');
},
/**
* Update the size of the grid based on its container's current size.
*/
resetTableSize: function () {
var templateGrid = $('#templates-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(templateGrid)) {
if (common.isDefinedAndNotNull(templateGrid)) {
templateGrid.resizeCanvas();
}
},
/**
* Load the processor templates table.
*/
@ -381,7 +442,7 @@ nf.TemplatesTable = (function () {
dataType: 'json'
}).done(function (response) {
// ensure there are groups specified
if (nf.Common.isDefinedAndNotNull(response.templates)) {
if (common.isDefinedAndNotNull(response.templates)) {
var templatesGrid = $('#templates-table').data('gridInstance');
var templatesData = templatesGrid.getData();
@ -398,7 +459,7 @@ nf.TemplatesTable = (function () {
} else {
$('#total-templates').text('0');
}
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}
};
}());
}));

View File

@ -15,14 +15,39 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
$(document).ready(function () {
// initialize the templates page
nf.Templates.init();
});
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.TemplatesTable',
'nf.ErrorHandler',
'nf.Storage'],
function ($, common, templatesTable, errorHandler, storage) {
return (nf.Templates = factory($, common, templatesTable, errorHandler, storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Templates =
factory(require('jquery'),
require('nf.Common'),
require('nf.TemplatesTable'),
require('nf.ErrorHandler'),
require('nf.Storage')));
} else {
nf.Templates = factory(root.$,
root.nf.Common,
root.nf.TemplatesTable,
root.nf.ErrorHandler,
root.nf.Storage);
}
}(this, function ($, common, templatesTable, errorHandler, storage) {
'use strict';
nf.Templates = (function () {
$(document).ready(function () {
// initialize the templates page
nfTemplates.init();
});
/**
* Configuration object used to hold a number of configuration items.
@ -44,8 +69,8 @@ nf.Templates = (function () {
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
common.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -54,7 +79,7 @@ nf.Templates = (function () {
var initializeTemplatesPage = function () {
// define mouse over event for the refresh button
$('#refresh-button').click(function () {
nf.TemplatesTable.loadTemplatesTable();
templatesTable.loadTemplatesTable();
});
// get the banners if we're not in the shell
@ -66,8 +91,8 @@ nf.Templates = (function () {
dataType: 'json'
}).done(function (response) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(response.banners)) {
if (nf.Common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
if (common.isDefinedAndNotNull(response.banners)) {
if (common.isDefinedAndNotNull(response.banners.headerText) && response.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(response.banners.headerText).show();
@ -81,7 +106,7 @@ nf.Templates = (function () {
updateTop('templates');
}
if (nf.Common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
if (common.isDefinedAndNotNull(response.banners.footerText) && response.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(response.banners.footerText).show();
@ -97,7 +122,7 @@ nf.Templates = (function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -106,21 +131,21 @@ nf.Templates = (function () {
}).promise();
};
return {
var nfTemplates = {
/**
* Initializes the templates page.
*/
init: function () {
nf.Storage.init();
storage.init();
// load the current user
loadCurrentUser().done(function () {
// create the templates table
nf.TemplatesTable.init();
templatesTable.init();
// load the table
nf.TemplatesTable.loadTemplatesTable().done(function () {
templatesTable.loadTemplatesTable().done(function () {
// once the table is initialized, finish initializing the page
initializeTemplatesPage().done(function () {
var setBodySize = function () {
@ -137,7 +162,7 @@ nf.Templates = (function () {
}
// configure the initial grid height
nf.TemplatesTable.resetTableSize();
templatesTable.resetTableSize();
};
// get the about details
@ -155,15 +180,15 @@ nf.Templates = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
@ -172,8 +197,8 @@ nf.Templates = (function () {
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
@ -183,12 +208,12 @@ nf.Templates = (function () {
var tabsContainers = $('.tab-container');
var tabsContents = [];
for (var k = 0, len = tabsContainers.length; k < len; k++) {
if ($(tabsContainers[k]).is(':visible')){
if ($(tabsContainers[k]).is(':visible')) {
tabsContents.push($('#' + $(tabsContainers[k]).attr('id') + '-content'));
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
@ -196,4 +221,6 @@ nf.Templates = (function () {
});
}
};
}());
return nfTemplates;
}));

View File

@ -15,9 +15,34 @@
* limitations under the License.
*/
/* global nf, Slick */
/* global nf, define, module, require, exports */
nf.UsersTable = (function () {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.Client',
'nf.ErrorHandler'],
function ($, Slick, common, client, errorHandler) {
return (nf.UsersTable = factory($, Slick, common, client, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.UsersTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.Client'),
require('nf.ErrorHandler')));
} else {
nf.UsersTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.Client,
root.nf.ErrorHandler);
}
}(this, function ($, Slick, common, client, errorHandler) {
'use strict';
/**
* Configuration object used to hold a number of configuration items.
@ -51,11 +76,11 @@ nf.UsersTable = (function () {
// update the user
$.ajax({
type: 'DELETE',
url: user.uri + '?' + $.param(nf.Client.getRevision(user)),
url: user.uri + '?' + $.param(client.getRevision(user)),
dataType: 'json'
}).done(function () {
nf.UsersTable.loadUsersTable();
}).fail(nf.Common.handleAjaxError);
self.loadUsersTable();
}).fail(errorHandler.handleAjaxError);
// hide the dialog
$('#user-delete-dialog').modal('hide');
@ -144,7 +169,7 @@ nf.UsersTable = (function () {
// build the request entity
var updatedGroupEntity = {
'revision': nf.Client.getRevision(groupEntity),
'revision': client.getRevision(groupEntity),
'component': $.extend({}, groupEntity.component, {
'users': groupMembers
})
@ -182,7 +207,7 @@ nf.UsersTable = (function () {
// build the request entity
var updatedGroupEntity = {
'revision': nf.Client.getRevision(groupEntity),
'revision': client.getRevision(groupEntity),
'component': $.extend({}, groupEntity.component, {
'users': groupMembers
})
@ -208,7 +233,7 @@ nf.UsersTable = (function () {
// get the grid and data
var usersGrid = $('#users-table').data('gridInstance');
var usersData = usersGrid.getData();
// create the user
var userXhr = $.ajax({
type: 'POST',
@ -225,16 +250,16 @@ nf.UsersTable = (function () {
var groupEntity = usersData.getItemById(selectedGroup.id)
xhrs.push(addUserToGroup(groupEntity, userEntity));
});
$.when.apply(window, xhrs).always(function () {
nf.UsersTable.loadUsersTable().done(function () {
self.loadUsersTable().done(function () {
// select the new user
var row = usersData.getRowById(userEntity.id);
usersGrid.setSelectedRows([row]);
usersGrid.scrollRowIntoView(row);
});
}).fail(nf.Common.handleAjaxError);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -251,7 +276,7 @@ nf.UsersTable = (function () {
var userEntity = usersData.getItemById(userId);
var updatedUserEntity = {
'revision': nf.Client.getRevision(userEntity),
'revision': client.getRevision(userEntity),
'component': {
'id': userId,
'identity': userIdentity
@ -268,11 +293,11 @@ nf.UsersTable = (function () {
});
userXhr.done(function (updatedUserEntity) {
// determine what to add/remove
var groupsAdded = [];
var groupsRemoved = [];
$.each(updatedUserEntity.component.userGroups, function(_, currentGroup) {
$.each(updatedUserEntity.component.userGroups, function (_, currentGroup) {
var isSelected = $.grep(selectedGroups, function (group) {
return group.id === currentGroup.id;
});
@ -282,7 +307,7 @@ nf.UsersTable = (function () {
groupsRemoved.push(currentGroup);
}
});
$.each(selectedGroups, function(_, selectedGroup) {
$.each(selectedGroups, function (_, selectedGroup) {
var isSelected = $.grep(updatedUserEntity.component.userGroups, function (group) {
return group.id === selectedGroup.id;
});
@ -305,9 +330,9 @@ nf.UsersTable = (function () {
});
$.when.apply(window, xhrs).always(function () {
nf.UsersTable.loadUsersTable();
}).fail(nf.Common.handleAjaxError);
}).fail(nf.Common.handleAjaxError);
self.loadUsersTable();
}).fail(errorHandler.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -324,7 +349,7 @@ nf.UsersTable = (function () {
dataType: 'json',
contentType: 'application/json'
}).done(function (groupEntity) {
nf.UsersTable.loadUsersTable().done(function () {
self.loadUsersTable().done(function () {
// add the user
var usersGrid = $('#users-table').data('gridInstance');
var usersData = usersGrid.getData();
@ -334,7 +359,7 @@ nf.UsersTable = (function () {
usersGrid.setSelectedRows([row]);
usersGrid.scrollRowIntoView(row);
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
var updateGroup = function (groupId, groupIdentity, selectedUsers) {
@ -344,7 +369,7 @@ nf.UsersTable = (function () {
var groupEntity = usersData.getItemById(groupId);
var updatedGroupoEntity = {
'revision': nf.Client.getRevision(groupEntity),
'revision': client.getRevision(groupEntity),
'component': {
'id': groupId,
'identity': groupIdentity,
@ -360,8 +385,8 @@ nf.UsersTable = (function () {
dataType: 'json',
contentType: 'application/json'
}).done(function (groupEntity) {
nf.UsersTable.loadUsersTable();
}).fail(nf.Common.handleAjaxError);
self.loadUsersTable();
}).fail(errorHandler.handleAjaxError);
};
/**
@ -385,7 +410,7 @@ nf.UsersTable = (function () {
// see if we should create or update this user
if ($.trim(userId) === '') {
var tenantEntity = {
'revision': nf.Client.getRevision({
'revision': client.getRevision({
'revision': {
'version': 0
}
@ -499,7 +524,7 @@ nf.UsersTable = (function () {
*/
var globalResourceParser = function (dataContext) {
return 'Global policy to ' +
nf.Common.getPolicyTypeListing(nf.Common.substringAfterFirst(dataContext.component.resource, '/')).text;
common.getPolicyTypeListing(common.substringAfterFirst(dataContext.component.resource, '/')).text;
};
/**
@ -514,13 +539,13 @@ nf.UsersTable = (function () {
//determine policy type
if (resource.startsWith('/policies')) {
resource = nf.Common.substringAfterFirst(resource, '/policies');
resource = common.substringAfterFirst(resource, '/policies');
policyLabel += 'Admin policy for ';
} else if (resource.startsWith('/data-transfer')) {
resource = nf.Common.substringAfterFirst(resource, '/data-transfer');
resource = common.substringAfterFirst(resource, '/data-transfer');
policyLabel += 'Site to site policy for ';
} else if (resource.startsWith('/data')) {
resource = nf.Common.substringAfterFirst(resource, '/data');
resource = common.substringAfterFirst(resource, '/data');
policyLabel += 'Data policy for ';
} else {
policyLabel += 'Component policy for ';
@ -567,7 +592,7 @@ nf.UsersTable = (function () {
// if the user has permission to the policy
if (dataContext.permissions.canRead === true) {
// check if Global policy
if (nf.Common.isUndefinedOrNull(dataContext.component.componentReference)) {
if (common.isUndefinedOrNull(dataContext.component.componentReference)) {
return globalResourceParser(dataContext);
}
// not a global policy... check if user has access to the component reference
@ -582,7 +607,7 @@ nf.UsersTable = (function () {
var markup = '';
if (dataContext.permissions.canRead === true) {
if (nf.Common.isDefinedAndNotNull(dataContext.component.componentReference)) {
if (common.isDefinedAndNotNull(dataContext.component.componentReference)) {
if (dataContext.component.resource.indexOf('/processors') >= 0) {
markup += '<div title="Go To" class="pointer go-to-component fa fa-long-arrow-right" style="float: left;"></div>';
} else if (dataContext.component.resource.indexOf('/controller-services') >= 0) {
@ -622,13 +647,34 @@ nf.UsersTable = (function () {
};
var userPoliciesColumns = [
{id: 'policy', name: 'Policy', sortable: true, resizable: true, formatter: policyDisplayNameFormatter, width: 150},
{id: 'action', name: 'Action', sortable: true, resizable: false, formatter: actionFormatter, width: 50}
{
id: 'policy',
name: 'Policy',
sortable: true,
resizable: true,
formatter: policyDisplayNameFormatter,
width: 150
},
{
id: 'action',
name: 'Action',
sortable: true,
resizable: false,
formatter: actionFormatter,
width: 50
}
];
// add the actions if we're in the shell
if (top !== window) {
userPoliciesColumns.push({id: 'actions', name: '&nbsp;', sortable: false, resizable: false, formatter: actionsFormatter, width: 25});
userPoliciesColumns.push({
id: 'actions',
name: '&nbsp;',
sortable: false,
resizable: false,
formatter: actionsFormatter,
width: 25
});
}
var userPoliciesOptions = {
@ -737,12 +783,12 @@ nf.UsersTable = (function () {
var membersGroupsFormatter = function (row, cell, value, columnDef, dataContext) {
if (dataContext.type === 'group') {
return 'Members: <b>' + dataContext.component.users.map(function (user) {
return user.component.identity;
}).join('</b>, <b>') + '</b>';
return user.component.identity;
}).join('</b>, <b>') + '</b>';
} else {
return 'Member of: <b>' + dataContext.component.userGroups.map(function (group) {
return group.component.identity;
}).join('</b>, <b>') + '</b>';
return group.component.identity;
}).join('</b>, <b>') + '</b>';
}
};
@ -751,12 +797,12 @@ nf.UsersTable = (function () {
var markup = '';
// ensure user can modify the user
if (nf.Common.canModifyTenants()) {
if (common.canModifyTenants()) {
markup += '<div title="Edit" class="pointer edit-user fa fa-pencil" style="margin-right: 3px;"></div>';
markup += '<div title="Remove" class="pointer delete-user fa fa-trash"></div>';
}
if (!nf.Common.isEmpty(dataContext.component.accessPolicies)) {
if (!common.isEmpty(dataContext.component.accessPolicies)) {
markup += '<div title="View User Policies" class="pointer view-user-policies fa fa-key" style="margin-left: 3px;"></div>';
}
@ -765,10 +811,32 @@ nf.UsersTable = (function () {
// initialize the templates table
var usersColumns = [
{id: 'identity', name: 'User', sortable: true, resizable: true, formatter: identityFormatter},
{id: 'membersGroups', name: '&nbsp;', sortable: true, defaultSortAsc: false, resizable: true, formatter: membersGroupsFormatter},
{id: 'actions', name: '&nbsp;', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100}
{
id: 'identity',
name: 'User',
sortable: true,
resizable: true,
formatter: identityFormatter
},
{
id: 'membersGroups',
name: '&nbsp;',
sortable: true,
defaultSortAsc: false,
resizable: true,
formatter: membersGroupsFormatter
},
{
id: 'actions',
name: '&nbsp;',
sortable: false,
resizable: false,
formatter: actionFormatter,
width: 100,
maxWidth: 100
}
];
var usersOptions = {
forceFitColumns: true,
enableTextSelectionOnCells: true,
@ -854,15 +922,15 @@ nf.UsersTable = (function () {
var userSort = function (sortDetails, data) {
// defines a function for sorting
var comparer = function (a, b) {
if(a.permissions.canRead && b.permissions.canRead) {
var aString = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
if (a.permissions.canRead && b.permissions.canRead) {
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1;
} else {
if (!a.permissions.canRead && !b.permissions.canRead){
if (!a.permissions.canRead && !b.permissions.canRead) {
return 0;
}
if(a.permissions.canRead){
if (a.permissions.canRead) {
return 1;
} else {
return -1;
@ -883,10 +951,10 @@ nf.UsersTable = (function () {
var userPolicySort = function (sortDetails, data) {
// defines a function for sorting
var comparer = function (a, b) {
if(a.permissions.canRead && b.permissions.canRead) {
if (a.permissions.canRead && b.permissions.canRead) {
if (sortDetails.columnId === 'action') {
var aString = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
return aString === bString ? 0 : aString > bString ? 1 : -1;
} else if (sortDetails.columnId === 'policy') {
var aString = '';
@ -895,7 +963,7 @@ nf.UsersTable = (function () {
// if the user has permission to the policy
if (a.permissions.canRead === true) {
// check if Global policy
if (nf.Common.isUndefinedOrNull(a.component.componentReference)) {
if (common.isUndefinedOrNull(a.component.componentReference)) {
aString = globalResourceParser(a);
} else {
// not a global policy... check if user has access to the component reference
@ -908,9 +976,9 @@ nf.UsersTable = (function () {
// if the user has permission to the policy
if (b.permissions.canRead === true) {
// check if Global policy
if (nf.Common.isUndefinedOrNull(b.component.componentReference)) {
if (common.isUndefinedOrNull(b.component.componentReference)) {
bString = globalResourceParser(b);
}else {
} else {
// not a global policy... check if user has access to the component reference
bString = componentResourceParser(b);
}
@ -921,10 +989,10 @@ nf.UsersTable = (function () {
return aString === bString ? 0 : aString > bString ? 1 : -1;
}
} else {
if (!a.permissions.canRead && !b.permissions.canRead){
if (!a.permissions.canRead && !b.permissions.canRead) {
return 0;
}
if(a.permissions.canRead){
if (a.permissions.canRead) {
return 1;
} else {
return -1;
@ -953,7 +1021,7 @@ nf.UsersTable = (function () {
var usersGrid = $('#users-table').data('gridInstance');
// ensure the grid has been initialized
if (nf.Common.isDefinedAndNotNull(usersGrid)) {
if (common.isDefinedAndNotNull(usersGrid)) {
var usersData = usersGrid.getData();
// update the search criteria
@ -998,7 +1066,7 @@ nf.UsersTable = (function () {
// add a row for each user
var count = 0;
$.each(usersData.getItems(), function(_, user) {
$.each(usersData.getItems(), function (_, user) {
if (user.type === 'user') {
// checkbox
var checkbox = $('<div class="user-check nf-checkbox checkbox-unchecked"></div>').addClass('group-user-' + user.id);
@ -1031,14 +1099,14 @@ nf.UsersTable = (function () {
// add a row for each user
var count = 0;
$.each(usersData.getItems(), function(_, group) {
$.each(usersData.getItems(), function (_, group) {
if (group.type === 'group') {
// checkbox
var checkbox = $('<div class="group-check nf-checkbox checkbox-unchecked"></div>').addClass('user-group-' + group.id);
// group id
var groupId = $('<span class="group-id hidden"></span>').text(group.id);
// icon
var groupIcon = $('<div class="fa fa-users" style="margin-top: 6px;"></div>');
@ -1127,7 +1195,7 @@ nf.UsersTable = (function () {
userPoliciesData.beginUpdate();
// set the rows
if (nf.Common.isDefinedAndNotNull(user.component.accessPolicies)) {
if (common.isDefinedAndNotNull(user.component.accessPolicies)) {
userPoliciesData.setItems(user.component.accessPolicies);
}
@ -1146,7 +1214,7 @@ nf.UsersTable = (function () {
userPoliciesGrid.resizeCanvas();
};
return {
var nfUsersTable = {
init: function () {
initUserDialog();
initUserPoliciesDialog();
@ -1154,7 +1222,7 @@ nf.UsersTable = (function () {
initUserDeleteDialog();
initUsersTable();
if (nf.Common.canModifyTenants()) {
if (common.canModifyTenants()) {
$('#new-user-button').on('click', function () {
buildUsersList();
buildGroupsList();
@ -1179,7 +1247,7 @@ nf.UsersTable = (function () {
var usersTable = $('#users-table');
if (usersTable.is(':visible')) {
var grid = usersTable.data('gridInstance');
if (nf.Common.isDefinedAndNotNull(grid)) {
if (common.isDefinedAndNotNull(grid)) {
grid.resizeCanvas();
}
}
@ -1242,7 +1310,9 @@ nf.UsersTable = (function () {
usersGrid.getSelectionModel().setSelectedRows([]);
$('#total-users').text(usersData.getLength());
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
}
};
}());
return nfUsersTable;
}));

View File

@ -14,18 +14,50 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
$(document).ready(function () {
// initialize the counters page
nf.Users.init();
//alter styles if we're not in the shell
if (top === window) {
$('#users').css('top', 20);
$('#users-refresh-container').css('bottom', 20);
/* global nf, top, define, module, require, exports */
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Common',
'nf.UsersTable',
'nf.ErrorHandler',
'nf.Storage',
'nf.Client'],
function ($, common, usersTable, errorHandler, storage, client) {
return (nf.Users = factory($, common, usersTable, errorHandler, storage, client));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Users =
factory(require('jquery'),
require('nf.Common'),
require('nf.UsersTable'),
require('nf.ErrorHandler'),
require('nf.Storage'),
require('nf.Client')));
} else {
nf.Users =
factory(root.$,
root.nf.Common,
root.nf.UsersTable,
root.nf.ErrorHandler,
root.nf.Storage,
root.nf.Client);
}
});
}(this, function ($, common, usersTable, errorHandler, storage, client) {
'use strict';
nf.Users = (function () {
$(document).ready(function () {
// initialize the counters page
nfUsers.init();
//alter styles if we're not in the shell
if (top === window) {
$('#users').css('top', 20);
$('#users-refresh-container').css('bottom', 20);
}
});
/**
* Configuration object used to hold a number of configuration items.
@ -47,14 +79,14 @@ nf.Users = (function () {
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
common.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError);
};
var initializeUsersPage = function () {
// define mouse over event for the refresh button
nf.Common.addHoverEffect('#user-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () {
nf.UsersTable.loadUsersTable();
common.addHoverEffect('#user-refresh-button', 'button-refresh', 'button-refresh-hover').click(function () {
usersTable.loadUsersTable();
});
// get the banners if we're not in the shell
@ -66,8 +98,8 @@ nf.Users = (function () {
dataType: 'json'
}).done(function (bannerResponse) {
// ensure the banners response is specified
if (nf.Common.isDefinedAndNotNull(bannerResponse.banners)) {
if (nf.Common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') {
if (common.isDefinedAndNotNull(bannerResponse.banners)) {
if (common.isDefinedAndNotNull(bannerResponse.banners.headerText) && bannerResponse.banners.headerText !== '') {
// update the header text
var bannerHeader = $('#banner-header').text(bannerResponse.banners.headerText).show();
@ -81,7 +113,7 @@ nf.Users = (function () {
updateTop('users');
}
if (nf.Common.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') {
if (common.isDefinedAndNotNull(bannerResponse.banners.footerText) && bannerResponse.banners.footerText !== '') {
// update the footer text and show it
var bannerFooter = $('#banner-footer').text(bannerResponse.banners.footerText).show();
@ -97,7 +129,7 @@ nf.Users = (function () {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -106,30 +138,30 @@ nf.Users = (function () {
});
};
return {
var nfUsers = {
/**
* Initializes the counters page.
*/
init: function () {
nf.Storage.init();
storage.init();
// initialize the client
nf.Client.init();
client.init();
// load the users authorities
ensureAccess().done(function () {
// create the counters table
nf.UsersTable.init();
usersTable.init();
// load the users table
nf.UsersTable.loadUsersTable().done(function () {
usersTable.loadUsersTable().done(function () {
// finish initializing users page
initializeUsersPage().done(function () {
// listen for browser resize events to update the page size
$(window).resize(nf.UsersTable.resetTableSize);
$(window).resize(usersTable.resetTableSize);
// configure the initial grid height
nf.UsersTable.resetTableSize();
usersTable.resetTableSize();
// get the about details
$.ajax({
@ -143,15 +175,15 @@ nf.Users = (function () {
// set the document title and the about title
document.title = countersTitle;
$('#users-header-text').text(countersTitle);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
});
$(window).on('resize', function (e) {
// resize dialogs when appropriate
var dialogs = $('.dialog');
for (var i = 0, len = dialogs.length; i < len; i++) {
if ($(dialogs[i]).is(':visible')){
setTimeout(function(dialog){
if ($(dialogs[i]).is(':visible')) {
setTimeout(function (dialog) {
dialog.modal('resize');
}, 50, $(dialogs[i]));
}
@ -160,8 +192,8 @@ nf.Users = (function () {
// resize grids when appropriate
var gridElements = $('*[class*="slickgrid_"]');
for (var j = 0, len = gridElements.length; j < len; j++) {
if ($(gridElements[j]).is(':visible')){
setTimeout(function(gridElement){
if ($(gridElements[j]).is(':visible')) {
setTimeout(function (gridElement) {
gridElement.data('gridInstance').resizeCanvas();
}, 50, $(gridElements[j]));
}
@ -171,4 +203,6 @@ nf.Users = (function () {
});
}
};
}());
return nfUsers;
}));