[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';
@ -60,7 +59,20 @@
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.
*/
@ -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,15 +957,15 @@
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.'
});
@ -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;
}
@ -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,7 +1601,7 @@
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">' +
@ -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,7 +15,63 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, define, module, require, exports */
(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';
$(document).ready(function () {
@ -23,30 +79,29 @@ $(document).ready(function () {
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 = [];
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
appCtrl.$inject = ['$scope', 'serviceProvider', 'bulletinBoardCtrl'];
nfBulletinBoard.$inject = ['serviceProvider'];
serviceProvider.$inject = [];
//Configure Angular App
app.config(nf.ng.AppConfig);
app.config(appConfig);
//Define Angular App Controllers
app.controller('ngBulletinBoardAppCtrl', nf.ng.AppCtrl);
app.controller('ngBulletinBoardAppCtrl', appCtrl);
//Define Angular App Services
app.service('serviceProvider', nf.ng.ServiceProvider);
app.service('bulletinBoardCtrl', nf.ng.BulletinBoardCtrl);
app.service('serviceProvider', serviceProvider);
app.service('bulletinBoardCtrl', nfBulletinBoard);
//Manually Boostrap Angular App
nf.ng.Bridge.injector = angular.bootstrap($('body'), ['ngBulletinBoardApp'], { strictDi: true });
angularBridge.injector = angular.bootstrap($('body'), ['ngBulletinBoardApp'], {strictDi: true});
// initialize the bulletin board
nf.ng.Bridge.injector.get('bulletinBoardCtrl').init();
angularBridge.injector.get('bulletinBoardCtrl').init();
});
nf.ng.BulletinBoardCtrl = function (serviceProvider) {
'use strict';
var nfBulletinBoard = function (serviceProvider) {
/**
* Configuration object used to hold a number of configuration items.
@ -103,7 +158,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
// set the document title and the about title
document.title = bulletinBoardTitle;
$('#bulletin-board-header-text').text(bulletinBoardTitle);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
// get the banners if we're not in the shell
var loadBanners = $.Deferred(function (deferred) {
@ -114,8 +169,8 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
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();
@ -129,7 +184,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
updateTop('bulletin-board');
}
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();
@ -145,7 +200,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -231,7 +286,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
// 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, sourceId);
parent.$('#shell-close-button').click();
}
@ -244,6 +299,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
*/
this.polling = true;
}
BulletinBoardCtrl.prototype = {
constructor: BulletinBoardCtrl,
@ -277,7 +333,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
});
}
nf.Storage.init();
storage.init();
initializePage().done(function () {
start();
@ -291,7 +347,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
var data = {};
// include the timestamp if appropriate
if (nf.Common.isDefinedAndNotNull(lastBulletin)) {
if (common.isDefinedAndNotNull(lastBulletin)) {
data['after'] = lastBulletin;
} else {
data['limit'] = 10;
@ -326,7 +382,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
dataType: 'json'
}).done(function (response) {
// ensure the bulletin board was specified
if (nf.Common.isDefinedAndNotNull(response.bulletinBoard)) {
if (common.isDefinedAndNotNull(response.bulletinBoard)) {
var bulletinBoard = response.bulletinBoard;
// update the stats last refreshed timestamp
@ -351,13 +407,13 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
// format the source id
var source;
if (nf.Common.isDefinedAndNotNull(bulletin.sourceId) && nf.Common.isDefinedAndNotNull(bulletin.groupId) && top !== window) {
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 (nf.Common.isUndefined(sourceId) || nf.Common.isNull(sourceId)) {
if (common.isUndefined(sourceId) || common.isNull(sourceId)) {
sourceId = '';
}
source = $('<div class="bulletin-source"></div>').text(sourceId);
@ -374,7 +430,7 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
$('<div class="clear"></div>').appendTo(bulletinInfoMarkup);
// format the node address if applicable
if (nf.Common.isDefinedAndNotNull(bulletin.nodeAddress)) {
if (common.isDefinedAndNotNull(bulletin.nodeAddress)) {
$('<div class="bulletin-node"></div>').text(bulletin.nodeAddress).appendTo(bulletinMarkup);
}
@ -409,9 +465,9 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
$('#bulletin-error-message').text(xhr.responseText).show();
// stop future polling
togglePolling();
bulletinBoardCtrl.togglePolling();
} else {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
}
});
},
@ -433,3 +489,6 @@ nf.ng.BulletinBoardCtrl = function (serviceProvider) {
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,9 +15,34 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
nf.CustomUi = {
(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';
return {
/**
* Shows the custom ui.
*
@ -27,11 +52,11 @@ nf.CustomUi = {
*/
showCustomUi: function (entity, uri, editable) {
return $.Deferred(function (deferred) {
nf.Common.getAccessToken('../nifi-api/access/ui-extension-token').done(function (uiExtensionToken) {
common.getAccessToken('../nifi-api/access/ui-extension-token').done(function (uiExtensionToken) {
// record the processor id
$('#shell-close-button');
var revision = nf.Client.getRevision(entity);
var revision = client.getRevision(entity);
// build the customer ui params
var customUiParams = {
@ -42,16 +67,16 @@ nf.CustomUi = {
};
// conditionally include the ui extension token
if (!nf.Common.isBlank(uiExtensionToken)) {
if (!common.isBlank(uiExtensionToken)) {
customUiParams['access_token'] = uiExtensionToken;
}
// show the shell
nf.Shell.showPage('..' + uri + '?' + $.param(customUiParams), false).done(function () {
shell.showPage('..' + uri + '?' + $.param(customUiParams), false).done(function () {
deferred.resolve();
});
}).fail(function () {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Advanced Configuration',
dialogContent: 'Unable to generate access token for accessing the advanced configuration dialog.'
});
@ -59,4 +84,5 @@ nf.CustomUi = {
});
}).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.
@ -33,11 +58,11 @@ nf.ClusterTable = (function () {
data: [{
name: 'cluster',
update: refreshClusterData,
isAuthorized: nf.Common.canAccessController
isAuthorized: common.canAccessController
}, {
name: 'systemDiagnostics',
update: refreshSystemDiagnosticsData,
isAuthorized: nf.Common.canAccessSystem
isAuthorized: common.canAccessSystem
}
]
};
@ -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,
@ -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;
@ -317,8 +562,8 @@ nf.ClusterTable = (function () {
// 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,13 +571,13 @@ 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'
@ -340,19 +585,19 @@ nf.ClusterTable = (function () {
|| 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]);
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]);
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
@ -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)) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var jvmTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -715,8 +960,8 @@ 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)) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var systemTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -744,8 +989,8 @@ 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)) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var flowFileTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -773,8 +1018,8 @@ 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)) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var contentStorageTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -806,8 +1051,8 @@ 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)) {
if (common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics)
&& common.isDefinedAndNotNull(systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots)) {
var versionTableRows = [];
systemDiagnosticsResponse.systemDiagnostics.nodeSnapshots.forEach(function (nodeSnapshot) {
@ -848,7 +1093,7 @@ nf.ClusterTable = (function () {
handlers.forEach(function (handler) {
handler(systemDiagnosticsResponse);
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
return loadPromise;
};
@ -921,7 +1166,7 @@ nf.ClusterTable = (function () {
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();
@ -951,7 +1196,7 @@ nf.ClusterTable = (function () {
handlers.forEach(function (handler) {
handler(response);
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
return clusterNodesDataPromise;
}
@ -961,7 +1206,7 @@ nf.ClusterTable = (function () {
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,15 +15,40 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
(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';
$(document).ready(function () {
// initialize the counters page
nf.Cluster.init();
nfCluster.init();
});
nf.Cluster = (function () {
/**
* 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,12 +132,12 @@ 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 () {
@ -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,7 +181,7 @@ 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();
@ -189,7 +214,7 @@ nf.Cluster = (function () {
}
}
$.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.
@ -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
@ -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 {
@ -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 = {
@ -245,7 +294,7 @@ nf.CountersTable = (function () {
*/
resetTableSize: function () {
var countersGrid = $('#counters-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(countersGrid)) {
if (common.isDefinedAndNotNull(countersGrid)) {
countersGrid.resizeCanvas();
}
},
@ -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,15 +15,40 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
(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';
$(document).ready(function () {
// initialize the counters page
nf.Counters.init();
nfCounters.init();
});
nf.Counters = (function () {
/**
* 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 () {
@ -138,7 +163,7 @@ nf.Counters = (function () {
}
// configure the initial grid height
nf.CountersTable.resetTableSize();
countersTable.resetTableSize();
};
// get the about details
@ -156,7 +181,7 @@ nf.Counters = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
@ -189,7 +214,7 @@ nf.Counters = (function () {
}
}
$.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,11 +15,32 @@
* 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;
@ -38,9 +59,6 @@
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) {
@ -146,7 +164,7 @@
$('#history-last-refreshed').text(history.lastRefreshed);
// set the timezone for the start and end time
$('.timezone').text(nf.Common.substringAfterLast(history.lastRefreshed, ' '));
$('.timezone').text(common.substringAfterLast(history.lastRefreshed, ' '));
// show the filter message if applicable
if (query['sourceId'] || query['userIdentity'] || query['startDate'] || query['endDate']) {
@ -163,7 +181,7 @@
from: from,
to: to
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
xhr.fromPage = fromPage;
xhr.toPage = toPage;
@ -196,9 +214,11 @@
return data.length;
};
init();
function HistoryModel() {
}
return {
HistoryModel.prototype = {
constructor: HistoryModel,
// properties
data: data,
// methods
@ -213,9 +233,7 @@
// events
onDataLoading: onDataLoading,
onDataLoaded: onDataLoaded
};
}
// nf.HistoryModel
$.extend(true, window, {nf: {HistoryModel: HistoryModel}});
})(jQuery);
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
@ -283,7 +311,7 @@ nf.HistoryTable = (function () {
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,15 +15,43 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
(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';
$(document).ready(function () {
// initialize the status page
nf.History.init();
nfHistory.init();
});
nf.History = (function () {
/**
* 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 () {
@ -160,7 +173,7 @@ nf.History = (function () {
}
// configure the initial grid height
nf.HistoryTable.resetTableSize();
historyTable.resetTableSize();
};
// get the about details
@ -178,7 +191,7 @@ nf.History = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
@ -211,11 +224,13 @@ nf.History = (function () {
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
});
}
};
}());
return nfHistory;
}));

View File

@ -15,14 +15,33 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
(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';
$(document).ready(function () {
nf.Login.init();
nfLogin.init();
});
nf.Login = (function () {
var config = {
urls: {
token: '../nifi-api/access/token',
@ -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({
@ -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,17 +153,17 @@ 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();
}
@ -214,4 +233,6 @@ nf.Login = (function () {
});
}
};
}());
return nfLogin;
}));

View File

@ -15,6 +15,23 @@
* limitations under the License.
*/
/* global nf, define, module, require, exports */
(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.
*/
@ -22,10 +39,10 @@ $(document).ready(function ($) {
// include jwt when possible
$.ajaxSetup({
'beforeSend': function (xhr) {
var hadToken = nf.Storage.hasItem('jwt');
var hadToken = storage.hasItem('jwt');
// get the token to include in all requests
var token = nf.Storage.getItem('jwt');
var token = storage.getItem('jwt');
if (token !== null) {
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
} else {
@ -37,3 +54,4 @@ $(document).ready(function ($) {
}
});
});
}));

View File

@ -15,9 +15,27 @@
* 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 {
@ -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,7 +15,25 @@
* limitations under the License.
*/
/* global nf, parseFloat */
/* global nf, define, module, require, exports, parseFloat */
// Define a common utility class used across the entire application.
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'nf.Storage'],
function ($, storage) {
return (nf.Common = factory($, storage));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.Common = factory(require('jquery'),
require('nf.Storage')));
} else {
nf.Common = factory(root.$,
root.nf.Storage);
}
}(this, function ($, storage) {
'use strict';
$(document).ready(function () {
// preload the image for the error page - this is preloaded because the system
@ -52,14 +70,14 @@ $(document).ready(function () {
});
// shows the logout link in the message-pane when appropriate and schedule token refresh
if (nf.Storage.getItem('jwt') !== null) {
if (storage.getItem('jwt') !== null) {
$('#user-logout-container').css('display', 'block');
nf.Common.scheduleTokenRefresh();
nfCommon.scheduleTokenRefresh();
}
// handle logout
$('#user-logout').on('click', function () {
nf.Storage.removeItem('jwt');
storage.removeItem('jwt');
window.location = '/nifi/login';
});
@ -73,8 +91,6 @@ $(document).ready(function () {
});
});
// Define a common utility class used across the entire application.
nf.Common = (function () {
// interval for cancelling token refresh when necessary
var tokenRefreshInterval = null;
@ -120,7 +136,7 @@ nf.Common = (function () {
description: 'Allows users to view/modify Counters'
}];
return {
var nfCommon = {
ANONYMOUS_USER_TEXT: 'Anonymous user',
config: {
@ -174,8 +190,8 @@ nf.Common = (function () {
var markup = '';
// restriction
if (nf.Common.isBlank(dataContext.usageRestriction) === false) {
markup += '<div class="view-usage-restriction fa fa-shield"></div><span class="hidden row-id">' + nf.Common.escapeHtml(dataContext.id) + '</span>';
if (nfCommon.isBlank(dataContext.usageRestriction) === false) {
markup += '<div class="view-usage-restriction fa fa-shield"></div><span class="hidden row-id">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
} else {
markup += '<div class="fa"></div>';
}
@ -192,7 +208,7 @@ nf.Common = (function () {
* @param currentUser
*/
setCurrentUser: function (currentUser) {
nf.Common.currentUser = currentUser;
nfCommon.currentUser = currentUser;
},
/**
@ -205,10 +221,10 @@ nf.Common = (function () {
}
// set the interval to one hour
var interval = nf.Common.MILLIS_PER_MINUTE;
var interval = nfCommon.MILLIS_PER_MINUTE;
var checkExpiration = function () {
var expiration = nf.Storage.getItemExpiration('jwt');
var expiration = storage.getItemExpiration('jwt');
// ensure there is an expiration and token present
if (expiration !== null) {
@ -216,11 +232,11 @@ nf.Common = (function () {
var now = new Date();
// get the time remainging plus a little bonus time to reload the token
var timeRemaining = expirationDate.valueOf() - now.valueOf() - (30 * nf.Common.MILLIS_PER_SECOND);
var timeRemaining = expirationDate.valueOf() - now.valueOf() - (30 * nfCommon.MILLIS_PER_SECOND);
if (timeRemaining < interval) {
if ($('#current-user').text() !== nf.Common.ANONYMOUS_USER_TEXT && !$('#anonymous-user-alert').is(':visible')) {
if ($('#current-user').text() !== nfCommon.ANONYMOUS_USER_TEXT && !$('#anonymous-user-alert').is(':visible')) {
// if the token will expire before the next interval minus some bonus time, notify the user to re-login
$('#anonymous-user-alert').show().qtip($.extend({}, nf.Common.config.tooltipConfig, {
$('#anonymous-user-alert').show().qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: 'Your session will expire soon. Please log in again to avoid being automatically logged out.',
position: {
my: 'top right',
@ -249,7 +265,7 @@ nf.Common = (function () {
}
// alert user's of anonymous access
anonymousUserAlert.show().qtip($.extend({}, nf.Common.config.tooltipConfig, {
anonymousUserAlert.show().qtip($.extend({}, nfCommon.config.tooltipConfig, {
content: 'You are accessing with limited authority. Log in or request an account to access with additional authority granted to you by an administrator.',
position: {
my: 'top right',
@ -258,7 +274,7 @@ nf.Common = (function () {
}));
// render the anonymous user text
$('#current-user').text(nf.Common.ANONYMOUS_USER_TEXT).show();
$('#current-user').text(nfCommon.ANONYMOUS_USER_TEXT).show();
},
/**
@ -269,7 +285,7 @@ nf.Common = (function () {
* @returns {string}
*/
getJwtPayload: function (jwt) {
if (nf.Common.isDefinedAndNotNull(jwt)) {
if (nfCommon.isDefinedAndNotNull(jwt)) {
var segments = jwt.split(/\./);
if (segments.length !== 3) {
return '';
@ -278,7 +294,7 @@ nf.Common = (function () {
var rawPayload = $.base64.atob(segments[1]);
var payload = JSON.parse(rawPayload);
if (nf.Common.isDefinedAndNotNull(payload)) {
if (nfCommon.isDefinedAndNotNull(payload)) {
return payload;
} else {
return null;
@ -294,8 +310,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessProvenance: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.provenancePermissions.canRead === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.provenancePermissions.canRead === true;
} else {
return false;
}
@ -307,8 +323,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessRestrictedComponents: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.restrictedComponentsPermissions.canWrite === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.restrictedComponentsPermissions.canWrite === true;
} else {
return false;
}
@ -320,8 +336,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessCounters: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.countersPermissions.canRead === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.countersPermissions.canRead === true;
} else {
return false;
}
@ -333,8 +349,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canModifyCounters: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.countersPermissions.canRead === true && nf.Common.currentUser.countersPermissions.canWrite === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.countersPermissions.canRead === true && nfCommon.currentUser.countersPermissions.canWrite === true;
} else {
return false;
}
@ -346,8 +362,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessTenants: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.tenantsPermissions.canRead === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.tenantsPermissions.canRead === true;
} else {
return false;
}
@ -359,8 +375,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canModifyTenants: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.tenantsPermissions.canRead === true && nf.Common.currentUser.tenantsPermissions.canWrite === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.tenantsPermissions.canRead === true && nfCommon.currentUser.tenantsPermissions.canWrite === true;
} else {
return false;
}
@ -372,8 +388,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessPolicies: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.policiesPermissions.canRead === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.policiesPermissions.canRead === true;
} else {
return false;
}
@ -385,8 +401,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canModifyPolicies: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.policiesPermissions.canRead === true && nf.Common.currentUser.policiesPermissions.canWrite === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.policiesPermissions.canRead === true && nfCommon.currentUser.policiesPermissions.canWrite === true;
} else {
return false;
}
@ -398,8 +414,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessController: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.controllerPermissions.canRead === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.controllerPermissions.canRead === true;
} else {
return false;
}
@ -411,8 +427,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canModifyController: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.controllerPermissions.canRead === true && nf.Common.currentUser.controllerPermissions.canWrite === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.controllerPermissions.canRead === true && nfCommon.currentUser.controllerPermissions.canWrite === true;
} else {
return false;
}
@ -424,8 +440,8 @@ nf.Common = (function () {
* @returns {boolean}
*/
canAccessSystem: function () {
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
return nf.Common.currentUser.systemPermissions.canRead === true;
if (nfCommon.isDefinedAndNotNull(nfCommon.currentUser)) {
return nfCommon.currentUser.systemPermissions.canRead === true;
} else {
return false;
}
@ -478,151 +494,11 @@ nf.Common = (function () {
return '#ffffff';
},
/**
* 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 {
nf.Dialog.showOkDialog({
headerText: 'Session Expired',
dialogContent: 'Your session has expired. Please press Ok to log in again.',
okHandler: function () {
window.location = '/nifi';
}
});
}
// close the canvas
nf.Common.closeCanvas();
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();
// close the canvas
nf.Common.closeCanvas();
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) {
nf.Dialog.showOkDialog({
headerText: 'Error',
dialogContent: nf.Common.escapeHtml(xhr.responseText)
});
} else if (xhr.status === 403) {
nf.Dialog.showOkDialog({
headerText: 'Insufficient Permissions',
dialogContent: nf.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 (nf.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();
// close the canvas
nf.Common.closeCanvas();
}
},
/**
* Closes the canvas by removing the splash screen and stats poller.
*/
closeCanvas: function () {
nf.Common.showLogoutLink();
// ensure this javascript has been loaded in the nf canvas page
if (nf.Common.isDefinedAndNotNull(nf.Canvas)) {
// hide the splash screen if required
if ($('#splash').is(':visible')) {
nf.Canvas.hideSplash();
}
// hide the context menu
nf.ContextMenu.hide();
// shut off the auto refresh
nf.Canvas.stopPolling();
// allow page refresh with ctrl-r
nf.Canvas.disableRefreshHotKey();
}
},
/**
* Shows the logout link if appropriate.
*/
showLogoutLink: function () {
if (nf.Storage.getItem('jwt') === null) {
if (storage.getItem('jwt') === null) {
$('#user-logout-container').css('display', 'none');
} else {
$('#user-logout-container').css('display', 'block');
@ -636,7 +512,7 @@ nf.Common = (function () {
*/
isContentViewConfigured: function () {
var contentViewerUrl = $('#nifi-content-viewer-url').text();
return !nf.Common.isBlank(contentViewerUrl);
return !nfCommon.isBlank(contentViewerUrl);
},
/**
@ -648,7 +524,7 @@ nf.Common = (function () {
* @argument {string} value The value
*/
populateField: function (target, value) {
if (nf.Common.isUndefined(value) || nf.Common.isNull(value)) {
if (nfCommon.isUndefined(value) || nfCommon.isNull(value)) {
return $('#' + target).addClass('unset').text('No value set');
} else if (value === '') {
return $('#' + target).addClass('blank').text('Empty string set');
@ -694,23 +570,23 @@ nf.Common = (function () {
var tipContent = [];
// show the property description if applicable
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (!nf.Common.isBlank(propertyDescriptor.description)) {
tipContent.push(nf.Common.escapeHtml(propertyDescriptor.description));
if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
if (!nfCommon.isBlank(propertyDescriptor.description)) {
tipContent.push(nfCommon.escapeHtml(propertyDescriptor.description));
}
if (!nf.Common.isBlank(propertyDescriptor.defaultValue)) {
tipContent.push('<b>Default value:</b> ' + nf.Common.escapeHtml(propertyDescriptor.defaultValue));
if (!nfCommon.isBlank(propertyDescriptor.defaultValue)) {
tipContent.push('<b>Default value:</b> ' + nfCommon.escapeHtml(propertyDescriptor.defaultValue));
}
if (!nf.Common.isBlank(propertyDescriptor.supportsEl)) {
tipContent.push('<b>Supports expression language:</b> ' + nf.Common.escapeHtml(propertyDescriptor.supportsEl));
if (!nfCommon.isBlank(propertyDescriptor.supportsEl)) {
tipContent.push('<b>Supports expression language:</b> ' + nfCommon.escapeHtml(propertyDescriptor.supportsEl));
}
}
if (nf.Common.isDefinedAndNotNull(propertyHistory)) {
if (!nf.Common.isEmpty(propertyHistory.previousValues)) {
if (nfCommon.isDefinedAndNotNull(propertyHistory)) {
if (!nfCommon.isEmpty(propertyHistory.previousValues)) {
var history = [];
$.each(propertyHistory.previousValues, function (_, previousValue) {
history.push('<li>' + nf.Common.escapeHtml(previousValue.previousValue) + ' - ' + nf.Common.escapeHtml(previousValue.timestamp) + ' (' + nf.Common.escapeHtml(previousValue.userIdentity) + ')</li>');
history.push('<li>' + nfCommon.escapeHtml(previousValue.previousValue) + ' - ' + nfCommon.escapeHtml(previousValue.timestamp) + ' (' + nfCommon.escapeHtml(previousValue.userIdentity) + ')</li>');
});
tipContent.push('<b>History:</b><ul class="property-info">' + history.join('') + '</ul>');
}
@ -730,7 +606,7 @@ nf.Common = (function () {
* @argument {string} value The value of the property
*/
formatProperty: function (name, value) {
return '<div><span class="label">' + nf.Common.formatValue(name) + ': </span>' + nf.Common.formatValue(value) + '</div>';
return '<div><span class="label">' + nfCommon.formatValue(name) + ': </span>' + nfCommon.formatValue(value) + '</div>';
},
/**
@ -739,11 +615,11 @@ nf.Common = (function () {
* @argument {string} value The value of the property
*/
formatValue: function (value) {
if (nf.Common.isDefinedAndNotNull(value)) {
if (nfCommon.isDefinedAndNotNull(value)) {
if (value === '') {
return '<span class="blank" style="font-size: 13px; padding-top: 2px;">Empty string set</span>';
} else {
return nf.Common.escapeHtml(value);
return nfCommon.escapeHtml(value);
}
} else {
return '<span class="unset" style="font-size: 13px; padding-top: 2px;">No value set</span>';
@ -767,7 +643,7 @@ nf.Common = (function () {
};
return function (string) {
if (nf.Common.isDefinedAndNotNull(string)) {
if (nfCommon.isDefinedAndNotNull(string)) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return entityMap[s];
});
@ -783,7 +659,7 @@ nf.Common = (function () {
* @argument {object} propertyDescriptor The property descriptor
*/
isSensitiveProperty: function (propertyDescriptor) {
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
return propertyDescriptor.sensitive === true;
} else {
return false;
@ -796,7 +672,7 @@ nf.Common = (function () {
* @param {object} propertyDescriptor The property descriptor
*/
isRequiredProperty: function (propertyDescriptor) {
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
return propertyDescriptor.required === true;
} else {
return false;
@ -809,7 +685,7 @@ nf.Common = (function () {
* @param {object} propertyDescriptor The property descriptor
*/
isDynamicProperty: function (propertyDescriptor) {
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
return propertyDescriptor.dynamic === true;
} else {
return false;
@ -822,7 +698,7 @@ nf.Common = (function () {
* @argument {object} propertyDescriptor The property descriptor
*/
getAllowableValues: function (propertyDescriptor) {
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
return propertyDescriptor.allowableValues;
} else {
return null;
@ -835,7 +711,7 @@ nf.Common = (function () {
* @param {object} propertyDescriptor The property descriptor
*/
supportsEl: function (propertyDescriptor) {
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
if (nfCommon.isDefinedAndNotNull(propertyDescriptor)) {
return propertyDescriptor.supportsEl === true;
} else {
return false;
@ -944,7 +820,7 @@ nf.Common = (function () {
*/
getAccessToken: function (accessTokenUrl) {
return $.Deferred(function (deferred) {
if (nf.Storage.hasItem('jwt')) {
if (storage.hasItem('jwt')) {
$.ajax({
type: 'POST',
url: accessTokenUrl
@ -977,35 +853,35 @@ nf.Common = (function () {
duration = duration < 1 ? 0 : duration;
// determine the number of days in the specified duration
var days = duration / nf.Common.MILLIS_PER_DAY;
var days = duration / nfCommon.MILLIS_PER_DAY;
days = days >= 1 ? parseInt(days, 10) : 0;
duration %= nf.Common.MILLIS_PER_DAY;
duration %= nfCommon.MILLIS_PER_DAY;
// remaining duration should be less than 1 day, get number of hours
var hours = duration / nf.Common.MILLIS_PER_HOUR;
var hours = duration / nfCommon.MILLIS_PER_HOUR;
hours = hours >= 1 ? parseInt(hours, 10) : 0;
duration %= nf.Common.MILLIS_PER_HOUR;
duration %= nfCommon.MILLIS_PER_HOUR;
// remaining duration should be less than 1 hour, get number of minutes
var minutes = duration / nf.Common.MILLIS_PER_MINUTE;
var minutes = duration / nfCommon.MILLIS_PER_MINUTE;
minutes = minutes >= 1 ? parseInt(minutes, 10) : 0;
duration %= nf.Common.MILLIS_PER_MINUTE;
duration %= nfCommon.MILLIS_PER_MINUTE;
// remaining duration should be less than 1 minute, get number of seconds
var seconds = duration / nf.Common.MILLIS_PER_SECOND;
var seconds = duration / nfCommon.MILLIS_PER_SECOND;
seconds = seconds >= 1 ? parseInt(seconds, 10) : 0;
// remaining duration is the number millis (don't support sub millisecond resolution)
duration = Math.floor(duration % nf.Common.MILLIS_PER_SECOND);
duration = Math.floor(duration % nfCommon.MILLIS_PER_SECOND);
// format the time
var time = nf.Common.pad(hours, 2, '0') +
var time = nfCommon.pad(hours, 2, '0') +
':' +
nf.Common.pad(minutes, 2, '0') +
nfCommon.pad(minutes, 2, '0') +
':' +
nf.Common.pad(seconds, 2, '0') +
nfCommon.pad(seconds, 2, '0') +
'.' +
nf.Common.pad(duration, 3, '0');
nfCommon.pad(duration, 3, '0');
// only include days if appropriate
if (days > 0) {
@ -1031,25 +907,25 @@ nf.Common = (function () {
*/
formatDataSize: function (dataSize) {
// check terabytes
var dataSizeToFormat = parseFloat(dataSize / nf.Common.BYTES_IN_TERABYTE);
var dataSizeToFormat = parseFloat(dataSize / nfCommon.BYTES_IN_TERABYTE);
if (dataSizeToFormat > 1) {
return dataSizeToFormat.toFixed(2) + " TB";
}
// check gigabytes
dataSizeToFormat = parseFloat(dataSize / nf.Common.BYTES_IN_GIGABYTE);
dataSizeToFormat = parseFloat(dataSize / nfCommon.BYTES_IN_GIGABYTE);
if (dataSizeToFormat > 1) {
return dataSizeToFormat.toFixed(2) + " GB";
}
// check megabytes
dataSizeToFormat = parseFloat(dataSize / nf.Common.BYTES_IN_MEGABYTE);
dataSizeToFormat = parseFloat(dataSize / nfCommon.BYTES_IN_MEGABYTE);
if (dataSizeToFormat > 1) {
return dataSizeToFormat.toFixed(2) + " MB";
}
// check kilobytes
dataSizeToFormat = parseFloat(dataSize / nf.Common.BYTES_IN_KILOBYTE);
dataSizeToFormat = parseFloat(dataSize / nfCommon.BYTES_IN_KILOBYTE);
if (dataSizeToFormat > 1) {
return dataSizeToFormat.toFixed(2) + " KB";
}
@ -1079,7 +955,7 @@ nf.Common = (function () {
* @param {float} f
*/
formatFloat: function (f) {
if (nf.Common.isUndefinedOrNull(f)) {
if (nfCommon.isUndefinedOrNull(f)) {
return 0.00 + '';
}
return f.toFixed(2) + '';
@ -1113,19 +989,19 @@ nf.Common = (function () {
* @returns {String}
*/
formatDateTime: function (date) {
return nf.Common.pad(date.getMonth() + 1, 2, '0') +
return nfCommon.pad(date.getMonth() + 1, 2, '0') +
'/' +
nf.Common.pad(date.getDate(), 2, '0') +
nfCommon.pad(date.getDate(), 2, '0') +
'/' +
nf.Common.pad(date.getFullYear(), 2, '0') +
nfCommon.pad(date.getFullYear(), 2, '0') +
' ' +
nf.Common.pad(date.getHours(), 2, '0') +
nfCommon.pad(date.getHours(), 2, '0') +
':' +
nf.Common.pad(date.getMinutes(), 2, '0') +
nfCommon.pad(date.getMinutes(), 2, '0') +
':' +
nf.Common.pad(date.getSeconds(), 2, '0') +
nfCommon.pad(date.getSeconds(), 2, '0') +
'.' +
nf.Common.pad(date.getMilliseconds(), 3, '0');
nfCommon.pad(date.getMilliseconds(), 3, '0');
},
/**
@ -1138,7 +1014,7 @@ nf.Common = (function () {
*/
parseDateTime: function (rawDateTime) {
// handle non date values
if (!nf.Common.isDefinedAndNotNull(rawDateTime)) {
if (!nfCommon.isDefinedAndNotNull(rawDateTime)) {
return new Date();
}
if (rawDateTime === 'No value set') {
@ -1252,7 +1128,7 @@ nf.Common = (function () {
* @argument {object} obj The object to test
*/
isDefinedAndNotNull: function (obj) {
return !nf.Common.isUndefined(obj) && !nf.Common.isNull(obj);
return !nfCommon.isUndefined(obj) && !nfCommon.isNull(obj);
},
/**
@ -1261,7 +1137,7 @@ nf.Common = (function () {
* @param {object} obj The object to test
*/
isUndefinedOrNull: function (obj) {
return nf.Common.isUndefined(obj) || nf.Common.isNull(obj);
return nfCommon.isUndefined(obj) || nfCommon.isNull(obj);
},
/**
@ -1279,7 +1155,7 @@ nf.Common = (function () {
* @argument {string} str The string to test
*/
isBlank: function (str) {
return nf.Common.isUndefined(str) || nf.Common.isNull(str) || $.trim(str) === '';
return nfCommon.isUndefined(str) || nfCommon.isNull(str) || $.trim(str) === '';
},
/**
@ -1340,8 +1216,8 @@ nf.Common = (function () {
// format the node address
var nodeAddress = '';
if (nf.Common.isDefinedAndNotNull(bulletin.nodeAddress)) {
nodeAddress = '-&nbsp;' + nf.Common.escapeHtml(bulletin.nodeAddress) + '&nbsp;-&nbsp;';
if (nfCommon.isDefinedAndNotNull(bulletin.nodeAddress)) {
nodeAddress = '-&nbsp;' + nfCommon.escapeHtml(bulletin.nodeAddress) + '&nbsp;-&nbsp;';
}
// set the bulletin message (treat as text)
@ -1351,9 +1227,9 @@ nf.Common = (function () {
// create the bulletin message
var formattedBulletin = $('<div>' +
nf.Common.escapeHtml(bulletin.timestamp) + '&nbsp;' +
nfCommon.escapeHtml(bulletin.timestamp) + '&nbsp;' +
nodeAddress + '&nbsp;' +
'<b>' + nf.Common.escapeHtml(bulletin.level) + '</b>&nbsp;' +
'<b>' + nfCommon.escapeHtml(bulletin.level) + '</b>&nbsp;' +
'</div>').append(bulletinMessage);
formattedBulletinEntities.push(formattedBulletin);
@ -1364,9 +1240,13 @@ nf.Common = (function () {
getPolicyTypeListing: function (value) {
var nest = d3.nest()
.key(function(d) { return d.value; })
.key(function (d) {
return d.value;
})
.map(policyTypeListing, d3.map);
return nest.get(value)[0];
}
};
}());
return nfCommon;
}));

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,7 +15,20 @@
* limitations under the License.
*/
/* global nf */
/* global nf, define, module, require, exports */
(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
@ -42,9 +55,7 @@ $(document).ready(function () {
});
});
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,9 +15,22 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, define, module, require, exports */
nf.ng.AppConfig = function ($mdThemingProvider, $compileProvider) {
(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);
@ -92,4 +105,5 @@ nf.ng.AppConfig = function ($mdThemingProvider, $compileProvider) {
}).warnPalette("warnPalette", {
"default": "500"
});
};
}
}));

View File

@ -15,9 +15,23 @@
* 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';
return function ($scope, serviceProvider) {
'use strict';
function AppCtrl(serviceProvider) {
@ -26,6 +40,7 @@ nf.ng.AppCtrl = function ($scope, serviceProvider) {
//any registered angular service is available through the serviceProvider
this.serviceProvider = serviceProvider;
}
AppCtrl.prototype = {
constructor: AppCtrl
}
@ -35,5 +50,6 @@ nf.ng.AppCtrl = function ($scope, 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;
};
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,14 +15,25 @@
* 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';
return function () {
function ServiceProvider() {
}
ServiceProvider.prototype = {
constructor: ServiceProvider,
@ -33,19 +44,19 @@ nf.ng.ServiceProvider = function () {
* @param {object} object The object to register
*/
register: function (name, object) {
serviceProvider[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
* @param {string} objectName The lookup name of the object to remove from the registry
*/
remove: function (objectName) {
delete serviceProvider[objectName];
delete this[objectName];
}
}
var serviceProvider = new ServiceProvider();
return serviceProvider;
};
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,7 +15,27 @@
* 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',
'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';
$(document).ready(function () {
// configure the dialog
@ -38,7 +58,7 @@ $(document).ready(function () {
// register a listener when the frame is undocked
$('#shell-undock-button').click(function () {
var uri = $('#shell-iframe').attr('src');
if (!nf.Common.isBlank(uri)) {
if (!common.isBlank(uri)) {
// open the page and close the shell
window.open(uri);
@ -48,8 +68,6 @@ $(document).ready(function () {
});
});
nf.Shell = (function () {
var showPageResize = null;
var showContentResize = null;
@ -82,15 +100,15 @@ nf.Shell = (function () {
*/
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
@ -136,8 +154,8 @@ nf.Shell = (function () {
*/
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) {
@ -186,4 +204,4 @@ nf.Shell = (function () {
}).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;
}
@ -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;
@ -87,7 +97,7 @@ nf.Storage = (function () {
var key = localStorage.key(i);
// attempt to get the item which will expire if necessary
nf.Storage.getItem(key);
this.getItem(key);
} catch (e) {
}
}
@ -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;
}
@ -182,4 +192,4 @@ nf.Storage = (function () {
localStorage.removeItem(key);
}
};
}());
}));

View File

@ -15,6 +15,21 @@
* limitations under the License.
*/
/* global nf, define, module, require, exports */
(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';
/**
* Captures keydown on the window to ensure certain keystrokes are handled in a consistent manner, particularly those
* that can lead to browser navigation/reload.
@ -38,7 +53,7 @@ $(document).ready(function ($) {
// consider property detail dialogs
if ($('div.property-detail').is(':visible')) {
nf.UniversalCapture.removeAllPropertyDetailDialogs();
nfUniversalDialog.removeAllPropertyDetailDialogs();
// prevent further bubbling as we're already handled it
evt.stopImmediatePropagation();
@ -115,8 +130,7 @@ $(document).ready(function ($) {
});
});
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,9 +15,36 @@
* limitations under the License.
*/
/* global nf, d3 */
/* global nf, top, define, module, require, exports */
nf.ng.ProvenanceLineage = 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.ng.ProvenanceLineage = factory($, d3, common, dialog, errorHandler));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.ProvenanceLineage =
factory(require('jquery'),
require('d3'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.ErrorHandler')));
} else {
nf.ng.ProvenanceLineage = factory(root.$,
root.d3,
root.nf.Common,
root.nf.Dialog,
root.nf.ErrorHandler);
}
}(this, function ($, d3, common, dialog, errorHandler) {
'use strict';
var mySelf = function () {
'use strict';
/**
@ -27,6 +54,7 @@ nf.ng.ProvenanceLineage = function () {
sliderTickCount: 75,
urls: {
lineage: '../nifi-api/provenance/lineage'
}
};
@ -108,7 +136,7 @@ nf.ng.ProvenanceLineage = function () {
data: JSON.stringify(lineageEntity),
dataType: 'json',
contentType: 'application/json'
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -119,7 +147,7 @@ nf.ng.ProvenanceLineage = function () {
*/
var getLineage = function (lineage) {
var url = lineage.uri;
if (nf.Common.isDefinedAndNotNull(lineage.request.clusterNodeId)) {
if (common.isDefinedAndNotNull(lineage.request.clusterNodeId)) {
url += '?' + $.param({
clusterNodeId: lineage.request.clusterNodeId
});
@ -129,7 +157,7 @@ nf.ng.ProvenanceLineage = function () {
type: 'GET',
url: url,
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -140,7 +168,7 @@ nf.ng.ProvenanceLineage = function () {
*/
var cancelLineage = function (lineage) {
var url = lineage.uri;
if (nf.Common.isDefinedAndNotNull(lineage.request.clusterNodeId)) {
if (common.isDefinedAndNotNull(lineage.request.clusterNodeId)) {
url += '?' + $.param({
clusterNodeId: lineage.request.clusterNodeId
});
@ -150,7 +178,7 @@ nf.ng.ProvenanceLineage = function () {
type: 'DELETE',
url: url,
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
var DEFAULT_NODE_SPACING = 100;
@ -188,7 +216,7 @@ nf.ng.ProvenanceLineage = function () {
descendants.add(link.target.id);
});
if (nf.Common.isUndefined(depth)) {
if (common.isUndefined(depth)) {
locateDescendants(children, descendants);
} else if (depth > 1) {
locateDescendants(children, descendants, depth - 1);
@ -455,11 +483,11 @@ nf.ng.ProvenanceLineage = function () {
node.incoming = [];
// ensure this event has an event time
if (nf.Common.isUndefined(minMillis) || minMillis > node.millis) {
if (common.isUndefined(minMillis) || minMillis > node.millis) {
minMillis = node.millis;
minTimestamp = node.timestamp;
}
if (nf.Common.isUndefined(maxMillis) || maxMillis < node.millis) {
if (common.isUndefined(maxMillis) || maxMillis < node.millis) {
maxMillis = node.millis;
}
});
@ -498,7 +526,7 @@ nf.ng.ProvenanceLineage = function () {
// create the proper date by adjusting by the offsets
var date = new Date(millis + userTimeOffset + provenanceTableCtrl.serverTimeOffset);
return nf.Common.formatDateTime(date);
return common.formatDateTime(date);
};
// handle context menu clicks...
@ -724,7 +752,9 @@ nf.ng.ProvenanceLineage = function () {
return 'url(#' + d.target.type + ')';
});
})
.text(function(d) { return '\ue808' });
.text(function (d) {
return '\ue808'
});
};
// renders event nodes
@ -807,7 +837,7 @@ nf.ng.ProvenanceLineage = function () {
// closes the searching dialog and cancels the query on the server
var closeDialog = function () {
// cancel the provenance results since we've successfully processed the results
if (nf.Common.isDefinedAndNotNull(lineage)) {
if (common.isDefinedAndNotNull(lineage)) {
cancelLineage(lineage);
}
@ -834,11 +864,11 @@ nf.ng.ProvenanceLineage = function () {
}
// close the dialog if the results contain an error
if (!nf.Common.isEmpty(lineage.results.errors)) {
if (!common.isEmpty(lineage.results.errors)) {
var errors = lineage.results.errors;
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Process Lineage',
dialogContent: nf.Common.formatUnorderedList(errors)
dialogContent: common.formatUnorderedList(errors)
});
closeDialog();
@ -858,7 +888,7 @@ nf.ng.ProvenanceLineage = function () {
renderEventLineage(results);
} else {
// inform the user that no results were found
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Lineage Results',
dialogContent: 'The lineage search has completed successfully but there no results were found. The events may have aged off.'
});
@ -1323,7 +1353,7 @@ nf.ng.ProvenanceLineage = function () {
// closes the searching dialog and cancels the query on the server
var closeDialog = function () {
// cancel the provenance results since we've successfully processed the results
if (nf.Common.isDefinedAndNotNull(lineage)) {
if (common.isDefinedAndNotNull(lineage)) {
cancelLineage(lineage);
}
@ -1349,11 +1379,11 @@ nf.ng.ProvenanceLineage = function () {
}
// close the dialog if the results contain an error
if (!nf.Common.isEmpty(lineage.results.errors)) {
if (!common.isEmpty(lineage.results.errors)) {
var errors = lineage.results.errors;
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Process Lineage',
dialogContent: nf.Common.formatUnorderedList(errors)
dialogContent: common.formatUnorderedList(errors)
});
closeDialog();
@ -1395,3 +1425,6 @@ nf.ng.ProvenanceLineage = function () {
var provenanceLineageCtrl = new ProvenanceLineageCtrl();
return provenanceLineageCtrl;
};
return mySelf;
}));

View File

@ -15,9 +15,42 @@
* limitations under the License.
*/
/* global nf, top, Slick */
/* global nf, top, define, module, require, exports */
nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery',
'Slick',
'nf.Common',
'nf.Dialog',
'nf.ErrorHandler',
'nf.Storage',
'nf.ng.Bridge'],
function ($, Slick, common, dialog, errorHandler, storage, angularBridge) {
return (nf.ng.ProvenanceTable = factory($, Slick, common, dialog, errorHandler, storage, angularBridge));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.ng.ProvenanceTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.Dialog'),
require('nf.ErrorHandler'),
require('nf.Storage'),
require('nf.ng.Bridge')));
} else {
nf.ng.ProvenanceTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.Dialog,
root.nf.ErrorHandler,
root.nf.Storage,
root.nf.ng.Bridge);
}
}(this, function ($, Slick, common, dialog, errorHandler, storage, angularBridge) {
'use strict';
var nfProvenanceTable = function (provenanceLineageCtrl) {
'use strict';
/**
@ -60,17 +93,17 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var dataUri = config.urls.provenanceEvents + encodeURIComponent(eventId) + '/content/' + encodeURIComponent(direction);
// perform the request once we've received a token
nf.Common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
var parameters = {};
// conditionally include the ui extension token
if (!nf.Common.isBlank(downloadToken)) {
if (!common.isBlank(downloadToken)) {
parameters['access_token'] = downloadToken;
}
// conditionally include the cluster node id
var clusterNodeId = $('#provenance-event-cluster-node-id').text();
if (!nf.Common.isBlank(clusterNodeId)) {
if (!common.isBlank(clusterNodeId)) {
parameters['clusterNodeId'] = clusterNodeId;
}
@ -81,7 +114,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
window.open(dataUri + '?' + $.param(parameters));
}
}).fail(function () {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Provenance',
dialogContent: 'Unable to generate access token for downloading content.'
});
@ -102,7 +135,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// generate tokens as necessary
var getAccessTokens = $.Deferred(function (deferred) {
if (nf.Storage.hasItem('jwt')) {
if (storage.hasItem('jwt')) {
// generate a token for the ui extension and another for the callback
var uiExtensionToken = $.ajax({
type: 'POST',
@ -119,7 +152,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var downloadToken = downloadTokenResult[0];
deferred.resolve(uiExtensionToken, downloadToken);
}).fail(function () {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Provenance',
dialogContent: 'Unable to generate access token for viewing content.'
});
@ -136,12 +169,12 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// conditionally include the cluster node id
var clusterNodeId = $('#provenance-event-cluster-node-id').text();
if (!nf.Common.isBlank(clusterNodeId)) {
if (!common.isBlank(clusterNodeId)) {
dataUriParameters['clusterNodeId'] = clusterNodeId;
}
// include the download token if applicable
if (!nf.Common.isBlank(downloadToken)) {
if (!common.isBlank(downloadToken)) {
dataUriParameters['access_token'] = downloadToken;
}
@ -167,7 +200,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
};
// include the download token if applicable
if (!nf.Common.isBlank(uiExtensionToken)) {
if (!common.isBlank(uiExtensionToken)) {
contentViewerParameters['access_token'] = uiExtensionToken;
}
@ -224,7 +257,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
$('#modified-attribute-toggle').removeClass('checkbox-checked').addClass('checkbox-unchecked');
},
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));
}
}
});
@ -250,7 +283,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
});
// if a content viewer url is specified, use it
if (nf.Common.isContentViewConfigured()) {
if (common.isContentViewConfigured()) {
// input view
$('#input-content-view').on('click', function () {
viewContent('input');
@ -270,7 +303,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// conditionally include the cluster node id
var clusterNodeId = $('#provenance-event-cluster-node-id').text();
if (!nf.Common.isBlank(clusterNodeId)) {
if (!common.isBlank(clusterNodeId)) {
replayEntity['clusterNodeId'] = clusterNodeId;
}
@ -281,11 +314,11 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
dataType: 'json',
contentType: 'application/json'
}).done(function (response) {
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Provenance',
dialogContent: 'Successfully submitted replay request.'
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$('#event-details-dialog').modal('hide');
});
@ -355,7 +388,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
$('#provenance-search-location').combo({
options: searchableOptions
});
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
// show the node search combo
$('#provenance-search-location-container').show();
@ -501,7 +534,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var searchValue = $.trim(searchableField.find('input.searchable-field-input').val());
// if the field isn't blank include it in the search
if (!nf.Common.isBlank(searchValue)) {
if (!common.isBlank(searchValue)) {
searchCriteria[fieldId] = searchValue;
}
});
@ -598,7 +631,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// define how general values are formatted
var valueFormatter = function (row, cell, value, columnDef, dataContext) {
return nf.Common.formatValue(value);
return common.formatValue(value);
};
// determine if the this page is in the shell
@ -609,13 +642,13 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var markup = '';
// conditionally include the cluster node id
if (nf.Common.SUPPORTS_SVG) {
if (common.SUPPORTS_SVG) {
markup += '<div title="Show Lineage" class="pointer show-lineage icon icon-lineage" style="margin-right: 3px;"></div>';
}
// conditionally support going to the component
var isRemotePort = dataContext.componentType === 'Remote Input Port' || dataContext.componentType === 'Remote Output Port';
if (isInShell && nf.Common.isDefinedAndNotNull(dataContext.groupId) && isRemotePort === false) {
if (isInShell && common.isDefinedAndNotNull(dataContext.groupId) && isRemotePort === false) {
markup += '<div class="pointer go-to fa fa-long-arrow-right" title="Go To"></div>';
}
@ -641,9 +674,28 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
defaultSortAsc: false,
resizable: true
},
{id: 'eventType', name: 'Type', field: 'eventType', sortable: true, resizable: true},
{id: 'flowFileUuid', name: 'FlowFile Uuid', field: 'flowFileUuid', sortable: true, resizable: true},
{id: 'fileSize', name: 'Size', field: 'fileSize', sortable: true, defaultSortAsc: false, resizable: true},
{
id: 'eventType',
name: 'Type',
field: 'eventType',
sortable: true,
resizable: true
},
{
id: 'flowFileUuid',
name: 'FlowFile Uuid',
field: 'flowFileUuid',
sortable: true,
resizable: true
},
{
id: 'fileSize',
name: 'Size',
field: 'fileSize',
sortable: true,
defaultSortAsc: false,
resizable: true
},
{
id: 'componentName',
name: 'Component Name',
@ -652,7 +704,13 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
resizable: true,
formatter: valueFormatter
},
{id: 'componentType', name: 'Component Type', field: 'componentType', sortable: true, resizable: true}
{
id: 'componentType',
name: 'Component Type',
field: 'componentType',
sortable: true,
resizable: true
}
];
// conditionally show the cluster node identifier
@ -667,7 +725,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
}
// conditionally show the action column
if (nf.Common.SUPPORTS_SVG || isInShell) {
if (common.SUPPORTS_SVG || isInShell) {
provenanceColumns.push({
id: 'actions',
name: '&nbsp;',
@ -747,7 +805,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
provenanceGrid.render();
// update the total number of displayed events if necessary
$('#displayed-events').text(nf.Common.formatInteger(args.current));
$('#displayed-events').text(common.formatInteger(args.current));
});
provenanceData.onRowsChanged.subscribe(function (e, args) {
provenanceGrid.invalidateRows(args.rows);
@ -770,7 +828,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var provenanceGrid = $('#provenance-table').data('gridInstance');
// ensure the grid has been initialized
if (nf.Common.isDefinedAndNotNull(provenanceGrid)) {
if (common.isDefinedAndNotNull(provenanceGrid)) {
var provenanceData = provenanceGrid.getData();
// update the search criteria
@ -824,24 +882,24 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// defines a function for sorting
var comparer = function (a, b) {
if (sortDetails.columnId === 'eventTime') {
var aTime = nf.Common.parseDateTime(a[sortDetails.columnId]).getTime();
var bTime = nf.Common.parseDateTime(b[sortDetails.columnId]).getTime();
var aTime = common.parseDateTime(a[sortDetails.columnId]).getTime();
var bTime = common.parseDateTime(b[sortDetails.columnId]).getTime();
if (aTime === bTime) {
return a['id'] - b['id'];
} else {
return aTime - bTime;
}
} else if (sortDetails.columnId === 'fileSize') {
var aSize = nf.Common.parseSize(a[sortDetails.columnId]);
var bSize = nf.Common.parseSize(b[sortDetails.columnId]);
var aSize = common.parseSize(a[sortDetails.columnId]);
var bSize = common.parseSize(b[sortDetails.columnId]);
if (aSize === bSize) {
return a['id'] - b['id'];
} else {
return aSize - bSize;
}
} 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] : '';
if (aString === bString) {
return a['id'] - b['id'];
} else {
@ -878,7 +936,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
data: JSON.stringify(provenanceEntity),
dataType: 'json',
contentType: 'application/json'
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -889,7 +947,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
*/
var getProvenance = function (provenance) {
var url = provenance.uri;
if (nf.Common.isDefinedAndNotNull(provenance.request.clusterNodeId)) {
if (common.isDefinedAndNotNull(provenance.request.clusterNodeId)) {
url += '?' + $.param({
clusterNodeId: provenance.request.clusterNodeId,
summarize: true,
@ -906,7 +964,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
type: 'GET',
url: url,
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -917,7 +975,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
*/
var cancelProvenance = function (provenance) {
var url = provenance.uri;
if (nf.Common.isDefinedAndNotNull(provenance.request.clusterNodeId)) {
if (common.isDefinedAndNotNull(provenance.request.clusterNodeId)) {
url += '?' + $.param({
clusterNodeId: provenance.request.clusterNodeId
});
@ -927,7 +985,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
type: 'DELETE',
url: url,
dataType: 'json'
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -940,7 +998,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var provenanceResults = provenance.results;
// ensure there are groups specified
if (nf.Common.isDefinedAndNotNull(provenanceResults.provenanceEvents)) {
if (common.isDefinedAndNotNull(provenanceResults.provenanceEvents)) {
var provenanceTable = $('#provenance-table').data('gridInstance');
var provenanceData = provenanceTable.getData();
@ -953,21 +1011,21 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
$('#provenance-last-refreshed').text(provenanceResults.generated);
// update the oldest event available
$('#oldest-event').html(nf.Common.formatValue(provenanceResults.oldestEvent));
$('#oldest-event').html(common.formatValue(provenanceResults.oldestEvent));
// record the server offset
provenanceTableCtrl.serverTimeOffset = provenanceResults.timeOffset;
// determines if the specified query is blank (no search terms, start or end date)
var isBlankQuery = function (query) {
return nf.Common.isUndefinedOrNull(query.startDate) && nf.Common.isUndefinedOrNull(query.endDate) && $.isEmptyObject(query.searchTerms);
return common.isUndefinedOrNull(query.startDate) && common.isUndefinedOrNull(query.endDate) && $.isEmptyObject(query.searchTerms);
};
// update the filter message based on the request
if (isBlankQuery(provenanceRequest)) {
var message = 'Showing the most recent ';
if (provenanceResults.totalCount >= config.maxResults) {
message += (nf.Common.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events, please refine the search.');
message += (common.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events, please refine the search.');
} else {
message += ('events.');
}
@ -976,7 +1034,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
} else {
var message = 'Showing ';
if (provenanceResults.totalCount >= config.maxResults) {
message += (nf.Common.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events that match the specified query, please refine the search.');
message += (common.formatInteger(config.maxResults) + ' of ' + provenanceResults.total + ' events that match the specified query, please refine the search.');
} else {
message += ('the events that match the specified query.');
}
@ -985,7 +1043,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
}
// update the total number of events
$('#total-events').text(nf.Common.formatInteger(provenanceResults.provenanceEvents.length));
$('#total-events').text(common.formatInteger(provenanceResults.provenanceEvents.length));
} else {
$('#total-events').text('0');
}
@ -998,11 +1056,11 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
*/
var goTo = function (item) {
// ensure the component is still present in the flow
if (nf.Common.isDefinedAndNotNull(item.groupId)) {
if (common.isDefinedAndNotNull(item.groupId)) {
// 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(item.groupId, item.componentId);
parent.$('#shell-close-button').click();
}
@ -1013,6 +1071,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
function ProvenanceTableCtrl() {
/**
* The server time offset
*/
this.serverTimeOffset = null;
@ -1027,12 +1086,12 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
* @param {boolean} isClustered Whether or not this instance is clustered
*/
init: function (isClustered) {
var self = this;
var provenanceTableCtrl = this;
return $.Deferred(function (deferred) {
// handles init failure
var failure = function (xhr, status, error) {
deferred.reject();
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
};
// initialize the lineage view
@ -1041,8 +1100,8 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// initialize the table view
initDetailsDialog();
initProvenanceQueryDialog();
initProvenanceTable(isClustered, self);
initSearchDialog(isClustered, self).done(function () {
initProvenanceTable(isClustered, provenanceTableCtrl);
initSearchDialog(isClustered, provenanceTableCtrl).done(function () {
deferred.resolve();
}).fail(failure);
}).promise();
@ -1053,7 +1112,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
*/
resetTableSize: function () {
var provenanceGrid = $('#provenance-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(provenanceGrid)) {
if (common.isDefinedAndNotNull(provenanceGrid)) {
provenanceGrid.resizeCanvas();
}
},
@ -1072,7 +1131,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// update the progress bar
var label = $('<div class="progress-label"></div>').text(value + '%');
(nf.ng.Bridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + value + '" class="md-hue-2" md-mode="determinate" aria-label="Progress"></md-progress-linear>'))(nf.ng.Bridge.rootScope)).appendTo(progressBar);
(angularBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + value + '" class="md-hue-2" md-mode="determinate" aria-label="Progress"></md-progress-linear>'))(angularBridge.rootScope)).appendTo(progressBar);
progressBar.append(label);
},
@ -1084,7 +1143,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
* @param {object} query
*/
loadProvenanceTable: function (query) {
var self = this;
var provenanceTableCtrl = this;
var provenanceProgress = $('#provenance-percent-complete');
// add support to cancel outstanding requests - when the button is pressed we
@ -1098,7 +1157,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var provenanceTimer = null;
// update the progress bar value
self.updateProgress(provenanceProgress, 0);
provenanceTableCtrl.updateProgress(provenanceProgress, 0);
// show the 'searching...' dialog
$('#provenance-query-dialog').modal('setButtonModel', [{
@ -1129,7 +1188,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// -----------------------------
// handle the specified query appropriately
if (nf.Common.isDefinedAndNotNull(query)) {
if (common.isDefinedAndNotNull(query)) {
// store the last query performed
cachedQuery = query;
} else if (!$.isEmptyObject(cachedQuery)) {
@ -1143,7 +1202,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// closes the searching dialog and cancels the query on the server
var closeDialog = function () {
// cancel the provenance results since we've successfully processed the results
if (nf.Common.isDefinedAndNotNull(provenance)) {
if (common.isDefinedAndNotNull(provenance)) {
cancelProvenance(provenance);
}
@ -1171,21 +1230,21 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
}
// update the percent complete
self.updateProgress(provenanceProgress, provenance.percentCompleted);
provenanceTableCtrl.updateProgress(provenanceProgress, provenance.percentCompleted);
// process the results if they are finished
if (provenance.finished === true) {
// show any errors when the query finishes
if (!nf.Common.isEmpty(provenance.results.errors)) {
if (!common.isEmpty(provenance.results.errors)) {
var errors = provenance.results.errors;
nf.Dialog.showOkDialog({
dialog.showOkDialog({
headerText: 'Provenance',
dialogContent: nf.Common.formatUnorderedList(errors),
dialogContent: common.formatUnorderedList(errors),
});
}
// process the results
loadProvenanceResults(provenance, self);
loadProvenanceResults(provenance, provenanceTableCtrl);
// hide the dialog
closeDialog();
@ -1246,25 +1305,25 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// update the event details
$('#provenance-event-id').text(event.eventId);
$('#provenance-event-time').html(nf.Common.formatValue(event.eventTime)).ellipsis();
$('#provenance-event-type').html(nf.Common.formatValue(event.eventType)).ellipsis();
$('#provenance-event-flowfile-uuid').html(nf.Common.formatValue(event.flowFileUuid)).ellipsis();
$('#provenance-event-component-id').html(nf.Common.formatValue(event.componentId)).ellipsis();
$('#provenance-event-component-name').html(nf.Common.formatValue(event.componentName)).ellipsis();
$('#provenance-event-component-type').html(nf.Common.formatValue(event.componentType)).ellipsis();
$('#provenance-event-details').html(nf.Common.formatValue(event.details)).ellipsis();
$('#provenance-event-time').html(common.formatValue(event.eventTime)).ellipsis();
$('#provenance-event-type').html(common.formatValue(event.eventType)).ellipsis();
$('#provenance-event-flowfile-uuid').html(common.formatValue(event.flowFileUuid)).ellipsis();
$('#provenance-event-component-id').html(common.formatValue(event.componentId)).ellipsis();
$('#provenance-event-component-name').html(common.formatValue(event.componentName)).ellipsis();
$('#provenance-event-component-type').html(common.formatValue(event.componentType)).ellipsis();
$('#provenance-event-details').html(common.formatValue(event.details)).ellipsis();
// over the default tooltip with the actual byte count
var fileSize = $('#provenance-event-file-size').html(nf.Common.formatValue(event.fileSize)).ellipsis();
fileSize.attr('title', nf.Common.formatInteger(event.fileSizeBytes) + ' bytes');
var fileSize = $('#provenance-event-file-size').html(common.formatValue(event.fileSize)).ellipsis();
fileSize.attr('title', common.formatInteger(event.fileSizeBytes) + ' bytes');
// sets an duration
var setDuration = function (field, value) {
if (nf.Common.isDefinedAndNotNull(value)) {
if (common.isDefinedAndNotNull(value)) {
if (value === 0) {
field.text('< 1ms');
} else {
field.text(nf.Common.formatDuration(value));
field.text(common.formatDuration(value));
}
} else {
field.html('<span class="unset">No value set</span>');
@ -1279,7 +1338,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var formatEventDetail = function (label, value) {
$('<div class="event-detail"></div>').append(
$('<div class="detail-name"></div>').text(label)).append(
$('<div class="detail-value">' + nf.Common.formatValue(value) + '</div>').ellipsis()).append(
$('<div class="detail-value">' + common.formatValue(value) + '</div>').ellipsis()).append(
$('<div class="clear"></div>')).appendTo('#additional-provenance-details');
};
@ -1310,7 +1369,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
}
// conditionally show the cluster node identifier
if (nf.Common.isDefinedAndNotNull(event.clusterNodeId)) {
if (common.isDefinedAndNotNull(event.clusterNodeId)) {
// save the cluster node id
$('#provenance-event-cluster-node-id').text(event.clusterNodeId);
@ -1323,7 +1382,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var childUuids = $('#child-flowfiles-container');
// handle parent flowfiles
if (nf.Common.isEmpty(event.parentUuids)) {
if (common.isEmpty(event.parentUuids)) {
$('#parent-flowfile-count').text(0);
parentUuids.append('<span class="unset">No parents</span>');
} else {
@ -1334,7 +1393,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
}
// handle child flowfiles
if (nf.Common.isEmpty(event.childUuids)) {
if (common.isEmpty(event.childUuids)) {
$('#child-flowfile-count').text(0);
childUuids.append('<span class="unset">No children</span>');
} else {
@ -1351,23 +1410,23 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
$.each(event.attributes, function (_, attribute) {
// create the attribute record
var attributeRecord = $('<div class="attribute-detail"></div>')
.append($('<div class="attribute-name">' + nf.Common.formatValue(attribute.name) + '</div>').ellipsis())
.append($('<div class="attribute-name">' + common.formatValue(attribute.name) + '</div>').ellipsis())
.appendTo(attributesContainer);
// add the current value
attributeRecord
.append($('<div class="attribute-value">' + nf.Common.formatValue(attribute.value) + '</div>').ellipsis())
.append($('<div class="attribute-value">' + common.formatValue(attribute.value) + '</div>').ellipsis())
.append('<div class="clear"></div>');
// show the previous value if the property has changed
if (attribute.value !== attribute.previousValue) {
if (nf.Common.isDefinedAndNotNull(attribute.previousValue)) {
if (common.isDefinedAndNotNull(attribute.previousValue)) {
attributeRecord
.append($('<div class="modified-attribute-value">' + nf.Common.formatValue(attribute.previousValue) + '<span class="unset"> (previous)</span></div>').ellipsis())
.append($('<div class="modified-attribute-value">' + common.formatValue(attribute.previousValue) + '<span class="unset"> (previous)</span></div>').ellipsis())
.append('<div class="clear"></div>');
} else {
attributeRecord
.append($('<div class="unset" style="font-size: 13px; padding-top: 2px;">' + nf.Common.formatValue(attribute.previousValue) + '</div>').ellipsis())
.append($('<div class="unset" style="font-size: 13px; padding-top: 2px;">' + common.formatValue(attribute.previousValue) + '</div>').ellipsis())
.append('<div class="clear"></div>');
}
} else {
@ -1377,7 +1436,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
});
var formatContentValue = function (element, value) {
if (nf.Common.isDefinedAndNotNull(value)) {
if (common.isDefinedAndNotNull(value)) {
element.removeClass('unset').text(value);
} else {
element.addClass('unset').text('No value previously set');
@ -1395,9 +1454,9 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// input content file size
var inputContentSize = $('#input-content-size');
formatContentValue(inputContentSize, event.inputContentClaimFileSize);
if (nf.Common.isDefinedAndNotNull(event.inputContentClaimFileSize)) {
if (common.isDefinedAndNotNull(event.inputContentClaimFileSize)) {
// over the default tooltip with the actual byte count
inputContentSize.attr('title', nf.Common.formatInteger(event.inputContentClaimFileSizeBytes) + ' bytes');
inputContentSize.attr('title', common.formatInteger(event.inputContentClaimFileSizeBytes) + ' bytes');
}
formatContentValue($('#output-content-container'), event.outputContentClaimContainer);
@ -1409,15 +1468,15 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
// output content file size
var outputContentSize = $('#output-content-size');
formatContentValue(outputContentSize, event.outputContentClaimFileSize);
if (nf.Common.isDefinedAndNotNull(event.outputContentClaimFileSize)) {
if (common.isDefinedAndNotNull(event.outputContentClaimFileSize)) {
// over the default tooltip with the actual byte count
outputContentSize.attr('title', nf.Common.formatInteger(event.outputContentClaimFileSizeBytes) + ' bytes');
outputContentSize.attr('title', common.formatInteger(event.outputContentClaimFileSizeBytes) + ' bytes');
}
if (event.inputContentAvailable === true) {
$('#input-content-download').show();
if (nf.Common.isContentViewConfigured()) {
if (common.isContentViewConfigured()) {
$('#input-content-view').show();
} else {
$('#input-content-view').hide();
@ -1430,7 +1489,7 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
if (event.outputContentAvailable === true) {
$('#output-content-download').show();
if (nf.Common.isContentViewConfigured()) {
if (common.isContentViewConfigured()) {
$('#output-content-view').show();
} else {
$('#output-content-view').hide();
@ -1458,3 +1517,6 @@ nf.ng.ProvenanceTable = function (provenanceLineageCtrl) {
var provenanceTableCtrl = new ProvenanceTableCtrl();
return provenanceTableCtrl;
};
return nfProvenanceTable;
}));

View File

@ -15,39 +15,99 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
(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';
$(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'];
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
appCtrl.$inject = ['$scope'];
nfProvenance.$inject = ['provenanceTableCtrl'];
provenanceLineage.$inject = [];
provenanceTable.$inject = ['provenanceLineageCtrl'];
//Configure Angular App
app.config(nf.ng.AppConfig);
app.config(appConfig);
//Define Angular App Controllers
app.controller('ngProvenanceAppCtrl', nf.ng.AppCtrl);
app.controller('ngProvenanceAppCtrl', appCtrl);
//Define Angular App Services
app.service('provenanceCtrl', nf.ng.Provenance);
app.service('provenanceLineageCtrl', nf.ng.ProvenanceLineage);
app.service('provenanceTableCtrl', nf.ng.ProvenanceTable);
app.service('provenanceCtrl', nfProvenance);
app.service('provenanceLineageCtrl', provenanceLineage);
app.service('provenanceTableCtrl', provenanceTable);
//Manually Boostrap Angular App
nf.ng.Bridge.injector = angular.bootstrap($('body'), ['ngProvenanceApp'], { strictDi: true });
angularBridge.injector = angular.bootstrap($('body'), ['ngProvenanceApp'], {strictDi: true});
// initialize the status page
nf.ng.Bridge.injector.get('provenanceCtrl').init();
angularBridge.injector.get('provenanceCtrl').init();
});
nf.ng.Provenance = function (provenanceTableCtrl) {
'use strict';
var nfProvenance = function (provenanceTableCtrl) {
/**
* Configuration object used to hold a number of configuration items.
@ -75,7 +135,7 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
url: config.urls.clusterSummary
}).done(function (response) {
isClustered = response.clusterSummary.connectedToCluster;
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -98,14 +158,14 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
$('.timezone').text(aboutDetails.timezone);
// store the content viewer url if available
if (!nf.Common.isBlank(aboutDetails.contentViewerUrl)) {
if (!common.isBlank(aboutDetails.contentViewerUrl)) {
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
}
// set the document title and the about title
document.title = provenanceTitle;
$('#provenance-header-text').text(provenanceTitle);
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -117,8 +177,8 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
url: config.urls.currentUser,
dataType: 'json'
}).done(function (currentUser) {
nf.Common.setCurrentUser(currentUser);
}).fail(nf.Common.handleAjaxError);
common.setCurrentUser(currentUser);
}).fail(errorHandler.handleAjaxError);
};
/**
@ -140,8 +200,8 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
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();
@ -155,7 +215,7 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
updateTop('provenance');
}
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();
@ -171,7 +231,7 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
deferred.resolve();
}).fail(function (xhr, status, error) {
nf.Common.handleAjaxError(xhr, status, error);
errorHandler.handleAjaxError(xhr, status, error);
deferred.reject();
});
} else {
@ -190,7 +250,7 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
* Initializes the status page.
*/
init: function () {
nf.Storage.init();
storage.init();
// load the user and detect if the NiFi is clustered
$.when(loadAbout(), loadCurrentUser(), detectedCluster()).done(function () {
@ -286,7 +346,7 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
}
}
$.each(tabsContents, function (index, tabsContent) {
nf.Common.toggleScrollable(tabsContent.get(0));
common.toggleScrollable(tabsContent.get(0));
});
});
});
@ -296,4 +356,7 @@ nf.ng.Provenance = function (provenanceTableCtrl) {
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,7 +2289,7 @@ 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) {
return a.name === b.name ? 0 : a.name > b.name ? 1 : -1;
@ -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,7 +2316,7 @@ 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) {
return a.identifier === b.identifier ? 0 : a.identifier > b.identifier ? 1 : -1;
@ -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,12 +2380,12 @@ 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) + '%'));
$('<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 */
(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';
$(document).ready(function () {
//Create Angular App
var app = angular.module('ngSummaryApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
//Define Dependency Injection Annotations
nf.ng.AppConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
nf.ng.AppCtrl.$inject = ['$scope', 'serviceProvider'];
nf.ng.ServiceProvider.$inject = [];
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
appCtrl.$inject = ['$scope', 'serviceProvider'];
serviceProvider.$inject = [];
//Configure Angular App
app.config(nf.ng.AppConfig);
app.config(appConfig);
//Define Angular App Controllers
app.controller('ngSummaryAppCtrl', nf.ng.AppCtrl);
app.controller('ngSummaryAppCtrl', appCtrl);
//Define Angular App Services
app.service('serviceProvider', nf.ng.ServiceProvider);
app.service('serviceProvider', serviceProvider);
//Manually Boostrap Angular App
nf.ng.Bridge.injector = angular.bootstrap($('body'), ['ngSummaryApp'], { strictDi: true });
angularBridge.injector = angular.bootstrap($('body'), ['ngSummaryApp'], {strictDi: true});
// initialize the summary page
nf.Summary.init();
clusterSummary.loadClusterSummary().done(function () {
nfSummary.init();
});
});
nf.Summary = (function () {
/**
* 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 () {
@ -163,7 +241,7 @@ nf.Summary = (function () {
});
}
nf.SummaryTable.resetTableSize();
summaryTable.resetTableSize();
};
// get the about details
@ -181,7 +259,7 @@ nf.Summary = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
@ -214,7 +292,7 @@ nf.Summary = (function () {
}
}
$.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.
@ -40,12 +65,12 @@ nf.TemplatesTable = (function () {
var comparer = function (a, b) {
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 {
@ -71,9 +96,9 @@ nf.TemplatesTable = (function () {
*/
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);
}
@ -89,7 +114,7 @@ nf.TemplatesTable = (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.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();
}
@ -113,7 +138,7 @@ nf.TemplatesTable = (function () {
// 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
@ -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.'
});
@ -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,
@ -366,7 +427,7 @@ nf.TemplatesTable = (function () {
*/
resetTableSize: function () {
var templateGrid = $('#templates-table').data('gridInstance');
if (nf.Common.isDefinedAndNotNull(templateGrid)) {
if (common.isDefinedAndNotNull(templateGrid)) {
templateGrid.resizeCanvas();
}
},
@ -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,15 +15,40 @@
* limitations under the License.
*/
/* global nf, top */
/* global nf, top, define, module, require, exports */
(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';
$(document).ready(function () {
// initialize the templates page
nf.Templates.init();
nfTemplates.init();
});
nf.Templates = (function () {
/**
* 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,7 +180,7 @@ nf.Templates = (function () {
// set the initial size
setBodySize();
}).fail(nf.Common.handleAjaxError);
}).fail(errorHandler.handleAjaxError);
$(window).on('resize', function (e) {
setBodySize();
@ -188,7 +213,7 @@ nf.Templates = (function () {
}
}
$.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
})
@ -227,14 +252,14 @@ nf.UsersTable = (function () {
});
$.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
@ -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 = {
@ -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,
@ -855,8 +923,8 @@ nf.UsersTable = (function () {
// 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] : '';
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) {
@ -885,8 +953,8 @@ nf.UsersTable = (function () {
var comparer = function (a, b) {
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,7 +976,7 @@ 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 {
// not a global policy... check if user has access to the component reference
@ -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
@ -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,9 +14,43 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* 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';
$(document).ready(function () {
// initialize the counters page
nf.Users.init();
nfUsers.init();
//alter styles if we're not in the shell
if (top === window) {
@ -25,8 +59,6 @@ $(document).ready(function () {
}
});
nf.Users = (function () {
/**
* 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,7 +175,7 @@ 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) {
@ -171,4 +203,6 @@ nf.Users = (function () {
});
}
};
}());
return nfUsers;
}));