mirror of https://github.com/apache/nifi.git
[NIFI-3360] taking bottom up approach to modularizing the canvas...wrapping modulaes with UMD and keep the app loading
- taking top down approach from this point and leveraging inversion of control desgin pattern - This closes #1487
This commit is contained in:
parent
2e1b87fa43
commit
bf3b1640fc
|
@ -422,56 +422,57 @@
|
||||||
<insertNewLine>true</insertNewLine>
|
<insertNewLine>true</insertNewLine>
|
||||||
<output>${project.build.directory}/${project.build.finalName}/js/nf/canvas/nf-canvas-all.js</output>
|
<output>${project.build.directory}/${project.build.finalName}/js/nf/canvas/nf-canvas-all.js</output>
|
||||||
<includes>
|
<includes>
|
||||||
<include>${staging.dir}/js/nf/nf-dialog.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-cluster-summary.js</include>
|
||||||
<include>${staging.dir}/js/nf/nf-storage.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-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-universal-capture.js</include>
|
||||||
<include>${staging.dir}/js/nf/nf-shell.js</include>
|
<include>${staging.dir}/js/nf/nf-dialog.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-snippet.js</include>
|
<include>${staging.dir}/js/nf/nf-common.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-queue-listing.js</include>
|
<include>${staging.dir}/js/nf/nf-error-handler.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-component-state.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-component-state.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/nf-shell.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/nf-client.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-clipboard.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-custom-ui.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-canvas-utils.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-controller-services.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-go-to.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-reporting-task.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-snippet.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-processor-configuration.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-connection.js</include>
|
||||||
<include>${staging.dir}/js/nf/nf-processor-details.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-funnel.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-process-group-configuration.js</include>
|
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-policy-management.js</include>
|
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group-configuration.js</include>
|
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group-details.js</include>
|
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group-ports.js</include>
|
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-port-configuration.js</include>
|
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-port-details.js</include>
|
|
||||||
<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>
|
<include>${staging.dir}/js/nf/canvas/nf-label.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-port.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-port.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-process-group.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-process-group.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-funnel.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-processor.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-connection.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-processor-configuration.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-draggable.js</include>
|
<include>${staging.dir}/js/nf/nf-processor-details.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-connectable.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-label-configuration.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-port-configuration.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-port-details.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-process-group-configuration.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group-configuration.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group-details.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-remote-process-group-ports.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/canvas/nf-context-menu.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-selectable.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-birdseye.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-settings.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-draggable.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-go-to.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-connectable.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-graph.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/nf-status-history.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-queue-listing.js</include>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-policy-management.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-actions.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-actions.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-clipboard.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-canvas.js</include>
|
||||||
<include>${staging.dir}/js/nf/nf-ng-service-provider.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-canvas-error-handler.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>
|
||||||
|
<include>${staging.dir}/js/nf/canvas/nf-settings.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/controllers/nf-ng-breadcrumbs-controller.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-header-controller.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js</include>
|
<include>${staging.dir}/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js</include>
|
||||||
|
@ -492,7 +493,7 @@
|
||||||
<include>${staging.dir}/js/nf/canvas/directives/nf-ng-draggable-directive.js</include>
|
<include>${staging.dir}/js/nf/canvas/directives/nf-ng-draggable-directive.js</include>
|
||||||
<include>${staging.dir}/js/nf/nf-ng-app-controller.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/nf-ng-app-config.js</include>
|
||||||
<include>${staging.dir}/js/nf/canvas/nf-canvas-utils.js</include>
|
<include>${staging.dir}/js/nf/canvas/nf-canvas-bootstrap.js</include>
|
||||||
</includes>
|
</includes>
|
||||||
</aggregation>
|
</aggregation>
|
||||||
<aggregation>
|
<aggregation>
|
||||||
|
|
|
@ -13,56 +13,57 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
nf.canvas.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${project.version}"></script>\n\
|
nf.canvas.script.tags=<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-cluster-summary.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-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-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-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/nf-dialog.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/nf-common.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/nf-error-handler.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-component-state.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-component-state.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/nf-client.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/canvas/nf-custom-ui.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/canvas/nf-controller-service.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/canvas/nf-controller-services.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-reporting-task.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-processor-configuration.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-connection.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-funnel.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/canvas/nf-policy-management.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group-configuration.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group-details.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group-ports.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-port-configuration.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-port-details.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-label-configuration.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-connection-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/canvas/nf-graph.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-processor.js?${project.version}"></script>\n\
|
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-label.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-label.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-port.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-port.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-process-group.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-process-group.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-funnel.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-processor.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-connection.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-processor-configuration.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-draggable.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-connectable.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-label-configuration.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-port-configuration.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-port-details.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/canvas/nf-remote-process-group-configuration.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group-details.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-remote-process-group-ports.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-connection-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/canvas/nf-context-menu.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-selectable.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-selectable.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-birdseye.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/nf-birdseye.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-draggable.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-connectable.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-graph.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/canvas/nf-queue-listing.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-policy-management.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-actions.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/canvas/nf-canvas.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/nf-canvas-error-handler.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-controller-service.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-controller-services.js?${project.version}"></script>\n\
|
||||||
|
<script type="text/javascript" src="js/nf/canvas/nf-reporting-task.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/controllers/nf-ng-breadcrumbs-controller.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\
|
<script type="text/javascript" src="js/nf/canvas/controllers/nf-ng-canvas-header-controller.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js?${project.version}"></script>\n\
|
<script type="text/javascript" src="js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js?${project.version}"></script>\n\
|
||||||
|
@ -83,6 +84,6 @@ nf.canvas.script.tags=<script type="text/javascript" src="js/nf/nf-dialog.js?${p
|
||||||
<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/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-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/nf-ng-app-config.js?${project.version}"></script>\n\
|
||||||
<script type="text/javascript" src="js/nf/canvas/nf-canvas-utils.js?${project.version}"></script>
|
<script type="text/javascript" src="js/nf/canvas/nf-canvas-bootstrap.js?${project.version}"></script>
|
||||||
nf.canvas.style.tags=<link rel="stylesheet" href="css/canvas.css?${project.version}" type="text/css" />\n\
|
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" />
|
<link rel="stylesheet" href="css/common-ui.css?${project.version}" type="text/css" />
|
|
@ -22,56 +22,56 @@
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.processor}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.processor}}"
|
||||||
id="processor-component"
|
id="processor-component"
|
||||||
class="component-button icon icon-processor"
|
class="component-button icon icon-processor"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.processorComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.processorComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.inputPort}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.inputPort}}"
|
||||||
id="port-in-component"
|
id="port-in-component"
|
||||||
class="component-button icon icon-port-in"
|
class="component-button icon icon-port-in"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.inputPortComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.inputPortComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.outputPort}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.outputPort}}"
|
||||||
id="port-out-component"
|
id="port-out-component"
|
||||||
class="component-button icon icon-port-out"
|
class="component-button icon icon-port-out"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.outputPortComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.outputPortComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.processGroup}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.processGroup}}"
|
||||||
id="group-component"
|
id="group-component"
|
||||||
class="component-button icon icon-group"
|
class="component-button icon icon-group"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.groupComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.groupComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.remoteProcessGroup}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.remoteProcessGroup}}"
|
||||||
id="group-remote-component"
|
id="group-remote-component"
|
||||||
class="component-button icon icon-group-remote"
|
class="component-button icon icon-group-remote"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.remoteGroupComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.remoteGroupComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.funnel}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.funnel}}"
|
||||||
id="funnel-component"
|
id="funnel-component"
|
||||||
class="component-button icon icon-funnel"
|
class="component-button icon icon-funnel"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.funnelComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.funnelComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.template}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.template}}"
|
||||||
id="template-component"
|
id="template-component"
|
||||||
class="component-button icon icon-template"
|
class="component-button icon icon-template"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.templateComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.templateComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.label}}"
|
<button title="{{appCtrl.serviceProvider.headerCtrl.toolboxCtrl.config.type.label}}"
|
||||||
id="label-component"
|
id="label-component"
|
||||||
class="component-button icon icon-label"
|
class="component-button icon icon-label"
|
||||||
ng-disabled="!appCtrl.nf.Canvas.canWrite();"
|
ng-disabled="!appCtrl.nf.CanvasUtils.canWrite();"
|
||||||
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.labelComponent);">
|
nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.labelComponent);">
|
||||||
<span class="component-button-grip"></span>
|
<span class="component-button-grip"></span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -146,15 +146,15 @@
|
||||||
<i class="fa fa-history"></i>Flow Configuration History
|
<i class="fa fa-history"></i>Flow Configuration History
|
||||||
</a>
|
</a>
|
||||||
</md-menu-item>
|
</md-menu-item>
|
||||||
<md-menu-divider ng-if="appCtrl.nf.Canvas.isConfigurableAuthorizer()"></md-menu-divider>
|
<md-menu-divider ng-if="appCtrl.nf.CanvasUtils.isConfigurableAuthorizer()"></md-menu-divider>
|
||||||
<md-menu-item layout-align="space-around center" ng-if="appCtrl.nf.Canvas.isConfigurableAuthorizer()">
|
<md-menu-item layout-align="space-around center" ng-if="appCtrl.nf.CanvasUtils.isConfigurableAuthorizer()">
|
||||||
<a id="users-link" layout="row"
|
<a id="users-link" layout="row"
|
||||||
ng-click="appCtrl.serviceProvider.headerCtrl.globalMenuCtrl.users.shell.launch();"
|
ng-click="appCtrl.serviceProvider.headerCtrl.globalMenuCtrl.users.shell.launch();"
|
||||||
ng-class="{disabled: !(appCtrl.nf.Common.canAccessTenants())}">
|
ng-class="{disabled: !(appCtrl.nf.Common.canAccessTenants())}">
|
||||||
<i class="fa fa-users"></i>Users
|
<i class="fa fa-users"></i>Users
|
||||||
</a>
|
</a>
|
||||||
</md-menu-item>
|
</md-menu-item>
|
||||||
<md-menu-item layout-align="space-around center" ng-if="appCtrl.nf.Canvas.isConfigurableAuthorizer()">
|
<md-menu-item layout-align="space-around center" ng-if="appCtrl.nf.CanvasUtils.isConfigurableAuthorizer()">
|
||||||
<a id="policies-link" layout="row"
|
<a id="policies-link" layout="row"
|
||||||
ng-click="appCtrl.serviceProvider.headerCtrl.globalMenuCtrl.policies.shell.launch();"
|
ng-click="appCtrl.serviceProvider.headerCtrl.globalMenuCtrl.policies.shell.launch();"
|
||||||
ng-class="{disabled: !(appCtrl.nf.Common.canAccessTenants() && appCtrl.nf.Common.canModifyPolicies())}">
|
ng-class="{disabled: !(appCtrl.nf.Common.canAccessTenants() && appCtrl.nf.Common.canModifyPolicies())}">
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
|
<%@ page contentType="text/html" pageEncoding="UTF-8" session="false" %>
|
||||||
<nf-breadcrumbs
|
<nf-breadcrumbs
|
||||||
breadcrumbs="appCtrl.serviceProvider.breadcrumbsCtrl.getBreadcrumbs();"
|
breadcrumbs="appCtrl.serviceProvider.breadcrumbsCtrl.getBreadcrumbs();"
|
||||||
click-func="appCtrl.nf.CanvasUtils.enterGroup"
|
click-func="appCtrl.nf.CanvasUtils.getComponentByType('ProcessGroup').enterGroup"
|
||||||
highlight-crumb-id="appCtrl.nf.Canvas.getGroupId();"
|
highlight-crumb-id="appCtrl.nf.CanvasUtils.getGroupId();"
|
||||||
separator-func="appCtrl.nf.Common.isDefinedAndNotNull">
|
separator-func="appCtrl.nf.Common.isDefinedAndNotNull">
|
||||||
</nf-breadcrumbs>
|
</nf-breadcrumbs>
|
||||||
<div id="graph-controls">
|
<div id="graph-controls">
|
||||||
|
@ -95,8 +95,8 @@
|
||||||
ng-disabled="!(appCtrl.serviceProvider.graphControlsCtrl.canConfigureOrOpenDetails())">
|
ng-disabled="!(appCtrl.serviceProvider.graphControlsCtrl.canConfigureOrOpenDetails())">
|
||||||
<div class="graph-control-action-icon fa fa-gear"></div></button>
|
<div class="graph-control-action-icon fa fa-gear"></div></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-spacer-small" ng-if="appCtrl.nf.Canvas.isConfigurableAuthorizer()"> </div>
|
<div class="button-spacer-small" ng-if="appCtrl.nf.CanvasUtils.isConfigurableAuthorizer()"> </div>
|
||||||
<div id="operate-policy" class="action-button" title="Access Policies" ng-if="appCtrl.nf.Canvas.isConfigurableAuthorizer()">
|
<div id="operate-policy" class="action-button" title="Access Policies" ng-if="appCtrl.nf.CanvasUtils.isConfigurableAuthorizer()">
|
||||||
<button ng-click="appCtrl.nf.Actions['managePolicies'](appCtrl.nf.CanvasUtils.getSelection());"
|
<button ng-click="appCtrl.nf.Actions['managePolicies'](appCtrl.nf.CanvasUtils.getSelection());"
|
||||||
ng-disabled="!(appCtrl.serviceProvider.graphControlsCtrl.canManagePolicies())">
|
ng-disabled="!(appCtrl.serviceProvider.graphControlsCtrl.canManagePolicies())">
|
||||||
<div class="graph-control-action-icon fa fa-key"></div></button>
|
<div class="graph-control-action-icon fa fa-key"></div></button>
|
||||||
|
@ -128,13 +128,13 @@
|
||||||
<div class="button-spacer-large"> </div>
|
<div class="button-spacer-large"> </div>
|
||||||
<div id="operate-template" class="action-button" title="Create Template">
|
<div id="operate-template" class="action-button" title="Create Template">
|
||||||
<button ng-click="appCtrl.nf.Actions['template'](appCtrl.nf.CanvasUtils.getSelection());"
|
<button ng-click="appCtrl.nf.Actions['template'](appCtrl.nf.CanvasUtils.getSelection());"
|
||||||
ng-disabled="!(appCtrl.nf.Canvas.canWrite() && (appCtrl.nf.CanvasUtils.getSelection().empty() || appCtrl.nf.CanvasUtils.canRead(appCtrl.nf.CanvasUtils.getSelection())));">
|
ng-disabled="!(appCtrl.nf.CanvasUtils.canWrite() && (appCtrl.nf.CanvasUtils.getSelection().empty() || appCtrl.nf.CanvasUtils.canRead(appCtrl.nf.CanvasUtils.getSelection())));">
|
||||||
<div class="graph-control-action-icon icon icon-template-save"></div></button>
|
<div class="graph-control-action-icon icon icon-template-save"></div></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-spacer-small"> </div>
|
<div class="button-spacer-small"> </div>
|
||||||
<div id="operate-template-upload" class="action-button" title="Upload Template">
|
<div id="operate-template-upload" class="action-button" title="Upload Template">
|
||||||
<button ng-click="appCtrl.nf.Actions['uploadTemplate']();"
|
<button ng-click="appCtrl.nf.Actions['uploadTemplate']();"
|
||||||
ng-disabled="!(appCtrl.nf.Canvas.canWrite() && appCtrl.nf.CanvasUtils.getSelection().empty());">
|
ng-disabled="!(appCtrl.nf.CanvasUtils.canWrite() && appCtrl.nf.CanvasUtils.getSelection().empty());">
|
||||||
<div class="graph-control-action-icon icon icon-template-import"></div></button>
|
<div class="graph-control-action-icon icon icon-template-import"></div></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
@ -154,7 +154,7 @@
|
||||||
<div class="button-spacer-large"> </div>
|
<div class="button-spacer-large"> </div>
|
||||||
<div id="operate-group" class="action-button" title="Group">
|
<div id="operate-group" class="action-button" title="Group">
|
||||||
<button ng-click="appCtrl.nf.Actions['group'](appCtrl.nf.CanvasUtils.getSelection());"
|
<button ng-click="appCtrl.nf.Actions['group'](appCtrl.nf.CanvasUtils.getSelection());"
|
||||||
ng-disabled="!appCtrl.nf.CanvasUtils.isDisconnected(appCtrl.nf.CanvasUtils.getSelection()) || !appCtrl.nf.CanvasUtils.canModify(appCtrl.nf.CanvasUtils.getSelection());">
|
ng-disabled="!appCtrl.nf.Connection.isDisconnected(appCtrl.nf.CanvasUtils.getSelection()) || !appCtrl.nf.CanvasUtils.canModify(appCtrl.nf.CanvasUtils.getSelection());">
|
||||||
<div class="graph-control-action-icon icon icon-group"></div></button>
|
<div class="graph-control-action-icon icon icon-group"></div></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-spacer-large"> </div>
|
<div class="button-spacer-large"> </div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
/* requires qtip plugin to be loaded first*/
|
/* requires qtip plugin to be loaded first*/
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,108 +15,92 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.BreadcrumbsCtrl = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common'],
|
||||||
|
function ($, common) {
|
||||||
|
return (nf.ng.BreadcrumbsCtrl = factory($, common));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.BreadcrumbsCtrl =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common')));
|
||||||
|
} else {
|
||||||
|
nf.ng.BreadcrumbsCtrl = factory(root.$,
|
||||||
|
root.nf.Common);
|
||||||
|
}
|
||||||
|
}(this, function ($, common) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function BreadcrumbsCtrl() {
|
return function (serviceProvider) {
|
||||||
this.breadcrumbs = [];
|
'use strict';
|
||||||
}
|
|
||||||
BreadcrumbsCtrl.prototype = {
|
|
||||||
constructor: BreadcrumbsCtrl,
|
|
||||||
|
|
||||||
/**
|
function BreadcrumbsCtrl() {
|
||||||
* Register the breadcrumbs controller.
|
|
||||||
*/
|
|
||||||
register: function() {
|
|
||||||
if (serviceProvider.breadcrumbsCtrl === undefined) {
|
|
||||||
serviceProvider.register('breadcrumbsCtrl', breadcrumbsCtrl);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the breadcrumbs.
|
|
||||||
*
|
|
||||||
* @param {object} breadcrumbEntity The breadcrumb
|
|
||||||
*/
|
|
||||||
generateBreadcrumbs: function(breadcrumbEntity) {
|
|
||||||
var label = breadcrumbEntity.id;
|
|
||||||
if (breadcrumbEntity.permissions.canRead) {
|
|
||||||
label = breadcrumbEntity.breadcrumb.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.breadcrumbs.unshift($.extend({
|
|
||||||
'label': label
|
|
||||||
}, breadcrumbEntity));
|
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(breadcrumbEntity.parentBreadcrumb)) {
|
|
||||||
this.generateBreadcrumbs(breadcrumbEntity.parentBreadcrumb);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the breadcrumbs.
|
|
||||||
*/
|
|
||||||
resetBreadcrumbs: function() {
|
|
||||||
this.breadcrumbs = [];
|
this.breadcrumbs = [];
|
||||||
},
|
}
|
||||||
|
|
||||||
/**
|
BreadcrumbsCtrl.prototype = {
|
||||||
* Get the breadcrumbs.
|
constructor: BreadcrumbsCtrl,
|
||||||
*/
|
|
||||||
getBreadcrumbs: function() {
|
|
||||||
return this.breadcrumbs;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the breadcrumbs css.
|
* Register the breadcrumbs controller.
|
||||||
*
|
*/
|
||||||
* @param {object} style The style to be applied.
|
register: function () {
|
||||||
*/
|
if (serviceProvider.breadcrumbsCtrl === undefined) {
|
||||||
updateBreadcrumbsCss: function(style) {
|
serviceProvider.register('breadcrumbsCtrl', breadcrumbsCtrl);
|
||||||
$('#breadcrumbs').css(style);
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset initial scroll position.
|
* Generate the breadcrumbs.
|
||||||
*/
|
*
|
||||||
resetScrollPosition: function() {
|
* @param {object} breadcrumbEntity The breadcrumb
|
||||||
var title = $('#data-flow-title-container');
|
*/
|
||||||
var titlePosition = title.position();
|
generateBreadcrumbs: function (breadcrumbEntity) {
|
||||||
var titleWidth = title.outerWidth();
|
var label = breadcrumbEntity.id;
|
||||||
var titleRight = titlePosition.left + titleWidth;
|
if (breadcrumbEntity.permissions.canRead) {
|
||||||
|
label = breadcrumbEntity.breadcrumb.name;
|
||||||
var padding = $('#breadcrumbs-right-border').width();
|
|
||||||
var viewport = $('#data-flow-title-viewport');
|
|
||||||
var viewportWidth = viewport.width();
|
|
||||||
var viewportRight = viewportWidth - padding;
|
|
||||||
|
|
||||||
// if the title's right is past the viewport's right, shift accordingly
|
|
||||||
if (titleRight > viewportRight) {
|
|
||||||
// adjust the position
|
|
||||||
title.css('left', (titlePosition.left - (titleRight - viewportRight)) + 'px');
|
|
||||||
} else {
|
|
||||||
title.css('left', '10px');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a scroll event on the `element`
|
|
||||||
*
|
|
||||||
* @param {object} element The element event listener will be registered upon.
|
|
||||||
*/
|
|
||||||
registerMouseWheelEvent: function(element) {
|
|
||||||
// mousewheel -> IE, Chrome
|
|
||||||
// DOMMouseScroll -> FF
|
|
||||||
// wheel -> FF, IE
|
|
||||||
|
|
||||||
// still having issues with this in IE :/
|
|
||||||
element.on('DOMMouseScroll mousewheel', function (evt, d) {
|
|
||||||
if (nf.Common.isUndefinedOrNull(evt.originalEvent)) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.breadcrumbs.unshift($.extend({
|
||||||
|
'label': label
|
||||||
|
}, breadcrumbEntity));
|
||||||
|
|
||||||
|
if (common.isDefinedAndNotNull(breadcrumbEntity.parentBreadcrumb)) {
|
||||||
|
this.generateBreadcrumbs(breadcrumbEntity.parentBreadcrumb);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the breadcrumbs.
|
||||||
|
*/
|
||||||
|
resetBreadcrumbs: function () {
|
||||||
|
this.breadcrumbs = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the breadcrumbs.
|
||||||
|
*/
|
||||||
|
getBreadcrumbs: function () {
|
||||||
|
return this.breadcrumbs;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the breadcrumbs css.
|
||||||
|
*
|
||||||
|
* @param {object} style The style to be applied.
|
||||||
|
*/
|
||||||
|
updateBreadcrumbsCss: function (style) {
|
||||||
|
$('#breadcrumbs').css(style);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset initial scroll position.
|
||||||
|
*/
|
||||||
|
resetScrollPosition: function () {
|
||||||
var title = $('#data-flow-title-container');
|
var title = $('#data-flow-title-container');
|
||||||
var titlePosition = title.position();
|
var titlePosition = title.position();
|
||||||
var titleWidth = title.outerWidth();
|
var titleWidth = title.outerWidth();
|
||||||
|
@ -127,46 +111,82 @@ nf.ng.BreadcrumbsCtrl = function (serviceProvider) {
|
||||||
var viewportWidth = viewport.width();
|
var viewportWidth = viewport.width();
|
||||||
var viewportRight = viewportWidth - padding;
|
var viewportRight = viewportWidth - padding;
|
||||||
|
|
||||||
// if the width of the title is larger than the viewport
|
// if the title's right is past the viewport's right, shift accordingly
|
||||||
if (titleWidth > viewportWidth) {
|
if (titleRight > viewportRight) {
|
||||||
var adjust = false;
|
// adjust the position
|
||||||
|
title.css('left', (titlePosition.left - (titleRight - viewportRight)) + 'px');
|
||||||
|
} else {
|
||||||
|
title.css('left', '10px');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
var delta = 0;
|
/**
|
||||||
|
* Registers a scroll event on the `element`
|
||||||
|
*
|
||||||
|
* @param {object} element The element event listener will be registered upon.
|
||||||
|
*/
|
||||||
|
registerMouseWheelEvent: function (element) {
|
||||||
|
// mousewheel -> IE, Chrome
|
||||||
|
// DOMMouseScroll -> FF
|
||||||
|
// wheel -> FF, IE
|
||||||
|
|
||||||
//Chrome and Safari both have evt.originalEvent.detail defined but
|
// still having issues with this in IE :/
|
||||||
//evt.originalEvent.wheelDelta holds the correct value so we must
|
element.on('DOMMouseScroll mousewheel', function (evt, d) {
|
||||||
//check for evt.originalEvent.wheelDelta first!
|
if (common.isUndefinedOrNull(evt.originalEvent)) {
|
||||||
if (nf.Common.isDefinedAndNotNull(evt.originalEvent.wheelDelta)) {
|
return;
|
||||||
delta = evt.originalEvent.wheelDelta;
|
|
||||||
} else if (nf.Common.isDefinedAndNotNull(evt.originalEvent.detail)) {
|
|
||||||
delta = -evt.originalEvent.detail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine the increment
|
var title = $('#data-flow-title-container');
|
||||||
if (delta > 0 && titleRight > viewportRight) {
|
var titlePosition = title.position();
|
||||||
var increment = -25;
|
var titleWidth = title.outerWidth();
|
||||||
adjust = true;
|
var titleRight = titlePosition.left + titleWidth;
|
||||||
} else if (delta < 0 && (titlePosition.left - padding) < 0) {
|
|
||||||
increment = 25;
|
|
||||||
|
|
||||||
// don't shift too far
|
var padding = $('#breadcrumbs-right-border').width();
|
||||||
if (titlePosition.left + increment > padding) {
|
var viewport = $('#data-flow-title-viewport');
|
||||||
increment = padding - titlePosition.left;
|
var viewportWidth = viewport.width();
|
||||||
|
var viewportRight = viewportWidth - padding;
|
||||||
|
|
||||||
|
// if the width of the title is larger than the viewport
|
||||||
|
if (titleWidth > viewportWidth) {
|
||||||
|
var adjust = false;
|
||||||
|
|
||||||
|
var delta = 0;
|
||||||
|
|
||||||
|
//Chrome and Safari both have evt.originalEvent.detail defined but
|
||||||
|
//evt.originalEvent.wheelDelta holds the correct value so we must
|
||||||
|
//check for evt.originalEvent.wheelDelta first!
|
||||||
|
if (common.isDefinedAndNotNull(evt.originalEvent.wheelDelta)) {
|
||||||
|
delta = evt.originalEvent.wheelDelta;
|
||||||
|
} else if (common.isDefinedAndNotNull(evt.originalEvent.detail)) {
|
||||||
|
delta = -evt.originalEvent.detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust = true;
|
// determine the increment
|
||||||
}
|
if (delta > 0 && titleRight > viewportRight) {
|
||||||
|
var increment = -25;
|
||||||
|
adjust = true;
|
||||||
|
} else if (delta < 0 && (titlePosition.left - padding) < 0) {
|
||||||
|
increment = 25;
|
||||||
|
|
||||||
if (adjust) {
|
// don't shift too far
|
||||||
// adjust the position
|
if (titlePosition.left + increment > padding) {
|
||||||
title.css('left', (titlePosition.left + increment) + 'px');
|
increment = padding - titlePosition.left;
|
||||||
|
}
|
||||||
|
|
||||||
|
adjust = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adjust) {
|
||||||
|
// adjust the position
|
||||||
|
title.css('left', (titlePosition.left + increment) + 'px');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var breadcrumbsCtrl = new BreadcrumbsCtrl();
|
var breadcrumbsCtrl = new BreadcrumbsCtrl();
|
||||||
breadcrumbsCtrl.register();
|
breadcrumbsCtrl.register();
|
||||||
return breadcrumbsCtrl;
|
return breadcrumbsCtrl;
|
||||||
};
|
}
|
||||||
|
}));
|
|
@ -15,469 +15,506 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.FlowStatusCtrl = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ContextMenu',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Settings'],
|
||||||
|
function ($, common, dialog, canvasUtils, contextMenu, clusterSummary, errorHandler, settings) {
|
||||||
|
return (nf.ng.Canvas.FlowStatusCtrl = factory($, common, dialog, canvasUtils, contextMenu, clusterSummary, errorHandler, settings));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.FlowStatusCtrl =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ContextMenu'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Settings')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.FlowStatusCtrl = factory(root.$,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ContextMenu,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Settings);
|
||||||
|
}
|
||||||
|
}(this, function ($, common, dialog, canvasUtils, contextMenu, clusterSummary, errorHandler, settings) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
return function (serviceProvider) {
|
||||||
search: 'Search',
|
'use strict';
|
||||||
urls: {
|
|
||||||
search: '../nifi-api/flow/search-results',
|
|
||||||
status: '../nifi-api/flow/status'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function FlowStatusCtrl() {
|
var config = {
|
||||||
this.connectedNodesCount = "-";
|
search: 'Search',
|
||||||
this.activeThreadCount = "-";
|
urls: {
|
||||||
this.totalQueued = "-";
|
search: '../nifi-api/flow/search-results',
|
||||||
this.controllerTransmittingCount = "-";
|
status: '../nifi-api/flow/status'
|
||||||
this.controllerNotTransmittingCount = "-";
|
}
|
||||||
this.controllerRunningCount = "-";
|
};
|
||||||
this.controllerStoppedCount = "-";
|
|
||||||
this.controllerInvalidCount = "-";
|
|
||||||
this.controllerDisabledCount = "-";
|
|
||||||
this.statsLastRefreshed = "-";
|
|
||||||
|
|
||||||
/**
|
function FlowStatusCtrl() {
|
||||||
* The search controller.
|
this.connectedNodesCount = "-";
|
||||||
*/
|
this.activeThreadCount = "-";
|
||||||
this.search = {
|
this.totalQueued = "-";
|
||||||
|
this.controllerTransmittingCount = "-";
|
||||||
|
this.controllerNotTransmittingCount = "-";
|
||||||
|
this.controllerRunningCount = "-";
|
||||||
|
this.controllerStoppedCount = "-";
|
||||||
|
this.controllerInvalidCount = "-";
|
||||||
|
this.controllerDisabledCount = "-";
|
||||||
|
this.statsLastRefreshed = "-";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the search input element.
|
* The search controller.
|
||||||
*/
|
*/
|
||||||
getInputElement: function () {
|
this.search = {
|
||||||
return $('#search-field');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the search button element.
|
* Get the search input element.
|
||||||
*/
|
*/
|
||||||
getButtonElement: function () {
|
getInputElement: function () {
|
||||||
return $('#search-button');
|
return $('#search-field');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the search container element.
|
* Get the search button element.
|
||||||
*/
|
*/
|
||||||
getSearchContainerElement: function () {
|
getButtonElement: function () {
|
||||||
return $('#search-container');
|
return $('#search-button');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the search controller.
|
* Get the search container element.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
getSearchContainerElement: function () {
|
||||||
|
return $('#search-container');
|
||||||
|
},
|
||||||
|
|
||||||
var searchCtrl = this;
|
/**
|
||||||
|
* Initialize the search controller.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
|
||||||
// Create new jQuery UI widget
|
var searchCtrl = this;
|
||||||
$.widget('nf.searchAutocomplete', $.ui.autocomplete, {
|
|
||||||
reset: function () {
|
|
||||||
this.term = null;
|
|
||||||
},
|
|
||||||
_create: function() {
|
|
||||||
this._super();
|
|
||||||
this.widget().menu('option', 'items', '> :not(.search-header, .search-no-matches)' );
|
|
||||||
},
|
|
||||||
_resizeMenu: function () {
|
|
||||||
var ul = this.menu.element;
|
|
||||||
ul.width(400);
|
|
||||||
},
|
|
||||||
_normalize: function (searchResults) {
|
|
||||||
var items = [];
|
|
||||||
items.push(searchResults);
|
|
||||||
return items;
|
|
||||||
},
|
|
||||||
_renderMenu: function (ul, items) {
|
|
||||||
var nfSearchAutocomplete = this;
|
|
||||||
|
|
||||||
// the object that holds the search results is normalized into a single element array
|
// Create new jQuery UI widget
|
||||||
var searchResults = items[0];
|
$.widget('nf.searchAutocomplete', $.ui.autocomplete, {
|
||||||
|
reset: function () {
|
||||||
|
this.term = null;
|
||||||
|
},
|
||||||
|
_create: function () {
|
||||||
|
this._super();
|
||||||
|
this.widget().menu('option', 'items', '> :not(.search-header, .search-no-matches)');
|
||||||
|
},
|
||||||
|
_resizeMenu: function () {
|
||||||
|
var ul = this.menu.element;
|
||||||
|
ul.width(400);
|
||||||
|
},
|
||||||
|
_normalize: function (searchResults) {
|
||||||
|
var items = [];
|
||||||
|
items.push(searchResults);
|
||||||
|
return items;
|
||||||
|
},
|
||||||
|
_renderMenu: function (ul, items) {
|
||||||
|
var nfSearchAutocomplete = this;
|
||||||
|
|
||||||
// show all processors
|
// the object that holds the search results is normalized into a single element array
|
||||||
if (!nf.Common.isEmpty(searchResults.processorResults)) {
|
var searchResults = items[0];
|
||||||
ul.append('<li class="search-header"><div class="search-result-icon icon icon-processor"></div>Processors</li>');
|
|
||||||
$.each(searchResults.processorResults, function (i, processorMatch) {
|
// show all processors
|
||||||
nfSearchAutocomplete._renderItem(ul, processorMatch);
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, processorMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show all process groups
|
||||||
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, processGroupMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show all remote process groups
|
||||||
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, remoteProcessGroupMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show all connections
|
||||||
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, connectionMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show all input ports
|
||||||
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, inputPortMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show all output ports
|
||||||
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, outputPortMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// show all funnels
|
||||||
|
if (!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) {
|
||||||
|
nfSearchAutocomplete._renderItem(ul, funnelMatch);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure there were some results
|
||||||
|
if (ul.children().length === 0) {
|
||||||
|
ul.append('<li class="unset search-no-matches">No results matched the search terms</li>');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_renderItem: function (ul, match) {
|
||||||
|
var itemContent = $('<a></a>').append($('<div class="search-match-header"></div>').text(match.name));
|
||||||
|
$.each(match.matches, function (i, match) {
|
||||||
|
itemContent.append($('<div class="search-match"></div>').text(match));
|
||||||
});
|
});
|
||||||
|
return $('<li></li>').data('ui-autocomplete-item', match).append(itemContent).appendTo(ul);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// show all process groups
|
// configure the new searchAutocomplete jQuery UI widget
|
||||||
if (!nf.Common.isEmpty(searchResults.processGroupResults)) {
|
this.getInputElement().searchAutocomplete({
|
||||||
ul.append('<li class="search-header"><div class="search-result-icon icon icon-group"></div>Process Groups</li>');
|
appendTo: '#search-flow-results',
|
||||||
$.each(searchResults.processGroupResults, function (i, processGroupMatch) {
|
position: {
|
||||||
nfSearchAutocomplete._renderItem(ul, processGroupMatch);
|
my: 'right top',
|
||||||
|
at: 'right bottom',
|
||||||
|
offset: '1 1'
|
||||||
|
},
|
||||||
|
source: function (request, response) {
|
||||||
|
// create the search request
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
data: {
|
||||||
|
q: request.term
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
url: config.urls.search
|
||||||
|
}).done(function (searchResponse) {
|
||||||
|
response(searchResponse.searchResultsDTO);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
select: function (event, ui) {
|
||||||
|
var item = ui.item;
|
||||||
|
|
||||||
|
// show the selected component
|
||||||
|
canvasUtils.showComponent(item.groupId, item.id);
|
||||||
|
|
||||||
|
searchCtrl.getInputElement().val('').blur();
|
||||||
|
|
||||||
|
// stop event propagation
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
open: function (event, ui) {
|
||||||
|
// show the glass pane
|
||||||
|
var searchField = $(this);
|
||||||
|
$('<div class="search-glass-pane"></div>').one('click', function () {
|
||||||
|
}).appendTo('body');
|
||||||
|
},
|
||||||
|
close: function (event, ui) {
|
||||||
|
// set the input text to '' and reset the cached term
|
||||||
|
$(this).searchAutocomplete('reset');
|
||||||
|
searchCtrl.getInputElement().val('');
|
||||||
|
|
||||||
|
// remove the glass pane
|
||||||
|
$('div.search-glass-pane').remove();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// show all remote process groups
|
// hide the search input
|
||||||
if (!nf.Common.isEmpty(searchResults.remoteProcessGroupResults)) {
|
searchCtrl.toggleSearchField();
|
||||||
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) {
|
|
||||||
nfSearchAutocomplete._renderItem(ul, remoteProcessGroupMatch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// show all connections
|
/**
|
||||||
if (!nf.Common.isEmpty(searchResults.connectionResults)) {
|
* Toggle/Slide the search field open/closed.
|
||||||
ul.append('<li class="search-header"><div class="search-result-icon icon icon-connect"></div>Connections</li>');
|
*/
|
||||||
$.each(searchResults.connectionResults, function (i, connectionMatch) {
|
toggleSearchField: function () {
|
||||||
nfSearchAutocomplete._renderItem(ul, connectionMatch);
|
var searchCtrl = this;
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// show all input ports
|
// hide the context menu if necessary
|
||||||
if (!nf.Common.isEmpty(searchResults.inputPortResults)) {
|
contextMenu.hide();
|
||||||
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) {
|
|
||||||
nfSearchAutocomplete._renderItem(ul, inputPortMatch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// show all output ports
|
var isVisible = searchCtrl.getInputElement().is(':visible');
|
||||||
if (!nf.Common.isEmpty(searchResults.outputPortResults)) {
|
var display = 'none';
|
||||||
ul.append('<li class="search-header"><div class="search-result-icon icon icon-port-out"></div>Output Ports</li>');
|
var class1 = 'search-container-opened';
|
||||||
$.each(searchResults.outputPortResults, function (i, outputPortMatch) {
|
var class2 = 'search-container-closed';
|
||||||
nfSearchAutocomplete._renderItem(ul, outputPortMatch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// show all funnels
|
|
||||||
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) {
|
|
||||||
nfSearchAutocomplete._renderItem(ul, funnelMatch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure there were some results
|
|
||||||
if (ul.children().length === 0) {
|
|
||||||
ul.append('<li class="unset search-no-matches">No results matched the search terms</li>');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_renderItem: function (ul, match) {
|
|
||||||
var itemContent = $('<a></a>').append($('<div class="search-match-header"></div>').text(match.name));
|
|
||||||
$.each(match.matches, function (i, match) {
|
|
||||||
itemContent.append($('<div class="search-match"></div>').text(match));
|
|
||||||
});
|
|
||||||
return $('<li></li>').data('ui-autocomplete-item', match).append(itemContent).appendTo(ul);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// configure the new searchAutocomplete jQuery UI widget
|
|
||||||
this.getInputElement().searchAutocomplete({
|
|
||||||
appendTo: '#search-flow-results',
|
|
||||||
position: {
|
|
||||||
my: 'right top',
|
|
||||||
at: 'right bottom',
|
|
||||||
offset: '1 1'
|
|
||||||
},
|
|
||||||
source: function (request, response) {
|
|
||||||
// create the search request
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
data: {
|
|
||||||
q: request.term
|
|
||||||
},
|
|
||||||
dataType: 'json',
|
|
||||||
url: config.urls.search
|
|
||||||
}).done(function (searchResponse) {
|
|
||||||
response(searchResponse.searchResultsDTO);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
select: function (event, ui) {
|
|
||||||
var item = ui.item;
|
|
||||||
|
|
||||||
// show the selected component
|
|
||||||
nf.CanvasUtils.showComponent(item.groupId, item.id);
|
|
||||||
|
|
||||||
searchCtrl.getInputElement().val('').blur();
|
|
||||||
|
|
||||||
// stop event propagation
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
open: function (event, ui) {
|
|
||||||
// show the glass pane
|
|
||||||
var searchField = $(this);
|
|
||||||
$('<div class="search-glass-pane"></div>').one('click', function () {
|
|
||||||
}).appendTo('body');
|
|
||||||
},
|
|
||||||
close: function (event, ui) {
|
|
||||||
// set the input text to '' and reset the cached term
|
|
||||||
$(this).searchAutocomplete('reset');
|
|
||||||
searchCtrl.getInputElement().val('');
|
|
||||||
|
|
||||||
// remove the glass pane
|
|
||||||
$('div.search-glass-pane').remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// hide the search input
|
|
||||||
searchCtrl.toggleSearchField();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle/Slide the search field open/closed.
|
|
||||||
*/
|
|
||||||
toggleSearchField: function () {
|
|
||||||
var searchCtrl = this;
|
|
||||||
|
|
||||||
// hide the context menu if necessary
|
|
||||||
nf.ContextMenu.hide();
|
|
||||||
|
|
||||||
var isVisible = searchCtrl.getInputElement().is(':visible');
|
|
||||||
var display = 'none';
|
|
||||||
var class1 = 'search-container-opened';
|
|
||||||
var class2 = 'search-container-closed';
|
|
||||||
if (!isVisible) {
|
|
||||||
searchCtrl.getButtonElement().css('background-color', '#FFFFFF');
|
|
||||||
display = 'inline-block';
|
|
||||||
class1 = 'search-container-closed';
|
|
||||||
class2 = 'search-container-opened';
|
|
||||||
} else {
|
|
||||||
searchCtrl.getInputElement().css('display', display);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getSearchContainerElement().switchClass(class1, class2, 500, function () {
|
|
||||||
searchCtrl.getInputElement().css('display', display);
|
|
||||||
if (!isVisible) {
|
if (!isVisible) {
|
||||||
searchCtrl.getButtonElement().css('background-color', '#FFFFFF');
|
searchCtrl.getButtonElement().css('background-color', '#FFFFFF');
|
||||||
searchCtrl.getInputElement().focus();
|
display = 'inline-block';
|
||||||
|
class1 = 'search-container-closed';
|
||||||
|
class2 = 'search-container-opened';
|
||||||
} else {
|
} else {
|
||||||
searchCtrl.getButtonElement().css('background-color', '#E3E8EB');
|
searchCtrl.getInputElement().css('display', display);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
this.getSearchContainerElement().switchClass(class1, class2, 500, function () {
|
||||||
* The bulletins controller.
|
searchCtrl.getInputElement().css('display', display);
|
||||||
*/
|
if (!isVisible) {
|
||||||
this.bulletins = {
|
searchCtrl.getButtonElement().css('background-color', '#FFFFFF');
|
||||||
|
searchCtrl.getInputElement().focus();
|
||||||
|
} else {
|
||||||
|
searchCtrl.getButtonElement().css('background-color', '#E3E8EB');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the bulletins.
|
* The bulletins controller.
|
||||||
*
|
|
||||||
* @param response The controller bulletins returned from the `../nifi-api/controller/bulletins` endpoint.
|
|
||||||
*/
|
*/
|
||||||
update: function (response) {
|
this.bulletins = {
|
||||||
|
|
||||||
// icon for system bulletins
|
/**
|
||||||
var bulletinIcon = $('#bulletin-button');
|
* Update the bulletins.
|
||||||
var currentBulletins = bulletinIcon.data('bulletins');
|
*
|
||||||
|
* @param response The controller bulletins returned from the `../nifi-api/controller/bulletins` endpoint.
|
||||||
|
*/
|
||||||
|
update: function (response) {
|
||||||
|
|
||||||
// update the bulletins if necessary
|
// icon for system bulletins
|
||||||
if (nf.Common.doBulletinsDiffer(currentBulletins, response.bulletins)) {
|
var bulletinIcon = $('#bulletin-button');
|
||||||
bulletinIcon.data('bulletins', response.bulletins);
|
var currentBulletins = bulletinIcon.data('bulletins');
|
||||||
|
|
||||||
// get the formatted the bulletins
|
// update the bulletins if necessary
|
||||||
var bulletins = nf.Common.getFormattedBulletins(response.bulletins);
|
if (common.doBulletinsDiffer(currentBulletins, response.bulletins)) {
|
||||||
|
bulletinIcon.data('bulletins', response.bulletins);
|
||||||
|
|
||||||
// bulletins for this processor are now gone
|
// get the formatted the bulletins
|
||||||
if (bulletins.length === 0) {
|
var bulletins = common.getFormattedBulletins(response.bulletins);
|
||||||
if (bulletinIcon.data('qtip')) {
|
|
||||||
bulletinIcon.removeClass('has-bulletins').qtip('api').destroy(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var newBulletins = nf.Common.formatUnorderedList(bulletins);
|
|
||||||
|
|
||||||
// different bulletins, refresh
|
// bulletins for this processor are now gone
|
||||||
if (bulletinIcon.data('qtip')) {
|
if (bulletins.length === 0) {
|
||||||
bulletinIcon.qtip('option', 'content.text', newBulletins);
|
if (bulletinIcon.data('qtip')) {
|
||||||
|
bulletinIcon.removeClass('has-bulletins').qtip('api').destroy(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// no bulletins before, show icon and tips
|
var newBulletins = common.formatUnorderedList(bulletins);
|
||||||
bulletinIcon.addClass('has-bulletins').qtip($.extend({},
|
|
||||||
nf.CanvasUtils.config.systemTooltipConfig,
|
// different bulletins, refresh
|
||||||
{
|
if (bulletinIcon.data('qtip')) {
|
||||||
content: newBulletins,
|
bulletinIcon.qtip('option', 'content.text', newBulletins);
|
||||||
position: {
|
} else {
|
||||||
at: 'bottom left',
|
// no bulletins before, show icon and tips
|
||||||
my: 'top right',
|
bulletinIcon.addClass('has-bulletins').qtip($.extend({},
|
||||||
adjust: {
|
canvasUtils.config.systemTooltipConfig,
|
||||||
x: 4
|
{
|
||||||
|
content: newBulletins,
|
||||||
|
position: {
|
||||||
|
at: 'bottom left',
|
||||||
|
my: 'top right',
|
||||||
|
adjust: {
|
||||||
|
x: 4
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
));
|
||||||
));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update controller service and reporting task bulletins
|
||||||
|
settings.setBulletins(response.controllerServiceBulletins, response.reportingTaskBulletins);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update controller service and reporting task bulletins
|
|
||||||
nf.Settings.setBulletins(response.controllerServiceBulletins, response.reportingTaskBulletins);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
FlowStatusCtrl.prototype = {
|
FlowStatusCtrl.prototype = {
|
||||||
constructor: FlowStatusCtrl,
|
constructor: FlowStatusCtrl,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the flow status controller.
|
* Initialize the flow status controller.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this.search.init();
|
this.search.init();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reloads the current status of the flow.
|
* Reloads the current status of the flow.
|
||||||
*/
|
*/
|
||||||
reloadFlowStatus: function () {
|
reloadFlowStatus: function () {
|
||||||
var flowStatusCtrl = this;
|
var flowStatusCtrl = this;
|
||||||
|
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: config.urls.status,
|
url: config.urls.status,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// report the updated status
|
// report the updated status
|
||||||
if (nf.Common.isDefinedAndNotNull(response.controllerStatus)) {
|
if (common.isDefinedAndNotNull(response.controllerStatus)) {
|
||||||
flowStatusCtrl.update(response.controllerStatus);
|
flowStatusCtrl.update(response.controllerStatus);
|
||||||
}
|
}
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the cluster summary.
|
* Updates the cluster summary.
|
||||||
*
|
*
|
||||||
* @param clusterSummary
|
* @param summary
|
||||||
*/
|
*/
|
||||||
updateClusterSummary: function (clusterSummary) {
|
updateClusterSummary: function (summary) {
|
||||||
// see if this node has been (dis)connected
|
// see if this node has been (dis)connected
|
||||||
if (nf.ClusterSummary.isConnectedToCluster() !== clusterSummary.connectedToCluster) {
|
if (clusterSummary.isConnectedToCluster() !== summary.connectedToCluster) {
|
||||||
if (clusterSummary.connectedToCluster) {
|
if (summary.connectedToCluster) {
|
||||||
nf.Dialog.showConnectedToClusterMessage();
|
dialog.showConnectedToClusterMessage();
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showDisconnectedFromClusterMessage();
|
dialog.showDisconnectedFromClusterMessage();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var color = '#728E9B';
|
|
||||||
|
|
||||||
// update the connection state
|
|
||||||
if (clusterSummary.connectedToCluster) {
|
|
||||||
if (nf.Common.isDefinedAndNotNull(clusterSummary.connectedNodes)) {
|
|
||||||
var connectedNodes = clusterSummary.connectedNodes.split(' / ');
|
|
||||||
if (connectedNodes.length === 2 && connectedNodes[0] !== connectedNodes[1]) {
|
|
||||||
this.clusterConnectionWarning = true;
|
|
||||||
color = '#BA554A';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.connectedNodesCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(clusterSummary.connectedNodes) ? clusterSummary.connectedNodes : '-';
|
var color = '#728E9B';
|
||||||
} else {
|
|
||||||
this.connectedNodesCount = 'Disconnected';
|
// update the connection state
|
||||||
color = '#BA554A';
|
if (summary.connectedToCluster) {
|
||||||
|
if (common.isDefinedAndNotNull(summary.connectedNodes)) {
|
||||||
|
var connectedNodes = summary.connectedNodes.split(' / ');
|
||||||
|
if (connectedNodes.length === 2 && connectedNodes[0] !== connectedNodes[1]) {
|
||||||
|
this.clusterConnectionWarning = true;
|
||||||
|
color = '#BA554A';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.connectedNodesCount =
|
||||||
|
common.isDefinedAndNotNull(summary.connectedNodes) ? summary.connectedNodes : '-';
|
||||||
|
} else {
|
||||||
|
this.connectedNodesCount = 'Disconnected';
|
||||||
|
color = '#BA554A';
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the color
|
||||||
|
$('#connected-nodes-count').closest('div.fa-cubes').css('color', color);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the flow status counts.
|
||||||
|
*
|
||||||
|
* @param status The controller status returned from the `../nifi-api/flow/status` endpoint.
|
||||||
|
*/
|
||||||
|
update: function (status) {
|
||||||
|
var controllerInvalidCount = (common.isDefinedAndNotNull(status.invalidCount)) ? status.invalidCount : 0;
|
||||||
|
|
||||||
|
if (this.controllerInvalidCount > 0) {
|
||||||
|
$('#controller-invalid-count').parent().removeClass('zero').addClass('invalid');
|
||||||
|
} else {
|
||||||
|
$('#controller-invalid-count').parent().removeClass('invalid').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the report values
|
||||||
|
this.activeThreadCount = status.activeThreadCount;
|
||||||
|
|
||||||
|
if (this.activeThreadCount > 0) {
|
||||||
|
$('#flow-status-container').find('.icon-threads').removeClass('zero');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.icon-threads').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.totalQueued = status.queued;
|
||||||
|
|
||||||
|
if (this.totalQueued.indexOf('0 / 0') >= 0) {
|
||||||
|
$('#flow-status-container').find('.fa-list').addClass('zero');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.fa-list').removeClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the component counts
|
||||||
|
this.controllerTransmittingCount =
|
||||||
|
common.isDefinedAndNotNull(status.activeRemotePortCount) ?
|
||||||
|
status.activeRemotePortCount : '-';
|
||||||
|
|
||||||
|
if (this.controllerTransmittingCount > 0) {
|
||||||
|
$('#flow-status-container').find('.fa-bullseye').removeClass('zero').addClass('transmitting');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.fa-bullseye').removeClass('transmitting').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.controllerNotTransmittingCount =
|
||||||
|
common.isDefinedAndNotNull(status.inactiveRemotePortCount) ?
|
||||||
|
status.inactiveRemotePortCount : '-';
|
||||||
|
|
||||||
|
if (this.controllerNotTransmittingCount > 0) {
|
||||||
|
$('#flow-status-container').find('.icon-transmit-false').removeClass('zero').addClass('not-transmitting');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.icon-transmit-false').removeClass('not-transmitting').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.controllerRunningCount =
|
||||||
|
common.isDefinedAndNotNull(status.runningCount) ? status.runningCount : '-';
|
||||||
|
|
||||||
|
if (this.controllerRunningCount > 0) {
|
||||||
|
$('#flow-status-container').find('.fa-play').removeClass('zero').addClass('running');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.fa-play').removeClass('running').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.controllerStoppedCount =
|
||||||
|
common.isDefinedAndNotNull(status.stoppedCount) ? status.stoppedCount : '-';
|
||||||
|
|
||||||
|
if (this.controllerStoppedCount > 0) {
|
||||||
|
$('#flow-status-container').find('.fa-stop').removeClass('zero').addClass('stopped');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.fa-stop').removeClass('stopped').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.controllerInvalidCount =
|
||||||
|
common.isDefinedAndNotNull(status.invalidCount) ? status.invalidCount : '-';
|
||||||
|
|
||||||
|
if (this.controllerInvalidCount > 0) {
|
||||||
|
$('#flow-status-container').find('.fa-warning').removeClass('zero').addClass('invalid');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.fa-warning').removeClass('invalid').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.controllerDisabledCount =
|
||||||
|
common.isDefinedAndNotNull(status.disabledCount) ? status.disabledCount : '-';
|
||||||
|
|
||||||
|
if (this.controllerDisabledCount > 0) {
|
||||||
|
$('#flow-status-container').find('.icon-enable-false').removeClass('zero').addClass('disabled');
|
||||||
|
} else {
|
||||||
|
$('#flow-status-container').find('.icon-enable-false').removeClass('disabled').addClass('zero');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the controller level bulletins
|
||||||
|
*
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
|
updateBulletins: function (response) {
|
||||||
|
this.bulletins.update(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the color
|
|
||||||
$('#connected-nodes-count').closest('div.fa-cubes').css('color', color);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the flow status counts.
|
|
||||||
*
|
|
||||||
* @param status The controller status returned from the `../nifi-api/flow/status` endpoint.
|
|
||||||
*/
|
|
||||||
update: function (status) {
|
|
||||||
var controllerInvalidCount = (nf.Common.isDefinedAndNotNull(status.invalidCount)) ? status.invalidCount : 0;
|
|
||||||
|
|
||||||
if (this.controllerInvalidCount > 0) {
|
|
||||||
$('#controller-invalid-count').parent().removeClass('zero').addClass('invalid');
|
|
||||||
} else {
|
|
||||||
$('#controller-invalid-count').parent().removeClass('invalid').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the report values
|
|
||||||
this.activeThreadCount = status.activeThreadCount;
|
|
||||||
|
|
||||||
if (this.activeThreadCount > 0) {
|
|
||||||
$('#flow-status-container').find('.icon-threads').removeClass('zero');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.icon-threads').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.totalQueued = status.queued;
|
|
||||||
|
|
||||||
if (this.totalQueued.indexOf('0 / 0') >= 0) {
|
|
||||||
$('#flow-status-container').find('.fa-list').addClass('zero');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.fa-list').removeClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the component counts
|
|
||||||
this.controllerTransmittingCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(status.activeRemotePortCount) ?
|
|
||||||
status.activeRemotePortCount : '-';
|
|
||||||
|
|
||||||
if (this.controllerTransmittingCount > 0) {
|
|
||||||
$('#flow-status-container').find('.fa-bullseye').removeClass('zero').addClass('transmitting');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.fa-bullseye').removeClass('transmitting').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.controllerNotTransmittingCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(status.inactiveRemotePortCount) ?
|
|
||||||
status.inactiveRemotePortCount : '-';
|
|
||||||
|
|
||||||
if (this.controllerNotTransmittingCount > 0) {
|
|
||||||
$('#flow-status-container').find('.icon-transmit-false').removeClass('zero').addClass('not-transmitting');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.icon-transmit-false').removeClass('not-transmitting').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.controllerRunningCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(status.runningCount) ? status.runningCount : '-';
|
|
||||||
|
|
||||||
if (this.controllerRunningCount > 0) {
|
|
||||||
$('#flow-status-container').find('.fa-play').removeClass('zero').addClass('running');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.fa-play').removeClass('running').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.controllerStoppedCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(status.stoppedCount) ? status.stoppedCount : '-';
|
|
||||||
|
|
||||||
if (this.controllerStoppedCount > 0) {
|
|
||||||
$('#flow-status-container').find('.fa-stop').removeClass('zero').addClass('stopped');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.fa-stop').removeClass('stopped').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.controllerInvalidCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(status.invalidCount) ? status.invalidCount : '-';
|
|
||||||
|
|
||||||
if (this.controllerInvalidCount > 0) {
|
|
||||||
$('#flow-status-container').find('.fa-warning').removeClass('zero').addClass('invalid');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.fa-warning').removeClass('invalid').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.controllerDisabledCount =
|
|
||||||
nf.Common.isDefinedAndNotNull(status.disabledCount) ? status.disabledCount : '-';
|
|
||||||
|
|
||||||
if (this.controllerDisabledCount > 0) {
|
|
||||||
$('#flow-status-container').find('.icon-enable-false').removeClass('zero').addClass('disabled');
|
|
||||||
} else {
|
|
||||||
$('#flow-status-container').find('.icon-enable-false').removeClass('disabled').addClass('zero');
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the controller level bulletins
|
|
||||||
*
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
updateBulletins: function (response) {
|
|
||||||
this.bulletins.update(response);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var flowStatusCtrl = new FlowStatusCtrl();
|
var flowStatusCtrl = new FlowStatusCtrl();
|
||||||
return flowStatusCtrl;
|
return flowStatusCtrl;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,386 +15,426 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.GlobalMenuCtrl = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.QueueListing',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.PolicyManagement',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Settings',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, common, queueListing, shell, policyManagement, clusterSummary, errorHandler, settings, canvasUtils) {
|
||||||
|
return (nf.ng.Canvas.GlobalMenuCtrl = factory($, common, queueListing, shell, policyManagement, clusterSummary, errorHandler, settings, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.GlobalMenuCtrl =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.QueueListing'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.PolicyManagement'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Settings'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.GlobalMenuCtrl = factory(root.$,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.QueueListing,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.PolicyManagement,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Settings,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, common, queueListing, shell, policyManagement, clusterSummary, errorHandler, settings, canvasUtils) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
return function (serviceProvider) {
|
||||||
urls: {
|
'use strict';
|
||||||
helpDocument: '../nifi-docs/documentation',
|
|
||||||
controllerAbout: '../nifi-api/flow/about'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function GlobalMenuCtrl(serviceProvider) {
|
var config = {
|
||||||
|
urls: {
|
||||||
/**
|
helpDocument: '../nifi-docs/documentation',
|
||||||
* The summary menu item controller.
|
controllerAbout: '../nifi-api/flow/about'
|
||||||
*/
|
|
||||||
this.summary = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The summary menu item's shell controller.
|
|
||||||
*/
|
|
||||||
shell: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the summary shell.
|
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
nf.Shell.showPage('summary');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
function GlobalMenuCtrl(serviceProvider) {
|
||||||
* The counters menu item controller.
|
|
||||||
*/
|
|
||||||
this.counters = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The counters menu item's shell controller.
|
* The summary menu item controller.
|
||||||
*/
|
*/
|
||||||
shell: {
|
this.summary = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the counters shell.
|
* The summary menu item's shell controller.
|
||||||
*/
|
*/
|
||||||
launch: function () {
|
shell: {
|
||||||
if (nf.Common.canAccessCounters()) {
|
|
||||||
nf.Shell.showPage('counters');
|
/**
|
||||||
|
* Launch the summary shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
shell.showPage('summary');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The bulletin board menu item controller.
|
|
||||||
*/
|
|
||||||
this.bulletinBoard = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bulletin board menu item's shell controller.
|
* The counters menu item controller.
|
||||||
*/
|
*/
|
||||||
shell: {
|
this.counters = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the bulletin board shell.
|
* The counters menu item's shell controller.
|
||||||
*/
|
*/
|
||||||
launch: function () {
|
shell: {
|
||||||
nf.Shell.showPage('bulletin-board');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data provenance menu item controller.
|
* Launch the counters shell.
|
||||||
*/
|
*/
|
||||||
this.dataProvenance = {
|
launch: function () {
|
||||||
|
if (common.canAccessCounters()) {
|
||||||
/**
|
shell.showPage('counters');
|
||||||
* The data provenance menu item's shell controller.
|
}
|
||||||
*/
|
|
||||||
shell: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the data provenance shell.
|
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
if (nf.Common.canAccessProvenance()) {
|
|
||||||
nf.Shell.showPage('provenance');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The controller settings menu item controller.
|
|
||||||
*/
|
|
||||||
this.controllerSettings = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The controller settings menu item's shell controller.
|
* The bulletin board menu item controller.
|
||||||
*/
|
*/
|
||||||
shell: {
|
this.bulletinBoard = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the settings shell.
|
* The bulletin board menu item's shell controller.
|
||||||
*/
|
*/
|
||||||
launch: function () {
|
shell: {
|
||||||
nf.Settings.showSettings();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cluster menu item controller.
|
* Launch the bulletin board shell.
|
||||||
*/
|
*/
|
||||||
this.cluster = {
|
launch: function () {
|
||||||
|
shell.showPage('bulletin-board');
|
||||||
/**
|
|
||||||
* Determines if the cluster menu item is enabled.
|
|
||||||
*
|
|
||||||
* @returns {*|boolean}
|
|
||||||
*/
|
|
||||||
visible: function () {
|
|
||||||
return nf.ClusterSummary.isConnectedToCluster();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cluster menu item's shell controller.
|
|
||||||
*/
|
|
||||||
shell: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the cluster shell.
|
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
if (nf.Common.canAccessController()) {
|
|
||||||
nf.Shell.showPage('cluster');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The flow config history menu item controller.
|
|
||||||
*/
|
|
||||||
this.flowConfigHistory = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The flow config history menu item's shell controller.
|
* The data provenance menu item controller.
|
||||||
*/
|
*/
|
||||||
shell: {
|
this.dataProvenance = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the history shell.
|
* The data provenance menu item's shell controller.
|
||||||
*/
|
*/
|
||||||
launch: function () {
|
shell: {
|
||||||
nf.Shell.showPage('history');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The users menu item controller.
|
* Launch the data provenance shell.
|
||||||
*/
|
*/
|
||||||
this.users = {
|
launch: function () {
|
||||||
|
if (common.canAccessProvenance()) {
|
||||||
/**
|
shell.showPage('provenance');
|
||||||
* The users menu item's shell controller.
|
}
|
||||||
*/
|
|
||||||
shell: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the users shell.
|
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
if (nf.Common.canAccessTenants()) {
|
|
||||||
nf.Shell.showPage('users');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The policies menu item controller.
|
|
||||||
*/
|
|
||||||
this.policies = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The policies menu item's shell controller.
|
* The controller settings menu item controller.
|
||||||
*/
|
*/
|
||||||
shell: {
|
this.controllerSettings = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the policies shell.
|
* The controller settings menu item's shell controller.
|
||||||
*/
|
*/
|
||||||
launch: function () {
|
shell: {
|
||||||
if (nf.Common.canModifyPolicies() && nf.Common.canAccessTenants()) {
|
|
||||||
nf.PolicyManagement.showGlobalPolicies();
|
/**
|
||||||
|
* Launch the settings shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
settings.showSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The templates menu item controller.
|
|
||||||
*/
|
|
||||||
this.templates = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The templates menu item's shell controller.
|
* The cluster menu item controller.
|
||||||
*/
|
*/
|
||||||
shell: {
|
this.cluster = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launch the templates shell.
|
* Determines if the cluster menu item is enabled.
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
nf.Shell.showPage('templates?' + $.param({
|
|
||||||
groupId: nf.Canvas.getGroupId()
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The help menu item controller.
|
|
||||||
*/
|
|
||||||
this.help = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The help menu item's shell controller.
|
|
||||||
*/
|
|
||||||
shell: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the help documentation shell.
|
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
nf.Shell.showPage(config.urls.helpDocument);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The about menu item controller.
|
|
||||||
*/
|
|
||||||
this.about = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the about details.
|
|
||||||
*/
|
|
||||||
init: function () {
|
|
||||||
// get the about details
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: config.urls.controllerAbout,
|
|
||||||
dataType: 'json'
|
|
||||||
}).done(function (response) {
|
|
||||||
var aboutDetails = response.about;
|
|
||||||
// set the document title and the about title
|
|
||||||
document.title = aboutDetails.title;
|
|
||||||
$('#nf-version').text(aboutDetails.version);
|
|
||||||
var showVersionDetail = false;
|
|
||||||
if (aboutDetails.buildTag && aboutDetails.buildTag !== 'HEAD') {
|
|
||||||
$('#nf-about-build-tag').text(aboutDetails.buildTag);
|
|
||||||
$('#nf-version-detail-tag').show();
|
|
||||||
showVersionDetail = true;
|
|
||||||
}
|
|
||||||
if (aboutDetails.buildRevision) {
|
|
||||||
$('#nf-about-build-revision').text(aboutDetails.buildRevision);
|
|
||||||
$('#nf-about-build-branch').text(aboutDetails.buildBranch);
|
|
||||||
$('#nf-version-detail-commit').show();
|
|
||||||
showVersionDetail = true
|
|
||||||
}
|
|
||||||
if (aboutDetails.buildTimestamp) {
|
|
||||||
$('#nf-about-build-timestamp').text(aboutDetails.buildTimestamp);
|
|
||||||
$('#nf-version-detail-timestamp').show();
|
|
||||||
showVersionDetail = true;
|
|
||||||
}
|
|
||||||
if (showVersionDetail) {
|
|
||||||
$('#nf-version-detail').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// store the content viewer url if available
|
|
||||||
if (!nf.Common.isBlank(aboutDetails.contentViewerUrl)) {
|
|
||||||
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
|
|
||||||
nf.QueueListing.initFlowFileDetailsDialog();
|
|
||||||
}
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
|
|
||||||
this.modal.init();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The about menu item's modal controller.
|
|
||||||
*/
|
|
||||||
modal: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the modal element.
|
|
||||||
*
|
*
|
||||||
* @returns {*|jQuery|HTMLElement}
|
* @returns {*|boolean}
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
visible: function () {
|
||||||
return $('#nf-about');
|
return clusterSummary.isConnectedToCluster();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* The cluster menu item's shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the cluster shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
if (common.canAccessController()) {
|
||||||
|
shell.showPage('cluster');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flow config history menu item controller.
|
||||||
|
*/
|
||||||
|
this.flowConfigHistory = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flow config history menu item's shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the history shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
shell.showPage('history');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The users menu item controller.
|
||||||
|
*/
|
||||||
|
this.users = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The users menu item's shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the users shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
if (common.canAccessTenants()) {
|
||||||
|
shell.showPage('users');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The policies menu item controller.
|
||||||
|
*/
|
||||||
|
this.policies = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The policies menu item's shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the policies shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
if (common.canModifyPolicies() && common.canAccessTenants()) {
|
||||||
|
policyManagement.showGlobalPolicies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The templates menu item controller.
|
||||||
|
*/
|
||||||
|
this.templates = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The templates menu item's shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the templates shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
shell.showPage('templates?' + $.param({
|
||||||
|
groupId: canvasUtils.getGroupId()
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The help menu item controller.
|
||||||
|
*/
|
||||||
|
this.help = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The help menu item's shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the help documentation shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
shell.showPage(config.urls.helpDocument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The about menu item controller.
|
||||||
|
*/
|
||||||
|
this.about = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the about details.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
var aboutModal = this;
|
// get the about details
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: config.urls.controllerAbout,
|
||||||
|
dataType: 'json'
|
||||||
|
}).done(function (response) {
|
||||||
|
var aboutDetails = response.about;
|
||||||
|
// set the document title and the about title
|
||||||
|
document.title = aboutDetails.title;
|
||||||
|
$('#nf-version').text(aboutDetails.version);
|
||||||
|
var showVersionDetail = false;
|
||||||
|
if (aboutDetails.buildTag && aboutDetails.buildTag !== 'HEAD') {
|
||||||
|
$('#nf-about-build-tag').text(aboutDetails.buildTag);
|
||||||
|
$('#nf-version-detail-tag').show();
|
||||||
|
showVersionDetail = true;
|
||||||
|
}
|
||||||
|
if (aboutDetails.buildRevision) {
|
||||||
|
$('#nf-about-build-revision').text(aboutDetails.buildRevision);
|
||||||
|
$('#nf-about-build-branch').text(aboutDetails.buildBranch);
|
||||||
|
$('#nf-version-detail-commit').show();
|
||||||
|
showVersionDetail = true
|
||||||
|
}
|
||||||
|
if (aboutDetails.buildTimestamp) {
|
||||||
|
$('#nf-about-build-timestamp').text(aboutDetails.buildTimestamp);
|
||||||
|
$('#nf-version-detail-timestamp').show();
|
||||||
|
showVersionDetail = true;
|
||||||
|
}
|
||||||
|
if (showVersionDetail) {
|
||||||
|
$('#nf-version-detail').show();
|
||||||
|
}
|
||||||
|
|
||||||
var resizeAbout = function(){
|
// store the content viewer url if available
|
||||||
var dialog = $(this);
|
if (!common.isBlank(aboutDetails.contentViewerUrl)) {
|
||||||
var top = $('#nf-about-pic-container').height() + $('.dialog-header').height() + 10; //10 for padding-top
|
$('#nifi-content-viewer-url').text(aboutDetails.contentViewerUrl);
|
||||||
dialog.find('.dialog-content').css('top', top);
|
queueListing.initFlowFileDetailsDialog();
|
||||||
};
|
}
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
this.getElement().modal({
|
this.modal.init();
|
||||||
scrollableContentStyle: 'scrollable',
|
},
|
||||||
headerText: 'About Apache NiFi',
|
|
||||||
handler: {
|
/**
|
||||||
resize: resizeAbout
|
* The about menu item's modal controller.
|
||||||
},
|
*/
|
||||||
buttons: [{
|
modal: {
|
||||||
buttonText: 'Ok',
|
|
||||||
color: {
|
/**
|
||||||
base: '#728E9B',
|
* Gets the modal element.
|
||||||
hover: '#004849',
|
*
|
||||||
text: '#ffffff'
|
* @returns {*|jQuery|HTMLElement}
|
||||||
},
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#nf-about');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the modal.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
var aboutModal = this;
|
||||||
|
|
||||||
|
var resizeAbout = function () {
|
||||||
|
var dialog = $(this);
|
||||||
|
var top = $('#nf-about-pic-container').height() + $('.dialog-header').height() + 10; //10 for padding-top
|
||||||
|
dialog.find('.dialog-content').css('top', top);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getElement().modal({
|
||||||
|
scrollableContentStyle: 'scrollable',
|
||||||
|
headerText: 'About Apache NiFi',
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
resize: resizeAbout
|
||||||
aboutModal.hide();
|
},
|
||||||
|
buttons: [{
|
||||||
|
buttonText: 'Ok',
|
||||||
|
color: {
|
||||||
|
base: '#728E9B',
|
||||||
|
hover: '#004849',
|
||||||
|
text: '#ffffff'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
aboutModal.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}]
|
||||||
}]
|
});
|
||||||
});
|
},
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the modal config.
|
* Updates the modal config.
|
||||||
*
|
*
|
||||||
* @param {string} name The name of the property to update.
|
* @param {string} name The name of the property to update.
|
||||||
* @param {object|array} config The config for the `name`.
|
* @param {object|array} config The config for the `name`.
|
||||||
*/
|
*/
|
||||||
update: function (name, config) {
|
update: function (name, config) {
|
||||||
this.getElement().modal(name, config);
|
this.getElement().modal(name, config);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the modal
|
* Show the modal
|
||||||
*/
|
*/
|
||||||
show: function () {
|
show: function () {
|
||||||
this.getElement().modal('show');
|
this.getElement().modal('show');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the modal
|
* Hide the modal
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
hide: function () {
|
||||||
this.getElement().modal('hide');
|
this.getElement().modal('hide');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GlobalMenuCtrl.prototype = {
|
GlobalMenuCtrl.prototype = {
|
||||||
constructor: GlobalMenuCtrl,
|
constructor: GlobalMenuCtrl,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the global menu controls.
|
* Initialize the global menu controls.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
this.about.init();
|
this.about.init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var globalMenuCtrl = new GlobalMenuCtrl();
|
var globalMenuCtrl = new GlobalMenuCtrl();
|
||||||
return globalMenuCtrl;
|
return globalMenuCtrl;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,330 +15,364 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.GraphControlsCtrl = function (serviceProvider, navigateCtrl, operateCtrl) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Actions',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Storage',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.ProcessGroupConfiguration'],
|
||||||
|
function ($, action, birdseye, storage, canvasUtils, common, processGroupConfiguration) {
|
||||||
|
return (nf.ng.Canvas.GraphControlsCtrl = factory($, action, birdseye, storage, canvasUtils, common, processGroupConfiguration));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.GraphControlsCtrl =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Actions'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Storage'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.ProcessGroupConfiguration')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.GraphControlsCtrl = factory(root.$,
|
||||||
|
root.nf.Actions,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Storage,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.ProcessGroupConfiguration);
|
||||||
|
}
|
||||||
|
}(this, function ($, actions, birdseye, storage, canvasUtils, common, processGroupConfiguration) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
return function (serviceProvider, navigateCtrl, operateCtrl) {
|
||||||
* Opens the specified graph control.
|
'use strict';
|
||||||
*
|
|
||||||
* @param {jQuery} graphControl
|
|
||||||
*/
|
|
||||||
var openGraphControl = function (graphControl) {
|
|
||||||
// undock if necessary
|
|
||||||
if ($('div.graph-control-content').is(':visible') === false) {
|
|
||||||
$('#graph-controls div.graph-control-docked').hide();
|
|
||||||
$('#graph-controls div.graph-control-header-container').show();
|
|
||||||
$('.graph-control').removeClass('docked');
|
|
||||||
}
|
|
||||||
|
|
||||||
// show the content of the specified graph control
|
|
||||||
graphControl.children('div.graph-control-content').show();
|
|
||||||
graphControl.find('div.graph-control-expansion').removeClass('fa-plus-square-o').addClass('fa-minus-square-o');
|
|
||||||
|
|
||||||
// handle specific actions as necessary
|
|
||||||
if (graphControl.attr('id') === 'navigation-control') {
|
|
||||||
nf.Birdseye.updateBirdseyeVisibility(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the current visibility
|
|
||||||
var graphControlVisibility = nf.Storage.getItem('graph-control-visibility');
|
|
||||||
if (graphControlVisibility === null) {
|
|
||||||
graphControlVisibility = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the visibility for this graph control
|
|
||||||
var graphControlId = graphControl.attr('id');
|
|
||||||
graphControlVisibility[graphControlId] = true;
|
|
||||||
nf.Storage.setItem('graph-control-visibility', graphControlVisibility);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hides the specified graph control.
|
|
||||||
*
|
|
||||||
* @param {jQuery} graphControl
|
|
||||||
*/
|
|
||||||
var hideGraphControl = function (graphControl) {
|
|
||||||
// hide the content of the specified graph control
|
|
||||||
graphControl.children('div.graph-control-content').hide();
|
|
||||||
graphControl.find('div.graph-control-expansion').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
|
||||||
|
|
||||||
// dock if necessary
|
|
||||||
if ($('div.graph-control-content').is(':visible') === false) {
|
|
||||||
$('#graph-controls div.graph-control-header-container').hide();
|
|
||||||
$('#graph-controls div.graph-control-docked').show();
|
|
||||||
$('.graph-control').addClass('docked');
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle specific actions as necessary
|
|
||||||
if (graphControl.attr('id') === 'navigation-control') {
|
|
||||||
nf.Birdseye.updateBirdseyeVisibility(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the current visibility
|
|
||||||
var graphControlVisibility = nf.Storage.getItem('graph-control-visibility');
|
|
||||||
if (graphControlVisibility === null) {
|
|
||||||
graphControlVisibility = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the visibility for this graph control
|
|
||||||
var graphControlId = graphControl.attr('id');
|
|
||||||
graphControlVisibility[graphControlId] = false;
|
|
||||||
nf.Storage.setItem('graph-control-visibility', graphControlVisibility);
|
|
||||||
};
|
|
||||||
|
|
||||||
function GraphControlsCtrl(navigateCtrl, operateCtrl) {
|
|
||||||
this.navigateCtrl = navigateCtrl;
|
|
||||||
this.operateCtrl = operateCtrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
GraphControlsCtrl.prototype = {
|
|
||||||
constructor: GraphControlsCtrl,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the header controller.
|
* Opens the specified graph control.
|
||||||
|
*
|
||||||
|
* @param {jQuery} graphControl
|
||||||
*/
|
*/
|
||||||
register: function () {
|
var openGraphControl = function (graphControl) {
|
||||||
if (serviceProvider.graphControlsCtrl === undefined) {
|
// undock if necessary
|
||||||
serviceProvider.register('graphControlsCtrl', graphControlsCtrl);
|
if ($('div.graph-control-content').is(':visible') === false) {
|
||||||
|
$('#graph-controls div.graph-control-docked').hide();
|
||||||
|
$('#graph-controls div.graph-control-header-container').show();
|
||||||
|
$('.graph-control').removeClass('docked');
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// show the content of the specified graph control
|
||||||
* Initialize the graph controls.
|
graphControl.children('div.graph-control-content').show();
|
||||||
*/
|
graphControl.find('div.graph-control-expansion').removeClass('fa-plus-square-o').addClass('fa-minus-square-o');
|
||||||
init: function () {
|
|
||||||
this.operateCtrl.init();
|
// handle specific actions as necessary
|
||||||
// initial the graph control visibility
|
if (graphControl.attr('id') === 'navigation-control') {
|
||||||
var graphControlVisibility = nf.Storage.getItem('graph-control-visibility');
|
birdseye.updateBirdseyeVisibility(true);
|
||||||
if (graphControlVisibility !== null) {
|
|
||||||
$.each(graphControlVisibility, function (id, isVisible) {
|
|
||||||
var graphControl = $('#' + id);
|
|
||||||
if (graphControl) {
|
|
||||||
if (isVisible) {
|
|
||||||
openGraphControl(graphControl);
|
|
||||||
} else {
|
|
||||||
hideGraphControl(graphControl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
openGraphControl($('#navigation-control'));
|
|
||||||
openGraphControl($('#operation-control'));
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// get the current visibility
|
||||||
* Undock the graph control.
|
var graphControlVisibility = storage.getItem('graph-control-visibility');
|
||||||
* @param {jQuery} $event
|
if (graphControlVisibility === null) {
|
||||||
*/
|
graphControlVisibility = {};
|
||||||
undock: function ($event) {
|
|
||||||
openGraphControl($($event.target).parent());
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expand the graph control.
|
|
||||||
* @param {jQuery} $event
|
|
||||||
*/
|
|
||||||
expand: function ($event) {
|
|
||||||
var icon = $($event.target);
|
|
||||||
if (icon.find('.fa-plus-square-o').length > 0 || icon.hasClass('fa-plus-square-o') || icon.parent().children().find('.fa-plus-square-o').length > 0) {
|
|
||||||
openGraphControl(icon.closest('div.graph-control'));
|
|
||||||
} else {
|
|
||||||
hideGraphControl(icon.closest('div.graph-control'));
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
// update the visibility for this graph control
|
||||||
|
var graphControlId = graphControl.attr('id');
|
||||||
|
graphControlVisibility[graphControlId] = true;
|
||||||
|
storage.setItem('graph-control-visibility', graphControlVisibility);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the icon to show for the selection context.
|
* Hides the specified graph control.
|
||||||
|
*
|
||||||
|
* @param {jQuery} graphControl
|
||||||
*/
|
*/
|
||||||
getContextIcon: function () {
|
var hideGraphControl = function (graphControl) {
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
// hide the content of the specified graph control
|
||||||
|
graphControl.children('div.graph-control-content').hide();
|
||||||
|
graphControl.find('div.graph-control-expansion').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
||||||
|
|
||||||
if (selection.empty()) {
|
// dock if necessary
|
||||||
if (nf.Canvas.getParentGroupId() === null) {
|
if ($('div.graph-control-content').is(':visible') === false) {
|
||||||
return 'icon-drop';
|
$('#graph-controls div.graph-control-header-container').hide();
|
||||||
} else {
|
$('#graph-controls div.graph-control-docked').show();
|
||||||
return 'icon-group';
|
$('.graph-control').addClass('docked');
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle specific actions as necessary
|
||||||
|
if (graphControl.attr('id') === 'navigation-control') {
|
||||||
|
birdseye.updateBirdseyeVisibility(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the current visibility
|
||||||
|
var graphControlVisibility = storage.getItem('graph-control-visibility');
|
||||||
|
if (graphControlVisibility === null) {
|
||||||
|
graphControlVisibility = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the visibility for this graph control
|
||||||
|
var graphControlId = graphControl.attr('id');
|
||||||
|
graphControlVisibility[graphControlId] = false;
|
||||||
|
storage.setItem('graph-control-visibility', graphControlVisibility);
|
||||||
|
};
|
||||||
|
|
||||||
|
function GraphControlsCtrl(navigateCtrl, operateCtrl) {
|
||||||
|
this.navigateCtrl = navigateCtrl;
|
||||||
|
this.operateCtrl = operateCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphControlsCtrl.prototype = {
|
||||||
|
constructor: GraphControlsCtrl,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the header controller.
|
||||||
|
*/
|
||||||
|
register: function () {
|
||||||
|
if (serviceProvider.graphControlsCtrl === undefined) {
|
||||||
|
serviceProvider.register('graphControlsCtrl', graphControlsCtrl);
|
||||||
}
|
}
|
||||||
} else {
|
},
|
||||||
if (selection.size() === 1) {
|
|
||||||
if (nf.CanvasUtils.isProcessor(selection)) {
|
|
||||||
return 'icon-processor';
|
|
||||||
} else if (nf.CanvasUtils.isProcessGroup(selection)) {
|
|
||||||
return 'icon-group';
|
|
||||||
} else if (nf.CanvasUtils.isInputPort(selection)) {
|
|
||||||
return 'icon-port-in';
|
|
||||||
} else if (nf.CanvasUtils.isOutputPort(selection)) {
|
|
||||||
return 'icon-port-out';
|
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
|
||||||
return 'icon-group-remote';
|
|
||||||
} else if (nf.CanvasUtils.isFunnel(selection)) {
|
|
||||||
return 'icon-funnel';
|
|
||||||
} else if (nf.CanvasUtils.isLabel(selection)) {
|
|
||||||
return 'icon-label';
|
|
||||||
} else if (nf.CanvasUtils.isConnection(selection)) {
|
|
||||||
return 'icon-connect';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 'icon-drop';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will hide target when appropriate.
|
* Initialize the graph controls.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
init: function () {
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
this.operateCtrl.init();
|
||||||
if (selection.size() > 1) {
|
// initial the graph control visibility
|
||||||
return 'invisible'
|
var graphControlVisibility = storage.getItem('graph-control-visibility');
|
||||||
} else {
|
if (graphControlVisibility !== null) {
|
||||||
return '';
|
$.each(graphControlVisibility, function (id, isVisible) {
|
||||||
}
|
var graphControl = $('#' + id);
|
||||||
},
|
if (graphControl) {
|
||||||
|
if (isVisible) {
|
||||||
/**
|
openGraphControl(graphControl);
|
||||||
* Gets the name to show for the selection context.
|
|
||||||
*/
|
|
||||||
getContextName: function () {
|
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
|
||||||
var canRead = nf.Canvas.canRead();
|
|
||||||
|
|
||||||
if (selection.empty()) {
|
|
||||||
if (canRead) {
|
|
||||||
return nf.Canvas.getGroupName();
|
|
||||||
} else {
|
|
||||||
return nf.Canvas.getGroupId();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (selection.size() === 1) {
|
|
||||||
var d = selection.datum();
|
|
||||||
if (d.permissions.canRead) {
|
|
||||||
if (nf.CanvasUtils.isLabel(selection)) {
|
|
||||||
if ($.trim(d.component.label) !== '') {
|
|
||||||
return d.component.label;
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
hideGraphControl(graphControl);
|
||||||
}
|
}
|
||||||
} else if (nf.CanvasUtils.isConnection(selection)) {
|
}
|
||||||
return nf.CanvasUtils.formatConnectionName(d.component);
|
});
|
||||||
} else {
|
} else {
|
||||||
return d.component.name;
|
openGraphControl($('#navigation-control'));
|
||||||
|
openGraphControl($('#operation-control'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Undock the graph control.
|
||||||
|
* @param {jQuery} $event
|
||||||
|
*/
|
||||||
|
undock: function ($event) {
|
||||||
|
openGraphControl($($event.target).parent());
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expand the graph control.
|
||||||
|
* @param {jQuery} $event
|
||||||
|
*/
|
||||||
|
expand: function ($event) {
|
||||||
|
var icon = $($event.target);
|
||||||
|
if (icon.find('.fa-plus-square-o').length > 0 || icon.hasClass('fa-plus-square-o') || icon.parent().children().find('.fa-plus-square-o').length > 0) {
|
||||||
|
openGraphControl(icon.closest('div.graph-control'));
|
||||||
|
} else {
|
||||||
|
hideGraphControl(icon.closest('div.graph-control'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the icon to show for the selection context.
|
||||||
|
*/
|
||||||
|
getContextIcon: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
|
if (selection.empty()) {
|
||||||
|
if (canvasUtils.getParentGroupId() === null) {
|
||||||
|
return 'icon-drop';
|
||||||
|
} else {
|
||||||
|
return 'icon-group';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (selection.size() === 1) {
|
||||||
|
if (canvasUtils.isProcessor(selection)) {
|
||||||
|
return 'icon-processor';
|
||||||
|
} else if (canvasUtils.isProcessGroup(selection)) {
|
||||||
|
return 'icon-group';
|
||||||
|
} else if (canvasUtils.isInputPort(selection)) {
|
||||||
|
return 'icon-port-in';
|
||||||
|
} else if (canvasUtils.isOutputPort(selection)) {
|
||||||
|
return 'icon-port-out';
|
||||||
|
} else if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
|
return 'icon-group-remote';
|
||||||
|
} else if (canvasUtils.isFunnel(selection)) {
|
||||||
|
return 'icon-funnel';
|
||||||
|
} else if (canvasUtils.isLabel(selection)) {
|
||||||
|
return 'icon-label';
|
||||||
|
} else if (canvasUtils.isConnection(selection)) {
|
||||||
|
return 'icon-connect';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
return 'icon-drop';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will hide target when appropriate.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
if (selection.size() > 1) {
|
||||||
|
return 'invisible'
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name to show for the selection context.
|
||||||
|
*/
|
||||||
|
getContextName: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
var canRead = canvasUtils.canReadFromGroup();
|
||||||
|
|
||||||
|
if (selection.empty()) {
|
||||||
|
if (canRead) {
|
||||||
|
return canvasUtils.getGroupName();
|
||||||
|
} else {
|
||||||
|
return canvasUtils.getGroupId();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (selection.size() === 1) {
|
||||||
|
var d = selection.datum();
|
||||||
|
if (d.permissions.canRead) {
|
||||||
|
if (canvasUtils.isLabel(selection)) {
|
||||||
|
if ($.trim(d.component.label) !== '') {
|
||||||
|
return d.component.label;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
} else if (canvasUtils.isConnection(selection)) {
|
||||||
|
return canvasUtils.formatConnectionName(d.component);
|
||||||
|
} else {
|
||||||
|
return d.component.name;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return d.id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 'Multiple components selected';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type to show for the selection context.
|
||||||
|
*/
|
||||||
|
getContextType: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
|
if (selection.empty()) {
|
||||||
|
return 'Process Group';
|
||||||
|
} else {
|
||||||
|
if (selection.size() === 1) {
|
||||||
|
if (canvasUtils.isProcessor(selection)) {
|
||||||
|
return 'Processor';
|
||||||
|
} else if (canvasUtils.isProcessGroup(selection)) {
|
||||||
|
return 'Process Group';
|
||||||
|
} else if (canvasUtils.isInputPort(selection)) {
|
||||||
|
return 'Input Port';
|
||||||
|
} else if (canvasUtils.isOutputPort(selection)) {
|
||||||
|
return 'Output Port';
|
||||||
|
} else if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
|
return 'Remote Process Group';
|
||||||
|
} else if (canvasUtils.isFunnel(selection)) {
|
||||||
|
return 'Funnel';
|
||||||
|
} else if (canvasUtils.isLabel(selection)) {
|
||||||
|
return 'Label';
|
||||||
|
} else if (canvasUtils.isConnection(selection)) {
|
||||||
|
return 'Connection';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 'Multiple selected';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the id to show for the selection context.
|
||||||
|
*/
|
||||||
|
getContextId: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
|
if (selection.empty()) {
|
||||||
|
return canvasUtils.getGroupId();
|
||||||
|
} else {
|
||||||
|
if (selection.size() === 1) {
|
||||||
|
var d = selection.datum();
|
||||||
return d.id;
|
return d.id;
|
||||||
|
} else {
|
||||||
|
return 'Multiple selected';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return 'Multiple components selected';
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the type to show for the selection context.
|
* Determines whether the user can configure or open the details dialog.
|
||||||
*/
|
*/
|
||||||
getContextType: function () {
|
canConfigureOrOpenDetails: function () {
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
if (selection.empty()) {
|
if (selection.empty()) {
|
||||||
return 'Process Group';
|
return true;
|
||||||
} else {
|
}
|
||||||
if (selection.size() === 1) {
|
|
||||||
if (nf.CanvasUtils.isProcessor(selection)) {
|
return canvasUtils.isConfigurable(selection) || canvasUtils.hasDetails(selection);
|
||||||
return 'Processor';
|
},
|
||||||
} else if (nf.CanvasUtils.isProcessGroup(selection)) {
|
|
||||||
return 'Process Group';
|
/**
|
||||||
} else if (nf.CanvasUtils.isInputPort(selection)) {
|
* Opens either the configuration or details view based on the current state.
|
||||||
return 'Input Port';
|
*/
|
||||||
} else if (nf.CanvasUtils.isOutputPort(selection)) {
|
openConfigureOrDetailsView: function () {
|
||||||
return 'Output Port';
|
var selection = canvasUtils.getSelection();
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
|
||||||
return 'Remote Process Group';
|
if (selection.empty()) {
|
||||||
} else if (nf.CanvasUtils.isFunnel(selection)) {
|
processGroupConfiguration.showConfiguration(canvasUtils.getGroupId());
|
||||||
return 'Funnel';
|
}
|
||||||
} else if (nf.CanvasUtils.isLabel(selection)) {
|
|
||||||
return 'Label';
|
if (canvasUtils.isConfigurable(selection)) {
|
||||||
} else if (nf.CanvasUtils.isConnection(selection)) {
|
actions.showConfiguration(selection);
|
||||||
return 'Connection';
|
} else if (canvasUtils.hasDetails(selection)) {
|
||||||
|
actions.showDetails(selection);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the user can configure or open the policy management page.
|
||||||
|
*/
|
||||||
|
canManagePolicies: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
|
// ensure 0 or 1 components selected
|
||||||
|
if (selection.size() <= 1) {
|
||||||
|
// if something is selected, ensure it's not a connection
|
||||||
|
if (!selection.empty() && canvasUtils.isConnection(selection)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return 'Multiple selected';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// ensure access to read tenants
|
||||||
* Gets the id to show for the selection context.
|
return common.canAccessTenants();
|
||||||
*/
|
|
||||||
getContextId: function () {
|
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
|
||||||
|
|
||||||
if (selection.empty()) {
|
|
||||||
return nf.Canvas.getGroupId();
|
|
||||||
} else {
|
|
||||||
if (selection.size() === 1) {
|
|
||||||
var d = selection.datum();
|
|
||||||
return d.id;
|
|
||||||
} else {
|
|
||||||
return 'Multiple selected';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether the user can configure or open the details dialog.
|
|
||||||
*/
|
|
||||||
canConfigureOrOpenDetails: function () {
|
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
|
||||||
|
|
||||||
if (selection.empty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nf.CanvasUtils.isConfigurable(selection) || nf.CanvasUtils.hasDetails(selection);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens either the configuration or details view based on the current state.
|
|
||||||
*/
|
|
||||||
openConfigureOrDetailsView: function () {
|
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
|
||||||
|
|
||||||
if (selection.empty()) {
|
|
||||||
nf.ProcessGroupConfiguration.showConfiguration(nf.Canvas.getGroupId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nf.CanvasUtils.isConfigurable(selection)) {
|
|
||||||
nf.Actions.showConfiguration(selection);
|
|
||||||
} else if (nf.CanvasUtils.hasDetails(selection)) {
|
|
||||||
nf.Actions.showDetails(selection);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether the user can configure or open the policy management page.
|
|
||||||
*/
|
|
||||||
canManagePolicies: function () {
|
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
|
||||||
|
|
||||||
// ensure 0 or 1 components selected
|
|
||||||
if (selection.size() <= 1) {
|
|
||||||
// if something is selected, ensure it's not a connection
|
|
||||||
if (!selection.empty() && nf.CanvasUtils.isConnection(selection)) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure access to read tenants
|
return false;
|
||||||
return nf.Common.canAccessTenants();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var graphControlsCtrl = new GraphControlsCtrl(navigateCtrl, operateCtrl);
|
var graphControlsCtrl = new GraphControlsCtrl(navigateCtrl, operateCtrl);
|
||||||
graphControlsCtrl.register();
|
graphControlsCtrl.register();
|
||||||
return graphControlsCtrl;
|
return graphControlsCtrl;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,113 +15,141 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.HeaderCtrl = function (serviceProvider, toolboxCtrl, globalMenuCtrl, flowStatusCtrl) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Storage',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.ErrorHandler'],
|
||||||
|
function ($, common, storage, shell, errorHandler) {
|
||||||
|
return (nf.ng.Canvas.HeaderCtrl = factory($, common, storage, shell, errorHandler));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.HeaderCtrl =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Storage'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.ErrorHandler')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.HeaderCtrl = factory(root.$,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Storage,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.ErrorHandler);
|
||||||
|
}
|
||||||
|
}(this, function ($, common, storage, shell, errorHandler) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var MIN_TOOLBAR_WIDTH = 640;
|
return function (serviceProvider, toolboxCtrl, globalMenuCtrl, flowStatusCtrl) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
var MIN_TOOLBAR_WIDTH = 640;
|
||||||
urls: {
|
|
||||||
accessConfig: '../nifi-api/access/config'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function HeaderCtrl(toolboxCtrl, globalMenuCtrl, flowStatusCtrl) {
|
var config = {
|
||||||
this.toolboxCtrl = toolboxCtrl;
|
urls: {
|
||||||
this.globalMenuCtrl = globalMenuCtrl;
|
accessConfig: '../nifi-api/access/config'
|
||||||
this.flowStatusCtrl = flowStatusCtrl;
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
function HeaderCtrl(toolboxCtrl, globalMenuCtrl, flowStatusCtrl) {
|
||||||
* The login controller.
|
this.toolboxCtrl = toolboxCtrl;
|
||||||
*/
|
this.globalMenuCtrl = globalMenuCtrl;
|
||||||
this.loginCtrl = {
|
this.flowStatusCtrl = flowStatusCtrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the login controller.
|
* The login controller.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
this.loginCtrl = {
|
||||||
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:') {
|
* Initialize the login controller.
|
||||||
$('#login-link-container').css('display', 'none');
|
*/
|
||||||
|
init: function () {
|
||||||
|
var loginCtrl = this;
|
||||||
|
|
||||||
|
// if the user is not anonymous or accessing via http
|
||||||
|
if ($('#current-user').text() !== common.ANONYMOUS_USER_TEXT || location.protocol === 'http:') {
|
||||||
|
$('#login-link-container').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
// if accessing via http, don't show the current user
|
||||||
|
if (location.protocol === 'http:') {
|
||||||
|
$('#current-user-container').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the login config
|
||||||
|
var loginXhr = $.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: config.urls.accessConfig,
|
||||||
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
|
||||||
|
$.when(loginXhr).done(function (loginResult) {
|
||||||
|
loginCtrl.supportsLogin = loginResult.config.supportsLogin;
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean describing whether or not the NiFi instance supports login.
|
||||||
|
*/
|
||||||
|
supportsLogin: undefined,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The login shell controller.
|
||||||
|
*/
|
||||||
|
shell: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch the login shell.
|
||||||
|
*/
|
||||||
|
launch: function () {
|
||||||
|
shell.showPage('login', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// if accessing via http, don't show the current user
|
/**
|
||||||
if (location.protocol === 'http:') {
|
* The logout controller.
|
||||||
$('#current-user-container').css('display', 'none');
|
*/
|
||||||
|
this.logoutCtrl = {
|
||||||
|
logout: function () {
|
||||||
|
storage.removeItem("jwt");
|
||||||
|
window.location = '/nifi';
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// get the login config
|
HeaderCtrl.prototype = {
|
||||||
var loginXhr = $.ajax({
|
constructor: HeaderCtrl,
|
||||||
type: 'GET',
|
|
||||||
url: config.urls.accessConfig,
|
|
||||||
dataType: 'json'
|
|
||||||
});
|
|
||||||
|
|
||||||
$.when(loginXhr).done(function (loginResult) {
|
/**
|
||||||
loginCtrl.supportsLogin = loginResult.config.supportsLogin;
|
* Register the header controller.
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
*/
|
||||||
|
register: function () {
|
||||||
|
if (serviceProvider.headerCtrl === undefined) {
|
||||||
|
serviceProvider.register('headerCtrl', headerCtrl);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Boolean describing whether or not the NiFi instance supports login.
|
* Initialize the canvas header.
|
||||||
|
*
|
||||||
|
* @argument {boolean} supportsLogin Whether login is supported.
|
||||||
*/
|
*/
|
||||||
supportsLogin: undefined,
|
init: function () {
|
||||||
|
this.toolboxCtrl.init();
|
||||||
/**
|
this.globalMenuCtrl.init();
|
||||||
* The login shell controller.
|
this.flowStatusCtrl.init();
|
||||||
*/
|
this.loginCtrl.init();
|
||||||
shell: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Launch the login shell.
|
|
||||||
*/
|
|
||||||
launch: function () {
|
|
||||||
nf.Shell.showPage('login', false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The logout controller.
|
|
||||||
*/
|
|
||||||
this.logoutCtrl = {
|
|
||||||
logout: function () {
|
|
||||||
nf.Storage.removeItem("jwt");
|
|
||||||
window.location = '/nifi';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
HeaderCtrl.prototype = {
|
|
||||||
constructor: HeaderCtrl,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the header controller.
|
|
||||||
*/
|
|
||||||
register: function () {
|
|
||||||
if (serviceProvider.headerCtrl === undefined) {
|
|
||||||
serviceProvider.register('headerCtrl', headerCtrl);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the canvas header.
|
|
||||||
*
|
|
||||||
* @argument {boolean} supportsLogin Whether login is supported.
|
|
||||||
*/
|
|
||||||
init: function () {
|
|
||||||
this.toolboxCtrl.init();
|
|
||||||
this.globalMenuCtrl.init();
|
|
||||||
this.flowStatusCtrl.init();
|
|
||||||
this.loginCtrl.init();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var headerCtrl = new HeaderCtrl(toolboxCtrl, globalMenuCtrl, flowStatusCtrl);
|
var headerCtrl = new HeaderCtrl(toolboxCtrl, globalMenuCtrl, flowStatusCtrl);
|
||||||
headerCtrl.register();
|
headerCtrl.register();
|
||||||
return headerCtrl;
|
return headerCtrl;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,77 +15,97 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.NavigateCtrl = function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['nf.CanvasUtils',
|
||||||
|
'nf.ContextMenu'],
|
||||||
|
function (canvasUtils, contextMenu) {
|
||||||
|
return (nf.ng.Canvas.NavigateCtrl = factory(canvasUtils, contextMenu));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.NavigateCtrl =
|
||||||
|
factory(require('nf.CanvasUtils'),
|
||||||
|
require('nf.ContextMenu')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.NavigateCtrl = factory(root.nf.CanvasUtils,
|
||||||
|
root.nf.ContextMenu);
|
||||||
|
}
|
||||||
|
}(this, function (canvasUtils, contextMenu) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function NavigateCtrl() {
|
return function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
/**
|
function NavigateCtrl() {
|
||||||
* Zoom in on the canvas.
|
|
||||||
*/
|
|
||||||
this.zoomIn = function () {
|
|
||||||
nf.Canvas.View.zoomIn();
|
|
||||||
|
|
||||||
// hide the context menu
|
/**
|
||||||
nf.ContextMenu.hide();
|
* Zoom in on the canvas.
|
||||||
|
*/
|
||||||
|
this.zoomIn = function () {
|
||||||
|
canvasUtils.zoomCanvasViewIn();
|
||||||
|
|
||||||
// refresh the canvas
|
// hide the context menu
|
||||||
nf.Canvas.View.refresh({
|
contextMenu.hide();
|
||||||
transition: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
// refresh the canvas
|
||||||
* Zoom out on the canvas.
|
canvasUtils.refreshCanvasView({
|
||||||
*/
|
transition: true
|
||||||
this.zoomOut = function () {
|
});
|
||||||
nf.Canvas.View.zoomOut();
|
};
|
||||||
|
|
||||||
// hide the context menu
|
/**
|
||||||
nf.ContextMenu.hide();
|
* Zoom out on the canvas.
|
||||||
|
*/
|
||||||
|
this.zoomOut = function () {
|
||||||
|
canvasUtils.zoomCanvasViewOut();
|
||||||
|
|
||||||
// refresh the canvas
|
// hide the context menu
|
||||||
nf.Canvas.View.refresh({
|
contextMenu.hide();
|
||||||
transition: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
// refresh the canvas
|
||||||
* Zoom fit on the canvas.
|
canvasUtils.refreshCanvasView({
|
||||||
*/
|
transition: true
|
||||||
this.zoomFit = function () {
|
});
|
||||||
nf.Canvas.View.fit();
|
};
|
||||||
|
|
||||||
// hide the context menu
|
/**
|
||||||
nf.ContextMenu.hide();
|
* Zoom fit on the canvas.
|
||||||
|
*/
|
||||||
|
this.zoomFit = function () {
|
||||||
|
canvasUtils.fitCanvasView();
|
||||||
|
|
||||||
// refresh the canvas
|
// hide the context menu
|
||||||
nf.Canvas.View.refresh({
|
contextMenu.hide();
|
||||||
transition: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
// refresh the canvas
|
||||||
* Zoom actual size on the canvas.
|
canvasUtils.refreshCanvasView({
|
||||||
*/
|
transition: true
|
||||||
this.zoomActualSize = function () {
|
});
|
||||||
nf.Canvas.View.actualSize();
|
};
|
||||||
|
|
||||||
// hide the context menu
|
/**
|
||||||
nf.ContextMenu.hide();
|
* Zoom actual size on the canvas.
|
||||||
|
*/
|
||||||
|
this.zoomActualSize = function () {
|
||||||
|
canvasUtils.actualSizeCanvasView();
|
||||||
|
|
||||||
// refresh the canvas
|
// hide the context menu
|
||||||
nf.Canvas.View.refresh({
|
contextMenu.hide();
|
||||||
transition: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
NavigateCtrl.prototype = {
|
|
||||||
constructor: NavigateCtrl
|
|
||||||
}
|
|
||||||
|
|
||||||
var navigateCtrl = new NavigateCtrl();
|
// refresh the canvas
|
||||||
return navigateCtrl;
|
canvasUtils.refreshCanvasView({
|
||||||
};
|
transition: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigateCtrl.prototype = {
|
||||||
|
constructor: NavigateCtrl
|
||||||
|
}
|
||||||
|
|
||||||
|
var navigateCtrl = new NavigateCtrl();
|
||||||
|
return navigateCtrl;
|
||||||
|
};
|
||||||
|
}));
|
|
@ -15,323 +15,207 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.OperateCtrl = function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Processor'],
|
||||||
|
function ($, d3, dialog, birdseye, canvasUtils, common, client, processor) {
|
||||||
|
return (nf.ng.Canvas.OperateCtrl = factory($, d3, dialog, birdseye, canvasUtils, common, client, processor));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.OperateCtrl =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Processor')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.OperateCtrl = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Processor);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, dialog, birdseye, canvasUtils, common, client, processor) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// updates the color if its a valid hex color string
|
return function () {
|
||||||
var updateColor = function () {
|
'use strict';
|
||||||
var hex = $('#fill-color-value').val();
|
|
||||||
|
|
||||||
// only update the fill color when its a valid hex color string
|
// updates the color if its a valid hex color string
|
||||||
// #[six hex characters|three hex characters] case insensitive
|
var updateColor = function () {
|
||||||
if (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex)) {
|
var hex = $('#fill-color-value').val();
|
||||||
$('#fill-color').minicolors('value', hex);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function OperateCtrl() {
|
// only update the fill color when its a valid hex color string
|
||||||
|
// #[six hex characters|three hex characters] case insensitive
|
||||||
/**
|
if (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex)) {
|
||||||
* The canvas operator's create template component.
|
$('#fill-color').minicolors('value', hex);
|
||||||
*/
|
|
||||||
this.template = {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The canvas operator's create template component's modal.
|
|
||||||
*/
|
|
||||||
modal: {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the modal element.
|
|
||||||
*
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
getElement: function () {
|
|
||||||
return $('#new-template-dialog');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the modal.
|
|
||||||
*/
|
|
||||||
init: function () {
|
|
||||||
// configure the create template dialog
|
|
||||||
this.getElement().modal({
|
|
||||||
scrollableContentStyle: 'scrollable',
|
|
||||||
headerText: 'Create Template'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the modal config.
|
|
||||||
*
|
|
||||||
* @param {string} name The name of the property to update.
|
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
|
||||||
update: function (name, config) {
|
|
||||||
this.getElement().modal(name, config);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the modal.
|
|
||||||
*/
|
|
||||||
show: function () {
|
|
||||||
this.getElement().modal('show');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hide the modal.
|
|
||||||
*/
|
|
||||||
hide: function () {
|
|
||||||
this.getElement().modal('hide');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
function OperateCtrl() {
|
||||||
* The canvas operator's create template component.
|
|
||||||
*/
|
|
||||||
this.templateUpload = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The canvas operator's create template component's modal.
|
* The canvas operator's create template component.
|
||||||
*/
|
*/
|
||||||
modal: {
|
this.template = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the modal element.
|
* The canvas operator's create template component's modal.
|
||||||
*
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
modal: {
|
||||||
return $('#upload-template-dialog');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* Gets the modal element.
|
||||||
*/
|
*
|
||||||
init: function () {
|
* @returns {*|jQuery|HTMLElement}
|
||||||
// initialize the form
|
*/
|
||||||
var templateForm = $('#template-upload-form').ajaxForm({
|
getElement: function () {
|
||||||
url: '../nifi-api/process-groups/',
|
return $('#new-template-dialog');
|
||||||
dataType: 'xml',
|
},
|
||||||
beforeSubmit: function (formData, $form, options) {
|
|
||||||
// ensure uploading to the current process group
|
|
||||||
options.url += (encodeURIComponent(nf.Canvas.getGroupId()) + '/templates/upload');
|
|
||||||
},
|
|
||||||
success: function (response, statusText, xhr, form) {
|
|
||||||
// see if the import was successful and inform the user
|
|
||||||
if (response.documentElement.tagName === 'templateEntity') {
|
|
||||||
nf.Dialog.showOkDialog({
|
|
||||||
headerText: 'Success',
|
|
||||||
dialogContent: 'Template successfully imported.'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// import failed
|
|
||||||
var statusText = 'Unable to import template. Please check the log for errors.';
|
|
||||||
if (response.documentElement.tagName === 'errorResponse') {
|
|
||||||
// if a more specific error was given, use it
|
|
||||||
var errorMessage = response.documentElement.getAttribute('statusText');
|
|
||||||
if (!nf.Common.isBlank(errorMessage)) {
|
|
||||||
statusText = errorMessage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// show reason
|
/**
|
||||||
nf.Dialog.showOkDialog({
|
* Initialize the modal.
|
||||||
headerText: 'Unable to Upload',
|
*/
|
||||||
dialogContent: nf.Common.escapeHtml(statusText)
|
init: function () {
|
||||||
});
|
// configure the create template dialog
|
||||||
}
|
this.getElement().modal({
|
||||||
},
|
scrollableContentStyle: 'scrollable',
|
||||||
error: function (xhr, statusText, error) {
|
headerText: 'Create Template'
|
||||||
// request failed
|
});
|
||||||
nf.Dialog.showOkDialog({
|
},
|
||||||
headerText: 'Unable to Upload',
|
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// configure the upload template dialog
|
/**
|
||||||
this.getElement().modal({
|
* Updates the modal config.
|
||||||
headerText: 'Upload Template',
|
*
|
||||||
buttons: [{
|
* @param {string} name The name of the property to update.
|
||||||
buttonText: 'Upload',
|
* @param {object|array} config The config for the `name`.
|
||||||
color: {
|
*/
|
||||||
base: '#728E9B',
|
update: function (name, config) {
|
||||||
hover: '#004849',
|
this.getElement().modal(name, config);
|
||||||
text: '#ffffff'
|
},
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: function () {
|
|
||||||
var selectedTemplate = $('#selected-template-name').text();
|
|
||||||
|
|
||||||
// submit the template if necessary
|
/**
|
||||||
if (nf.Common.isBlank(selectedTemplate)) {
|
* Show the modal.
|
||||||
$('#upload-template-status').text('No template selected. Please browse to select a template.');
|
*/
|
||||||
} else {
|
show: function () {
|
||||||
templateForm.submit();
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
// hide the dialog
|
/**
|
||||||
$('#upload-template-dialog').modal('hide');
|
* Hide the modal.
|
||||||
}
|
*/
|
||||||
}
|
hide: function () {
|
||||||
}
|
this.getElement().modal('hide');
|
||||||
}, {
|
}
|
||||||
buttonText: 'Cancel',
|
|
||||||
color: {
|
|
||||||
base: '#E3E8EB',
|
|
||||||
hover: '#C7D2D7',
|
|
||||||
text: '#004849'
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: function () {
|
|
||||||
// hide the dialog
|
|
||||||
$('#upload-template-dialog').modal('hide');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
handler: {
|
|
||||||
close: function () {
|
|
||||||
// set the filename
|
|
||||||
$('#selected-template-name').text('');
|
|
||||||
$('#upload-template-status').text('');
|
|
||||||
|
|
||||||
// reset the form to ensure that the change fire will fire
|
|
||||||
templateForm.resetForm();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// add a handler for the change file input chain event
|
|
||||||
$('#template-file-field').on('change', function (e) {
|
|
||||||
var filename = $(this).val();
|
|
||||||
if (!nf.Common.isBlank(filename)) {
|
|
||||||
filename = filename.replace(/^.*[\\\/]/, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the filename and clear any status
|
|
||||||
$('#selected-template-name').text(filename);
|
|
||||||
$('#upload-template-status').text('');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the modal config.
|
|
||||||
*
|
|
||||||
* @param {string} name The name of the property to update.
|
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
|
||||||
update: function (name, config) {
|
|
||||||
this.getElement().modal(name, config);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the modal.
|
|
||||||
*/
|
|
||||||
show: function () {
|
|
||||||
this.getElement().modal('show');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hide the modal.
|
|
||||||
*/
|
|
||||||
hide: function () {
|
|
||||||
this.getElement().modal('hide');
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The canvas operator's fillcolor component.
|
|
||||||
*/
|
|
||||||
this.fillcolor = {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The canvas operator's fillcolor component's modal.
|
* The canvas operator's create template component.
|
||||||
*/
|
*/
|
||||||
modal: {
|
this.templateUpload = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the modal element.
|
* The canvas operator's create template component's modal.
|
||||||
*
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
modal: {
|
||||||
return $('#fill-color-dialog');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* Gets the modal element.
|
||||||
*/
|
*
|
||||||
init: function () {
|
* @returns {*|jQuery|HTMLElement}
|
||||||
// configure the create fillcolor dialog
|
*/
|
||||||
this.getElement().modal({
|
getElement: function () {
|
||||||
scrollableContentStyle: 'scrollable',
|
return $('#upload-template-dialog');
|
||||||
headerText: 'Change Color',
|
},
|
||||||
buttons: [{
|
|
||||||
buttonText: 'Apply',
|
/**
|
||||||
color: {
|
* Initialize the modal.
|
||||||
base: '#728E9B',
|
*/
|
||||||
hover: '#004849',
|
init: function () {
|
||||||
text: '#ffffff'
|
// initialize the form
|
||||||
|
var templateForm = $('#template-upload-form').ajaxForm({
|
||||||
|
url: '../nifi-api/process-groups/',
|
||||||
|
dataType: 'xml',
|
||||||
|
beforeSubmit: function (formData, $form, options) {
|
||||||
|
// ensure uploading to the current process group
|
||||||
|
options.url += (encodeURIComponent(canvasUtils.getGroupId()) + '/templates/upload');
|
||||||
},
|
},
|
||||||
handler: {
|
success: function (response, statusText, xhr, form) {
|
||||||
click: function () {
|
// see if the import was successful and inform the user
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
if (response.documentElement.tagName === 'templateEntity') {
|
||||||
|
dialog.showOkDialog({
|
||||||
// color the selected components
|
headerText: 'Success',
|
||||||
selection.each(function (d) {
|
dialogContent: 'Template successfully imported.'
|
||||||
var selected = d3.select(this);
|
|
||||||
var selectedData = selected.datum();
|
|
||||||
|
|
||||||
// get the color and update the styles
|
|
||||||
var color = $('#fill-color').minicolors('value');
|
|
||||||
|
|
||||||
// ensure the color actually changed
|
|
||||||
if (color !== selectedData.component.style['background-color']) {
|
|
||||||
// build the request entity
|
|
||||||
var entity = {
|
|
||||||
'revision': nf.Client.getRevision(selectedData),
|
|
||||||
'component': {
|
|
||||||
'id': selectedData.id,
|
|
||||||
'style': {
|
|
||||||
'background-color': color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// update the style for the specified component
|
|
||||||
$.ajax({
|
|
||||||
type: 'PUT',
|
|
||||||
url: selectedData.uri,
|
|
||||||
data: JSON.stringify(entity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// update the component
|
|
||||||
nf[selectedData.type].set(response);
|
|
||||||
}).fail(function (xhr, status, error) {
|
|
||||||
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
|
||||||
nf.Dialog.showOkDialog({
|
|
||||||
headerText: 'Error',
|
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).always(function(){
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// import failed
|
||||||
|
var statusText = 'Unable to import template. Please check the log for errors.';
|
||||||
|
if (response.documentElement.tagName === 'errorResponse') {
|
||||||
|
// if a more specific error was given, use it
|
||||||
|
var errorMessage = response.documentElement.getAttribute('statusText');
|
||||||
|
if (!common.isBlank(errorMessage)) {
|
||||||
|
statusText = errorMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// close the dialog
|
// show reason
|
||||||
$('#fill-color-dialog').modal('hide');
|
dialog.showOkDialog({
|
||||||
|
headerText: 'Unable to Upload',
|
||||||
|
dialogContent: common.escapeHtml(statusText)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, statusText, error) {
|
||||||
|
// request failed
|
||||||
|
dialog.showOkDialog({
|
||||||
|
headerText: 'Unable to Upload',
|
||||||
|
dialogContent: common.escapeHtml(xhr.responseText)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
{
|
|
||||||
|
// configure the upload template dialog
|
||||||
|
this.getElement().modal({
|
||||||
|
headerText: 'Upload Template',
|
||||||
|
buttons: [{
|
||||||
|
buttonText: 'Upload',
|
||||||
|
color: {
|
||||||
|
base: '#728E9B',
|
||||||
|
hover: '#004849',
|
||||||
|
text: '#ffffff'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
var selectedTemplate = $('#selected-template-name').text();
|
||||||
|
|
||||||
|
// submit the template if necessary
|
||||||
|
if (common.isBlank(selectedTemplate)) {
|
||||||
|
$('#upload-template-status').text('No template selected. Please browse to select a template.');
|
||||||
|
} else {
|
||||||
|
templateForm.submit();
|
||||||
|
|
||||||
|
// hide the dialog
|
||||||
|
$('#upload-template-dialog').modal('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
buttonText: 'Cancel',
|
buttonText: 'Cancel',
|
||||||
color: {
|
color: {
|
||||||
base: '#E3E8EB',
|
base: '#E3E8EB',
|
||||||
|
@ -340,130 +224,283 @@ nf.ng.Canvas.OperateCtrl = function () {
|
||||||
},
|
},
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: function () {
|
||||||
// close the dialog
|
// hide the dialog
|
||||||
$('#fill-color-dialog').modal('hide');
|
$('#upload-template-dialog').modal('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
handler: {
|
handler: {
|
||||||
close: function () {
|
close: function () {
|
||||||
// clear the current color
|
// set the filename
|
||||||
$('#fill-color-value').val('');
|
$('#selected-template-name').text('');
|
||||||
$('#fill-color').minicolors('value', '');
|
$('#upload-template-status').text('');
|
||||||
|
|
||||||
|
// reset the form to ensure that the change fire will fire
|
||||||
|
templateForm.resetForm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// add a handler for the change file input chain event
|
||||||
* Updates the modal config.
|
$('#template-file-field').on('change', function (e) {
|
||||||
*
|
var filename = $(this).val();
|
||||||
* @param {string} name The name of the property to update.
|
if (!common.isBlank(filename)) {
|
||||||
* @param {object|array} config The config for the `name`.
|
filename = filename.replace(/^.*[\\\/]/, '');
|
||||||
*/
|
}
|
||||||
update: function (name, config) {
|
|
||||||
this.getElement().modal(name, config);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
// set the filename and clear any status
|
||||||
* Show the modal.
|
$('#selected-template-name').text(filename);
|
||||||
*/
|
$('#upload-template-status').text('');
|
||||||
show: function () {
|
});
|
||||||
this.getElement().modal('show');
|
},
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hide the modal.
|
|
||||||
*/
|
|
||||||
hide: function () {
|
|
||||||
this.getElement().modal('hide');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The canvas operator's fillcolor component modal's minicolors.
|
|
||||||
*/
|
|
||||||
minicolors: {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the minicolors element.
|
* Updates the modal config.
|
||||||
|
*
|
||||||
|
* @param {string} name The name of the property to update.
|
||||||
|
* @param {object|array} config The config for the `name`.
|
||||||
|
*/
|
||||||
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The canvas operator's fillcolor component.
|
||||||
|
*/
|
||||||
|
this.fillcolor = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The canvas operator's fillcolor component's modal.
|
||||||
|
*/
|
||||||
|
modal: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the modal element.
|
||||||
*
|
*
|
||||||
* @returns {*|jQuery|HTMLElement}
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
getElement: function () {
|
||||||
return $('#fill-color');
|
return $('#fill-color-dialog');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the minicolors.
|
* Initialize the modal.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function () {
|
||||||
// configure the minicolors
|
// configure the create fillcolor dialog
|
||||||
this.getElement().minicolors({
|
this.getElement().modal({
|
||||||
inline: true,
|
scrollableContentStyle: 'scrollable',
|
||||||
change: function (hex, opacity) {
|
headerText: 'Change Color',
|
||||||
// update the value
|
buttons: [{
|
||||||
$('#fill-color-value').val(hex);
|
buttonText: 'Apply',
|
||||||
|
color: {
|
||||||
|
base: '#728E9B',
|
||||||
|
hover: '#004849',
|
||||||
|
text: '#ffffff'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
// always update the preview
|
// color the selected components
|
||||||
if (hex.toLowerCase() === '#ffffff') {
|
selection.each(function (d) {
|
||||||
//special case #ffffff implies default fill
|
var selected = d3.select(this);
|
||||||
$('#fill-color-processor-preview-icon').css({
|
var selectedData = selected.datum();
|
||||||
'color': nf.Processor.defaultIconColor(),
|
|
||||||
'background-color': hex
|
// get the color and update the styles
|
||||||
});
|
var color = $('#fill-color').minicolors('value');
|
||||||
} else {
|
|
||||||
$('#fill-color-processor-preview-icon').css({
|
// ensure the color actually changed
|
||||||
'color': nf.Common.determineContrastColor(
|
if (color !== selectedData.component.style['background-color']) {
|
||||||
nf.Common.substringAfterLast(
|
// build the request entity
|
||||||
hex, '#')),
|
var entity = {
|
||||||
'background-color': hex
|
'revision': client.getRevision(selectedData),
|
||||||
});
|
'component': {
|
||||||
|
'id': selectedData.id,
|
||||||
|
'style': {
|
||||||
|
'background-color': color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// update the style for the specified component
|
||||||
|
$.ajax({
|
||||||
|
type: 'PUT',
|
||||||
|
url: selectedData.uri,
|
||||||
|
data: JSON.stringify(entity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// update the component
|
||||||
|
canvasUtils.getComponentByType(selectedData.type).set(response);
|
||||||
|
}).fail(function (xhr, status, error) {
|
||||||
|
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
||||||
|
dialog.showOkDialog({
|
||||||
|
headerText: 'Error',
|
||||||
|
dialogContent: common.escapeHtml(xhr.responseText)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).always(function () {
|
||||||
|
birdseye.refresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// close the dialog
|
||||||
|
$('#fill-color-dialog').modal('hide');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
var borderColor = hex;
|
{
|
||||||
if (borderColor.toLowerCase() === '#ffffff') {
|
buttonText: 'Cancel',
|
||||||
borderColor = 'rgba(0,0,0,0.25)';
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
// close the dialog
|
||||||
|
$('#fill-color-dialog').modal('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
handler: {
|
||||||
|
close: function () {
|
||||||
|
// clear the current color
|
||||||
|
$('#fill-color-value').val('');
|
||||||
|
$('#fill-color').minicolors('value', '');
|
||||||
}
|
}
|
||||||
$('#fill-color-processor-preview').css({
|
|
||||||
'border-color': borderColor
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#fill-color-label-preview').css({
|
|
||||||
'background': hex
|
|
||||||
});
|
|
||||||
$('#fill-color-label-preview-value').css('color',
|
|
||||||
nf.Common.determineContrastColor(nf.Common.substringAfterLast(hex, '#'))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// apply fill color from field on blur and enter press
|
/**
|
||||||
$('#fill-color-value').on('blur', updateColor).on('keyup', function (e) {
|
* Updates the modal config.
|
||||||
var code = e.keyCode ? e.keyCode : e.which;
|
*
|
||||||
if (code === $.ui.keyCode.ENTER) {
|
* @param {string} name The name of the property to update.
|
||||||
updateColor();
|
* @param {object|array} config The config for the `name`.
|
||||||
}
|
*/
|
||||||
});
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The canvas operator's fillcolor component modal's minicolors.
|
||||||
|
*/
|
||||||
|
minicolors: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the minicolors element.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#fill-color');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the minicolors.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
// configure the minicolors
|
||||||
|
this.getElement().minicolors({
|
||||||
|
inline: true,
|
||||||
|
change: function (hex, opacity) {
|
||||||
|
// update the value
|
||||||
|
$('#fill-color-value').val(hex);
|
||||||
|
|
||||||
|
// always update the preview
|
||||||
|
if (hex.toLowerCase() === '#ffffff') {
|
||||||
|
//special case #ffffff implies default fill
|
||||||
|
$('#fill-color-processor-preview-icon').css({
|
||||||
|
'color': processor.defaultIconColor(),
|
||||||
|
'background-color': hex
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('#fill-color-processor-preview-icon').css({
|
||||||
|
'color': common.determineContrastColor(
|
||||||
|
common.substringAfterLast(
|
||||||
|
hex, '#')),
|
||||||
|
'background-color': hex
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var borderColor = hex;
|
||||||
|
if (borderColor.toLowerCase() === '#ffffff') {
|
||||||
|
borderColor = 'rgba(0,0,0,0.25)';
|
||||||
|
}
|
||||||
|
$('#fill-color-processor-preview').css({
|
||||||
|
'border-color': borderColor
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#fill-color-label-preview').css({
|
||||||
|
'background': hex
|
||||||
|
});
|
||||||
|
$('#fill-color-label-preview-value').css('color',
|
||||||
|
common.determineContrastColor(common.substringAfterLast(hex, '#'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// apply fill color from field on blur and enter press
|
||||||
|
$('#fill-color-value').on('blur', updateColor).on('keyup', function (e) {
|
||||||
|
var code = e.keyCode ? e.keyCode : e.which;
|
||||||
|
if (code === $.ui.keyCode.ENTER) {
|
||||||
|
updateColor();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
OperateCtrl.prototype = {
|
|
||||||
constructor: OperateCtrl,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the canvas operate controller.
|
|
||||||
*/
|
|
||||||
init: function () {
|
|
||||||
this.template.modal.init();
|
|
||||||
this.templateUpload.modal.init();
|
|
||||||
this.fillcolor.modal.init();
|
|
||||||
this.fillcolor.modal.minicolors.init();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var operateCtrl = new OperateCtrl();
|
OperateCtrl.prototype = {
|
||||||
return operateCtrl;
|
constructor: OperateCtrl,
|
||||||
};
|
|
||||||
|
/**
|
||||||
|
* Initializes the canvas operate controller.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
this.template.modal.init();
|
||||||
|
this.templateUpload.modal.init();
|
||||||
|
this.fillcolor.modal.init();
|
||||||
|
this.fillcolor.modal.minicolors.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var operateCtrl = new OperateCtrl();
|
||||||
|
return operateCtrl;
|
||||||
|
};
|
||||||
|
}));
|
|
@ -15,134 +15,154 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.Canvas.ToolboxCtrl = function (processorComponent,
|
(function (root, factory) {
|
||||||
inputPortComponent,
|
if (typeof define === 'function' && define.amd) {
|
||||||
outputPortComponent,
|
define(['nf.CanvasUtils',
|
||||||
groupComponent,
|
'nf.ContextMenu'],
|
||||||
remoteGroupComponent,
|
function (canvasUtils, contextMenu) {
|
||||||
funnelComponent,
|
return (nf.ng.Canvas.ToolboxCtrl = factory(canvasUtils, contextMenu));
|
||||||
templateComponent,
|
});
|
||||||
labelComponent) {
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.Canvas.ToolboxCtrl =
|
||||||
|
factory(require('nf.CanvasUtils'),
|
||||||
|
require('nf.ContextMenu')));
|
||||||
|
} else {
|
||||||
|
nf.ng.Canvas.ToolboxCtrl = factory(root.nf.CanvasUtils,
|
||||||
|
root.nf.ContextMenu);
|
||||||
|
}
|
||||||
|
}(this, function (canvasUtils, contextMenu) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function ToolboxCtrl(processorComponent,
|
return function (processorComponent,
|
||||||
inputPortComponent,
|
inputPortComponent,
|
||||||
outputPortComponent,
|
outputPortComponent,
|
||||||
groupComponent,
|
groupComponent,
|
||||||
remoteGroupComponent,
|
remoteGroupComponent,
|
||||||
funnelComponent,
|
funnelComponent,
|
||||||
templateComponent,
|
templateComponent,
|
||||||
labelComponent) {
|
labelComponent) {
|
||||||
this.processorComponent = processorComponent;
|
'use strict';
|
||||||
this.inputPortComponent = inputPortComponent;
|
|
||||||
this.outputPortComponent = outputPortComponent;
|
|
||||||
this.groupComponent = groupComponent;
|
|
||||||
this.remoteGroupComponent = remoteGroupComponent;
|
|
||||||
this.funnelComponent = funnelComponent;
|
|
||||||
this.templateComponent = templateComponent;
|
|
||||||
this.labelComponent = labelComponent;
|
|
||||||
|
|
||||||
/**
|
function ToolboxCtrl(processorComponent,
|
||||||
* Config for the toolbox
|
inputPortComponent,
|
||||||
*/
|
outputPortComponent,
|
||||||
this.config = {
|
groupComponent,
|
||||||
type: {
|
remoteGroupComponent,
|
||||||
processor: 'Processor',
|
funnelComponent,
|
||||||
inputPort: 'Input Port',
|
templateComponent,
|
||||||
outputPort: 'Output Port',
|
labelComponent) {
|
||||||
processGroup: 'Process Group',
|
this.processorComponent = processorComponent;
|
||||||
remoteProcessGroup: 'Remote Process Group',
|
this.inputPortComponent = inputPortComponent;
|
||||||
connection: 'Connection',
|
this.outputPortComponent = outputPortComponent;
|
||||||
funnel: 'Funnel',
|
this.groupComponent = groupComponent;
|
||||||
template: 'Template',
|
this.remoteGroupComponent = remoteGroupComponent;
|
||||||
label: 'Label'
|
this.funnelComponent = funnelComponent;
|
||||||
|
this.templateComponent = templateComponent;
|
||||||
|
this.labelComponent = labelComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config for the toolbox
|
||||||
|
*/
|
||||||
|
this.config = {
|
||||||
|
type: {
|
||||||
|
processor: 'Processor',
|
||||||
|
inputPort: 'Input Port',
|
||||||
|
outputPort: 'Output Port',
|
||||||
|
processGroup: 'Process Group',
|
||||||
|
remoteProcessGroup: 'Remote Process Group',
|
||||||
|
connection: 'Connection',
|
||||||
|
funnel: 'Funnel',
|
||||||
|
template: 'Template',
|
||||||
|
label: 'Label'
|
||||||
|
},
|
||||||
|
urls: {
|
||||||
|
api: '../nifi-api',
|
||||||
|
controller: '../nifi-api/controller',
|
||||||
|
processorTypes: '../nifi-api/flow/processor-types'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolboxCtrl.prototype = {
|
||||||
|
constructor: ToolboxCtrl,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the toolbox controller.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
// initialize modal dialogs
|
||||||
|
processorComponent.modal.init();
|
||||||
|
inputPortComponent.modal.init();
|
||||||
|
outputPortComponent.modal.init();
|
||||||
|
groupComponent.modal.init();
|
||||||
|
remoteGroupComponent.modal.init();
|
||||||
|
templateComponent.modal.init();
|
||||||
},
|
},
|
||||||
urls: {
|
|
||||||
api: '../nifi-api',
|
|
||||||
controller: '../nifi-api/controller',
|
|
||||||
processorTypes: '../nifi-api/flow/processor-types'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
ToolboxCtrl.prototype = {
|
|
||||||
constructor: ToolboxCtrl,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the toolbox controller.
|
* Gets the draggable configuration for a toolbox component.
|
||||||
*/
|
*
|
||||||
init: function() {
|
* @param {object} component The component responsible for handling the stop event.
|
||||||
// initialize modal dialogs
|
* @returns {object} The draggable configuration.
|
||||||
processorComponent.modal.init();
|
*
|
||||||
inputPortComponent.modal.init();
|
* NOTE: The `component` must implement a dropHandler.
|
||||||
outputPortComponent.modal.init();
|
*/
|
||||||
groupComponent.modal.init();
|
draggableComponentConfig: function (component) {
|
||||||
remoteGroupComponent.modal.init();
|
|
||||||
templateComponent.modal.init();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
//add hover effect
|
||||||
* Gets the draggable configuration for a toolbox component.
|
component.getElement().hover(function () {
|
||||||
*
|
component.getElement().removeClass(component.icon).addClass(component.hoverIcon);
|
||||||
* @param {object} component The component responsible for handling the stop event.
|
}, function () {
|
||||||
* @returns {object} The draggable configuration.
|
component.getElement().removeClass(component.hoverIcon).addClass(component.icon);
|
||||||
*
|
})
|
||||||
* NOTE: The `component` must implement a dropHandler.
|
|
||||||
*/
|
|
||||||
draggableComponentConfig: function(component) {
|
|
||||||
|
|
||||||
//add hover effect
|
return {
|
||||||
component.getElement().hover(function () {
|
zIndex: 1011,
|
||||||
component.getElement().removeClass(component.icon).addClass(component.hoverIcon);
|
revert: true,
|
||||||
}, function () {
|
revertDuration: 0,
|
||||||
component.getElement().removeClass(component.hoverIcon).addClass(component.icon);
|
cancel: false,
|
||||||
})
|
containment: 'body',
|
||||||
|
cursor: '-webkit-grabbing',
|
||||||
|
start: function (e, ui) {
|
||||||
|
// hide the context menu if necessary
|
||||||
|
contextMenu.hide();
|
||||||
|
},
|
||||||
|
stop: function (e, ui) {
|
||||||
|
var translate = canvasUtils.translateCanvasView();
|
||||||
|
var scale = canvasUtils.scaleCanvasView();
|
||||||
|
|
||||||
return {
|
var mouseX = e.originalEvent.pageX;
|
||||||
zIndex: 1011,
|
var mouseY = e.originalEvent.pageY - canvasUtils.getCanvasOffset();
|
||||||
revert: true,
|
|
||||||
revertDuration: 0,
|
|
||||||
cancel: false,
|
|
||||||
containment: 'body',
|
|
||||||
cursor: '-webkit-grabbing',
|
|
||||||
start: function (e, ui) {
|
|
||||||
// hide the context menu if necessary
|
|
||||||
nf.ContextMenu.hide();
|
|
||||||
},
|
|
||||||
stop: function (e, ui) {
|
|
||||||
var translate = nf.Canvas.View.translate();
|
|
||||||
var scale = nf.Canvas.View.scale();
|
|
||||||
|
|
||||||
var mouseX = e.originalEvent.pageX;
|
// invoke the drop handler if we're over the canvas
|
||||||
var mouseY = e.originalEvent.pageY - nf.Canvas.CANVAS_OFFSET;
|
if (mouseX >= 0 && mouseY >= 0) {
|
||||||
|
// adjust the x and y coordinates accordingly
|
||||||
|
var x = (mouseX / scale) - (translate[0] / scale);
|
||||||
|
var y = (mouseY / scale) - (translate[1] / scale);
|
||||||
|
|
||||||
// invoke the drop handler if we're over the canvas
|
//each component must implement a dropHandler function
|
||||||
if (mouseX >= 0 && mouseY >= 0) {
|
component.dropHandler.apply(component, [{
|
||||||
// adjust the x and y coordinates accordingly
|
x: x,
|
||||||
var x = (mouseX / scale) - (translate[0] / scale);
|
y: y
|
||||||
var y = (mouseY / scale) - (translate[1] / scale);
|
}]);
|
||||||
|
}
|
||||||
//each component must implement a dropHandler function
|
},
|
||||||
component.dropHandler.apply(component, [{
|
helper: component.dragIcon
|
||||||
x: x,
|
}
|
||||||
y: y
|
|
||||||
}]);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
helper: component.dragIcon
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var toolboxCtrl =
|
var toolboxCtrl =
|
||||||
new ToolboxCtrl(processorComponent,
|
new ToolboxCtrl(processorComponent,
|
||||||
inputPortComponent,
|
inputPortComponent,
|
||||||
outputPortComponent,
|
outputPortComponent,
|
||||||
groupComponent,
|
groupComponent,
|
||||||
remoteGroupComponent,
|
remoteGroupComponent,
|
||||||
funnelComponent,
|
funnelComponent,
|
||||||
templateComponent,
|
templateComponent,
|
||||||
labelComponent);
|
labelComponent);
|
||||||
return toolboxCtrl;
|
return toolboxCtrl;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,20 +15,36 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.BreadcrumbsDirective = function (breadcrumbsCtrl) {
|
(function (root, factory) {
|
||||||
return {
|
if (typeof define === 'function' && define.amd) {
|
||||||
restrict: 'E',
|
define([],
|
||||||
templateUrl: 'views/nf-ng-breadcrumbs-directive-view.html',
|
function () {
|
||||||
scope: {
|
return (nf.ng.BreadcrumbsDirective = factory());
|
||||||
'breadcrumbs': '=',
|
});
|
||||||
'clickFunc': '=',
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
'highlightCrumbId': '=',
|
module.exports = (nf.ng.BreadcrumbsDirective =
|
||||||
'separatorFunc': '='
|
factory());
|
||||||
},
|
} else {
|
||||||
link: function (scope, element, attrs) {
|
nf.ng.BreadcrumbsDirective = factory();
|
||||||
breadcrumbsCtrl.registerMouseWheelEvent(element);
|
}
|
||||||
}
|
}(this, function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
return function (breadcrumbsCtrl) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'views/nf-ng-breadcrumbs-directive-view.html',
|
||||||
|
scope: {
|
||||||
|
'breadcrumbs': '=',
|
||||||
|
'clickFunc': '=',
|
||||||
|
'highlightCrumbId': '=',
|
||||||
|
'separatorFunc': '='
|
||||||
|
},
|
||||||
|
link: function (scope, element, attrs) {
|
||||||
|
breadcrumbsCtrl.registerMouseWheelEvent(element);
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}));
|
|
@ -15,13 +15,29 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.DraggableDirective = function () {
|
(function (root, factory) {
|
||||||
return {
|
if (typeof define === 'function' && define.amd) {
|
||||||
restrict: 'AE',
|
define([],
|
||||||
link: function (scope, element, attrs) {
|
function () {
|
||||||
element.draggable(scope.$eval(attrs.nfDraggable));
|
return (nf.ng.DraggableDirective = factory());
|
||||||
}
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.DraggableDirective =
|
||||||
|
factory());
|
||||||
|
} else {
|
||||||
|
nf.ng.DraggableDirective = factory();
|
||||||
|
}
|
||||||
|
}(this, function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
return function () {
|
||||||
|
return {
|
||||||
|
restrict: 'AE',
|
||||||
|
link: function (scope, element, attrs) {
|
||||||
|
element.draggable(scope.$eval(attrs.nfDraggable));
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}));
|
|
@ -15,102 +15,134 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.FunnelComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
|
return (nf.ng.FunnelComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.FunnelComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler')));
|
||||||
|
} else {
|
||||||
|
nf.ng.FunnelComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function FunnelComponent() {
|
return function (serviceProvider) {
|
||||||
this.icon = 'icon icon-funnel';
|
'use strict';
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-funnel-add';
|
function FunnelComponent() {
|
||||||
}
|
this.icon = 'icon icon-funnel';
|
||||||
FunnelComponent.prototype = {
|
|
||||||
constructor: FunnelComponent,
|
|
||||||
|
|
||||||
/**
|
this.hoverIcon = 'icon icon-funnel-add';
|
||||||
* Gets the component.
|
|
||||||
*
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
getElement: function() {
|
|
||||||
return $('#funnel-component');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the component.
|
|
||||||
*/
|
|
||||||
enabled: function() {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function() {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function(pt) {
|
|
||||||
this.createFunnel(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-funnel-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new funnel at the specified point.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the funnel was dropped.
|
|
||||||
*/
|
|
||||||
createFunnel: function(pt) {
|
|
||||||
var outputPortEntity = {
|
|
||||||
'revision': nf.Client.getRevision({
|
|
||||||
'revision': {
|
|
||||||
'version': 0
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
'component': {
|
|
||||||
'position': {
|
|
||||||
'x': pt.x,
|
|
||||||
'y': pt.y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new funnel
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/funnels',
|
|
||||||
data: JSON.stringify(outputPortEntity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// add the funnel to the graph
|
|
||||||
nf.Graph.add({
|
|
||||||
'funnels': [response]
|
|
||||||
}, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var funnelComponent = new FunnelComponent();
|
FunnelComponent.prototype = {
|
||||||
return funnelComponent;
|
constructor: FunnelComponent,
|
||||||
};
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#funnel-component');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the component.
|
||||||
|
*/
|
||||||
|
enabled: function () {
|
||||||
|
this.getElement().attr('disabled', false);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the component was dropped.
|
||||||
|
*/
|
||||||
|
dropHandler: function (pt) {
|
||||||
|
this.createFunnel(pt);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
dragIcon: function (event) {
|
||||||
|
return $('<div class="icon icon-funnel-add"></div>');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new funnel at the specified point.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the funnel was dropped.
|
||||||
|
*/
|
||||||
|
createFunnel: function (pt) {
|
||||||
|
var outputPortEntity = {
|
||||||
|
'revision': client.getRevision({
|
||||||
|
'revision': {
|
||||||
|
'version': 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'component': {
|
||||||
|
'position': {
|
||||||
|
'x': pt.x,
|
||||||
|
'y': pt.y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new funnel
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/funnels',
|
||||||
|
data: JSON.stringify(outputPortEntity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// add the funnel to the graph
|
||||||
|
graph.add({
|
||||||
|
'funnels': [response]
|
||||||
|
}, {
|
||||||
|
'selectAll': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var funnelComponent = new FunnelComponent();
|
||||||
|
return funnelComponent;
|
||||||
|
};
|
||||||
|
}));
|
|
@ -15,229 +15,260 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.GroupComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
|
return (nf.ng.GroupComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.GroupComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler')));
|
||||||
|
} else {
|
||||||
|
nf.ng.GroupComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
return function (serviceProvider) {
|
||||||
* Create the group and add to the graph.
|
'use strict';
|
||||||
*
|
|
||||||
* @argument {string} groupName The name of the group.
|
|
||||||
* @argument {object} pt The point that the group was dropped.
|
|
||||||
*/
|
|
||||||
var createGroup = function (groupName, pt) {
|
|
||||||
var processGroupEntity = {
|
|
||||||
'revision': nf.Client.getRevision({
|
|
||||||
'revision': {
|
|
||||||
'version': 0
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
'component': {
|
|
||||||
'name': groupName,
|
|
||||||
'position': {
|
|
||||||
'x': pt.x,
|
|
||||||
'y': pt.y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new processor of the defined type
|
|
||||||
return $.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/process-groups',
|
|
||||||
data: JSON.stringify(processGroupEntity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// add the process group to the graph
|
|
||||||
nf.Graph.add({
|
|
||||||
'processGroups': [response]
|
|
||||||
}, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// update component visibility
|
|
||||||
nf.Canvas.View.updateVisibility();
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
};
|
|
||||||
|
|
||||||
function GroupComponent() {
|
|
||||||
|
|
||||||
this.icon = 'icon icon-group';
|
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-group-add';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The group component's modal.
|
* Create the group and add to the graph.
|
||||||
|
*
|
||||||
|
* @argument {string} groupName The name of the group.
|
||||||
|
* @argument {object} pt The point that the group was dropped.
|
||||||
*/
|
*/
|
||||||
this.modal = {
|
var createGroup = function (groupName, pt) {
|
||||||
|
var processGroupEntity = {
|
||||||
|
'revision': client.getRevision({
|
||||||
|
'revision': {
|
||||||
|
'version': 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'component': {
|
||||||
|
'name': groupName,
|
||||||
|
'position': {
|
||||||
|
'x': pt.x,
|
||||||
|
'y': pt.y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new processor of the defined type
|
||||||
|
return $.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/process-groups',
|
||||||
|
data: JSON.stringify(processGroupEntity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// add the process group to the graph
|
||||||
|
graph.add({
|
||||||
|
'processGroups': [response]
|
||||||
|
}, {
|
||||||
|
'selectAll': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// update component visibility
|
||||||
|
graph.updateVisibility();
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
};
|
||||||
|
|
||||||
|
function GroupComponent() {
|
||||||
|
|
||||||
|
this.icon = 'icon icon-group';
|
||||||
|
|
||||||
|
this.hoverIcon = 'icon icon-group-add';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the modal element.
|
* The group component's modal.
|
||||||
|
*/
|
||||||
|
this.modal = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the modal element.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#new-process-group-dialog');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the modal.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
// configure the new process group dialog
|
||||||
|
this.getElement().modal({
|
||||||
|
scrollableContentStyle: 'scrollable',
|
||||||
|
headerText: 'Add Process Group',
|
||||||
|
handler: {
|
||||||
|
close: function () {
|
||||||
|
$('#new-process-group-name').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the modal config.
|
||||||
|
*
|
||||||
|
* @param {string} name The name of the property to update.
|
||||||
|
* @param {object|array} config The config for the `name`.
|
||||||
|
*/
|
||||||
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupComponent.prototype = {
|
||||||
|
constructor: GroupComponent,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
*
|
*
|
||||||
* @returns {*|jQuery|HTMLElement}
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
getElement: function () {
|
||||||
return $('#new-process-group-dialog');
|
return $('#group-component');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* Enable the component.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
enabled: function () {
|
||||||
// configure the new process group dialog
|
this.getElement().attr('disabled', false);
|
||||||
this.getElement().modal({
|
|
||||||
scrollableContentStyle: 'scrollable',
|
|
||||||
headerText: 'Add Process Group',
|
|
||||||
handler: {
|
|
||||||
close: function () {
|
|
||||||
$('#new-process-group-name').val('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the modal config.
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
*
|
*
|
||||||
* @param {string} name The name of the property to update.
|
* @argument {object} pt The point that the component was dropped.
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
*/
|
||||||
update: function (name, config) {
|
dropHandler: function (pt) {
|
||||||
this.getElement().modal(name, config);
|
this.promptForGroupName(pt);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the modal.
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
show: function () {
|
dragIcon: function (event) {
|
||||||
this.getElement().modal('show');
|
return $('<div class="icon icon-group-add"></div>');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the modal.
|
* Prompts the user to enter the name for the group.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the group was dropped.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
promptForGroupName: function (pt) {
|
||||||
this.getElement().modal('hide');
|
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();
|
||||||
|
|
||||||
GroupComponent.prototype = {
|
// hide the dialog
|
||||||
constructor: GroupComponent,
|
groupComponent.modal.hide();
|
||||||
|
|
||||||
/**
|
// create the group and resolve the deferred accordingly
|
||||||
* Gets the component.
|
createGroup(groupName, pt).done(function (response) {
|
||||||
*
|
deferred.resolve(response.component);
|
||||||
* @returns {*|jQuery|HTMLElement}
|
}).fail(function () {
|
||||||
*/
|
deferred.reject();
|
||||||
getElement: function () {
|
});
|
||||||
return $('#group-component');
|
};
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
groupComponent.modal.update('setButtonModel', [{
|
||||||
* Enable the component.
|
buttonText: 'Add',
|
||||||
*/
|
|
||||||
enabled: function () {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function () {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function (pt) {
|
|
||||||
this.promptForGroupName(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-group-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prompts the user to enter the name for the group.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the group was dropped.
|
|
||||||
*/
|
|
||||||
promptForGroupName: function (pt) {
|
|
||||||
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
|
|
||||||
groupComponent.modal.hide();
|
|
||||||
|
|
||||||
// create the group and resolve the deferred accordingly
|
|
||||||
createGroup(groupName, pt).done(function (response) {
|
|
||||||
deferred.resolve(response.component);
|
|
||||||
}).fail(function () {
|
|
||||||
deferred.reject();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
groupComponent.modal.update('setButtonModel', [{
|
|
||||||
buttonText: 'Add',
|
|
||||||
color: {
|
|
||||||
base: '#728E9B',
|
|
||||||
hover: '#004849',
|
|
||||||
text: '#ffffff'
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: addGroup
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
buttonText: 'Cancel',
|
|
||||||
color: {
|
color: {
|
||||||
base: '#E3E8EB',
|
base: '#728E9B',
|
||||||
hover: '#C7D2D7',
|
hover: '#004849',
|
||||||
text: '#004849'
|
text: '#ffffff'
|
||||||
},
|
},
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: addGroup
|
||||||
// reject the deferred
|
|
||||||
deferred.reject();
|
|
||||||
|
|
||||||
// close the dialog
|
|
||||||
groupComponent.modal.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}]);
|
},
|
||||||
|
{
|
||||||
|
buttonText: 'Cancel',
|
||||||
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
// reject the deferred
|
||||||
|
deferred.reject();
|
||||||
|
|
||||||
// show the dialog
|
// close the dialog
|
||||||
groupComponent.modal.show();
|
groupComponent.modal.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
// set up the focus and key handlers
|
// show the dialog
|
||||||
$('#new-process-group-name').focus().off('keyup').on('keyup', function (e) {
|
groupComponent.modal.show();
|
||||||
var code = e.keyCode ? e.keyCode : e.which;
|
|
||||||
if (code === $.ui.keyCode.ENTER) {
|
// set up the focus and key handlers
|
||||||
addGroup();
|
$('#new-process-group-name').focus().off('keyup').on('keyup', function (e) {
|
||||||
}
|
var code = e.keyCode ? e.keyCode : e.which;
|
||||||
});
|
if (code === $.ui.keyCode.ENTER) {
|
||||||
}).promise();
|
addGroup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).promise();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var groupComponent = new GroupComponent();
|
var groupComponent = new GroupComponent();
|
||||||
return groupComponent;
|
return groupComponent;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,222 +15,253 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.InputPortComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
|
return (nf.ng.InputPortComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.InputPortComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler')));
|
||||||
|
} else {
|
||||||
|
nf.ng.InputPortComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
return function (serviceProvider) {
|
||||||
* Create the input port and add to the graph.
|
'use strict';
|
||||||
*
|
|
||||||
* @argument {string} portName The input port name.
|
|
||||||
* @argument {object} pt The point that the input port was dropped.
|
|
||||||
*/
|
|
||||||
var createInputPort = function (portName, pt) {
|
|
||||||
var inputPortEntity = {
|
|
||||||
'revision': nf.Client.getRevision({
|
|
||||||
'revision': {
|
|
||||||
'version': 0
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
'component': {
|
|
||||||
'name': portName,
|
|
||||||
'position': {
|
|
||||||
'x': pt.x,
|
|
||||||
'y': pt.y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new processor of the defined type
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/input-ports',
|
|
||||||
data: JSON.stringify(inputPortEntity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// add the port to the graph
|
|
||||||
nf.Graph.add({
|
|
||||||
'inputPorts': [response]
|
|
||||||
}, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// update component visibility
|
|
||||||
nf.Canvas.View.updateVisibility();
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
};
|
|
||||||
|
|
||||||
function InputPortComponent() {
|
|
||||||
|
|
||||||
this.icon = 'icon icon-port-in';
|
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-port-in-add';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input port component's modal.
|
* Create the input port and add to the graph.
|
||||||
|
*
|
||||||
|
* @argument {string} portName The input port name.
|
||||||
|
* @argument {object} pt The point that the input port was dropped.
|
||||||
*/
|
*/
|
||||||
this.modal = {
|
var createInputPort = function (portName, pt) {
|
||||||
|
var inputPortEntity = {
|
||||||
|
'revision': client.getRevision({
|
||||||
|
'revision': {
|
||||||
|
'version': 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'component': {
|
||||||
|
'name': portName,
|
||||||
|
'position': {
|
||||||
|
'x': pt.x,
|
||||||
|
'y': pt.y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new processor of the defined type
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/input-ports',
|
||||||
|
data: JSON.stringify(inputPortEntity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// add the port to the graph
|
||||||
|
graph.add({
|
||||||
|
'inputPorts': [response]
|
||||||
|
}, {
|
||||||
|
'selectAll': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// update component visibility
|
||||||
|
graph.updateVisibility();
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
};
|
||||||
|
|
||||||
|
function InputPortComponent() {
|
||||||
|
|
||||||
|
this.icon = 'icon icon-port-in';
|
||||||
|
|
||||||
|
this.hoverIcon = 'icon icon-port-in-add';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the modal element.
|
* The input port component's modal.
|
||||||
|
*/
|
||||||
|
this.modal = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the modal element.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#new-port-dialog');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the modal.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
// configure the new port dialog
|
||||||
|
this.getElement().modal({
|
||||||
|
scrollableContentStyle: 'scrollable',
|
||||||
|
headerText: 'Add Port',
|
||||||
|
handler: {
|
||||||
|
close: function () {
|
||||||
|
$('#new-port-name').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the modal config.
|
||||||
|
*
|
||||||
|
* @param {string} name The name of the property to update.
|
||||||
|
* @param {object|array} config The config for the `name`.
|
||||||
|
*/
|
||||||
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
InputPortComponent.prototype = {
|
||||||
|
constructor: InputPortComponent,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
*
|
*
|
||||||
* @returns {*|jQuery|HTMLElement}
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
getElement: function () {
|
||||||
return $('#new-port-dialog');
|
return $('#port-in-component');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* Enable the component.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
enabled: function () {
|
||||||
// configure the new port dialog
|
this.getElement().attr('disabled', false);
|
||||||
this.getElement().modal({
|
|
||||||
scrollableContentStyle: 'scrollable',
|
|
||||||
headerText: 'Add Port',
|
|
||||||
handler: {
|
|
||||||
close: function () {
|
|
||||||
$('#new-port-name').val('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the modal config.
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
*
|
*
|
||||||
* @param {string} name The name of the property to update.
|
* @argument {object} pt The point that the component was dropped.
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
*/
|
||||||
update: function (name, config) {
|
dropHandler: function (pt) {
|
||||||
this.getElement().modal(name, config);
|
this.promptForInputPortName(pt);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the modal.
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
show: function () {
|
dragIcon: function (event) {
|
||||||
this.getElement().modal('show');
|
return $('<div class="icon icon-port-in-add"></div>');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the modal.
|
* Prompts the user to enter the name for the input port.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the input port was dropped.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
promptForInputPortName: function (pt) {
|
||||||
this.getElement().modal('hide');
|
var inputPortComponent = this;
|
||||||
}
|
var addInputPort = function () {
|
||||||
};
|
// get the name of the input port and clear the textfield
|
||||||
}
|
var portName = $('#new-port-name').val();
|
||||||
|
|
||||||
InputPortComponent.prototype = {
|
// hide the dialog
|
||||||
constructor: InputPortComponent,
|
inputPortComponent.modal.hide();
|
||||||
|
|
||||||
/**
|
// create the input port
|
||||||
* Gets the component.
|
createInputPort(portName, pt);
|
||||||
*
|
};
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
getElement: function () {
|
|
||||||
return $('#port-in-component');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
this.modal.update('setButtonModel', [{
|
||||||
* Enable the component.
|
buttonText: 'Add',
|
||||||
*/
|
|
||||||
enabled: function () {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function () {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function (pt) {
|
|
||||||
this.promptForInputPortName(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-port-in-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prompts the user to enter the name for the input port.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the input port was dropped.
|
|
||||||
*/
|
|
||||||
promptForInputPortName: function (pt) {
|
|
||||||
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
|
|
||||||
inputPortComponent.modal.hide();
|
|
||||||
|
|
||||||
// create the input port
|
|
||||||
createInputPort(portName, pt);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.modal.update('setButtonModel', [{
|
|
||||||
buttonText: 'Add',
|
|
||||||
color: {
|
|
||||||
base: '#728E9B',
|
|
||||||
hover: '#004849',
|
|
||||||
text: '#ffffff'
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: addInputPort
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
buttonText: 'Cancel',
|
|
||||||
color: {
|
color: {
|
||||||
base: '#E3E8EB',
|
base: '#728E9B',
|
||||||
hover: '#C7D2D7',
|
hover: '#004849',
|
||||||
text: '#004849'
|
text: '#ffffff'
|
||||||
},
|
},
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: addInputPort
|
||||||
inputPortComponent.modal.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}]);
|
},
|
||||||
|
{
|
||||||
|
buttonText: 'Cancel',
|
||||||
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
inputPortComponent.modal.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
// update the port type
|
// update the port type
|
||||||
$('#new-port-type').text('Input');
|
$('#new-port-type').text('Input');
|
||||||
|
|
||||||
// show the dialog
|
// show the dialog
|
||||||
this.modal.show();
|
this.modal.show();
|
||||||
|
|
||||||
// set up the focus and key handlers
|
// set up the focus and key handlers
|
||||||
$('#new-port-name').focus().off('keyup').on('keyup', function (e) {
|
$('#new-port-name').focus().off('keyup').on('keyup', function (e) {
|
||||||
var code = e.keyCode ? e.keyCode : e.which;
|
var code = e.keyCode ? e.keyCode : e.which;
|
||||||
if (code === $.ui.keyCode.ENTER) {
|
if (code === $.ui.keyCode.ENTER) {
|
||||||
addInputPort();
|
addInputPort();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var inputPortComponent = new InputPortComponent();
|
var inputPortComponent = new InputPortComponent();
|
||||||
return inputPortComponent;
|
return inputPortComponent;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,104 +15,139 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.LabelComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Label'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler, label) {
|
||||||
|
return (nf.ng.LabelComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler, label));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.LabelComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Label')));
|
||||||
|
} else {
|
||||||
|
nf.ng.LabelComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Label);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler, label) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function LabelComponent() {
|
return function (serviceProvider) {
|
||||||
this.icon = 'icon icon-label';
|
'use strict';
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-label-add';
|
function LabelComponent() {
|
||||||
}
|
this.icon = 'icon icon-label';
|
||||||
LabelComponent.prototype = {
|
|
||||||
constructor: LabelComponent,
|
|
||||||
|
|
||||||
/**
|
this.hoverIcon = 'icon icon-label-add';
|
||||||
* Gets the component.
|
|
||||||
*
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
getElement: function() {
|
|
||||||
return $('#label-component');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the component.
|
|
||||||
*/
|
|
||||||
enabled: function() {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function() {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function(pt) {
|
|
||||||
this.createLabel(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-label-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the label and add to the graph.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the label was dropped.
|
|
||||||
*/
|
|
||||||
createLabel: function(pt) {
|
|
||||||
var labelEntity = {
|
|
||||||
'revision': nf.Client.getRevision({
|
|
||||||
'revision': {
|
|
||||||
'version': 0
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
'component': {
|
|
||||||
'width': nf.Label.config.width,
|
|
||||||
'height': nf.Label.config.height,
|
|
||||||
'position': {
|
|
||||||
'x': pt.x,
|
|
||||||
'y': pt.y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new label
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/labels',
|
|
||||||
data: JSON.stringify(labelEntity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// add the label to the graph
|
|
||||||
nf.Graph.add({
|
|
||||||
'labels': [response]
|
|
||||||
}, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var labelComponent = new LabelComponent();
|
LabelComponent.prototype = {
|
||||||
return labelComponent;
|
constructor: LabelComponent,
|
||||||
};
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#label-component');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the component.
|
||||||
|
*/
|
||||||
|
enabled: function () {
|
||||||
|
this.getElement().attr('disabled', false);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the component was dropped.
|
||||||
|
*/
|
||||||
|
dropHandler: function (pt) {
|
||||||
|
this.createLabel(pt);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
dragIcon: function (event) {
|
||||||
|
return $('<div class="icon icon-label-add"></div>');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the label and add to the graph.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the label was dropped.
|
||||||
|
*/
|
||||||
|
createLabel: function (pt) {
|
||||||
|
var labelEntity = {
|
||||||
|
'revision': client.getRevision({
|
||||||
|
'revision': {
|
||||||
|
'version': 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'component': {
|
||||||
|
'width': label.config.width,
|
||||||
|
'height': label.config.height,
|
||||||
|
'position': {
|
||||||
|
'x': pt.x,
|
||||||
|
'y': pt.y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new label
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/labels',
|
||||||
|
data: JSON.stringify(labelEntity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// add the label to the graph
|
||||||
|
graph.add({
|
||||||
|
'labels': [response]
|
||||||
|
}, {
|
||||||
|
'selectAll': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var labelComponent = new LabelComponent();
|
||||||
|
return labelComponent;
|
||||||
|
};
|
||||||
|
}));
|
|
@ -15,213 +15,244 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.OutputPortComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
|
return (nf.ng.OutputPortComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.OutputPortComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler')));
|
||||||
|
} else {
|
||||||
|
nf.ng.OutputPortComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
return function (serviceProvider) {
|
||||||
* Create the input port and add to the graph.
|
'use strict';
|
||||||
*
|
|
||||||
* @argument {string} portName The output port name.
|
|
||||||
* @argument {object} pt The point that the output port was dropped.
|
|
||||||
*/
|
|
||||||
var createOutputPort = function (portName, pt) {
|
|
||||||
var outputPortEntity = {
|
|
||||||
'revision': nf.Client.getRevision({
|
|
||||||
'revision': {
|
|
||||||
'version': 0
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
'component': {
|
|
||||||
'name': portName,
|
|
||||||
'position': {
|
|
||||||
'x': pt.x,
|
|
||||||
'y': pt.y
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new processor of the defined type
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/output-ports',
|
|
||||||
data: JSON.stringify(outputPortEntity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// add the port to the graph
|
|
||||||
nf.Graph.add({
|
|
||||||
'outputPorts': [response]
|
|
||||||
}, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// update component visibility
|
|
||||||
nf.Canvas.View.updateVisibility();
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
};
|
|
||||||
|
|
||||||
function OutputPortComponent() {
|
|
||||||
|
|
||||||
this.icon = 'icon icon-port-out';
|
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-port-out-add';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The output port component's modal.
|
* Create the input port and add to the graph.
|
||||||
|
*
|
||||||
|
* @argument {string} portName The output port name.
|
||||||
|
* @argument {object} pt The point that the output port was dropped.
|
||||||
*/
|
*/
|
||||||
this.modal = {
|
var createOutputPort = function (portName, pt) {
|
||||||
|
var outputPortEntity = {
|
||||||
|
'revision': client.getRevision({
|
||||||
|
'revision': {
|
||||||
|
'version': 0
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
'component': {
|
||||||
|
'name': portName,
|
||||||
|
'position': {
|
||||||
|
'x': pt.x,
|
||||||
|
'y': pt.y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new processor of the defined type
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/output-ports',
|
||||||
|
data: JSON.stringify(outputPortEntity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// add the port to the graph
|
||||||
|
graph.add({
|
||||||
|
'outputPorts': [response]
|
||||||
|
}, {
|
||||||
|
'selectAll': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// update component visibility
|
||||||
|
graph.updateVisibility();
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
};
|
||||||
|
|
||||||
|
function OutputPortComponent() {
|
||||||
|
|
||||||
|
this.icon = 'icon icon-port-out';
|
||||||
|
|
||||||
|
this.hoverIcon = 'icon icon-port-out-add';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the modal element.
|
* The output port component's modal.
|
||||||
|
*/
|
||||||
|
this.modal = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the modal element.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#new-port-dialog'); //Reuse the input port dialog....
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the modal.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
//Reuse the input port dialog....
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the modal config.
|
||||||
|
*
|
||||||
|
* @param {string} name The name of the property to update.
|
||||||
|
* @param {object|array} config The config for the `name`.
|
||||||
|
*/
|
||||||
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputPortComponent.prototype = {
|
||||||
|
constructor: OutputPortComponent,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
*
|
*
|
||||||
* @returns {*|jQuery|HTMLElement}
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
getElement: function () {
|
||||||
return $('#new-port-dialog'); //Reuse the input port dialog....
|
return $('#port-out-component');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* Enable the component.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
enabled: function () {
|
||||||
//Reuse the input port dialog....
|
this.getElement().attr('disabled', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the modal config.
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
*
|
*
|
||||||
* @param {string} name The name of the property to update.
|
* @argument {object} pt The point that the component was dropped.
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
*/
|
||||||
update: function (name, config) {
|
dropHandler: function (pt) {
|
||||||
this.getElement().modal(name, config);
|
this.promptForOutputPortName(pt);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the modal.
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
show: function () {
|
dragIcon: function (event) {
|
||||||
this.getElement().modal('show');
|
return $('<div class="icon icon-port-out-add"></div>');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the modal.
|
* Prompts the user to enter the name for the output port.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the output port was dropped.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
promptForOutputPortName: function (pt) {
|
||||||
this.getElement().modal('hide');
|
var outputPortComponent = this;
|
||||||
}
|
var addOutputPort = function () {
|
||||||
};
|
// get the name of the output port and clear the textfield
|
||||||
}
|
var portName = $('#new-port-name').val();
|
||||||
|
|
||||||
OutputPortComponent.prototype = {
|
// hide the dialog
|
||||||
constructor: OutputPortComponent,
|
outputPortComponent.modal.hide();
|
||||||
|
|
||||||
/**
|
// create the output port
|
||||||
* Gets the component.
|
createOutputPort(portName, pt);
|
||||||
*
|
};
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
getElement: function () {
|
|
||||||
return $('#port-out-component');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
this.modal.update('setButtonModel', [{
|
||||||
* Enable the component.
|
buttonText: 'Add',
|
||||||
*/
|
|
||||||
enabled: function () {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function () {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function (pt) {
|
|
||||||
this.promptForOutputPortName(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-port-out-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prompts the user to enter the name for the output port.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the output port was dropped.
|
|
||||||
*/
|
|
||||||
promptForOutputPortName: function (pt) {
|
|
||||||
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
|
|
||||||
outputPortComponent.modal.hide();
|
|
||||||
|
|
||||||
// create the output port
|
|
||||||
createOutputPort(portName, pt);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.modal.update('setButtonModel', [{
|
|
||||||
buttonText: 'Add',
|
|
||||||
color: {
|
|
||||||
base: '#728E9B',
|
|
||||||
hover: '#004849',
|
|
||||||
text: '#ffffff'
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: addOutputPort
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
buttonText: 'Cancel',
|
|
||||||
color: {
|
color: {
|
||||||
base: '#E3E8EB',
|
base: '#728E9B',
|
||||||
hover: '#C7D2D7',
|
hover: '#004849',
|
||||||
text: '#004849'
|
text: '#ffffff'
|
||||||
},
|
},
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: addOutputPort
|
||||||
outputPortComponent.modal.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}]);
|
},
|
||||||
|
{
|
||||||
|
buttonText: 'Cancel',
|
||||||
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
outputPortComponent.modal.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
// update the port type
|
// update the port type
|
||||||
$('#new-port-type').text('Output');
|
$('#new-port-type').text('Output');
|
||||||
|
|
||||||
// set the focus and show the dialog
|
// set the focus and show the dialog
|
||||||
this.modal.show();
|
this.modal.show();
|
||||||
|
|
||||||
// set up the focus and key handlers
|
// set up the focus and key handlers
|
||||||
$('#new-port-name').focus().off('keyup').on('keyup', function (e) {
|
$('#new-port-name').focus().off('keyup').on('keyup', function (e) {
|
||||||
var code = e.keyCode ? e.keyCode : e.which;
|
var code = e.keyCode ? e.keyCode : e.which;
|
||||||
if (code === $.ui.keyCode.ENTER) {
|
if (code === $.ui.keyCode.ENTER) {
|
||||||
addOutputPort();
|
addOutputPort();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var outputPortComponent = new OutputPortComponent();
|
var outputPortComponent = new OutputPortComponent();
|
||||||
return outputPortComponent;
|
return outputPortComponent;
|
||||||
};
|
};
|
||||||
|
}));
|
File diff suppressed because it is too large
Load Diff
|
@ -15,265 +15,302 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.RemoteProcessGroupComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Common'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) {
|
||||||
|
return (nf.ng.RemoteProcessGroupComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.RemoteProcessGroupComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Common')));
|
||||||
|
} else {
|
||||||
|
nf.ng.RemoteProcessGroupComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Common);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
return function (serviceProvider) {
|
||||||
* Create the controller and add to the graph.
|
'use strict';
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the remote group was dropped.
|
|
||||||
*/
|
|
||||||
var createRemoteProcessGroup = function (pt) {
|
|
||||||
|
|
||||||
var remoteProcessGroupEntity = {
|
|
||||||
'revision': nf.Client.getRevision({
|
|
||||||
'revision': {
|
|
||||||
'version': 0
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
'component': {
|
|
||||||
'targetUris': $('#new-remote-process-group-uris').val(),
|
|
||||||
'position': {
|
|
||||||
'x': pt.x,
|
|
||||||
'y': pt.y
|
|
||||||
},
|
|
||||||
'communicationsTimeout': $('#new-remote-process-group-timeout').val(),
|
|
||||||
'yieldDuration': $('#new-remote-process-group-yield-duration').val(),
|
|
||||||
'transportProtocol': $('#new-remote-process-group-transport-protocol-combo').combo('getSelectedOption').value,
|
|
||||||
'proxyHost': $('#new-remote-process-group-proxy-host').val(),
|
|
||||||
'proxyPort': $('#new-remote-process-group-proxy-port').val(),
|
|
||||||
'proxyUser': $('#new-remote-process-group-proxy-user').val(),
|
|
||||||
'proxyPassword': $('#new-remote-process-group-proxy-password').val()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new processor of the defined type
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/remote-process-groups',
|
|
||||||
data: JSON.stringify(remoteProcessGroupEntity),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// add the processor to the graph
|
|
||||||
nf.Graph.add({
|
|
||||||
'remoteProcessGroups': [response]
|
|
||||||
}, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// hide the dialog
|
|
||||||
$('#new-remote-process-group-dialog').modal('hide');
|
|
||||||
|
|
||||||
// update component visibility
|
|
||||||
nf.Canvas.View.updateVisibility();
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(function (xhr, status, error) {
|
|
||||||
if (xhr.status === 400) {
|
|
||||||
var errors = xhr.responseText.split('\n');
|
|
||||||
|
|
||||||
var content;
|
|
||||||
if (errors.length === 1) {
|
|
||||||
content = $('<span></span>').text(errors[0]);
|
|
||||||
} else {
|
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
|
||||||
dialogContent: content,
|
|
||||||
headerText: 'Configuration Error'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function RemoteProcessGroupComponent() {
|
|
||||||
|
|
||||||
this.icon = 'icon icon-group-remote';
|
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-group-remote-add';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The remote group component's modal.
|
* Create the controller and add to the graph.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the remote group was dropped.
|
||||||
*/
|
*/
|
||||||
this.modal = {
|
var createRemoteProcessGroup = function (pt) {
|
||||||
|
|
||||||
/**
|
var remoteProcessGroupEntity = {
|
||||||
* Gets the modal element.
|
'revision': client.getRevision({
|
||||||
*
|
'revision': {
|
||||||
* @returns {*|jQuery|HTMLElement}
|
'version': 0
|
||||||
*/
|
|
||||||
getElement: function () {
|
|
||||||
return $('#new-remote-process-group-dialog');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the modal.
|
|
||||||
*/
|
|
||||||
init: function () {
|
|
||||||
var defaultTimeout = "30 sec";
|
|
||||||
var defaultYieldDuration = "10 sec";
|
|
||||||
// configure the new remote process group dialog
|
|
||||||
this.getElement().modal({
|
|
||||||
scrollableContentStyle: 'scrollable',
|
|
||||||
headerText: 'Add Remote Process Group',
|
|
||||||
handler: {
|
|
||||||
close: function () {
|
|
||||||
$('#new-remote-process-group-uris').val('');
|
|
||||||
$('#new-remote-process-group-timeout').val(defaultTimeout);
|
|
||||||
$('#new-remote-process-group-yield-duration').val(defaultYieldDuration);
|
|
||||||
$('#new-remote-process-group-transport-protocol-combo').combo('setSelectedOption', {
|
|
||||||
value: 'RAW'
|
|
||||||
});
|
|
||||||
$('#new-remote-process-group-proxy-host').val('');
|
|
||||||
$('#new-remote-process-group-proxy-port').val('');
|
|
||||||
$('#new-remote-process-group-proxy-user').val('');
|
|
||||||
$('#new-remote-process-group-proxy-password').val('');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}),
|
||||||
|
'component': {
|
||||||
|
'targetUris': $('#new-remote-process-group-uris').val(),
|
||||||
|
'position': {
|
||||||
|
'x': pt.x,
|
||||||
|
'y': pt.y
|
||||||
|
},
|
||||||
|
'communicationsTimeout': $('#new-remote-process-group-timeout').val(),
|
||||||
|
'yieldDuration': $('#new-remote-process-group-yield-duration').val(),
|
||||||
|
'transportProtocol': $('#new-remote-process-group-transport-protocol-combo').combo('getSelectedOption').value,
|
||||||
|
'proxyHost': $('#new-remote-process-group-proxy-host').val(),
|
||||||
|
'proxyPort': $('#new-remote-process-group-proxy-port').val(),
|
||||||
|
'proxyUser': $('#new-remote-process-group-proxy-user').val(),
|
||||||
|
'proxyPassword': $('#new-remote-process-group-proxy-password').val()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new processor of the defined type
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/remote-process-groups',
|
||||||
|
data: JSON.stringify(remoteProcessGroupEntity),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// add the processor to the graph
|
||||||
|
graph.add({
|
||||||
|
'remoteProcessGroups': [response]
|
||||||
|
}, {
|
||||||
|
'selectAll': true
|
||||||
});
|
});
|
||||||
// set default values
|
|
||||||
$('#new-remote-process-group-timeout').val(defaultTimeout);
|
// hide the dialog
|
||||||
$('#new-remote-process-group-yield-duration').val(defaultYieldDuration);
|
$('#new-remote-process-group-dialog').modal('hide');
|
||||||
// initialize the transport protocol combo
|
|
||||||
$('#new-remote-process-group-transport-protocol-combo').combo({
|
// update component visibility
|
||||||
options: [{
|
graph.updateVisibility();
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(function (xhr, status, error) {
|
||||||
|
if (xhr.status === 400) {
|
||||||
|
var errors = xhr.responseText.split('\n');
|
||||||
|
|
||||||
|
var content;
|
||||||
|
if (errors.length === 1) {
|
||||||
|
content = $('<span></span>').text(errors[0]);
|
||||||
|
} else {
|
||||||
|
content = common.formatUnorderedList(errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.showOkDialog({
|
||||||
|
dialogContent: content,
|
||||||
|
headerText: 'Configuration Error'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
function RemoteProcessGroupComponent() {
|
||||||
|
|
||||||
|
this.icon = 'icon icon-group-remote';
|
||||||
|
|
||||||
|
this.hoverIcon = 'icon icon-group-remote-add';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The remote group component's modal.
|
||||||
|
*/
|
||||||
|
this.modal = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the modal element.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#new-remote-process-group-dialog');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the modal.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
var defaultTimeout = "30 sec";
|
||||||
|
var defaultYieldDuration = "10 sec";
|
||||||
|
// configure the new remote process group dialog
|
||||||
|
this.getElement().modal({
|
||||||
|
scrollableContentStyle: 'scrollable',
|
||||||
|
headerText: 'Add Remote Process Group',
|
||||||
|
handler: {
|
||||||
|
close: function () {
|
||||||
|
$('#new-remote-process-group-uris').val('');
|
||||||
|
$('#new-remote-process-group-timeout').val(defaultTimeout);
|
||||||
|
$('#new-remote-process-group-yield-duration').val(defaultYieldDuration);
|
||||||
|
$('#new-remote-process-group-transport-protocol-combo').combo('setSelectedOption', {
|
||||||
|
value: 'RAW'
|
||||||
|
});
|
||||||
|
$('#new-remote-process-group-proxy-host').val('');
|
||||||
|
$('#new-remote-process-group-proxy-port').val('');
|
||||||
|
$('#new-remote-process-group-proxy-user').val('');
|
||||||
|
$('#new-remote-process-group-proxy-password').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// set default values
|
||||||
|
$('#new-remote-process-group-timeout').val(defaultTimeout);
|
||||||
|
$('#new-remote-process-group-yield-duration').val(defaultYieldDuration);
|
||||||
|
// initialize the transport protocol combo
|
||||||
|
$('#new-remote-process-group-transport-protocol-combo').combo({
|
||||||
|
options: [{
|
||||||
text: 'RAW',
|
text: 'RAW',
|
||||||
value: 'RAW'
|
value: 'RAW'
|
||||||
}, {
|
}, {
|
||||||
text: 'HTTP',
|
text: 'HTTP',
|
||||||
value: 'HTTP'
|
value: 'HTTP'
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the modal config.
|
|
||||||
*
|
|
||||||
* @param {string} name The name of the property to update.
|
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
|
||||||
update: function (name, config) {
|
|
||||||
this.getElement().modal(name, config);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the modal.
|
|
||||||
*/
|
|
||||||
show: function () {
|
|
||||||
this.getElement().modal('show');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hide the modal.
|
|
||||||
*/
|
|
||||||
hide: function () {
|
|
||||||
this.getElement().modal('hide');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteProcessGroupComponent.prototype = {
|
|
||||||
constructor: RemoteProcessGroupComponent,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the component.
|
|
||||||
*
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
getElement: function () {
|
|
||||||
return $('#group-remote-component');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the component.
|
|
||||||
*/
|
|
||||||
enabled: function () {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function () {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function (pt) {
|
|
||||||
this.promptForRemoteProcessGroupUri(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-group-remote-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prompts the user to enter the URI for the remote process group.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the remote group was dropped.
|
|
||||||
*/
|
|
||||||
promptForRemoteProcessGroupUri: function (pt) {
|
|
||||||
var remoteProcessGroupComponent = this;
|
|
||||||
var addRemoteProcessGroup = function () {
|
|
||||||
// create the remote process group
|
|
||||||
createRemoteProcessGroup(pt);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.modal.update('setButtonModel', [{
|
|
||||||
buttonText: 'Add',
|
|
||||||
color: {
|
|
||||||
base: '#728E9B',
|
|
||||||
hover: '#004849',
|
|
||||||
text: '#ffffff'
|
|
||||||
},
|
},
|
||||||
handler: {
|
|
||||||
click: addRemoteProcessGroup
|
/**
|
||||||
|
* Updates the modal config.
|
||||||
|
*
|
||||||
|
* @param {string} name The name of the property to update.
|
||||||
|
* @param {object|array} config The config for the `name`.
|
||||||
|
*/
|
||||||
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoteProcessGroupComponent.prototype = {
|
||||||
|
constructor: RemoteProcessGroupComponent,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#group-remote-component');
|
||||||
},
|
},
|
||||||
{
|
|
||||||
buttonText: 'Cancel',
|
/**
|
||||||
|
* Enable the component.
|
||||||
|
*/
|
||||||
|
enabled: function () {
|
||||||
|
this.getElement().attr('disabled', false);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the component was dropped.
|
||||||
|
*/
|
||||||
|
dropHandler: function (pt) {
|
||||||
|
this.promptForRemoteProcessGroupUri(pt);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
dragIcon: function (event) {
|
||||||
|
return $('<div class="icon icon-group-remote-add"></div>');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prompts the user to enter the URI for the remote process group.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the remote group was dropped.
|
||||||
|
*/
|
||||||
|
promptForRemoteProcessGroupUri: function (pt) {
|
||||||
|
var remoteProcessGroupComponent = this;
|
||||||
|
var addRemoteProcessGroup = function () {
|
||||||
|
// create the remote process group
|
||||||
|
createRemoteProcessGroup(pt);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.modal.update('setButtonModel', [{
|
||||||
|
buttonText: 'Add',
|
||||||
color: {
|
color: {
|
||||||
base: '#E3E8EB',
|
base: '#728E9B',
|
||||||
hover: '#C7D2D7',
|
hover: '#004849',
|
||||||
text: '#004849'
|
text: '#ffffff'
|
||||||
},
|
},
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: addRemoteProcessGroup
|
||||||
remoteProcessGroupComponent.modal.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}]);
|
},
|
||||||
|
{
|
||||||
|
buttonText: 'Cancel',
|
||||||
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
remoteProcessGroupComponent.modal.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
// show the dialog
|
// show the dialog
|
||||||
this.modal.show();
|
this.modal.show();
|
||||||
|
|
||||||
// set the focus and key handlers
|
// set the focus and key handlers
|
||||||
$('#new-remote-process-group-uris').focus().off('keyup').on('keyup', function (e) {
|
$('#new-remote-process-group-uris').focus().off('keyup').on('keyup', function (e) {
|
||||||
var code = e.keyCode ? e.keyCode : e.which;
|
var code = e.keyCode ? e.keyCode : e.which;
|
||||||
if (code === $.ui.keyCode.ENTER) {
|
if (code === $.ui.keyCode.ENTER) {
|
||||||
addRemoteProcessGroup();
|
addRemoteProcessGroup();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var remoteProcessGroupComponent = new RemoteProcessGroupComponent();
|
var remoteProcessGroupComponent = new RemoteProcessGroupComponent();
|
||||||
return remoteProcessGroupComponent;
|
return remoteProcessGroupComponent;
|
||||||
};
|
};
|
||||||
|
}));
|
|
@ -15,236 +15,273 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ng.TemplateComponent = function (serviceProvider) {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Common'],
|
||||||
|
function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) {
|
||||||
|
return (nf.ng.TemplateComponent = factory($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ng.TemplateComponent =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Common')));
|
||||||
|
} else {
|
||||||
|
nf.ng.TemplateComponent = factory(root.$,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Common);
|
||||||
|
}
|
||||||
|
}(this, function ($, client, birdseye, graph, canvasUtils, errorHandler, dialog, common) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
return function (serviceProvider) {
|
||||||
* Instantiates the specified template.
|
'use strict';
|
||||||
*
|
|
||||||
* @argument {string} templateId The template id.
|
|
||||||
* @argument {object} pt The point that the template was dropped.
|
|
||||||
*/
|
|
||||||
var createTemplate = function (templateId, pt) {
|
|
||||||
var instantiateTemplateInstance = {
|
|
||||||
'templateId': templateId,
|
|
||||||
'originX': pt.x,
|
|
||||||
'originY': pt.y
|
|
||||||
};
|
|
||||||
|
|
||||||
// create a new instance of the new template
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/template-instance',
|
|
||||||
data: JSON.stringify(instantiateTemplateInstance),
|
|
||||||
dataType: 'json',
|
|
||||||
contentType: 'application/json'
|
|
||||||
}).done(function (response) {
|
|
||||||
// populate the graph accordingly
|
|
||||||
nf.Graph.add(response.flow, {
|
|
||||||
'selectAll': true
|
|
||||||
});
|
|
||||||
|
|
||||||
// update component visibility
|
|
||||||
nf.Canvas.View.updateVisibility();
|
|
||||||
|
|
||||||
// update the birdseye
|
|
||||||
nf.Birdseye.refresh();
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
|
||||||
};
|
|
||||||
|
|
||||||
function TemplateComponent() {
|
|
||||||
|
|
||||||
this.icon = 'icon icon-template';
|
|
||||||
|
|
||||||
this.hoverIcon = 'icon icon-template-add';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The template component's modal.
|
* Instantiates the specified template.
|
||||||
|
*
|
||||||
|
* @argument {string} templateId The template id.
|
||||||
|
* @argument {object} pt The point that the template was dropped.
|
||||||
*/
|
*/
|
||||||
this.modal = {
|
var createTemplate = function (templateId, pt) {
|
||||||
|
var instantiateTemplateInstance = {
|
||||||
|
'templateId': templateId,
|
||||||
|
'originX': pt.x,
|
||||||
|
'originY': pt.y
|
||||||
|
};
|
||||||
|
|
||||||
|
// create a new instance of the new template
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/template-instance',
|
||||||
|
data: JSON.stringify(instantiateTemplateInstance),
|
||||||
|
dataType: 'json',
|
||||||
|
contentType: 'application/json'
|
||||||
|
}).done(function (response) {
|
||||||
|
// populate the graph accordingly
|
||||||
|
graph.add(response.flow, {
|
||||||
|
'selectAll': true
|
||||||
|
});
|
||||||
|
|
||||||
|
// update component visibility
|
||||||
|
graph.updateVisibility();
|
||||||
|
|
||||||
|
// update the birdseye
|
||||||
|
birdseye.refresh();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
};
|
||||||
|
|
||||||
|
function TemplateComponent() {
|
||||||
|
|
||||||
|
this.icon = 'icon icon-template';
|
||||||
|
|
||||||
|
this.hoverIcon = 'icon icon-template-add';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the modal element.
|
* The template component's modal.
|
||||||
|
*/
|
||||||
|
this.modal = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the modal element.
|
||||||
|
*
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
|
*/
|
||||||
|
getElement: function () {
|
||||||
|
return $('#instantiate-template-dialog');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the modal.
|
||||||
|
*/
|
||||||
|
init: function () {
|
||||||
|
// configure the instantiate template dialog
|
||||||
|
this.getElement().modal({
|
||||||
|
scrollableContentStyle: 'scrollable',
|
||||||
|
headerText: 'Add Template'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the modal config.
|
||||||
|
*
|
||||||
|
* @param {string} name The name of the property to update.
|
||||||
|
* @param {object|array} config The config for the `name`.
|
||||||
|
*/
|
||||||
|
update: function (name, config) {
|
||||||
|
this.getElement().modal(name, config);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the modal.
|
||||||
|
*/
|
||||||
|
show: function () {
|
||||||
|
this.getElement().modal('show');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the modal.
|
||||||
|
*/
|
||||||
|
hide: function () {
|
||||||
|
this.getElement().modal('hide');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
TemplateComponent.prototype = {
|
||||||
|
constructor: TemplateComponent,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the component.
|
||||||
*
|
*
|
||||||
* @returns {*|jQuery|HTMLElement}
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
getElement: function () {
|
getElement: function () {
|
||||||
return $('#instantiate-template-dialog');
|
return $('#template-component');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the modal.
|
* Enable the component.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
enabled: function () {
|
||||||
// configure the instantiate template dialog
|
this.getElement().attr('disabled', false);
|
||||||
this.getElement().modal({
|
|
||||||
scrollableContentStyle: 'scrollable',
|
|
||||||
headerText: 'Add Template'
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the modal config.
|
* Disable the component.
|
||||||
|
*/
|
||||||
|
disabled: function () {
|
||||||
|
this.getElement().attr('disabled', true);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function for when component is dropped on the canvas.
|
||||||
*
|
*
|
||||||
* @param {string} name The name of the property to update.
|
* @argument {object} pt The point that the component was dropped.
|
||||||
* @param {object|array} config The config for the `name`.
|
|
||||||
*/
|
*/
|
||||||
update: function (name, config) {
|
dropHandler: function (pt) {
|
||||||
this.getElement().modal(name, config);
|
this.promptForTemplate(pt);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the modal.
|
* The drag icon for the toolbox component.
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
* @returns {*|jQuery|HTMLElement}
|
||||||
*/
|
*/
|
||||||
show: function () {
|
dragIcon: function (event) {
|
||||||
this.getElement().modal('show');
|
return $('<div class="icon icon-template-add"></div>');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide the modal.
|
* Prompts the user to select a template.
|
||||||
|
*
|
||||||
|
* @argument {object} pt The point that the template was dropped.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
promptForTemplate: function (pt) {
|
||||||
this.getElement().modal('hide');
|
var templateComponent = this;
|
||||||
}
|
$.ajax({
|
||||||
};
|
type: 'GET',
|
||||||
}
|
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/flow/templates',
|
||||||
|
dataType: 'json'
|
||||||
|
}).done(function (response) {
|
||||||
|
var templates = response.templates;
|
||||||
|
if (common.isDefinedAndNotNull(templates) && templates.length > 0) {
|
||||||
|
// sort the templates
|
||||||
|
templates = templates.sort(function (one, two) {
|
||||||
|
var oneDate = common.parseDateTime(one.template.timestamp);
|
||||||
|
var twoDate = common.parseDateTime(two.template.timestamp);
|
||||||
|
|
||||||
TemplateComponent.prototype = {
|
// newest templates first
|
||||||
constructor: TemplateComponent,
|
return twoDate.getTime() - oneDate.getTime();
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
var options = [];
|
||||||
* Gets the component.
|
$.each(templates, function (_, templateEntity) {
|
||||||
*
|
if (templateEntity.permissions.canRead === true) {
|
||||||
* @returns {*|jQuery|HTMLElement}
|
options.push({
|
||||||
*/
|
text: templateEntity.template.name,
|
||||||
getElement: function () {
|
value: templateEntity.id,
|
||||||
return $('#template-component');
|
description: common.escapeHtml(templateEntity.template.description)
|
||||||
},
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable the component.
|
|
||||||
*/
|
|
||||||
enabled: function () {
|
|
||||||
this.getElement().attr('disabled', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable the component.
|
|
||||||
*/
|
|
||||||
disabled: function () {
|
|
||||||
this.getElement().attr('disabled', true);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler function for when component is dropped on the canvas.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the component was dropped.
|
|
||||||
*/
|
|
||||||
dropHandler: function (pt) {
|
|
||||||
this.promptForTemplate(pt);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The drag icon for the toolbox component.
|
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
* @returns {*|jQuery|HTMLElement}
|
|
||||||
*/
|
|
||||||
dragIcon: function (event) {
|
|
||||||
return $('<div class="icon icon-template-add"></div>');
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prompts the user to select a template.
|
|
||||||
*
|
|
||||||
* @argument {object} pt The point that the template was dropped.
|
|
||||||
*/
|
|
||||||
promptForTemplate: function (pt) {
|
|
||||||
var templateComponent = this;
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: serviceProvider.headerCtrl.toolboxCtrl.config.urls.api + '/flow/templates',
|
|
||||||
dataType: 'json'
|
|
||||||
}).done(function (response) {
|
|
||||||
var templates = response.templates;
|
|
||||||
if (nf.Common.isDefinedAndNotNull(templates) && templates.length > 0) {
|
|
||||||
// sort the templates
|
|
||||||
templates = templates.sort(function (one, two) {
|
|
||||||
var oneDate = nf.Common.parseDateTime(one.template.timestamp);
|
|
||||||
var twoDate = nf.Common.parseDateTime(two.template.timestamp);
|
|
||||||
|
|
||||||
// newest templates first
|
|
||||||
return twoDate.getTime() - oneDate.getTime();
|
|
||||||
});
|
|
||||||
|
|
||||||
var options = [];
|
|
||||||
$.each(templates, function (_, templateEntity) {
|
|
||||||
if (templateEntity.permissions.canRead === true) {
|
|
||||||
options.push({
|
|
||||||
text: templateEntity.template.name,
|
|
||||||
value: templateEntity.id,
|
|
||||||
description: nf.Common.escapeHtml(templateEntity.template.description)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// configure the templates combo
|
|
||||||
$('#available-templates').combo({
|
|
||||||
maxHeight: 300,
|
|
||||||
options: options
|
|
||||||
});
|
|
||||||
|
|
||||||
// update the button model
|
|
||||||
templateComponent.modal.update('setButtonModel', [{
|
|
||||||
buttonText: 'Add',
|
|
||||||
color: {
|
|
||||||
base: '#728E9B',
|
|
||||||
hover: '#004849',
|
|
||||||
text: '#ffffff'
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: function () {
|
|
||||||
// get the type of processor currently selected
|
|
||||||
var selectedOption = $('#available-templates').combo('getSelectedOption');
|
|
||||||
var templateId = selectedOption.value;
|
|
||||||
|
|
||||||
// hide the dialog
|
|
||||||
templateComponent.modal.hide();
|
|
||||||
|
|
||||||
// instantiate the specified template
|
|
||||||
createTemplate(templateId, pt);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
},
|
|
||||||
{
|
// configure the templates combo
|
||||||
buttonText: 'Cancel',
|
$('#available-templates').combo({
|
||||||
|
maxHeight: 300,
|
||||||
|
options: options
|
||||||
|
});
|
||||||
|
|
||||||
|
// update the button model
|
||||||
|
templateComponent.modal.update('setButtonModel', [{
|
||||||
|
buttonText: 'Add',
|
||||||
color: {
|
color: {
|
||||||
base: '#E3E8EB',
|
base: '#728E9B',
|
||||||
hover: '#C7D2D7',
|
hover: '#004849',
|
||||||
text: '#004849'
|
text: '#ffffff'
|
||||||
},
|
},
|
||||||
handler: {
|
handler: {
|
||||||
click: function () {
|
click: function () {
|
||||||
|
// get the type of processor currently selected
|
||||||
|
var selectedOption = $('#available-templates').combo('getSelectedOption');
|
||||||
|
var templateId = selectedOption.value;
|
||||||
|
|
||||||
|
// hide the dialog
|
||||||
templateComponent.modal.hide();
|
templateComponent.modal.hide();
|
||||||
|
|
||||||
|
// instantiate the specified template
|
||||||
|
createTemplate(templateId, pt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]);
|
},
|
||||||
|
{
|
||||||
|
buttonText: 'Cancel',
|
||||||
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
templateComponent.modal.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
// show the dialog
|
// show the dialog
|
||||||
templateComponent.modal.show();
|
templateComponent.modal.show();
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Instantiate Template',
|
headerText: 'Instantiate Template',
|
||||||
dialogContent: 'No templates have been loaded into this NiFi.'
|
dialogContent: 'No templates have been loaded into this NiFi.'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var templateComponent = new TemplateComponent();
|
var templateComponent = new TemplateComponent();
|
||||||
return templateComponent;
|
return templateComponent;
|
||||||
};
|
};
|
||||||
|
}));
|
File diff suppressed because it is too large
Load Diff
|
@ -15,17 +15,49 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Birdseye = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ContextMenu',
|
||||||
|
'nf.Label'],
|
||||||
|
function ($, d3, errorHandler, common, canvasUtils, contextMenu, label) {
|
||||||
|
return (nf.Birdseye = factory($, d3, errorHandler, common, canvasUtils, contextMenu, label));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Birdseye =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ContextMenu'),
|
||||||
|
require('nf.Label')));
|
||||||
|
} else {
|
||||||
|
nf.Birdseye = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ContextMenu,
|
||||||
|
root.nf.Label);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, canvasUtils, contextMenu, label) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfGraph;
|
||||||
var birdseyeGroup;
|
var birdseyeGroup;
|
||||||
var componentGroup;
|
var componentGroup;
|
||||||
|
|
||||||
// refreshes the birdseye
|
// refreshes the birdseye
|
||||||
var refresh = function (components) {
|
var refresh = function (components) {
|
||||||
var translate = nf.Canvas.View.translate();
|
var translate = canvasUtils.translateCanvasView();
|
||||||
var scale = nf.Canvas.View.scale();
|
var scale = canvasUtils.scaleCanvasView();
|
||||||
|
|
||||||
// scale the translation
|
// scale the translation
|
||||||
translate = [translate[0] / scale, translate[1] / scale];
|
translate = [translate[0] / scale, translate[1] / scale];
|
||||||
|
@ -33,7 +65,7 @@ nf.Birdseye = (function () {
|
||||||
// get the bounding box for the graph and convert into canvas space
|
// get the bounding box for the graph and convert into canvas space
|
||||||
var graphBox = d3.select('#canvas').node().getBoundingClientRect();
|
var graphBox = d3.select('#canvas').node().getBoundingClientRect();
|
||||||
var graphLeft = (graphBox.left / scale) - translate[0];
|
var graphLeft = (graphBox.left / scale) - translate[0];
|
||||||
var graphTop = ((graphBox.top - nf.Canvas.CANVAS_OFFSET) / scale) - translate[1];
|
var graphTop = ((graphBox.top - canvasUtils.getCanvasOffset()) / scale) - translate[1];
|
||||||
var graphRight = (graphBox.right / scale) - translate[0];
|
var graphRight = (graphBox.right / scale) - translate[0];
|
||||||
var graphBottom = (graphBox.bottom / scale) - translate[1];
|
var graphBottom = (graphBox.bottom / scale) - translate[1];
|
||||||
|
|
||||||
|
@ -149,11 +181,11 @@ nf.Birdseye = (function () {
|
||||||
|
|
||||||
// labels
|
// labels
|
||||||
$.each(components.labels, function (_, d) {
|
$.each(components.labels, function (_, d) {
|
||||||
var color = nf.Label.defaultColor();
|
var color = label.defaultColor();
|
||||||
|
|
||||||
if (d.permissions.canRead) {
|
if (d.permissions.canRead) {
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
if (common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
||||||
color = d.component.style['background-color'];
|
color = d.component.style['background-color'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,7 +224,7 @@ nf.Birdseye = (function () {
|
||||||
|
|
||||||
if (d.permissions.canRead) {
|
if (d.permissions.canRead) {
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
if (common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
||||||
color = d.component.style['background-color'];
|
color = d.component.style['background-color'];
|
||||||
|
|
||||||
//if the background color is #ffffff use the default instead
|
//if the background color is #ffffff use the default instead
|
||||||
|
@ -212,8 +244,10 @@ nf.Birdseye = (function () {
|
||||||
// whether or not the birdseye is open, don't adjust unless necessary
|
// whether or not the birdseye is open, don't adjust unless necessary
|
||||||
var visible = true;
|
var visible = true;
|
||||||
|
|
||||||
return {
|
var nfBirdseye = {
|
||||||
init: function () {
|
init: function (graph) {
|
||||||
|
nfGraph = graph;
|
||||||
|
|
||||||
var birdseye = $('#birdseye');
|
var birdseye = $('#birdseye');
|
||||||
|
|
||||||
d3.select('#birdseye').append('canvas')
|
d3.select('#birdseye').append('canvas')
|
||||||
|
@ -244,7 +278,7 @@ nf.Birdseye = (function () {
|
||||||
})
|
})
|
||||||
.on('dragstart', function () {
|
.on('dragstart', function () {
|
||||||
// hide the context menu
|
// hide the context menu
|
||||||
nf.ContextMenu.hide();
|
contextMenu.hide();
|
||||||
})
|
})
|
||||||
.on('drag', function (d) {
|
.on('drag', function (d) {
|
||||||
d.x += d3.event.dx;
|
d.x += d3.event.dx;
|
||||||
|
@ -255,17 +289,17 @@ nf.Birdseye = (function () {
|
||||||
return 'translate(' + d.x + ', ' + d.y + ')';
|
return 'translate(' + d.x + ', ' + d.y + ')';
|
||||||
});
|
});
|
||||||
// get the current transformation
|
// get the current transformation
|
||||||
var scale = nf.Canvas.View.scale();
|
var scale = canvasUtils.scaleCanvasView();
|
||||||
var translate = nf.Canvas.View.translate();
|
var translate = canvasUtils.translateCanvasView();
|
||||||
|
|
||||||
// update the translation according to the delta
|
// update the translation according to the delta
|
||||||
translate = [(-d3.event.dx * scale) + translate[0], (-d3.event.dy * scale) + translate[1]];
|
translate = [(-d3.event.dx * scale) + translate[0], (-d3.event.dy * scale) + translate[1]];
|
||||||
|
|
||||||
// record the current transforms
|
// record the current transforms
|
||||||
nf.Canvas.View.translate(translate);
|
canvasUtils.translateCanvasView(translate);
|
||||||
|
|
||||||
// refresh the canvas
|
// refresh the canvas
|
||||||
nf.Canvas.View.refresh({
|
canvasUtils.refreshCanvasView({
|
||||||
persist: false,
|
persist: false,
|
||||||
transition: false,
|
transition: false,
|
||||||
refreshComponents: false,
|
refreshComponents: false,
|
||||||
|
@ -274,13 +308,13 @@ nf.Birdseye = (function () {
|
||||||
})
|
})
|
||||||
.on('dragend', function () {
|
.on('dragend', function () {
|
||||||
// update component visibility
|
// update component visibility
|
||||||
nf.Canvas.View.updateVisibility();
|
nfGraph.updateVisibility();
|
||||||
|
|
||||||
// persist the users view
|
// persist the users view
|
||||||
nf.CanvasUtils.persistUserView();
|
canvasUtils.persistUserView();
|
||||||
|
|
||||||
// refresh the birdseye
|
// refresh the birdseye
|
||||||
nf.Birdseye.refresh();
|
nfBirdseye.refresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
// context area
|
// context area
|
||||||
|
@ -303,7 +337,7 @@ nf.Birdseye = (function () {
|
||||||
*/
|
*/
|
||||||
refresh: function () {
|
refresh: function () {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
refresh(nf.Graph.get());
|
refresh(nfGraph.get());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -322,7 +356,7 @@ nf.Birdseye = (function () {
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
||||||
// refresh the birdseye as it may have changed
|
// refresh the birdseye as it may have changed
|
||||||
refresh(nf.Graph.get());
|
refresh(nfGraph.get());
|
||||||
} else {
|
} else {
|
||||||
// hide the outline
|
// hide the outline
|
||||||
birdseye.hide();
|
birdseye.hide();
|
||||||
|
@ -330,4 +364,6 @@ nf.Birdseye = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfBirdseye;
|
||||||
|
}));
|
|
@ -0,0 +1,400 @@
|
||||||
|
/*
|
||||||
|
* 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 define, module, require, exports */
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'angular',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Storage',
|
||||||
|
'nf.Canvas',
|
||||||
|
'nf.Graph',
|
||||||
|
'nf.ContextMenu',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.Settings',
|
||||||
|
'nf.Snippet',
|
||||||
|
'nf.Actions',
|
||||||
|
'nf.QueueListing',
|
||||||
|
'nf.ComponentState',
|
||||||
|
'nf.Draggable',
|
||||||
|
'nf.Connectable',
|
||||||
|
'nf.StatusHistory',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.ConnectionConfiguration',
|
||||||
|
'nf.ControllerService',
|
||||||
|
'nf.ReportingTask',
|
||||||
|
'nf.PolicyManagement',
|
||||||
|
'nf.ProcessorConfiguration',
|
||||||
|
'nf.ProcessGroupConfiguration',
|
||||||
|
'nf.ControllerServices',
|
||||||
|
'nf.RemoteProcessGroupConfiguration',
|
||||||
|
'nf.RemoteProcessGroupPorts',
|
||||||
|
'nf.PortConfiguration',
|
||||||
|
'nf.LabelConfiguration',
|
||||||
|
'nf.ProcessorDetails',
|
||||||
|
'nf.PortDetails',
|
||||||
|
'nf.ConnectionDetails',
|
||||||
|
'nf.RemoteProcessGroupDetails',
|
||||||
|
'nf.GoTo',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.ng.AppCtrl',
|
||||||
|
'nf.ng.AppConfig',
|
||||||
|
'nf.ng.ServiceProvider',
|
||||||
|
'nf.ng.BreadcrumbsCtrl',
|
||||||
|
'nf.ng.Canvas.HeaderCtrl',
|
||||||
|
'nf.ng.Canvas.FlowStatusCtrl',
|
||||||
|
'nf.ng.Canvas.GlobalMenuCtrl',
|
||||||
|
'nf.ng.Canvas.ToolboxCtrl',
|
||||||
|
'nf.ng.ProcessorComponent',
|
||||||
|
'nf.ng.InputPortComponent',
|
||||||
|
'nf.ng.OutputPortComponent',
|
||||||
|
'nf.ng.GroupComponent',
|
||||||
|
'nf.ng.RemoteProcessGroupComponent',
|
||||||
|
'nf.ng.FunnelComponent',
|
||||||
|
'nf.ng.TemplateComponent',
|
||||||
|
'nf.ng.LabelComponent',
|
||||||
|
'nf.ng.Canvas.GraphControlsCtrl',
|
||||||
|
'nf.ng.Canvas.NavigateCtrl',
|
||||||
|
'nf.ng.Canvas.OperateCtrl',
|
||||||
|
'nf.ng.BreadcrumbsDirective',
|
||||||
|
'nf.ng.DraggableDirective'],
|
||||||
|
function ($, angular, common, canvasUtils, errorHandler, client, clusterSummary, dialog, storage, canvas, graph, contextMenu, shell, settings, actions, snippet, queueListing, componentState, draggable, connectable, statusHistory, birdseye, connectionConfiguration, controllerService, reportingTask, policyManagement, processorConfiguration, processGroupConfiguration, controllerServices, remoteProcessGroupConfiguration, remoteProcessGroupPorts, portConfiguration, labelConfiguration, processorDetails, portDetails, connectionDetails, remoteProcessGroupDetails, nfGoto, angularBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) {
|
||||||
|
return factory($, angular, common, canvasUtils, errorHandler, client, clusterSummary, dialog, storage, canvas, graph, contextMenu, shell, settings, actions, snippet, queueListing, componentState, draggable, connectable, statusHistory, birdseye, connectionConfiguration, controllerService, reportingTask, policyManagement, processorConfiguration, processGroupConfiguration, controllerServices, remoteProcessGroupConfiguration, remoteProcessGroupPorts, portConfiguration, labelConfiguration, processorDetails, portDetails, connectionDetails, remoteProcessGroupDetails, nfGoto, angularBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective);
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = factory(require('jquery'),
|
||||||
|
require('angular'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('f.Storage'),
|
||||||
|
require('nf.Canvas'),
|
||||||
|
require('nf.Graph'),
|
||||||
|
require('nf.ContextMenu'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.Settings'),
|
||||||
|
require('nf.Actions'),
|
||||||
|
require('nf.Snippet'),
|
||||||
|
require('nf.QueueListing'),
|
||||||
|
require('nf.ComponentState'),
|
||||||
|
require('nf.Draggable'),
|
||||||
|
require('nf.Connectable'),
|
||||||
|
require('nf.StatusHistory'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.ConnectionConfiguration'),
|
||||||
|
require('nf.ControllerService'),
|
||||||
|
require('nf.ReportingTask'),
|
||||||
|
require('nf.PolicyManagement'),
|
||||||
|
require('nf.ProcessorConfiguration'),
|
||||||
|
require('nf.ProcessGroupConfiguration'),
|
||||||
|
require('nf.ControllerServices'),
|
||||||
|
require('nf.RemoteProcessGroupConfiguration'),
|
||||||
|
require('nf.RemoteProcessGroupPorts'),
|
||||||
|
require('nf.PortConfiguration'),
|
||||||
|
require('nf.LabelConfiguration'),
|
||||||
|
require('nf.ProcessorDetails'),
|
||||||
|
require('nf.PortDetails'),
|
||||||
|
require('nf.ConnectionDetails'),
|
||||||
|
require('nf.RemoteProcessGroupDetails'),
|
||||||
|
require('nf.GoTo'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.ng.AppCtrl'),
|
||||||
|
require('nf.ng.AppConfig'),
|
||||||
|
require('nf.ng.ServiceProvider'),
|
||||||
|
require('nf.ng.BreadcrumbsCtrl'),
|
||||||
|
require('nf.ng.Canvas.HeaderCtrl'),
|
||||||
|
require('nf.ng.Canvas.FlowStatusCtrl'),
|
||||||
|
require('nf.ng.Canvas.GlobalMenuCtrl'),
|
||||||
|
require('nf.ng.Canvas.ToolboxCtrl'),
|
||||||
|
require('nf.ng.ProcessorComponent'),
|
||||||
|
require('nf.ng.InputPortComponent'),
|
||||||
|
require('nf.ng.OutputPortComponent'),
|
||||||
|
require('nf.ng.GroupComponent'),
|
||||||
|
require('nf.ng.RemoteProcessGroupComponent'),
|
||||||
|
require('nf.ng.FunnelComponent'),
|
||||||
|
require('nf.ng.TemplateComponent'),
|
||||||
|
require('nf.ng.LabelComponent'),
|
||||||
|
require('nf.ng.Canvas.GraphControlsCtrl'),
|
||||||
|
require('nf.ng.Canvas.NavigateCtrl'),
|
||||||
|
require('nf.ng.Canvas.OperateCtrl'),
|
||||||
|
require('nf.ng.BreadcrumbsDirective'),
|
||||||
|
require('nf.ng.DraggableDirective'));
|
||||||
|
} else {
|
||||||
|
factory(root.$,
|
||||||
|
root.angular,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Storage,
|
||||||
|
root.nf.Canvas,
|
||||||
|
root.nf.Graph,
|
||||||
|
root.nf.ContextMenu,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.Settings,
|
||||||
|
root.nf.Actions,
|
||||||
|
root.nf.Snippet,
|
||||||
|
root.nf.QueueListing,
|
||||||
|
root.nf.ComponentState,
|
||||||
|
root.nf.Draggable,
|
||||||
|
root.nf.Connectable,
|
||||||
|
root.nf.StatusHistory,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.ConnectionConfiguration,
|
||||||
|
root.nf.ControllerService,
|
||||||
|
root.nf.ReportingTask,
|
||||||
|
root.nf.PolicyManagement,
|
||||||
|
root.nf.ProcessorConfiguration,
|
||||||
|
root.nf.ProcessGroupConfiguration,
|
||||||
|
root.nf.ControllerServices,
|
||||||
|
root.nf.RemoteProcessGroupConfiguration,
|
||||||
|
root.nf.RemoteProcessGroupPorts,
|
||||||
|
root.nf.PortConfiguration,
|
||||||
|
root.nf.LabelConfiguration,
|
||||||
|
root.nf.ProcessorDetails,
|
||||||
|
root.nf.PortDetails,
|
||||||
|
root.nf.ConnectionDetails,
|
||||||
|
root.nf.RemoteProcessGroupDetails,
|
||||||
|
root.nf.GoTo,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.ng.AppCtrl,
|
||||||
|
root.nf.ng.AppConfig,
|
||||||
|
root.nf.ng.ServiceProvider,
|
||||||
|
root.nf.ng.BreadcrumbsCtrl,
|
||||||
|
root.nf.ng.Canvas.HeaderCtrl,
|
||||||
|
root.nf.ng.Canvas.FlowStatusCtrl,
|
||||||
|
root.nf.ng.Canvas.GlobalMenuCtrl,
|
||||||
|
root.nf.ng.Canvas.ToolboxCtrl,
|
||||||
|
root.nf.ng.ProcessorComponent,
|
||||||
|
root.nf.ng.InputPortComponent,
|
||||||
|
root.nf.ng.OutputPortComponent,
|
||||||
|
root.nf.ng.GroupComponent,
|
||||||
|
root.nf.ng.RemoteProcessGroupComponent,
|
||||||
|
root.nf.ng.FunnelComponent,
|
||||||
|
root.nf.ng.TemplateComponent,
|
||||||
|
root.nf.ng.LabelComponent,
|
||||||
|
root.nf.ng.Canvas.GraphControlsCtrl,
|
||||||
|
root.nf.ng.Canvas.NavigateCtrl,
|
||||||
|
root.nf.ng.Canvas.OperateCtrl,
|
||||||
|
root.nf.ng.BreadcrumbsDirective,
|
||||||
|
root.nf.ng.DraggableDirective);
|
||||||
|
}
|
||||||
|
}(this, function ($, angular, common, canvasUtils, errorHandler, client, clusterSummary, dialog, storage, canvas, graph, contextMenu, shell, settings, actions, snippet, queueListing, componentState, draggable, connectable, statusHistory, birdseye, connectionConfiguration, controllerService, reportingTask, policyManagement, processorConfiguration, processGroupConfiguration, controllerServices, remoteProcessGroupConfiguration, remoteProcessGroupPorts, portConfiguration, labelConfiguration, processorDetails, portDetails, connectionDetails, remoteProcessGroupDetails, nfGoto, angularBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) {
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
urls: {
|
||||||
|
flowConfig: '../nifi-api/flow/config'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap the canvas application.
|
||||||
|
*/
|
||||||
|
$(document).ready(function () {
|
||||||
|
if (canvas.SUPPORTS_SVG) {
|
||||||
|
|
||||||
|
//Create Angular App
|
||||||
|
var app = angular.module('ngCanvasApp', ['ngResource', 'ngRoute', 'ngMaterial', 'ngMessages']);
|
||||||
|
|
||||||
|
//Define Dependency Injection Annotations
|
||||||
|
appConfig.$inject = ['$mdThemingProvider', '$compileProvider'];
|
||||||
|
appCtrl.$inject = ['$scope', 'serviceProvider', '$compile', 'headerCtrl', 'graphControlsCtrl'];
|
||||||
|
serviceProvider.$inject = [];
|
||||||
|
breadcrumbsCtrl.$inject = ['serviceProvider'];
|
||||||
|
headerCtrl.$inject = ['serviceProvider', 'toolboxCtrl', 'globalMenuCtrl', 'flowStatusCtrl'];
|
||||||
|
flowStatusCtrl.$inject = ['serviceProvider'];
|
||||||
|
globalMenuCtrl.$inject = ['serviceProvider'];
|
||||||
|
toolboxCtrl.$inject = ['processorComponent',
|
||||||
|
'inputPortComponent',
|
||||||
|
'outputPortComponent',
|
||||||
|
'groupComponent',
|
||||||
|
'remoteGroupComponent',
|
||||||
|
'funnelComponent',
|
||||||
|
'templateComponent',
|
||||||
|
'labelComponent'];
|
||||||
|
processorComponent.$inject = ['serviceProvider'];
|
||||||
|
inputPortComponent.$inject = ['serviceProvider'];
|
||||||
|
outputPortComponent.$inject = ['serviceProvider'];
|
||||||
|
processGroupComponent.$inject = ['serviceProvider'];
|
||||||
|
remoteProcessGroupComponent.$inject = ['serviceProvider'];
|
||||||
|
funnelComponent.$inject = ['serviceProvider'];
|
||||||
|
templateComponent.$inject = ['serviceProvider'];
|
||||||
|
labelComponent.$inject = ['serviceProvider'];
|
||||||
|
graphControlsCtrl.$inject = ['serviceProvider', 'navigateCtrl', 'operateCtrl'];
|
||||||
|
navigateCtrl.$inject = [];
|
||||||
|
operateCtrl.$inject = [];
|
||||||
|
breadcrumbsDirective.$inject = ['breadcrumbsCtrl'];
|
||||||
|
draggableDirective.$inject = [];
|
||||||
|
|
||||||
|
//Configure Angular App
|
||||||
|
app.config(appConfig);
|
||||||
|
|
||||||
|
//Define Angular App Controllers
|
||||||
|
app.controller('ngCanvasAppCtrl', appCtrl);
|
||||||
|
|
||||||
|
//Define Angular App Services
|
||||||
|
app.service('serviceProvider', serviceProvider);
|
||||||
|
app.service('breadcrumbsCtrl', breadcrumbsCtrl);
|
||||||
|
app.service('headerCtrl', headerCtrl);
|
||||||
|
app.service('flowStatusCtrl', flowStatusCtrl);
|
||||||
|
app.service('globalMenuCtrl', globalMenuCtrl);
|
||||||
|
app.service('toolboxCtrl', toolboxCtrl);
|
||||||
|
app.service('processorComponent', processorComponent);
|
||||||
|
app.service('inputPortComponent', inputPortComponent);
|
||||||
|
app.service('outputPortComponent', outputPortComponent);
|
||||||
|
app.service('groupComponent', processGroupComponent);
|
||||||
|
app.service('remoteGroupComponent', remoteProcessGroupComponent);
|
||||||
|
app.service('funnelComponent', funnelComponent);
|
||||||
|
app.service('templateComponent', templateComponent);
|
||||||
|
app.service('labelComponent', labelComponent);
|
||||||
|
app.service('graphControlsCtrl', graphControlsCtrl);
|
||||||
|
app.service('navigateCtrl', navigateCtrl);
|
||||||
|
app.service('operateCtrl', operateCtrl);
|
||||||
|
|
||||||
|
//Define Angular App Directives
|
||||||
|
app.directive('nfBreadcrumbs', breadcrumbsDirective);
|
||||||
|
app.directive('nfDraggable', draggableDirective);
|
||||||
|
|
||||||
|
// initialize the canvas utils and invert control of the canvas,
|
||||||
|
// actions, snippet, birdseye, and graph
|
||||||
|
canvasUtils.init(canvas, actions, snippet, birdseye, graph);
|
||||||
|
|
||||||
|
//Manually Boostrap Angular App
|
||||||
|
angularBridge.injector = angular.bootstrap($('body'), ['ngCanvasApp'], {strictDi: true});
|
||||||
|
|
||||||
|
// initialize the NiFi
|
||||||
|
var userXhr = canvas.init();
|
||||||
|
|
||||||
|
userXhr.done(function () {
|
||||||
|
// load the client id
|
||||||
|
var clientXhr = client.init();
|
||||||
|
|
||||||
|
// get the controller config to register the status poller
|
||||||
|
var configXhr = $.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: config.urls.flowConfig,
|
||||||
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
|
||||||
|
// ensure the config requests are loaded
|
||||||
|
$.when(configXhr, clusterSummary.loadClusterSummary(), userXhr, clientXhr).done(function (configResult) {
|
||||||
|
var configResponse = configResult[0];
|
||||||
|
|
||||||
|
// calculate the canvas offset
|
||||||
|
var canvasContainer = $('#canvas-container');
|
||||||
|
canvas.CANVAS_OFFSET = canvasContainer.offset().top;
|
||||||
|
|
||||||
|
// get the config details
|
||||||
|
var configDetails = configResponse.flowConfiguration;
|
||||||
|
|
||||||
|
// show disconnected message on load if necessary
|
||||||
|
if (clusterSummary.isClustered() && !clusterSummary.isConnectedToCluster()) {
|
||||||
|
dialog.showDisconnectedFromClusterMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the auto refresh interval
|
||||||
|
var autoRefreshIntervalSeconds = parseInt(configDetails.autoRefreshIntervalSeconds, 10);
|
||||||
|
|
||||||
|
// record whether we can configure the authorizer
|
||||||
|
canvas.setConfigurableAuthorizer(configDetails.supportsConfigurableAuthorizer);
|
||||||
|
|
||||||
|
// init storage
|
||||||
|
storage.init();
|
||||||
|
|
||||||
|
// initialize the application
|
||||||
|
canvas.initCanvas();
|
||||||
|
canvas.View.init();
|
||||||
|
// initialize the context menu and invert control of the actions
|
||||||
|
contextMenu.init(actions);
|
||||||
|
// initialize the shell and invert control of the context menu
|
||||||
|
shell.init(contextMenu);
|
||||||
|
angularBridge.injector.get('headerCtrl').init();
|
||||||
|
settings.init();
|
||||||
|
actions.init();
|
||||||
|
queueListing.init();
|
||||||
|
componentState.init();
|
||||||
|
|
||||||
|
// initialize the component behaviors
|
||||||
|
draggable.init();
|
||||||
|
connectable.init();
|
||||||
|
|
||||||
|
// initialize the chart
|
||||||
|
statusHistory.init(configDetails.timeOffset);
|
||||||
|
|
||||||
|
// initialize the birdseye
|
||||||
|
birdseye.init(graph);
|
||||||
|
|
||||||
|
// initialize the connection config and invert control of the birdseye and graph
|
||||||
|
connectionConfiguration.init(birdseye, graph);
|
||||||
|
controllerService.init();
|
||||||
|
reportingTask.init(settings);
|
||||||
|
policyManagement.init();
|
||||||
|
processorConfiguration.init();
|
||||||
|
// initialize the PG config and invert control of the controllerServices
|
||||||
|
processGroupConfiguration.init(controllerServices);
|
||||||
|
remoteProcessGroupConfiguration.init();
|
||||||
|
remoteProcessGroupPorts.init();
|
||||||
|
portConfiguration.init();
|
||||||
|
labelConfiguration.init();
|
||||||
|
processorDetails.init(true);
|
||||||
|
portDetails.init();
|
||||||
|
connectionDetails.init();
|
||||||
|
remoteProcessGroupDetails.init();
|
||||||
|
nfGoto.init();
|
||||||
|
graph.init().done(function () {
|
||||||
|
angularBridge.injector.get('graphControlsCtrl').init();
|
||||||
|
|
||||||
|
// determine the split between the polling
|
||||||
|
var pollingSplit = autoRefreshIntervalSeconds / 2;
|
||||||
|
|
||||||
|
// register the polling
|
||||||
|
setTimeout(function () {
|
||||||
|
canvas.startPolling(autoRefreshIntervalSeconds);
|
||||||
|
}, pollingSplit * 1000);
|
||||||
|
|
||||||
|
// hide the splash screen
|
||||||
|
canvas.hideSplash();
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
|
//initialize toolbox components tooltips
|
||||||
|
$('.component-button').qtip($.extend({}, common.config.tooltipConfig));
|
||||||
|
} else {
|
||||||
|
$('#message-title').text('Unsupported Browser');
|
||||||
|
$('#message-content').text('Flow graphs are shown using SVG. Please use a browser that supports rendering SVG.');
|
||||||
|
|
||||||
|
// show the error pane
|
||||||
|
$('#message-pane').show();
|
||||||
|
|
||||||
|
// hide the splash screen
|
||||||
|
canvas.hideSplash();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}));
|
|
@ -15,22 +15,34 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(['nf.ErrorHandler', 'nf.Common', 'nf.Canvas', 'nf.ContextMenu'], function (ajaxErrorHandler, common, canvas, contextMenu) {
|
define(['nf.ErrorHandler',
|
||||||
return (nf.ErrorHandler = factory(ajaxErrorHandler, common, canvas, contextMenu));
|
'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') {
|
} 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')));
|
module.exports = (nf.ErrorHandler =
|
||||||
|
factory(require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Canvas'),
|
||||||
|
require('nf.ContextMenu')));
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler = factory(root.nf.ErrorHandler, root.nf.Common, root.nf.Canvas, root.nf.ContextMenu);
|
nf.ErrorHandler = factory(root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Canvas,
|
||||||
|
root.nf.ContextMenu);
|
||||||
}
|
}
|
||||||
}(this, function (ajaxErrorHandler, common, canvas, contextMenu) {
|
}(this, function (ajaxErrorHandler, common, canvas, contextMenu) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for handling ajax errors. This also closes the canvas.
|
* Method for handling ajax errors. This also closes the canvas.
|
||||||
*
|
*
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -15,12 +15,28 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clipboard used for copying and pasting content.
|
* Clipboard used for copying and pasting content.
|
||||||
*/
|
*/
|
||||||
nf.Clipboard = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common'],
|
||||||
|
function ($, common) {
|
||||||
|
return (nf.Clipboard = factory($, common));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Clipboard =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common')));
|
||||||
|
} else {
|
||||||
|
nf.Clipboard = factory(root.$,
|
||||||
|
root.nf.Common);
|
||||||
|
}
|
||||||
|
}(this, function ($, common) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var COPY = 'copy';
|
var COPY = 'copy';
|
||||||
var PASTE = 'paste';
|
var PASTE = 'paste';
|
||||||
|
@ -30,28 +46,28 @@ nf.Clipboard = (function () {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Add a listener to receive copy and paste events.
|
* Add a listener to receive copy and paste events.
|
||||||
*
|
*
|
||||||
* @argument {object} listener A clipboard listener
|
* @argument {object} listener A clipboard listener
|
||||||
* @argument {function} funct Callback when clipboard events occur
|
* @argument {function} funct Callback when clipboard events occur
|
||||||
*/
|
*/
|
||||||
addListener: function (listener, funct) {
|
addListener: function (listener, funct) {
|
||||||
listeners[listener] = funct;
|
listeners[listener] = funct;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified listener.
|
* Remove the specified listener.
|
||||||
*
|
*
|
||||||
* @argument {object} listener A clipboard listener
|
* @argument {object} listener A clipboard listener
|
||||||
*/
|
*/
|
||||||
removeListener: function (listener) {
|
removeListener: function (listener) {
|
||||||
if (nf.Common.isDefinedAndNotNull(listeners[listener])) {
|
if (common.isDefinedAndNotNull(listeners[listener])) {
|
||||||
delete listeners[listener];
|
delete listeners[listener];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the specified data.
|
* Copy the specified data.
|
||||||
*
|
*
|
||||||
* @argument {object} d The data to copy to the clipboard
|
* @argument {object} d The data to copy to the clipboard
|
||||||
*/
|
*/
|
||||||
copy: function (d) {
|
copy: function (d) {
|
||||||
|
@ -62,14 +78,14 @@ nf.Clipboard = (function () {
|
||||||
listeners[listener].call(listener, COPY, data);
|
listeners[listener].call(listener, COPY, data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if any data has been copied.
|
* Checks to see if any data has been copied.
|
||||||
*/
|
*/
|
||||||
isCopied: function () {
|
isCopied: function () {
|
||||||
return nf.Common.isDefinedAndNotNull(data);
|
return common.isDefinedAndNotNull(data);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the most recent data thats copied. This operation
|
* Gets the most recent data thats copied. This operation
|
||||||
* will remove the corresponding data from the clipboard.
|
* will remove the corresponding data from the clipboard.
|
||||||
|
@ -77,7 +93,7 @@ nf.Clipboard = (function () {
|
||||||
paste: function () {
|
paste: function () {
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
// ensure there was data
|
// ensure there was data
|
||||||
if (nf.Common.isDefinedAndNotNull(data)) {
|
if (common.isDefinedAndNotNull(data)) {
|
||||||
var clipboardData = data;
|
var clipboardData = data;
|
||||||
|
|
||||||
// resolve the deferred
|
// resolve the deferred
|
||||||
|
@ -96,4 +112,4 @@ nf.Clipboard = (function () {
|
||||||
}).promise();
|
}).promise();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,12 +15,40 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Views state for a given component.
|
* Views state for a given component.
|
||||||
*/
|
*/
|
||||||
nf.ComponentState = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'Slick',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Common'],
|
||||||
|
function ($, Slick, clusterSummary, errorHandler, dialog, common) {
|
||||||
|
return (nf.ComponentState = factory($, Slick, clusterSummary, errorHandler, dialog, common));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ComponentState =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('Slick'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Common')));
|
||||||
|
} else {
|
||||||
|
nf.ComponentState = factory(root.$,
|
||||||
|
root.Slick,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Common);
|
||||||
|
}
|
||||||
|
}(this, function ($, Slick, clusterSummary, errorHandler, dialog, common) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the component state table.
|
* Filters the component state table.
|
||||||
|
@ -30,7 +58,7 @@ nf.ComponentState = (function () {
|
||||||
var componentStateTable = $('#component-state-table').data('gridInstance');
|
var componentStateTable = $('#component-state-table').data('gridInstance');
|
||||||
|
|
||||||
// ensure the grid has been initialized
|
// ensure the grid has been initialized
|
||||||
if (nf.Common.isDefinedAndNotNull(componentStateTable)) {
|
if (common.isDefinedAndNotNull(componentStateTable)) {
|
||||||
var componentStateData = componentStateTable.getData();
|
var componentStateData = componentStateTable.getData();
|
||||||
|
|
||||||
// update the search criteria
|
// update the search criteria
|
||||||
|
@ -67,7 +95,7 @@ nf.ComponentState = (function () {
|
||||||
|
|
||||||
// conditionally consider the scope
|
// conditionally consider the scope
|
||||||
var matchesScope = false;
|
var matchesScope = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(item['scope'])) {
|
if (common.isDefinedAndNotNull(item['scope'])) {
|
||||||
matchesScope = item['scope'].search(filterExp) >= 0;
|
matchesScope = item['scope'].search(filterExp) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +111,8 @@ nf.ComponentState = (function () {
|
||||||
var sort = function (sortDetails, data) {
|
var sort = function (sortDetails, data) {
|
||||||
// defines a function for sorting
|
// defines a function for sorting
|
||||||
var comparer = function (a, b) {
|
var comparer = function (a, b) {
|
||||||
var aString = nf.Common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
|
var aString = common.isDefinedAndNotNull(a[sortDetails.columnId]) ? a[sortDetails.columnId] : '';
|
||||||
var bString = nf.Common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
|
var bString = common.isDefinedAndNotNull(b[sortDetails.columnId]) ? b[sortDetails.columnId] : '';
|
||||||
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,7 +162,7 @@ nf.ComponentState = (function () {
|
||||||
componentStateData.beginUpdate();
|
componentStateData.beginUpdate();
|
||||||
|
|
||||||
// local state
|
// local state
|
||||||
if (nf.Common.isDefinedAndNotNull(localState)) {
|
if (common.isDefinedAndNotNull(localState)) {
|
||||||
$.each(localState.state, function (i, stateEntry) {
|
$.each(localState.state, function (i, stateEntry) {
|
||||||
componentStateData.addItem($.extend({
|
componentStateData.addItem($.extend({
|
||||||
id: count++,
|
id: count++,
|
||||||
|
@ -143,12 +171,12 @@ nf.ComponentState = (function () {
|
||||||
});
|
});
|
||||||
totalEntries += localState.totalEntryCount;
|
totalEntries += localState.totalEntryCount;
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(localState.state) && localState.totalEntryCount !== localState.state.length) {
|
if (common.isDefinedAndNotNull(localState.state) && localState.totalEntryCount !== localState.state.length) {
|
||||||
showPartialDetails = true;
|
showPartialDetails = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(clusterState)) {
|
if (common.isDefinedAndNotNull(clusterState)) {
|
||||||
$.each(clusterState.state, function (i, stateEntry) {
|
$.each(clusterState.state, function (i, stateEntry) {
|
||||||
componentStateData.addItem($.extend({
|
componentStateData.addItem($.extend({
|
||||||
id: count++,
|
id: count++,
|
||||||
|
@ -157,7 +185,7 @@ nf.ComponentState = (function () {
|
||||||
});
|
});
|
||||||
totalEntries += clusterState.totalEntryCount;
|
totalEntries += clusterState.totalEntryCount;
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(clusterState.state) && clusterState.totalEntryCount !== clusterState.state.length) {
|
if (common.isDefinedAndNotNull(clusterState.state) && clusterState.totalEntryCount !== clusterState.state.length) {
|
||||||
showPartialDetails = true;
|
showPartialDetails = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +199,7 @@ nf.ComponentState = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the total number of state entries
|
// update the total number of state entries
|
||||||
$('#total-component-state-entries').text(nf.Common.formatInteger(totalEntries));
|
$('#total-component-state-entries').text(common.formatInteger(totalEntries));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -253,9 +281,9 @@ nf.ComponentState = (function () {
|
||||||
|
|
||||||
// reload the table with no state
|
// reload the table with no state
|
||||||
loadComponentState()
|
loadComponentState()
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Component State',
|
headerText: 'Component State',
|
||||||
dialogContent: 'This component has no state to clear.'
|
dialogContent: 'This component has no state to clear.'
|
||||||
});
|
});
|
||||||
|
@ -282,7 +310,7 @@ nf.ComponentState = (function () {
|
||||||
];
|
];
|
||||||
|
|
||||||
// conditionally show the cluster node identifier
|
// conditionally show the cluster node identifier
|
||||||
if (nf.ClusterSummary.isClustered()) {
|
if (clusterSummary.isClustered()) {
|
||||||
componentStateColumns.push({
|
componentStateColumns.push({
|
||||||
id: 'scope',
|
id: 'scope',
|
||||||
field: 'scope',
|
field: 'scope',
|
||||||
|
@ -390,7 +418,7 @@ nf.ComponentState = (function () {
|
||||||
// reset the grid size
|
// reset the grid size
|
||||||
var componentStateGrid = componentStateTable.data('gridInstance');
|
var componentStateGrid = componentStateTable.data('gridInstance');
|
||||||
componentStateGrid.resizeCanvas();
|
componentStateGrid.resizeCanvas();
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,31 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Connectable = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['d3',
|
||||||
|
'nf.Connection',
|
||||||
|
'nf.ConnectionConfiguration',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function (d3, connection, connectionConfiguration, canvasUtils) {
|
||||||
|
return (nf.Connectable = factory(d3, connection, connectionConfiguration, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Connectable =
|
||||||
|
factory(require('d3'),
|
||||||
|
require('nf.Connection'),
|
||||||
|
require('nf.ConnectionConfiguration'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.Connectable = factory(root.d3,
|
||||||
|
root.nf.Connection,
|
||||||
|
root.nf.ConnectionConfiguration,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function (d3, connection, connectionConfiguration, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var connect;
|
var connect;
|
||||||
var canvas;
|
var canvas;
|
||||||
|
@ -56,7 +78,7 @@ nf.Connectable = (function () {
|
||||||
d3.event.sourceEvent.stopPropagation();
|
d3.event.sourceEvent.stopPropagation();
|
||||||
|
|
||||||
// unselect the previous components
|
// unselect the previous components
|
||||||
nf.CanvasUtils.getSelection().classed('selected', false);
|
canvasUtils.getSelection().classed('selected', false);
|
||||||
|
|
||||||
// mark the source component has selected
|
// mark the source component has selected
|
||||||
var source = d3.select(this.parentNode).classed('selected', true);
|
var source = d3.select(this.parentNode).classed('selected', true);
|
||||||
|
@ -106,7 +128,7 @@ nf.Connectable = (function () {
|
||||||
// component to itself. requiring the mouse to have actually moved before
|
// component to itself. requiring the mouse to have actually moved before
|
||||||
// checking the eligiblity of the destination addresses the issue
|
// checking the eligiblity of the destination addresses the issue
|
||||||
return (Math.abs(origin[0] - d3.event.x) > 10 || Math.abs(origin[1] - d3.event.y) > 10) &&
|
return (Math.abs(origin[0] - d3.event.x) > 10 || Math.abs(origin[1] - d3.event.y) > 10) &&
|
||||||
nf.CanvasUtils.isValidConnectionDestination(d3.select(this));
|
canvasUtils.isValidConnectionDestination(d3.select(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
// update the drag line
|
// update the drag line
|
||||||
|
@ -126,12 +148,12 @@ nf.Connectable = (function () {
|
||||||
var x = pathDatum.x;
|
var x = pathDatum.x;
|
||||||
var y = pathDatum.y;
|
var y = pathDatum.y;
|
||||||
var componentOffset = pathDatum.sourceWidth / 2;
|
var componentOffset = pathDatum.sourceWidth / 2;
|
||||||
var xOffset = nf.Connection.config.selfLoopXOffset;
|
var xOffset = connection.config.selfLoopXOffset;
|
||||||
var yOffset = nf.Connection.config.selfLoopYOffset;
|
var yOffset = connection.config.selfLoopYOffset;
|
||||||
return 'M' + x + ' ' + y + 'L' + (x + componentOffset + xOffset) + ' ' + (y - yOffset) + 'L' + (x + componentOffset + xOffset) + ' ' + (y + yOffset) + 'Z';
|
return 'M' + x + ' ' + y + 'L' + (x + componentOffset + xOffset) + ' ' + (y - yOffset) + 'L' + (x + componentOffset + xOffset) + ' ' + (y + yOffset) + 'Z';
|
||||||
} else {
|
} else {
|
||||||
// get the position on the destination perimeter
|
// get the position on the destination perimeter
|
||||||
var end = nf.CanvasUtils.getPerimeterPoint(pathDatum, {
|
var end = canvasUtils.getPerimeterPoint(pathDatum, {
|
||||||
'x': destinationData.position.x,
|
'x': destinationData.position.x,
|
||||||
'y': destinationData.position.y,
|
'y': destinationData.position.y,
|
||||||
'width': destinationData.dimensions.width,
|
'width': destinationData.dimensions.width,
|
||||||
|
@ -190,11 +212,16 @@ nf.Connectable = (function () {
|
||||||
|
|
||||||
// create the connection
|
// create the connection
|
||||||
var destinationData = destination.datum();
|
var destinationData = destination.datum();
|
||||||
nf.ConnectionConfiguration.createConnection(connectorData.sourceId, destinationData.id);
|
connectionConfiguration.createConnection(connectorData.sourceId, destinationData.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates the connect behavior for the components in the specified selection.
|
||||||
|
*
|
||||||
|
* @param {selection} components
|
||||||
|
*/
|
||||||
activate: function (components) {
|
activate: function (components) {
|
||||||
components
|
components
|
||||||
.classed('connectable', true)
|
.classed('connectable', true)
|
||||||
|
@ -203,7 +230,7 @@ nf.Connectable = (function () {
|
||||||
var selection = d3.select(this);
|
var selection = d3.select(this);
|
||||||
|
|
||||||
// ensure the current component supports connection source
|
// ensure the current component supports connection source
|
||||||
if (nf.CanvasUtils.isValidConnectionSource(selection)) {
|
if (canvasUtils.isValidConnectionSource(selection)) {
|
||||||
// see if theres already a connector rendered
|
// see if theres already a connector rendered
|
||||||
var addConnect = d3.select('text.add-connect');
|
var addConnect = d3.select('text.add-connect');
|
||||||
if (addConnect.empty()) {
|
if (addConnect.empty()) {
|
||||||
|
@ -245,6 +272,11 @@ nf.Connectable = (function () {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deactivates the connect behavior for the components in the specified selection.
|
||||||
|
*
|
||||||
|
* @param {selection} components
|
||||||
|
*/
|
||||||
deactivate: function (components) {
|
deactivate: function (components) {
|
||||||
components
|
components
|
||||||
.classed('connectable', false)
|
.classed('connectable', false)
|
||||||
|
@ -254,4 +286,4 @@ nf.Connectable = (function () {
|
||||||
.on('mouseout.connectable', null);
|
.on('mouseout.connectable', null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,46 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ConnectionConfiguration = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Connection'],
|
||||||
|
function ($, d3, errorHandler, common, dialog, client, canvasUtils, connection) {
|
||||||
|
return (nf.ConnectionConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, connection));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ConnectionConfiguration =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Connection')));
|
||||||
|
} else {
|
||||||
|
nf.ConnectionConfiguration = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Connection);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, connection) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfBirdseye;
|
||||||
|
var nfGraph;
|
||||||
|
|
||||||
var CONNECTION_OFFSET_Y_INCREMENT = 75;
|
var CONNECTION_OFFSET_Y_INCREMENT = 75;
|
||||||
var CONNECTION_OFFSET_X_INCREMENT = 200;
|
var CONNECTION_OFFSET_X_INCREMENT = 200;
|
||||||
|
@ -43,11 +80,11 @@ nf.ConnectionConfiguration = (function () {
|
||||||
*/
|
*/
|
||||||
var initializeSourceNewConnectionDialog = function (source) {
|
var initializeSourceNewConnectionDialog = function (source) {
|
||||||
// handle the selected source
|
// handle the selected source
|
||||||
if (nf.CanvasUtils.isProcessor(source)) {
|
if (canvasUtils.isProcessor(source)) {
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
// initialize the source processor
|
// initialize the source processor
|
||||||
initializeSourceProcessor(source).done(function (processor) {
|
initializeSourceProcessor(source).done(function (processor) {
|
||||||
if (!nf.Common.isEmpty(processor.relationships)) {
|
if (!common.isEmpty(processor.relationships)) {
|
||||||
// populate the available connections
|
// populate the available connections
|
||||||
$.each(processor.relationships, function (i, relationship) {
|
$.each(processor.relationships, function (i, relationship) {
|
||||||
createRelationshipOption(relationship.name);
|
createRelationshipOption(relationship.name);
|
||||||
|
@ -77,7 +114,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
addConnection(selectedRelationships);
|
addConnection(selectedRelationships);
|
||||||
} else {
|
} else {
|
||||||
// inform users that no relationships were selected
|
// inform users that no relationships were selected
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: 'The connection must have at least one relationship selected.'
|
dialogContent: 'The connection must have at least one relationship selected.'
|
||||||
});
|
});
|
||||||
|
@ -106,9 +143,9 @@ nf.ConnectionConfiguration = (function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
} else {
|
} else {
|
||||||
// there are no relationships for this processor
|
// there are no relationships for this processor
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: '\'' + nf.Common.escapeHtml(processor.name) + '\' does not support any relationships.'
|
dialogContent: '\'' + common.escapeHtml(processor.name) + '\' does not support any relationships.'
|
||||||
});
|
});
|
||||||
|
|
||||||
// reset the dialog
|
// reset the dialog
|
||||||
|
@ -124,11 +161,11 @@ nf.ConnectionConfiguration = (function () {
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
// determine how to initialize the source
|
// determine how to initialize the source
|
||||||
var connectionSourceDeferred;
|
var connectionSourceDeferred;
|
||||||
if (nf.CanvasUtils.isInputPort(source)) {
|
if (canvasUtils.isInputPort(source)) {
|
||||||
connectionSourceDeferred = initializeSourceInputPort(source);
|
connectionSourceDeferred = initializeSourceInputPort(source);
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(source)) {
|
} else if (canvasUtils.isRemoteProcessGroup(source)) {
|
||||||
connectionSourceDeferred = initializeSourceRemoteProcessGroup(source);
|
connectionSourceDeferred = initializeSourceRemoteProcessGroup(source);
|
||||||
} else if (nf.CanvasUtils.isProcessGroup(source)) {
|
} else if (canvasUtils.isProcessGroup(source)) {
|
||||||
connectionSourceDeferred = initializeSourceProcessGroup(source);
|
connectionSourceDeferred = initializeSourceProcessGroup(source);
|
||||||
} else {
|
} else {
|
||||||
connectionSourceDeferred = initializeSourceFunnel(source);
|
connectionSourceDeferred = initializeSourceFunnel(source);
|
||||||
|
@ -196,8 +233,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-source-component-id').val(inputPortData.id);
|
$('#connection-source-component-id').val(inputPortData.id);
|
||||||
|
|
||||||
// populate the group details
|
// populate the group details
|
||||||
$('#connection-source-group-id').val(nf.Canvas.getGroupId());
|
$('#connection-source-group-id').val(canvasUtils.getGroupId());
|
||||||
$('#connection-source-group-name').text(nf.Canvas.getGroupName());
|
$('#connection-source-group-name').text(canvasUtils.getGroupName());
|
||||||
|
|
||||||
// resolve the deferred
|
// resolve the deferred
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -222,8 +259,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-source-component-id').val(funnelData.id);
|
$('#connection-source-component-id').val(funnelData.id);
|
||||||
|
|
||||||
// populate the group details
|
// populate the group details
|
||||||
$('#connection-source-group-id').val(nf.Canvas.getGroupId());
|
$('#connection-source-group-id').val(canvasUtils.getGroupId());
|
||||||
$('#connection-source-group-name').text(nf.Canvas.getGroupName());
|
$('#connection-source-group-name').text(canvasUtils.getGroupName());
|
||||||
|
|
||||||
// resolve the deferred
|
// resolve the deferred
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -240,7 +277,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
// get the processor data
|
// get the processor data
|
||||||
var processorData = source.datum();
|
var processorData = source.datum();
|
||||||
var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id;
|
var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id;
|
||||||
var processorType = processorData.permissions.canRead ? nf.Common.substringAfterLast(processorData.component.type, '.') : 'Processor';
|
var processorType = processorData.permissions.canRead ? common.substringAfterLast(processorData.component.type, '.') : 'Processor';
|
||||||
|
|
||||||
// populate the source processor information
|
// populate the source processor information
|
||||||
$('#processor-source').show();
|
$('#processor-source').show();
|
||||||
|
@ -252,8 +289,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-source-component-id').val(processorData.id);
|
$('#connection-source-component-id').val(processorData.id);
|
||||||
|
|
||||||
// populate the group details
|
// populate the group details
|
||||||
$('#connection-source-group-id').val(nf.Canvas.getGroupId());
|
$('#connection-source-group-id').val(canvasUtils.getGroupId());
|
||||||
$('#connection-source-group-name').text(nf.Canvas.getGroupName());
|
$('#connection-source-group-name').text(canvasUtils.getGroupName());
|
||||||
|
|
||||||
// show the available relationships
|
// show the available relationships
|
||||||
$('#relationship-names-container').show();
|
$('#relationship-names-container').show();
|
||||||
|
@ -290,13 +327,13 @@ nf.ConnectionConfiguration = (function () {
|
||||||
options.push({
|
options.push({
|
||||||
text: component.name,
|
text: component.name,
|
||||||
value: component.id,
|
value: component.id,
|
||||||
description: nf.Common.escapeHtml(component.comments)
|
description: common.escapeHtml(component.comments)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// only proceed if there are output ports
|
// only proceed if there are output ports
|
||||||
if (!nf.Common.isEmpty(options)) {
|
if (!common.isEmpty(options)) {
|
||||||
$('#output-port-source').show();
|
$('#output-port-source').show();
|
||||||
|
|
||||||
// sort the options
|
// sort the options
|
||||||
|
@ -322,13 +359,13 @@ nf.ConnectionConfiguration = (function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
} else {
|
} else {
|
||||||
var message = '\'' + nf.Common.escapeHtml(processGroupName) + '\' does not have any output ports.';
|
var message = '\'' + common.escapeHtml(processGroupName) + '\' does not have any output ports.';
|
||||||
if (nf.Common.isEmpty(processGroupContents.outputPorts) === false) {
|
if (common.isEmpty(processGroupContents.outputPorts) === false) {
|
||||||
message = 'Not authorized for any output ports in \'' + nf.Common.escapeHtml(processGroupName) + '\'.';
|
message = 'Not authorized for any output ports in \'' + common.escapeHtml(processGroupName) + '\'.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// there are no output ports for this process group
|
// there are no output ports for this process group
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: message
|
dialogContent: message
|
||||||
});
|
});
|
||||||
|
@ -340,7 +377,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
// handle the error
|
// handle the error
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -366,7 +403,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var remoteProcessGroupContents = remoteProcessGroup.contents;
|
var remoteProcessGroupContents = remoteProcessGroup.contents;
|
||||||
|
|
||||||
// only proceed if there are output ports
|
// only proceed if there are output ports
|
||||||
if (!nf.Common.isEmpty(remoteProcessGroupContents.outputPorts)) {
|
if (!common.isEmpty(remoteProcessGroupContents.outputPorts)) {
|
||||||
$('#output-port-source').show();
|
$('#output-port-source').show();
|
||||||
|
|
||||||
// show the output port options
|
// show the output port options
|
||||||
|
@ -376,7 +413,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
text: outputPort.name,
|
text: outputPort.name,
|
||||||
value: outputPort.id,
|
value: outputPort.id,
|
||||||
disabled: outputPort.exists === false,
|
disabled: outputPort.exists === false,
|
||||||
description: nf.Common.escapeHtml(outputPort.comments)
|
description: common.escapeHtml(outputPort.comments)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -404,9 +441,9 @@ nf.ConnectionConfiguration = (function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
} else {
|
} else {
|
||||||
// there are no relationships for this processor
|
// there are no relationships for this processor
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: '\'' + nf.Common.escapeHtml(remoteProcessGroup.name) + '\' does not have any output ports.'
|
dialogContent: '\'' + common.escapeHtml(remoteProcessGroup.name) + '\' does not have any output ports.'
|
||||||
});
|
});
|
||||||
|
|
||||||
// reset the dialog
|
// reset the dialog
|
||||||
|
@ -416,7 +453,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
// handle the error
|
// handle the error
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -424,13 +461,13 @@ nf.ConnectionConfiguration = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var initializeDestinationNewConnectionDialog = function (destination) {
|
var initializeDestinationNewConnectionDialog = function (destination) {
|
||||||
if (nf.CanvasUtils.isOutputPort(destination)) {
|
if (canvasUtils.isOutputPort(destination)) {
|
||||||
return initializeDestinationOutputPort(destination);
|
return initializeDestinationOutputPort(destination);
|
||||||
} else if (nf.CanvasUtils.isProcessor(destination)) {
|
} else if (canvasUtils.isProcessor(destination)) {
|
||||||
return initializeDestinationProcessor(destination);
|
return initializeDestinationProcessor(destination);
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
|
} else if (canvasUtils.isRemoteProcessGroup(destination)) {
|
||||||
return initializeDestinationRemoteProcessGroup(destination);
|
return initializeDestinationRemoteProcessGroup(destination);
|
||||||
} else if (nf.CanvasUtils.isFunnel(destination)) {
|
} else if (canvasUtils.isFunnel(destination)) {
|
||||||
return initializeDestinationFunnel(destination);
|
return initializeDestinationFunnel(destination);
|
||||||
} else {
|
} else {
|
||||||
return initializeDestinationProcessGroup(destination);
|
return initializeDestinationProcessGroup(destination);
|
||||||
|
@ -450,8 +487,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-destination-component-id').val(outputPortData.id);
|
$('#connection-destination-component-id').val(outputPortData.id);
|
||||||
|
|
||||||
// populate the group details
|
// populate the group details
|
||||||
$('#connection-destination-group-id').val(nf.Canvas.getGroupId());
|
$('#connection-destination-group-id').val(canvasUtils.getGroupId());
|
||||||
$('#connection-destination-group-name').text(nf.Canvas.getGroupName());
|
$('#connection-destination-group-name').text(canvasUtils.getGroupName());
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).promise();
|
}).promise();
|
||||||
|
@ -468,8 +505,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-destination-component-id').val(funnelData.id);
|
$('#connection-destination-component-id').val(funnelData.id);
|
||||||
|
|
||||||
// populate the group details
|
// populate the group details
|
||||||
$('#connection-destination-group-id').val(nf.Canvas.getGroupId());
|
$('#connection-destination-group-id').val(canvasUtils.getGroupId());
|
||||||
$('#connection-destination-group-name').text(nf.Canvas.getGroupName());
|
$('#connection-destination-group-name').text(canvasUtils.getGroupName());
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).promise();
|
}).promise();
|
||||||
|
@ -479,7 +516,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
var processorData = destination.datum();
|
var processorData = destination.datum();
|
||||||
var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id;
|
var processorName = processorData.permissions.canRead ? processorData.component.name : processorData.id;
|
||||||
var processorType = processorData.permissions.canRead ? nf.Common.substringAfterLast(processorData.component.type, '.') : 'Processor';
|
var processorType = processorData.permissions.canRead ? common.substringAfterLast(processorData.component.type, '.') : 'Processor';
|
||||||
|
|
||||||
$('#processor-destination').show();
|
$('#processor-destination').show();
|
||||||
$('#processor-destination-name').text(processorName).attr('title', processorName);
|
$('#processor-destination-name').text(processorName).attr('title', processorName);
|
||||||
|
@ -490,8 +527,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-destination-component-id').val(processorData.id);
|
$('#connection-destination-component-id').val(processorData.id);
|
||||||
|
|
||||||
// populate the group details
|
// populate the group details
|
||||||
$('#connection-destination-group-id').val(nf.Canvas.getGroupId());
|
$('#connection-destination-group-id').val(canvasUtils.getGroupId());
|
||||||
$('#connection-destination-group-name').text(nf.Canvas.getGroupName());
|
$('#connection-destination-group-name').text(canvasUtils.getGroupName());
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).promise();
|
}).promise();
|
||||||
|
@ -521,12 +558,12 @@ nf.ConnectionConfiguration = (function () {
|
||||||
options.push({
|
options.push({
|
||||||
text: inputPort.permissions.canRead ? inputPort.component.name : inputPort.id,
|
text: inputPort.permissions.canRead ? inputPort.component.name : inputPort.id,
|
||||||
value: inputPort.id,
|
value: inputPort.id,
|
||||||
description: inputPort.permissions.canRead ? nf.Common.escapeHtml(inputPort.component.comments) : null
|
description: inputPort.permissions.canRead ? common.escapeHtml(inputPort.component.comments) : null
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// only proceed if there are output ports
|
// only proceed if there are output ports
|
||||||
if (!nf.Common.isEmpty(options)) {
|
if (!common.isEmpty(options)) {
|
||||||
$('#input-port-destination').show();
|
$('#input-port-destination').show();
|
||||||
|
|
||||||
// sort the options
|
// sort the options
|
||||||
|
@ -553,9 +590,9 @@ nf.ConnectionConfiguration = (function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
} else {
|
} else {
|
||||||
// there are no relationships for this processor
|
// there are no relationships for this processor
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: '\'' + nf.Common.escapeHtml(processGroupName) + '\' does not have any input ports.'
|
dialogContent: '\'' + common.escapeHtml(processGroupName) + '\' does not have any input ports.'
|
||||||
});
|
});
|
||||||
|
|
||||||
// reset the dialog
|
// reset the dialog
|
||||||
|
@ -565,7 +602,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
// handle the error
|
// handle the error
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -591,7 +628,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var remoteProcessGroupContents = remoteProcessGroup.contents;
|
var remoteProcessGroupContents = remoteProcessGroup.contents;
|
||||||
|
|
||||||
// only proceed if there are output ports
|
// only proceed if there are output ports
|
||||||
if (!nf.Common.isEmpty(remoteProcessGroupContents.inputPorts)) {
|
if (!common.isEmpty(remoteProcessGroupContents.inputPorts)) {
|
||||||
$('#input-port-destination').show();
|
$('#input-port-destination').show();
|
||||||
|
|
||||||
// show the input port options
|
// show the input port options
|
||||||
|
@ -601,7 +638,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
text: inputPort.name,
|
text: inputPort.name,
|
||||||
value: inputPort.id,
|
value: inputPort.id,
|
||||||
disabled: inputPort.exists === false,
|
disabled: inputPort.exists === false,
|
||||||
description: nf.Common.escapeHtml(inputPort.comments)
|
description: common.escapeHtml(inputPort.comments)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -629,9 +666,9 @@ nf.ConnectionConfiguration = (function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
} else {
|
} else {
|
||||||
// there are no relationships for this processor
|
// there are no relationships for this processor
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: '\'' + nf.Common.escapeHtml(remoteProcessGroup.name) + '\' does not have any input ports.'
|
dialogContent: '\'' + common.escapeHtml(remoteProcessGroup.name) + '\' does not have any input ports.'
|
||||||
});
|
});
|
||||||
|
|
||||||
// reset the dialog
|
// reset the dialog
|
||||||
|
@ -641,7 +678,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
// handle the error
|
// handle the error
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -679,11 +716,11 @@ nf.ConnectionConfiguration = (function () {
|
||||||
* @argument {selection} source The source
|
* @argument {selection} source The source
|
||||||
*/
|
*/
|
||||||
var initializeSourceEditConnectionDialog = function (source) {
|
var initializeSourceEditConnectionDialog = function (source) {
|
||||||
if (nf.CanvasUtils.isProcessor(source)) {
|
if (canvasUtils.isProcessor(source)) {
|
||||||
return initializeSourceProcessor(source);
|
return initializeSourceProcessor(source);
|
||||||
} else if (nf.CanvasUtils.isInputPort(source)) {
|
} else if (canvasUtils.isInputPort(source)) {
|
||||||
return initializeSourceInputPort(source);
|
return initializeSourceInputPort(source);
|
||||||
} else if (nf.CanvasUtils.isFunnel(source)) {
|
} else if (canvasUtils.isFunnel(source)) {
|
||||||
return initializeSourceFunnel(source);
|
return initializeSourceFunnel(source);
|
||||||
} else {
|
} else {
|
||||||
return initializeSourceReadOnlyGroup(source);
|
return initializeSourceReadOnlyGroup(source);
|
||||||
|
@ -697,13 +734,13 @@ nf.ConnectionConfiguration = (function () {
|
||||||
* @argument {object} connectionDestination The connection destination object
|
* @argument {object} connectionDestination The connection destination object
|
||||||
*/
|
*/
|
||||||
var initializeDestinationEditConnectionDialog = function (destination, connectionDestination) {
|
var initializeDestinationEditConnectionDialog = function (destination, connectionDestination) {
|
||||||
if (nf.CanvasUtils.isProcessor(destination)) {
|
if (canvasUtils.isProcessor(destination)) {
|
||||||
return initializeDestinationProcessor(destination);
|
return initializeDestinationProcessor(destination);
|
||||||
} else if (nf.CanvasUtils.isOutputPort(destination)) {
|
} else if (canvasUtils.isOutputPort(destination)) {
|
||||||
return initializeDestinationOutputPort(destination);
|
return initializeDestinationOutputPort(destination);
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
|
} else if (canvasUtils.isRemoteProcessGroup(destination)) {
|
||||||
return initializeDestinationRemoteProcessGroup(destination, connectionDestination);
|
return initializeDestinationRemoteProcessGroup(destination, connectionDestination);
|
||||||
} else if (nf.CanvasUtils.isFunnel(destination)) {
|
} else if (canvasUtils.isFunnel(destination)) {
|
||||||
return initializeDestinationFunnel(destination);
|
return initializeDestinationFunnel(destination);
|
||||||
} else {
|
} else {
|
||||||
return initializeDestinationProcessGroup(destination);
|
return initializeDestinationProcessGroup(destination);
|
||||||
|
@ -750,8 +787,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
y: sourceData.position.y + (sourceData.dimensions.height / 2)
|
y: sourceData.position.y + (sourceData.dimensions.height / 2)
|
||||||
};
|
};
|
||||||
|
|
||||||
var xOffset = nf.Connection.config.selfLoopXOffset;
|
var xOffset = connection.config.selfLoopXOffset;
|
||||||
var yOffset = nf.Connection.config.selfLoopYOffset;
|
var yOffset = connection.config.selfLoopYOffset;
|
||||||
bends.push({
|
bends.push({
|
||||||
'x': (rightCenter.x + xOffset),
|
'x': (rightCenter.x + xOffset),
|
||||||
'y': (rightCenter.y - yOffset)
|
'y': (rightCenter.y - yOffset)
|
||||||
|
@ -764,11 +801,11 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var existingConnections = [];
|
var existingConnections = [];
|
||||||
|
|
||||||
// get all connections for the source component
|
// get all connections for the source component
|
||||||
var connectionsForSourceComponent = nf.Connection.getComponentConnections(sourceComponentId);
|
var connectionsForSourceComponent = connection.getComponentConnections(sourceComponentId);
|
||||||
$.each(connectionsForSourceComponent, function (_, connectionForSourceComponent) {
|
$.each(connectionsForSourceComponent, function (_, connectionForSourceComponent) {
|
||||||
// get the id for the source/destination component
|
// get the id for the source/destination component
|
||||||
var connectionSourceComponentId = nf.CanvasUtils.getConnectionSourceComponentId(connectionForSourceComponent);
|
var connectionSourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionForSourceComponent);
|
||||||
var connectionDestinationComponentId = nf.CanvasUtils.getConnectionDestinationComponentId(connectionForSourceComponent);
|
var connectionDestinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionForSourceComponent);
|
||||||
|
|
||||||
// if the connection is between these same components, consider it for collisions
|
// if the connection is between these same components, consider it for collisions
|
||||||
if ((connectionSourceComponentId === sourceComponentId && connectionDestinationComponentId === destinationComponentId) ||
|
if ((connectionSourceComponentId === sourceComponentId && connectionDestinationComponentId === destinationComponentId) ||
|
||||||
|
@ -785,7 +822,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$.each(existingConnections, function (_, existingConnection) {
|
$.each(existingConnections, function (_, existingConnection) {
|
||||||
// only consider multiple connections with no bend points a collision, the existance of
|
// only consider multiple connections with no bend points a collision, the existance of
|
||||||
// bend points suggests that the user has placed the connection into a desired location
|
// bend points suggests that the user has placed the connection into a desired location
|
||||||
if (nf.Common.isEmpty(existingConnection.bends)) {
|
if (common.isEmpty(existingConnection.bends)) {
|
||||||
avoidCollision = true;
|
avoidCollision = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -805,7 +842,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var collides = function (x, y) {
|
var collides = function (x, y) {
|
||||||
var collides = false;
|
var collides = false;
|
||||||
$.each(existingConnections, function (_, existingConnection) {
|
$.each(existingConnections, function (_, existingConnection) {
|
||||||
if (!nf.Common.isEmpty(existingConnection.bends)) {
|
if (!common.isEmpty(existingConnection.bends)) {
|
||||||
if (isMoreHorizontal) {
|
if (isMoreHorizontal) {
|
||||||
// horizontal lines are adjusted in the y space
|
// horizontal lines are adjusted in the y space
|
||||||
if (existingConnection.bends[0].y === y) {
|
if (existingConnection.bends[0].y === y) {
|
||||||
|
@ -863,8 +900,8 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var destinationGroupId = $('#connection-destination-group-id').val();
|
var destinationGroupId = $('#connection-destination-group-id').val();
|
||||||
|
|
||||||
// determine the source and destination types
|
// determine the source and destination types
|
||||||
var sourceType = nf.CanvasUtils.getConnectableTypeForSource(source);
|
var sourceType = canvasUtils.getConnectableTypeForSource(source);
|
||||||
var destinationType = nf.CanvasUtils.getConnectableTypeForDestination(destination);
|
var destinationType = canvasUtils.getConnectableTypeForDestination(destination);
|
||||||
|
|
||||||
// get the settings
|
// get the settings
|
||||||
var connectionName = $('#connection-name').val();
|
var connectionName = $('#connection-name').val();
|
||||||
|
@ -875,7 +912,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
|
|
||||||
if (validateSettings()) {
|
if (validateSettings()) {
|
||||||
var connectionEntity = {
|
var connectionEntity = {
|
||||||
'revision': nf.Client.getRevision({
|
'revision': client.getRevision({
|
||||||
'revision': {
|
'revision': {
|
||||||
'version': 0
|
'version': 0
|
||||||
}
|
}
|
||||||
|
@ -904,29 +941,29 @@ nf.ConnectionConfiguration = (function () {
|
||||||
// create the new connection
|
// create the new connection
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: config.urls.api + '/process-groups/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/connections',
|
url: config.urls.api + '/process-groups/' + encodeURIComponent(canvasUtils.getGroupId()) + '/connections',
|
||||||
data: JSON.stringify(connectionEntity),
|
data: JSON.stringify(connectionEntity),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// add the connection
|
// add the connection
|
||||||
nf.Graph.add({
|
nfGraph.add({
|
||||||
'connections': [response]
|
'connections': [response]
|
||||||
}, {
|
}, {
|
||||||
'selectAll': true
|
'selectAll': true
|
||||||
});
|
});
|
||||||
|
|
||||||
// reload the connections source/destination components
|
// reload the connections source/destination components
|
||||||
nf.CanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
|
canvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
|
||||||
|
|
||||||
// update component visibility
|
// update component visibility
|
||||||
nf.Canvas.View.updateVisibility();
|
nfGraph.updateVisibility();
|
||||||
|
|
||||||
// update the birdseye
|
// update the birdseye
|
||||||
nf.Birdseye.refresh();
|
nfBirdseye.refresh();
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
// handle the error
|
// handle the error
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -947,7 +984,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
// get the destination details
|
// get the destination details
|
||||||
var destinationComponentId = $('#connection-destination-component-id').val();
|
var destinationComponentId = $('#connection-destination-component-id').val();
|
||||||
var destination = d3.select('#id-' + destinationComponentId);
|
var destination = d3.select('#id-' + destinationComponentId);
|
||||||
var destinationType = nf.CanvasUtils.getConnectableTypeForDestination(destination);
|
var destinationType = canvasUtils.getConnectableTypeForDestination(destination);
|
||||||
|
|
||||||
// get the destination details
|
// get the destination details
|
||||||
var destinationId = $('#connection-destination-id').val();
|
var destinationId = $('#connection-destination-id').val();
|
||||||
|
@ -961,9 +998,9 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var prioritizers = $('#prioritizer-selected').sortable('toArray');
|
var prioritizers = $('#prioritizer-selected').sortable('toArray');
|
||||||
|
|
||||||
if (validateSettings()) {
|
if (validateSettings()) {
|
||||||
var d = nf.Connection.get(connectionId);
|
var d = connection.get(connectionId);
|
||||||
var connectionEntity = {
|
var connectionEntity = {
|
||||||
'revision': nf.Client.getRevision(d),
|
'revision': client.getRevision(d),
|
||||||
'component': {
|
'component': {
|
||||||
'id': connectionId,
|
'id': connectionId,
|
||||||
'name': connectionName,
|
'name': connectionName,
|
||||||
|
@ -989,18 +1026,18 @@ nf.ConnectionConfiguration = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// update this connection
|
// update this connection
|
||||||
nf.Connection.set(response);
|
connection.set(response);
|
||||||
|
|
||||||
// reload the connections source/destination components
|
// reload the connections source/destination components
|
||||||
nf.CanvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
|
canvasUtils.reloadConnectionSourceAndDestination(sourceComponentId, destinationComponentId);
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText),
|
dialogContent: common.escapeHtml(xhr.responseText),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -1041,20 +1078,20 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var errors = [];
|
var errors = [];
|
||||||
|
|
||||||
// validate the settings
|
// validate the settings
|
||||||
if (nf.Common.isBlank($('#flow-file-expiration').val())) {
|
if (common.isBlank($('#flow-file-expiration').val())) {
|
||||||
errors.push('File expiration must be specified');
|
errors.push('File expiration must be specified');
|
||||||
}
|
}
|
||||||
if (!$.isNumeric($('#back-pressure-object-threshold').val())) {
|
if (!$.isNumeric($('#back-pressure-object-threshold').val())) {
|
||||||
errors.push('Back pressure object threshold must be an integer value');
|
errors.push('Back pressure object threshold must be an integer value');
|
||||||
}
|
}
|
||||||
if (nf.Common.isBlank($('#back-pressure-data-size-threshold').val())) {
|
if (common.isBlank($('#back-pressure-data-size-threshold').val())) {
|
||||||
errors.push('Back pressure data size threshold must be specified');
|
errors.push('Back pressure data size threshold must be specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: nf.Common.formatUnorderedList(errors)
|
dialogContent: common.formatUnorderedList(errors)
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1093,7 +1130,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#relationship-names-container').hide();
|
$('#relationship-names-container').hide();
|
||||||
|
|
||||||
// clear the id field
|
// clear the id field
|
||||||
nf.Common.clearField('connection-id');
|
common.clearField('connection-id');
|
||||||
|
|
||||||
// hide all the connection source panels
|
// hide all the connection source panels
|
||||||
$('#processor-source').hide();
|
$('#processor-source').hide();
|
||||||
|
@ -1126,8 +1163,18 @@ nf.ConnectionConfiguration = (function () {
|
||||||
removeTempEdge();
|
removeTempEdge();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfConnectionConfiguration = {
|
||||||
init: function () {
|
|
||||||
|
/**
|
||||||
|
* Initialize the connection configuration.
|
||||||
|
*
|
||||||
|
* @param birdseye The reference to the birdseye controller.
|
||||||
|
* @param graph The reference to the graph controller.
|
||||||
|
*/
|
||||||
|
init: function (birdseye, graph) {
|
||||||
|
nfBirdseye = birdseye;
|
||||||
|
nfGraph = graph;
|
||||||
|
|
||||||
// initially hide the relationship names container
|
// initially hide the relationship names container
|
||||||
$('#relationship-names-container').hide();
|
$('#relationship-names-container').hide();
|
||||||
|
|
||||||
|
@ -1141,7 +1188,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
resetDialog();
|
resetDialog();
|
||||||
},
|
},
|
||||||
open: function () {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1168,7 +1215,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// create an element for each available prioritizer
|
// create an element for each available prioritizer
|
||||||
$.each(response.prioritizerTypes, function (i, documentedType) {
|
$.each(response.prioritizerTypes, function (i, documentedType) {
|
||||||
nf.ConnectionConfiguration.addAvailablePrioritizer('#prioritizer-available', documentedType);
|
nfConnectionConfiguration.addAvailablePrioritizer('#prioritizer-available', documentedType);
|
||||||
});
|
});
|
||||||
|
|
||||||
// make the prioritizer containers sortable
|
// make the prioritizer containers sortable
|
||||||
|
@ -1179,7 +1226,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
opacity: 0.6
|
opacity: 0.6
|
||||||
});
|
});
|
||||||
$('#prioritizer-available, #prioritizer-selected').disableSelection();
|
$('#prioritizer-available, #prioritizer-selected').disableSelection();
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1190,17 +1237,17 @@ nf.ConnectionConfiguration = (function () {
|
||||||
*/
|
*/
|
||||||
addAvailablePrioritizer: function (prioritizerContainer, prioritizerType) {
|
addAvailablePrioritizer: function (prioritizerContainer, prioritizerType) {
|
||||||
var type = prioritizerType.type;
|
var type = prioritizerType.type;
|
||||||
var name = nf.Common.substringAfterLast(type, '.');
|
var name = common.substringAfterLast(type, '.');
|
||||||
|
|
||||||
// add the prioritizers to the available list
|
// add the prioritizers to the available list
|
||||||
var prioritizerList = $(prioritizerContainer);
|
var prioritizerList = $(prioritizerContainer);
|
||||||
var prioritizer = $('<li></li>').append($('<span style="float: left;"></span>').text(name)).attr('id', type).addClass('ui-state-default').appendTo(prioritizerList);
|
var prioritizer = $('<li></li>').append($('<span style="float: left;"></span>').text(name)).attr('id', type).addClass('ui-state-default').appendTo(prioritizerList);
|
||||||
|
|
||||||
// add the description if applicable
|
// add the description if applicable
|
||||||
if (nf.Common.isDefinedAndNotNull(prioritizerType.description)) {
|
if (common.isDefinedAndNotNull(prioritizerType.description)) {
|
||||||
$('<div class="fa fa-question-circle" style="float: right; margin-right: 5px;""></div>').appendTo(prioritizer).qtip($.extend({
|
$('<div class="fa fa-question-circle" style="float: right; margin-right: 5px;""></div>').appendTo(prioritizer).qtip($.extend({
|
||||||
content: nf.Common.escapeHtml(prioritizerType.description)
|
content: common.escapeHtml(prioritizerType.description)
|
||||||
}, nf.Common.config.tooltipConfig));
|
}, common.config.tooltipConfig));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1236,7 +1283,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#connection-configuration div.relationship-name').ellipsis();
|
$('#connection-configuration div.relationship-name').ellipsis();
|
||||||
|
|
||||||
// fill in the connection id
|
// fill in the connection id
|
||||||
nf.Common.populateField('connection-id', null);
|
common.populateField('connection-id', null);
|
||||||
|
|
||||||
// show the border if necessary
|
// show the border if necessary
|
||||||
var relationshipNames = $('#relationship-names');
|
var relationshipNames = $('#relationship-names');
|
||||||
|
@ -1262,12 +1309,12 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var connection = connectionEntry.component;
|
var connection = connectionEntry.component;
|
||||||
|
|
||||||
// identify the source component
|
// identify the source component
|
||||||
var sourceComponentId = nf.CanvasUtils.getConnectionSourceComponentId(connectionEntry);
|
var sourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionEntry);
|
||||||
var source = d3.select('#id-' + sourceComponentId);
|
var source = d3.select('#id-' + sourceComponentId);
|
||||||
|
|
||||||
// identify the destination component
|
// identify the destination component
|
||||||
if (nf.Common.isUndefinedOrNull(destination)) {
|
if (common.isUndefinedOrNull(destination)) {
|
||||||
var destinationComponentId = nf.CanvasUtils.getConnectionDestinationComponentId(connectionEntry);
|
var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionEntry);
|
||||||
destination = d3.select('#id-' + destinationComponentId);
|
destination = d3.select('#id-' + destinationComponentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,7 +1324,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var selectedRelationships = connection.selectedRelationships;
|
var selectedRelationships = connection.selectedRelationships;
|
||||||
|
|
||||||
// show the available relationship if applicable
|
// 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
|
// populate the available connections
|
||||||
$.each(availableRelationships, function (i, name) {
|
$.each(availableRelationships, function (i, name) {
|
||||||
createRelationshipOption(name);
|
createRelationshipOption(name);
|
||||||
|
@ -1304,14 +1351,14 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the source is a process group or remote process group, select the appropriate port if applicable
|
// if the source is a process group or remote process group, select the appropriate port if applicable
|
||||||
if (nf.CanvasUtils.isProcessGroup(source) || nf.CanvasUtils.isRemoteProcessGroup(source)) {
|
if (canvasUtils.isProcessGroup(source) || canvasUtils.isRemoteProcessGroup(source)) {
|
||||||
// populate the connection source details
|
// populate the connection source details
|
||||||
$('#connection-source-id').val(connection.source.id);
|
$('#connection-source-id').val(connection.source.id);
|
||||||
$('#read-only-output-port-name').text(connection.source.name).attr('title', connection.source.name);
|
$('#read-only-output-port-name').text(connection.source.name).attr('title', connection.source.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the destination is a process gorup or remote process group, select the appropriate port if applicable
|
// if the destination is a process gorup or remote process group, select the appropriate port if applicable
|
||||||
if (nf.CanvasUtils.isProcessGroup(destination) || nf.CanvasUtils.isRemoteProcessGroup(destination)) {
|
if (canvasUtils.isProcessGroup(destination) || canvasUtils.isRemoteProcessGroup(destination)) {
|
||||||
var destinationData = destination.datum();
|
var destinationData = destination.datum();
|
||||||
|
|
||||||
// when the group ids differ, its a new destination component so we don't want to preselect any port
|
// when the group ids differ, its a new destination component so we don't want to preselect any port
|
||||||
|
@ -1329,7 +1376,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
$('#back-pressure-data-size-threshold').val(connection.backPressureDataSizeThreshold);
|
$('#back-pressure-data-size-threshold').val(connection.backPressureDataSizeThreshold);
|
||||||
|
|
||||||
// format the connection id
|
// format the connection id
|
||||||
nf.Common.populateField('connection-id', connection.id);
|
common.populateField('connection-id', connection.id);
|
||||||
|
|
||||||
// handle each prioritizer
|
// handle each prioritizer
|
||||||
$.each(connection.prioritizers, function (i, type) {
|
$.each(connection.prioritizers, function (i, type) {
|
||||||
|
@ -1353,7 +1400,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
var selectedRelationships = getSelectedRelationships();
|
var selectedRelationships = getSelectedRelationships();
|
||||||
|
|
||||||
// see if we're working with a processor as the source
|
// see if we're working with a processor as the source
|
||||||
if (nf.CanvasUtils.isProcessor(source)) {
|
if (canvasUtils.isProcessor(source)) {
|
||||||
if (selectedRelationships.length > 0) {
|
if (selectedRelationships.length > 0) {
|
||||||
// if there are relationships selected update
|
// if there are relationships selected update
|
||||||
updateConnection(selectedRelationships).done(function () {
|
updateConnection(selectedRelationships).done(function () {
|
||||||
|
@ -1363,7 +1410,7 @@ nf.ConnectionConfiguration = (function () {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// inform users that no relationships were selected and the source is a processor
|
// inform users that no relationships were selected and the source is a processor
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection Configuration',
|
headerText: 'Connection Configuration',
|
||||||
dialogContent: 'The connection must have at least one relationship selected.'
|
dialogContent: 'The connection must have at least one relationship selected.'
|
||||||
});
|
});
|
||||||
|
@ -1423,4 +1470,6 @@ nf.ConnectionConfiguration = (function () {
|
||||||
}).promise();
|
}).promise();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfConnectionConfiguration;
|
||||||
|
}));
|
|
@ -15,9 +15,44 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Connection = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, common, dialog, errorHandler, client, canvasUtils) {
|
||||||
|
return (nf.Connection = factory($, d3, common, dialog, errorHandler, client, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Connection =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.Connection = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, common, dialog, errorHandler, client, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfCanvas;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
// the dimensions for the connection label
|
// the dimensions for the connection label
|
||||||
var dimensions = {
|
var dimensions = {
|
||||||
|
@ -162,7 +197,7 @@ nf.Connection = (function () {
|
||||||
for (var i = 0; i < line.length; i++) {
|
for (var i = 0; i < line.length; i++) {
|
||||||
if (i + 1 < line.length) {
|
if (i + 1 < line.length) {
|
||||||
var distance = distanceToSegment(p, line[i], line[i + 1]);
|
var distance = distanceToSegment(p, line[i], line[i + 1]);
|
||||||
if (nf.Common.isUndefined(minimumDistance) || distance < minimumDistance) {
|
if (common.isUndefined(minimumDistance) || distance < minimumDistance) {
|
||||||
minimumDistance = distance;
|
minimumDistance = distance;
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +232,7 @@ nf.Connection = (function () {
|
||||||
* @param {object} terminal
|
* @param {object} terminal
|
||||||
*/
|
*/
|
||||||
var isGroup = function (terminal) {
|
var isGroup = function (terminal) {
|
||||||
return terminal.groupId !== nf.Canvas.getGroupId() && (isInputPortType(terminal.type) || isOutputPortType(terminal.type));
|
return terminal.groupId !== canvasUtils.getGroupId() && (isInputPortType(terminal.type) || isOutputPortType(terminal.type));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,7 +242,7 @@ nf.Connection = (function () {
|
||||||
* @return {boolean} Whether expiration is configured
|
* @return {boolean} Whether expiration is configured
|
||||||
*/
|
*/
|
||||||
var isExpirationConfigured = function (connection) {
|
var isExpirationConfigured = function (connection) {
|
||||||
if (nf.Common.isDefinedAndNotNull(connection.flowFileExpiration)) {
|
if (common.isDefinedAndNotNull(connection.flowFileExpiration)) {
|
||||||
var match = connection.flowFileExpiration.match(/^(\d+).*/);
|
var match = connection.flowFileExpiration.match(/^(\d+).*/);
|
||||||
if (match !== null && match.length > 0) {
|
if (match !== null && match.length > 0) {
|
||||||
if (parseInt(match[0], 10) > 0) {
|
if (parseInt(match[0], 10) > 0) {
|
||||||
|
@ -274,9 +309,9 @@ nf.Connection = (function () {
|
||||||
})
|
})
|
||||||
.on('mousedown.selection', function () {
|
.on('mousedown.selection', function () {
|
||||||
// select the connection when clicking the selectable path
|
// select the connection when clicking the selectable path
|
||||||
nf.Selectable.select(d3.select(this.parentNode));
|
nfSelectable.select(d3.select(this.parentNode));
|
||||||
})
|
})
|
||||||
.call(nf.ContextMenu.activate);
|
.call(nfContextMenu.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
// determines whether the specified connection contains an unsupported relationship
|
// determines whether the specified connection contains an unsupported relationship
|
||||||
|
@ -284,7 +319,7 @@ nf.Connection = (function () {
|
||||||
var unavailable = false;
|
var unavailable = false;
|
||||||
|
|
||||||
// verify each selected relationship is still available
|
// verify each selected relationship is still available
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.selectedRelationships) && nf.Common.isDefinedAndNotNull(d.component.availableRelationships)) {
|
if (common.isDefinedAndNotNull(d.component.selectedRelationships) && common.isDefinedAndNotNull(d.component.availableRelationships)) {
|
||||||
$.each(d.component.selectedRelationships, function (_, selectedRelationship) {
|
$.each(d.component.selectedRelationships, function (_, selectedRelationship) {
|
||||||
if ($.inArray(selectedRelationship, d.component.availableRelationships) === -1) {
|
if ($.inArray(selectedRelationship, d.component.availableRelationships) === -1) {
|
||||||
unavailable = true;
|
unavailable = true;
|
||||||
|
@ -331,7 +366,7 @@ nf.Connection = (function () {
|
||||||
// determines whether the connection is in warning based on the object count threshold
|
// determines whether the connection is in warning based on the object count threshold
|
||||||
var isWarningCount = function (d) {
|
var isWarningCount = function (d) {
|
||||||
var percentUseCount = d.status.aggregateSnapshot.percentUseCount;
|
var percentUseCount = d.status.aggregateSnapshot.percentUseCount;
|
||||||
if (nf.Common.isDefinedAndNotNull(percentUseCount)) {
|
if (common.isDefinedAndNotNull(percentUseCount)) {
|
||||||
return percentUseCount >= 61 && percentUseCount <= 85;
|
return percentUseCount >= 61 && percentUseCount <= 85;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +376,7 @@ nf.Connection = (function () {
|
||||||
// determines whether the connection is in error based on the object count threshold
|
// determines whether the connection is in error based on the object count threshold
|
||||||
var isErrorCount = function (d) {
|
var isErrorCount = function (d) {
|
||||||
var percentUseCount = d.status.aggregateSnapshot.percentUseCount;
|
var percentUseCount = d.status.aggregateSnapshot.percentUseCount;
|
||||||
if (nf.Common.isDefinedAndNotNull(percentUseCount)) {
|
if (common.isDefinedAndNotNull(percentUseCount)) {
|
||||||
return percentUseCount > 85;
|
return percentUseCount > 85;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +391,7 @@ nf.Connection = (function () {
|
||||||
// determines whether the connection is in warning based on the data size threshold
|
// determines whether the connection is in warning based on the data size threshold
|
||||||
var isWarningBytes = function (d) {
|
var isWarningBytes = function (d) {
|
||||||
var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes;
|
var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes;
|
||||||
if (nf.Common.isDefinedAndNotNull(percentUseBytes)) {
|
if (common.isDefinedAndNotNull(percentUseBytes)) {
|
||||||
return percentUseBytes >= 61 && percentUseBytes <= 85;
|
return percentUseBytes >= 61 && percentUseBytes <= 85;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +401,7 @@ nf.Connection = (function () {
|
||||||
// determines whether the connection is in error based on the data size threshold
|
// determines whether the connection is in error based on the data size threshold
|
||||||
var isErrorBytes = function (d) {
|
var isErrorBytes = function (d) {
|
||||||
var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes;
|
var percentUseBytes = d.status.aggregateSnapshot.percentUseBytes;
|
||||||
if (nf.Common.isDefinedAndNotNull(percentUseBytes)) {
|
if (common.isDefinedAndNotNull(percentUseBytes)) {
|
||||||
return percentUseBytes > 85;
|
return percentUseBytes > 85;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,10 +419,10 @@ nf.Connection = (function () {
|
||||||
var transition = false;
|
var transition = false;
|
||||||
|
|
||||||
// extract the options if specified
|
// extract the options if specified
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
updatePath = nf.Common.isDefinedAndNotNull(options.updatePath) ? options.updatePath : updatePath;
|
updatePath = common.isDefinedAndNotNull(options.updatePath) ? options.updatePath : updatePath;
|
||||||
updateLabel = nf.Common.isDefinedAndNotNull(options.updateLabel) ? options.updateLabel : updateLabel;
|
updateLabel = common.isDefinedAndNotNull(options.updateLabel) ? options.updateLabel : updateLabel;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updatePath === true) {
|
if (updatePath === true) {
|
||||||
|
@ -397,7 +432,7 @@ nf.Connection = (function () {
|
||||||
|
|
||||||
if (d.permissions.canRead) {
|
if (d.permissions.canRead) {
|
||||||
// if there are more than one selected relationship, mark this as grouped
|
// if there are more than one selected relationship, mark this as grouped
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.selectedRelationships) && d.component.selectedRelationships.length > 1) {
|
if (common.isDefinedAndNotNull(d.component.selectedRelationships) && d.component.selectedRelationships.length > 1) {
|
||||||
grouped = true;
|
grouped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -472,7 +507,7 @@ nf.Connection = (function () {
|
||||||
|
|
||||||
if (updatePath === true) {
|
if (updatePath === true) {
|
||||||
// calculate the start and end points
|
// calculate the start and end points
|
||||||
var sourceComponentId = nf.CanvasUtils.getConnectionSourceComponentId(d);
|
var sourceComponentId = canvasUtils.getConnectionSourceComponentId(d);
|
||||||
var sourceData = d3.select('#id-' + sourceComponentId).datum();
|
var sourceData = d3.select('#id-' + sourceComponentId).datum();
|
||||||
var end;
|
var end;
|
||||||
|
|
||||||
|
@ -487,9 +522,9 @@ nf.Connection = (function () {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are currently dragging the endpoint to a new target, use that
|
// if we are currently dragging the endpoint to a new target, use that
|
||||||
// position, otherwise we need to calculate it for the current target
|
// position, otherwise we need to calculate it for the current target
|
||||||
if (nf.Common.isDefinedAndNotNull(d.end) && d.end.dragging === true) {
|
if (common.isDefinedAndNotNull(d.end) && d.end.dragging === true) {
|
||||||
// since we're dragging, use the same object thats bound to the endpoint drag event
|
// since we're dragging, use the same object thats bound to the endpoint drag event
|
||||||
end = d.end;
|
end = d.end;
|
||||||
|
|
||||||
|
@ -499,7 +534,7 @@ nf.Connection = (function () {
|
||||||
var newDestinationData = newDestination.datum();
|
var newDestinationData = newDestination.datum();
|
||||||
|
|
||||||
// get the position on the new destination perimeter
|
// get the position on the new destination perimeter
|
||||||
var newEnd = nf.CanvasUtils.getPerimeterPoint(endAnchor, {
|
var newEnd = canvasUtils.getPerimeterPoint(endAnchor, {
|
||||||
'x': newDestinationData.position.x,
|
'x': newDestinationData.position.x,
|
||||||
'y': newDestinationData.position.y,
|
'y': newDestinationData.position.y,
|
||||||
'width': newDestinationData.dimensions.width,
|
'width': newDestinationData.dimensions.width,
|
||||||
|
@ -511,11 +546,11 @@ nf.Connection = (function () {
|
||||||
end.y = newEnd.y;
|
end.y = newEnd.y;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var destinationComponentId = nf.CanvasUtils.getConnectionDestinationComponentId(d);
|
var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(d);
|
||||||
var destinationData = d3.select('#id-' + destinationComponentId).datum();
|
var destinationData = d3.select('#id-' + destinationComponentId).datum();
|
||||||
|
|
||||||
// get the position on the destination perimeter
|
// get the position on the destination perimeter
|
||||||
end = nf.CanvasUtils.getPerimeterPoint(endAnchor, {
|
end = canvasUtils.getPerimeterPoint(endAnchor, {
|
||||||
'x': destinationData.position.x,
|
'x': destinationData.position.x,
|
||||||
'y': destinationData.position.y,
|
'y': destinationData.position.y,
|
||||||
'width': destinationData.dimensions.width,
|
'width': destinationData.dimensions.width,
|
||||||
|
@ -532,7 +567,7 @@ nf.Connection = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the position on the source perimeter
|
// get the position on the source perimeter
|
||||||
var start = nf.CanvasUtils.getPerimeterPoint(startAnchor, {
|
var start = canvasUtils.getPerimeterPoint(startAnchor, {
|
||||||
'x': sourceData.position.x,
|
'x': sourceData.position.x,
|
||||||
'y': sourceData.position.y,
|
'y': sourceData.position.y,
|
||||||
'width': sourceData.dimensions.width,
|
'width': sourceData.dimensions.width,
|
||||||
|
@ -544,21 +579,21 @@ nf.Connection = (function () {
|
||||||
d.end = end;
|
d.end = end;
|
||||||
|
|
||||||
// update the connection paths
|
// update the connection paths
|
||||||
nf.CanvasUtils.transition(connection.select('path.connection-path'), transition)
|
canvasUtils.transition(connection.select('path.connection-path'), transition)
|
||||||
.attr({
|
.attr({
|
||||||
'd': function () {
|
'd': function () {
|
||||||
var datum = [d.start].concat(d.bends, [d.end]);
|
var datum = [d.start].concat(d.bends, [d.end]);
|
||||||
return lineGenerator(datum);
|
return lineGenerator(datum);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nf.CanvasUtils.transition(connection.select('path.connection-selection-path'), transition)
|
canvasUtils.transition(connection.select('path.connection-selection-path'), transition)
|
||||||
.attr({
|
.attr({
|
||||||
'd': function () {
|
'd': function () {
|
||||||
var datum = [d.start].concat(d.bends, [d.end]);
|
var datum = [d.start].concat(d.bends, [d.end]);
|
||||||
return lineGenerator(datum);
|
return lineGenerator(datum);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nf.CanvasUtils.transition(connection.select('path.connection-path-selectable'), transition)
|
canvasUtils.transition(connection.select('path.connection-path-selectable'), transition)
|
||||||
.attr({
|
.attr({
|
||||||
'd': function () {
|
'd': function () {
|
||||||
var datum = [d.start].concat(d.bends, [d.end]);
|
var datum = [d.start].concat(d.bends, [d.end]);
|
||||||
|
@ -594,12 +629,12 @@ nf.Connection = (function () {
|
||||||
})
|
})
|
||||||
.on('mousedown.selection', function () {
|
.on('mousedown.selection', function () {
|
||||||
// select the connection when clicking the label
|
// select the connection when clicking the label
|
||||||
nf.Selectable.select(d3.select(this.parentNode));
|
nfSelectable.select(d3.select(this.parentNode));
|
||||||
})
|
})
|
||||||
.call(nf.ContextMenu.activate);
|
.call(nfContextMenu.activate);
|
||||||
|
|
||||||
// update the start point
|
// update the start point
|
||||||
nf.CanvasUtils.transition(startpoints, transition)
|
canvasUtils.transition(startpoints, transition)
|
||||||
.attr('transform', function (p) {
|
.attr('transform', function (p) {
|
||||||
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
|
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
|
||||||
});
|
});
|
||||||
|
@ -624,12 +659,12 @@ nf.Connection = (function () {
|
||||||
})
|
})
|
||||||
.on('mousedown.selection', function () {
|
.on('mousedown.selection', function () {
|
||||||
// select the connection when clicking the label
|
// select the connection when clicking the label
|
||||||
nf.Selectable.select(d3.select(this.parentNode));
|
nfSelectable.select(d3.select(this.parentNode));
|
||||||
})
|
})
|
||||||
.call(nf.ContextMenu.activate);
|
.call(nfContextMenu.activate);
|
||||||
|
|
||||||
// update the end point
|
// update the end point
|
||||||
nf.CanvasUtils.transition(endpoints, transition)
|
canvasUtils.transition(endpoints, transition)
|
||||||
.attr('transform', function (p) {
|
.attr('transform', function (p) {
|
||||||
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
|
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
|
||||||
});
|
});
|
||||||
|
@ -660,10 +695,10 @@ nf.Connection = (function () {
|
||||||
var connectionData = connection.datum();
|
var connectionData = connection.datum();
|
||||||
|
|
||||||
// if this is a self loop prevent removing the last two bends
|
// if this is a self loop prevent removing the last two bends
|
||||||
var sourceComponentId = nf.CanvasUtils.getConnectionSourceComponentId(connectionData);
|
var sourceComponentId = canvasUtils.getConnectionSourceComponentId(connectionData);
|
||||||
var destinationComponentId = nf.CanvasUtils.getConnectionDestinationComponentId(connectionData);
|
var destinationComponentId = canvasUtils.getConnectionDestinationComponentId(connectionData);
|
||||||
if (sourceComponentId === destinationComponentId && d.component.bends.length <= 2) {
|
if (sourceComponentId === destinationComponentId && d.component.bends.length <= 2) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection',
|
headerText: 'Connection',
|
||||||
dialogContent: 'Looping connections must have at least two bend points.'
|
dialogContent: 'Looping connections must have at least two bend points.'
|
||||||
});
|
});
|
||||||
|
@ -704,12 +739,12 @@ nf.Connection = (function () {
|
||||||
})
|
})
|
||||||
.on('mousedown.selection', function () {
|
.on('mousedown.selection', function () {
|
||||||
// select the connection when clicking the label
|
// select the connection when clicking the label
|
||||||
nf.Selectable.select(d3.select(this.parentNode));
|
nfSelectable.select(d3.select(this.parentNode));
|
||||||
})
|
})
|
||||||
.call(nf.ContextMenu.activate);
|
.call(nfContextMenu.activate);
|
||||||
|
|
||||||
// update the midpoints
|
// update the midpoints
|
||||||
nf.CanvasUtils.transition(midpoints, transition)
|
canvasUtils.transition(midpoints, transition)
|
||||||
.attr('transform', function (p) {
|
.attr('transform', function (p) {
|
||||||
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
|
return 'translate(' + (p.x - 4) + ', ' + (p.y - 4) + ')';
|
||||||
});
|
});
|
||||||
|
@ -730,7 +765,7 @@ nf.Connection = (function () {
|
||||||
// update visible connections
|
// update visible connections
|
||||||
if (connection.classed('visible')) {
|
if (connection.classed('visible')) {
|
||||||
|
|
||||||
// if there is no connection label this connection is becoming
|
// if there is no connection label this connection is becoming
|
||||||
// visible so we need to render it
|
// visible so we need to render it
|
||||||
if (connectionLabelContainer.empty()) {
|
if (connectionLabelContainer.empty()) {
|
||||||
// connection label container
|
// connection label container
|
||||||
|
@ -741,9 +776,9 @@ nf.Connection = (function () {
|
||||||
})
|
})
|
||||||
.on('mousedown.selection', function () {
|
.on('mousedown.selection', function () {
|
||||||
// select the connection when clicking the label
|
// select the connection when clicking the label
|
||||||
nf.Selectable.select(d3.select(this.parentNode));
|
nfSelectable.select(d3.select(this.parentNode));
|
||||||
})
|
})
|
||||||
.call(nf.ContextMenu.activate);
|
.call(nfContextMenu.activate);
|
||||||
|
|
||||||
// connection label
|
// connection label
|
||||||
connectionLabelContainer.append('rect')
|
connectionLabelContainer.append('rect')
|
||||||
|
@ -846,7 +881,7 @@ nf.Connection = (function () {
|
||||||
connectionFromLabel.text(null).selectAll('title').remove();
|
connectionFromLabel.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the label as necessary
|
// apply ellipsis to the label as necessary
|
||||||
nf.CanvasUtils.ellipsis(connectionFromLabel, d.component.source.name);
|
canvasUtils.ellipsis(connectionFromLabel, d.component.source.name);
|
||||||
}).append('title').text(function () {
|
}).append('title').text(function () {
|
||||||
return d.component.source.name;
|
return d.component.source.name;
|
||||||
});
|
});
|
||||||
|
@ -955,7 +990,7 @@ nf.Connection = (function () {
|
||||||
connectionToLabel.text(null).selectAll('title').remove();
|
connectionToLabel.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the label as necessary
|
// apply ellipsis to the label as necessary
|
||||||
nf.CanvasUtils.ellipsis(connectionToLabel, d.component.destination.name);
|
canvasUtils.ellipsis(connectionToLabel, d.component.destination.name);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return d.component.destination.name;
|
return d.component.destination.name;
|
||||||
});
|
});
|
||||||
|
@ -998,10 +1033,10 @@ nf.Connection = (function () {
|
||||||
// -----------------------
|
// -----------------------
|
||||||
|
|
||||||
// get the connection name
|
// get the connection name
|
||||||
var connectionNameValue = nf.CanvasUtils.formatConnectionName(d.component);
|
var connectionNameValue = canvasUtils.formatConnectionName(d.component);
|
||||||
|
|
||||||
// is there a name to render
|
// is there a name to render
|
||||||
if (!nf.Common.isBlank(connectionNameValue)) {
|
if (!common.isBlank(connectionNameValue)) {
|
||||||
// see if the connection name label is already rendered
|
// see if the connection name label is already rendered
|
||||||
if (connectionName.empty()) {
|
if (connectionName.empty()) {
|
||||||
connectionName = connectionLabelContainer.append('g')
|
connectionName = connectionLabelContainer.append('g')
|
||||||
|
@ -1060,7 +1095,7 @@ nf.Connection = (function () {
|
||||||
connectionToLabel.text(null).selectAll('title').remove();
|
connectionToLabel.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the label as necessary
|
// apply ellipsis to the label as necessary
|
||||||
nf.CanvasUtils.ellipsis(connectionToLabel, connectionNameValue);
|
canvasUtils.ellipsis(connectionToLabel, connectionNameValue);
|
||||||
}).append('title').text(function () {
|
}).append('title').text(function () {
|
||||||
return connectionNameValue;
|
return connectionNameValue;
|
||||||
});
|
});
|
||||||
|
@ -1288,31 +1323,31 @@ nf.Connection = (function () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.select('title').text(function () {
|
.select('title').text(function () {
|
||||||
if (d.permissions.canRead) {
|
if (d.permissions.canRead) {
|
||||||
return 'Expires FlowFiles older than ' + d.component.flowFileExpiration;
|
return 'Expires FlowFiles older than ' + d.component.flowFileExpiration;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// update backpressure object fill
|
// update backpressure object fill
|
||||||
connectionLabelContainer.select('rect.backpressure-object')
|
connectionLabelContainer.select('rect.backpressure-object')
|
||||||
.classed('not-configured', function () {
|
.classed('not-configured', function () {
|
||||||
return nf.Common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount);
|
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount);
|
||||||
});
|
});
|
||||||
connectionLabelContainer.selectAll('rect.backpressure-tick.object')
|
connectionLabelContainer.selectAll('rect.backpressure-tick.object')
|
||||||
.classed('not-configured', function () {
|
.classed('not-configured', function () {
|
||||||
return nf.Common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount);
|
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
// update backpressure data size fill
|
// update backpressure data size fill
|
||||||
connectionLabelContainer.select('rect.backpressure-data-size')
|
connectionLabelContainer.select('rect.backpressure-data-size')
|
||||||
.classed('not-configured', function () {
|
.classed('not-configured', function () {
|
||||||
return nf.Common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes);
|
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes);
|
||||||
});
|
});
|
||||||
connectionLabelContainer.selectAll('rect.backpressure-tick.data-size')
|
connectionLabelContainer.selectAll('rect.backpressure-tick.data-size')
|
||||||
.classed('not-configured', function () {
|
.classed('not-configured', function () {
|
||||||
return nf.Common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes);
|
return common.isUndefinedOrNull(d.status.aggregateSnapshot.percentUseBytes);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (d.permissions.canWrite) {
|
if (d.permissions.canWrite) {
|
||||||
|
@ -1330,7 +1365,7 @@ nf.Connection = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the position of the label if possible
|
// update the position of the label if possible
|
||||||
nf.CanvasUtils.transition(connection.select('g.connection-label-container'), transition)
|
canvasUtils.transition(connection.select('g.connection-label-container'), transition)
|
||||||
.attr('transform', function () {
|
.attr('transform', function () {
|
||||||
var label = d3.select(this).select('rect.body');
|
var label = d3.select(this).select('rect.body');
|
||||||
var position = getLabelPosition(label);
|
var position = getLabelPosition(label);
|
||||||
|
@ -1354,7 +1389,7 @@ nf.Connection = (function () {
|
||||||
// queued count value
|
// queued count value
|
||||||
updated.select('text.queued tspan.count')
|
updated.select('text.queued tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
var backpressurePercentDataSize = updated.select('rect.backpressure-percent.data-size');
|
var backpressurePercentDataSize = updated.select('rect.backpressure-percent.data-size');
|
||||||
|
@ -1362,26 +1397,26 @@ nf.Connection = (function () {
|
||||||
.duration(400)
|
.duration(400)
|
||||||
.attr({
|
.attr({
|
||||||
'width': function (d) {
|
'width': function (d) {
|
||||||
if (nf.Common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) {
|
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) {
|
||||||
return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseBytes) / 100;
|
return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseBytes) / 100;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).each('end', function () {
|
}).each('end', function () {
|
||||||
backpressurePercentDataSize
|
backpressurePercentDataSize
|
||||||
.classed('warning', function (d) {
|
.classed('warning', function (d) {
|
||||||
return isWarningBytes(d);
|
return isWarningBytes(d);
|
||||||
})
|
})
|
||||||
.classed('error', function (d) {
|
.classed('error', function (d) {
|
||||||
return isErrorBytes(d);
|
return isErrorBytes(d);
|
||||||
});
|
});
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
updated.select('rect.backpressure-data-size').select('title').text(function (d) {
|
updated.select('rect.backpressure-data-size').select('title').text(function (d) {
|
||||||
if (nf.Common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) {
|
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseBytes)) {
|
||||||
return 'Queue is ' + d.status.aggregateSnapshot.percentUseBytes + '% full based on Back Pressure Data Size Threshold';
|
return 'Queue is ' + d.status.aggregateSnapshot.percentUseBytes + '% full based on Back Pressure Data Size Threshold';
|
||||||
} else {
|
} else {
|
||||||
return 'Back Pressure Data Size Threshold is not configured';
|
return 'Back Pressure Data Size Threshold is not configured';
|
||||||
|
@ -1394,7 +1429,7 @@ nf.Connection = (function () {
|
||||||
// queued size value
|
// queued size value
|
||||||
updated.select('text.queued tspan.size')
|
updated.select('text.queued tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
var backpressurePercentObject = updated.select('rect.backpressure-percent.object');
|
var backpressurePercentObject = updated.select('rect.backpressure-percent.object');
|
||||||
|
@ -1402,26 +1437,26 @@ nf.Connection = (function () {
|
||||||
.duration(400)
|
.duration(400)
|
||||||
.attr({
|
.attr({
|
||||||
'width': function (d) {
|
'width': function (d) {
|
||||||
if (nf.Common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) {
|
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) {
|
||||||
return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseCount) / 100;
|
return (backpressureBarWidth * d.status.aggregateSnapshot.percentUseCount) / 100;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).each('end', function () {
|
}).each('end', function () {
|
||||||
backpressurePercentObject
|
backpressurePercentObject
|
||||||
.classed('warning', function (d) {
|
.classed('warning', function (d) {
|
||||||
return isWarningCount(d);
|
return isWarningCount(d);
|
||||||
})
|
})
|
||||||
.classed('error', function (d) {
|
.classed('error', function (d) {
|
||||||
return isErrorCount(d);
|
return isErrorCount(d);
|
||||||
});
|
});
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
updated.select('rect.backpressure-object').select('title').text(function (d) {
|
updated.select('rect.backpressure-object').select('title').text(function (d) {
|
||||||
if (nf.Common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) {
|
if (common.isDefinedAndNotNull(d.status.aggregateSnapshot.percentUseCount)) {
|
||||||
return 'Queue is ' + d.status.aggregateSnapshot.percentUseCount + '% full based on Back Pressure Object Threshold';
|
return 'Queue is ' + d.status.aggregateSnapshot.percentUseCount + '% full based on Back Pressure Object Threshold';
|
||||||
} else {
|
} else {
|
||||||
return 'Back Pressure Object Threshold is not configured';
|
return 'Back Pressure Object Threshold is not configured';
|
||||||
|
@ -1463,7 +1498,7 @@ nf.Connection = (function () {
|
||||||
*/
|
*/
|
||||||
var save = function (d, connection) {
|
var save = function (d, connection) {
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision(d),
|
'revision': client.getRevision(d),
|
||||||
'component': connection
|
'component': connection
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1475,15 +1510,15 @@ nf.Connection = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// request was successful, update the entry
|
// request was successful, update the entry
|
||||||
nf.Connection.set(response);
|
nfConnection.set(response);
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection',
|
headerText: 'Connection',
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText)
|
dialogContent: common.escapeHtml(xhr.responseText)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1492,20 +1527,23 @@ nf.Connection = (function () {
|
||||||
var removeConnections = function (removed) {
|
var removeConnections = function (removed) {
|
||||||
// consider reloading source/destination of connection being removed
|
// consider reloading source/destination of connection being removed
|
||||||
removed.each(function (d) {
|
removed.each(function (d) {
|
||||||
nf.CanvasUtils.reloadConnectionSourceAndDestination(d.sourceId, d.destinationId);
|
canvasUtils.reloadConnectionSourceAndDestination(d.sourceId, d.destinationId);
|
||||||
});
|
});
|
||||||
|
|
||||||
// remove the connection
|
// remove the connection
|
||||||
removed.remove();
|
removed.remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfConnection = {
|
||||||
config: {
|
config: {
|
||||||
selfLoopXOffset: (dimensions.width / 2) + 5,
|
selfLoopXOffset: (dimensions.width / 2) + 5,
|
||||||
selfLoopYOffset: 25
|
selfLoopYOffset: 25
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function () {
|
init: function (selectable, contextMenu) {
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
connectionMap = d3.map();
|
connectionMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -1600,7 +1638,7 @@ nf.Connection = (function () {
|
||||||
|
|
||||||
// ensure the new destination is valid
|
// ensure the new destination is valid
|
||||||
d3.select('g.hover').classed('connectable-destination', function () {
|
d3.select('g.hover').classed('connectable-destination', function () {
|
||||||
return nf.CanvasUtils.isValidConnectionDestination(d3.select(this));
|
return canvasUtils.isValidConnectionDestination(d3.select(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
// redraw this connection
|
// redraw this connection
|
||||||
|
@ -1629,11 +1667,11 @@ nf.Connection = (function () {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// prompt for the new port if appropriate
|
// prompt for the new port if appropriate
|
||||||
if (nf.CanvasUtils.isProcessGroup(destination) || nf.CanvasUtils.isRemoteProcessGroup(destination)) {
|
if (canvasUtils.isProcessGroup(destination) || canvasUtils.isRemoteProcessGroup(destination)) {
|
||||||
// user will select new port and updated connect details will be set accordingly
|
// user will select new port and updated connect details will be set accordingly
|
||||||
nf.ConnectionConfiguration.showConfiguration(connection, destination).done(function () {
|
nfConnectionConfiguration.showConfiguration(connection, destination).done(function () {
|
||||||
// reload the previous destination
|
// reload the previous destination
|
||||||
nf.CanvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId);
|
canvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId);
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
// reset the connection
|
// reset the connection
|
||||||
connection.call(updateConnections, {
|
connection.call(updateConnections, {
|
||||||
|
@ -1644,15 +1682,15 @@ nf.Connection = (function () {
|
||||||
} else {
|
} else {
|
||||||
// get the destination details
|
// get the destination details
|
||||||
var destinationData = destination.datum();
|
var destinationData = destination.datum();
|
||||||
var destinationType = nf.CanvasUtils.getConnectableTypeForDestination(destination);
|
var destinationType = canvasUtils.getConnectableTypeForDestination(destination);
|
||||||
|
|
||||||
var connectionEntity = {
|
var connectionEntity = {
|
||||||
'revision': nf.Client.getRevision(connectionData),
|
'revision': client.getRevision(connectionData),
|
||||||
'component': {
|
'component': {
|
||||||
'id': connectionData.id,
|
'id': connectionData.id,
|
||||||
'destination': {
|
'destination': {
|
||||||
'id': destinationData.id,
|
'id': destinationData.id,
|
||||||
'groupId': nf.Canvas.getGroupId(),
|
'groupId': canvasUtils.getGroupId(),
|
||||||
'type': destinationType
|
'type': destinationType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1664,8 +1702,8 @@ nf.Connection = (function () {
|
||||||
x: destinationData.position.x + (destinationData.dimensions.width),
|
x: destinationData.position.x + (destinationData.dimensions.width),
|
||||||
y: destinationData.position.y + (destinationData.dimensions.height / 2)
|
y: destinationData.position.y + (destinationData.dimensions.height / 2)
|
||||||
};
|
};
|
||||||
var xOffset = nf.Connection.config.selfLoopXOffset;
|
var xOffset = nfConnection.config.selfLoopXOffset;
|
||||||
var yOffset = nf.Connection.config.selfLoopYOffset;
|
var yOffset = nfConnection.config.selfLoopYOffset;
|
||||||
|
|
||||||
connectionEntity.component.bends = [];
|
connectionEntity.component.bends = [];
|
||||||
connectionEntity.component.bends.push({
|
connectionEntity.component.bends.push({
|
||||||
|
@ -1688,16 +1726,16 @@ nf.Connection = (function () {
|
||||||
var updatedConnectionData = response.component;
|
var updatedConnectionData = response.component;
|
||||||
|
|
||||||
// refresh to update the label
|
// refresh to update the label
|
||||||
nf.Connection.set(response);
|
nfConnection.set(response);
|
||||||
|
|
||||||
// reload the previous destination and the new source/destination
|
// reload the previous destination and the new source/destination
|
||||||
nf.CanvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId);
|
canvasUtils.reloadConnectionSourceAndDestination(null, previousDestinationId);
|
||||||
nf.CanvasUtils.reloadConnectionSourceAndDestination(response.sourceId, response.destinationId);
|
canvasUtils.reloadConnectionSourceAndDestination(response.sourceId, response.destinationId);
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
if (xhr.status === 400 || xhr.status === 401 || xhr.status === 403 || xhr.status === 404 || xhr.status === 409) {
|
if (xhr.status === 400 || xhr.status === 401 || xhr.status === 403 || xhr.status === 404 || xhr.status === 409) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Connection',
|
headerText: 'Connection',
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText)
|
dialogContent: common.escapeHtml(xhr.responseText)
|
||||||
});
|
});
|
||||||
|
|
||||||
// reset the connection
|
// reset the connection
|
||||||
|
@ -1706,7 +1744,7 @@ nf.Connection = (function () {
|
||||||
'updateLabel': false
|
'updateLabel': false
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1743,10 +1781,10 @@ nf.Connection = (function () {
|
||||||
.attr('width', width)
|
.attr('width', width)
|
||||||
.attr('height', height)
|
.attr('height', height)
|
||||||
.attr('stroke-width', function () {
|
.attr('stroke-width', function () {
|
||||||
return 1 / nf.Canvas.View.scale();
|
return 1 / canvasUtils.scaleCanvasView();
|
||||||
})
|
})
|
||||||
.attr('stroke-dasharray', function () {
|
.attr('stroke-dasharray', function () {
|
||||||
return 4 / nf.Canvas.View.scale();
|
return 4 / canvasUtils.scaleCanvasView();
|
||||||
})
|
})
|
||||||
.datum({
|
.datum({
|
||||||
x: position.x,
|
x: position.x,
|
||||||
|
@ -1847,8 +1885,8 @@ nf.Connection = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (connectionEntities, options) {
|
add: function (connectionEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current time
|
// get the current time
|
||||||
|
@ -1868,7 +1906,7 @@ nf.Connection = (function () {
|
||||||
$.each(connectionEntities, function (_, connectionEntity) {
|
$.each(connectionEntities, function (_, connectionEntity) {
|
||||||
add(connectionEntity);
|
add(connectionEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(connectionEntities)) {
|
} else if (common.isDefinedAndNotNull(connectionEntities)) {
|
||||||
add(connectionEntities);
|
add(connectionEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1881,6 +1919,56 @@ nf.Connection = (function () {
|
||||||
}).call(sort);
|
}).call(sort);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the specified selection is disconnected from other nodes.
|
||||||
|
*
|
||||||
|
* @argument {selection} selection The selection
|
||||||
|
*/
|
||||||
|
isDisconnected: function (selection) {
|
||||||
|
|
||||||
|
// if nothing is selected return
|
||||||
|
if (selection.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var connections = d3.map();
|
||||||
|
var components = d3.map();
|
||||||
|
var isDisconnected = true;
|
||||||
|
|
||||||
|
// include connections
|
||||||
|
selection.filter(function (d) {
|
||||||
|
return d.type === 'Connection';
|
||||||
|
}).each(function (d) {
|
||||||
|
connections.set(d.id, d);
|
||||||
|
});
|
||||||
|
|
||||||
|
// include components and ensure their connections are included
|
||||||
|
selection.filter(function (d) {
|
||||||
|
return d.type !== 'Connection';
|
||||||
|
}).each(function (d) {
|
||||||
|
components.set(d.id, d.component);
|
||||||
|
|
||||||
|
// check all connections of this component
|
||||||
|
$.each(nfConnection.getComponentConnections(d.id), function (_, connection) {
|
||||||
|
if (!connections.has(connection.id)) {
|
||||||
|
isDisconnected = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
if (isDisconnected) {
|
||||||
|
|
||||||
|
// go through each connection to ensure its source and destination are included
|
||||||
|
connections.forEach(function (id, connection) {
|
||||||
|
if (isDisconnected) {
|
||||||
|
|
||||||
|
// determine whether this connection and its components are included within the selection
|
||||||
|
isDisconnected = components.has(canvasUtils.getConnectionSourceComponentId(connection)) && components.has(canvasUtils.getConnectionDestinationComponentId(connection));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return isDisconnected;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the graph with the specified connections.
|
* Populates the graph with the specified connections.
|
||||||
*
|
*
|
||||||
|
@ -1890,16 +1978,16 @@ nf.Connection = (function () {
|
||||||
set: function (connectionEntities, options) {
|
set: function (connectionEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = function (proposedConnectionEntity) {
|
var set = function (proposedConnectionEntity) {
|
||||||
var currentConnectionEntity = connectionMap.get(proposedConnectionEntity.id);
|
var currentConnectionEntity = connectionMap.get(proposedConnectionEntity.id);
|
||||||
|
|
||||||
// set the connection if appropriate due to revision and wasn't previously removed
|
// set the connection if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentConnectionEntity, proposedConnectionEntity) && !removedCache.has(proposedConnectionEntity.id)) {
|
if (client.isNewerRevision(currentConnectionEntity, proposedConnectionEntity) && !removedCache.has(proposedConnectionEntity.id)) {
|
||||||
connectionMap.set(proposedConnectionEntity.id, $.extend({
|
connectionMap.set(proposedConnectionEntity.id, $.extend({
|
||||||
type: 'Connection'
|
type: 'Connection'
|
||||||
}, proposedConnectionEntity));
|
}, proposedConnectionEntity));
|
||||||
|
@ -1922,7 +2010,7 @@ nf.Connection = (function () {
|
||||||
$.each(connectionEntities, function (_, connectionEntity) {
|
$.each(connectionEntities, function (_, connectionEntity) {
|
||||||
set(connectionEntity);
|
set(connectionEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(connectionEntities)) {
|
} else if (common.isDefinedAndNotNull(connectionEntities)) {
|
||||||
set(connectionEntities);
|
set(connectionEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1943,7 +2031,7 @@ nf.Connection = (function () {
|
||||||
* @param {string} connectionId
|
* @param {string} connectionId
|
||||||
*/
|
*/
|
||||||
refresh: function (connectionId) {
|
refresh: function (connectionId) {
|
||||||
if (nf.Common.isDefinedAndNotNull(connectionId)) {
|
if (common.isDefinedAndNotNull(connectionId)) {
|
||||||
d3.select('#id-' + connectionId).call(updateConnections, {
|
d3.select('#id-' + connectionId).call(updateConnections, {
|
||||||
'updatePath': true,
|
'updatePath': true,
|
||||||
'updateLabel': true
|
'updateLabel': true
|
||||||
|
@ -1992,7 +2080,7 @@ nf.Connection = (function () {
|
||||||
* Removes all processors.
|
* Removes all processors.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.Connection.remove(connectionMap.keys());
|
nfConnection.remove(connectionMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2008,7 +2096,7 @@ nf.Connection = (function () {
|
||||||
url: connectionEntity.uri,
|
url: connectionEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.Connection.set(response);
|
nfConnection.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2046,7 +2134,7 @@ nf.Connection = (function () {
|
||||||
var connections = [];
|
var connections = [];
|
||||||
connectionMap.forEach(function (_, entry) {
|
connectionMap.forEach(function (_, entry) {
|
||||||
// see if this component is the source or destination of this connection
|
// see if this component is the source or destination of this connection
|
||||||
if (nf.CanvasUtils.getConnectionSourceComponentId(entry) === id || nf.CanvasUtils.getConnectionDestinationComponentId(entry) === id) {
|
if (canvasUtils.getConnectionSourceComponentId(entry) === id || canvasUtils.getConnectionDestinationComponentId(entry) === id) {
|
||||||
connections.push(entry);
|
connections.push(entry);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2060,7 +2148,7 @@ nf.Connection = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return connectionMap.values();
|
return connectionMap.values();
|
||||||
} else {
|
} else {
|
||||||
return connectionMap.get(id);
|
return connectionMap.get(id);
|
||||||
|
@ -2085,4 +2173,6 @@ nf.Connection = (function () {
|
||||||
expire(removedCache);
|
expire(removedCache);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfConnection;
|
||||||
|
}));
|
|
@ -15,9 +15,39 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ContextMenu = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge'],
|
||||||
|
function ($, d3, errorHandler, common, canvasUtils, angularBridge) {
|
||||||
|
return (nf.ContextMenu = factory($, d3, errorHandler, common, canvasUtils, angularBridge));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ContextMenu =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge')));
|
||||||
|
} else {
|
||||||
|
nf.ContextMenu = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, canvasUtils, angularBridge) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfActions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the current group is not the root group.
|
* Returns whether the current group is not the root group.
|
||||||
|
@ -25,57 +55,57 @@ nf.ContextMenu = (function () {
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isNotRootGroup = function (selection) {
|
var isNotRootGroup = function (selection) {
|
||||||
return nf.Canvas.getParentGroupId() !== null && selection.empty();
|
return canvasUtils.getParentGroupId() !== null && selection.empty();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the component in the specified selection is configurable.
|
* Determines whether the component in the specified selection is configurable.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isConfigurable = function (selection) {
|
var isConfigurable = function (selection) {
|
||||||
return nf.CanvasUtils.isConfigurable(selection);
|
return canvasUtils.isConfigurable(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the component in the specified selection has configuration details.
|
* Determines whether the component in the specified selection has configuration details.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var hasDetails = function (selection) {
|
var hasDetails = function (selection) {
|
||||||
return nf.CanvasUtils.hasDetails(selection);
|
return canvasUtils.hasDetails(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection are deletable.
|
* Determines whether the components in the specified selection are deletable.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isDeletable = function (selection) {
|
var isDeletable = function (selection) {
|
||||||
return nf.CanvasUtils.areDeletable(selection);
|
return canvasUtils.areDeletable(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection are runnable.
|
* Determines whether the components in the specified selection are runnable.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isRunnable = function (selection) {
|
var isRunnable = function (selection) {
|
||||||
return nf.CanvasUtils.areRunnable(selection);
|
return canvasUtils.areRunnable(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection are stoppable.
|
* Determines whether the components in the specified selection are stoppable.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isStoppable = function (selection) {
|
var isStoppable = function (selection) {
|
||||||
return nf.CanvasUtils.areStoppable(selection);
|
return canvasUtils.areStoppable(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection support stats.
|
* Determines whether the components in the specified selection support stats.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var supportsStats = function (selection) {
|
var supportsStats = function (selection) {
|
||||||
|
@ -84,12 +114,12 @@ nf.ContextMenu = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) || nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isConnection(selection);
|
return canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) || canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isConnection(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection has usage documentation.
|
* Determines whether the components in the specified selection has usage documentation.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var hasUsage = function (selection) {
|
var hasUsage = function (selection) {
|
||||||
|
@ -97,43 +127,43 @@ nf.ContextMenu = (function () {
|
||||||
if (selection.size() !== 1) {
|
if (selection.size() !== 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nf.CanvasUtils.canRead(selection) === false) {
|
if (canvasUtils.canRead(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isProcessor(selection);
|
return canvasUtils.isProcessor(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether there is one component selected.
|
* Determines whether there is one component selected.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isNotConnection = function (selection) {
|
var isNotConnection = function (selection) {
|
||||||
return selection.size() === 1 && !nf.CanvasUtils.isConnection(selection);
|
return selection.size() === 1 && !canvasUtils.isConnection(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection are copyable.
|
* Determines whether the components in the specified selection are copyable.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isCopyable = function (selection) {
|
var isCopyable = function (selection) {
|
||||||
return nf.CanvasUtils.isCopyable(selection);
|
return canvasUtils.isCopyable(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the components in the specified selection are pastable.
|
* Determines whether the components in the specified selection are pastable.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection of currently selected components
|
* @param {selection} selection The selection of currently selected components
|
||||||
*/
|
*/
|
||||||
var isPastable = function (selection) {
|
var isPastable = function (selection) {
|
||||||
return nf.CanvasUtils.isPastable();
|
return canvasUtils.isPastable();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the specified selection is empty.
|
* Determines whether the specified selection is empty.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The seleciton
|
* @param {selection} selection The seleciton
|
||||||
*/
|
*/
|
||||||
var emptySelection = function (selection) {
|
var emptySelection = function (selection) {
|
||||||
|
@ -142,7 +172,7 @@ nf.ContextMenu = (function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the componets in the specified selection support being moved to the front.
|
* Determines whether the componets in the specified selection support being moved to the front.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection
|
* @param {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
var canMoveToFront = function (selection) {
|
var canMoveToFront = function (selection) {
|
||||||
|
@ -150,11 +180,11 @@ nf.ContextMenu = (function () {
|
||||||
if (selection.size() !== 1) {
|
if (selection.size() !== 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nf.CanvasUtils.canModify(selection) === false) {
|
if (canvasUtils.canModify(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isConnection(selection);
|
return canvasUtils.isConnection(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +193,7 @@ nf.ContextMenu = (function () {
|
||||||
* @param {selection} selection The selection
|
* @param {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
var canAlign = function (selection) {
|
var canAlign = function (selection) {
|
||||||
return nf.CanvasUtils.canAlign(selection);
|
return canvasUtils.canAlign(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,12 +202,12 @@ nf.ContextMenu = (function () {
|
||||||
* @param {selection} selection The selection
|
* @param {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
var isColorable = function (selection) {
|
var isColorable = function (selection) {
|
||||||
return nf.CanvasUtils.isColorable(selection);
|
return canvasUtils.isColorable(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the component in the specified selection is a connection.
|
* Determines whether the component in the specified selection is a connection.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection
|
* @param {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
var isConnection = function (selection) {
|
var isConnection = function (selection) {
|
||||||
|
@ -186,12 +216,12 @@ nf.ContextMenu = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isConnection(selection);
|
return canvasUtils.isConnection(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the component in the specified selection could possibly have downstream components.
|
* Determines whether the component in the specified selection could possibly have downstream components.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection
|
* @param {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
var hasDownstream = function (selection) {
|
var hasDownstream = function (selection) {
|
||||||
|
@ -200,14 +230,14 @@ nf.ContextMenu = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isFunnel(selection) || nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
|
return canvasUtils.isFunnel(selection) || canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) ||
|
||||||
nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isInputPort(selection) ||
|
canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isInputPort(selection) ||
|
||||||
(nf.CanvasUtils.isOutputPort(selection) && nf.Canvas.getParentGroupId() !== null);
|
(canvasUtils.isOutputPort(selection) && canvasUtils.getParentGroupId() !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the component in the specified selection could possibly have upstream components.
|
* Determines whether the component in the specified selection could possibly have upstream components.
|
||||||
*
|
*
|
||||||
* @param {selection} selection The selection
|
* @param {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
var hasUpstream = function (selection) {
|
var hasUpstream = function (selection) {
|
||||||
|
@ -216,9 +246,9 @@ nf.ContextMenu = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isFunnel(selection) || nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
|
return canvasUtils.isFunnel(selection) || canvasUtils.isProcessor(selection) || canvasUtils.isProcessGroup(selection) ||
|
||||||
nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isOutputPort(selection) ||
|
canvasUtils.isRemoteProcessGroup(selection) || canvasUtils.isOutputPort(selection) ||
|
||||||
(nf.CanvasUtils.isInputPort(selection) && nf.Canvas.getParentGroupId() !== null);
|
(canvasUtils.isInputPort(selection) && canvasUtils.getParentGroupId() !== null);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,11 +261,11 @@ nf.ContextMenu = (function () {
|
||||||
if (selection.size() !== 1) {
|
if (selection.size() !== 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nf.CanvasUtils.canRead(selection) === false || nf.CanvasUtils.canModify(selection) === false) {
|
if (canvasUtils.canRead(selection) === false || canvasUtils.canModify(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nf.CanvasUtils.isProcessor(selection)) {
|
if (canvasUtils.isProcessor(selection)) {
|
||||||
var processorData = selection.datum();
|
var processorData = selection.datum();
|
||||||
return processorData.component.persistsState === true;
|
return processorData.component.persistsState === true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -245,7 +275,7 @@ nf.ContextMenu = (function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the current selection is a process group.
|
* Determines whether the current selection is a process group.
|
||||||
*
|
*
|
||||||
* @param {selection} selection
|
* @param {selection} selection
|
||||||
*/
|
*/
|
||||||
var isProcessGroup = function (selection) {
|
var isProcessGroup = function (selection) {
|
||||||
|
@ -254,7 +284,7 @@ nf.ContextMenu = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isProcessGroup(selection);
|
return canvasUtils.isProcessGroup(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,56 +298,56 @@ nf.ContextMenu = (function () {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !nf.CanvasUtils.isLabel(selection) && !nf.CanvasUtils.isConnection(selection) && !nf.CanvasUtils.isProcessGroup(selection)
|
return !canvasUtils.isLabel(selection) && !canvasUtils.isConnection(selection) && !canvasUtils.isProcessGroup(selection)
|
||||||
&& !nf.CanvasUtils.isRemoteProcessGroup(selection) && nf.Common.canAccessProvenance();
|
&& !canvasUtils.isRemoteProcessGroup(selection) && common.canAccessProvenance();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the current selection is a remote process group.
|
* Determines whether the current selection is a remote process group.
|
||||||
*
|
*
|
||||||
* @param {selection} selection
|
* @param {selection} selection
|
||||||
*/
|
*/
|
||||||
var isRemoteProcessGroup = function (selection) {
|
var isRemoteProcessGroup = function (selection) {
|
||||||
// ensure the correct number of components are selected
|
// ensure the correct number of components are selected
|
||||||
if (selection.size() !== 1) {
|
if (selection.size() !== 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nf.CanvasUtils.canRead(selection) === false) {
|
if (canvasUtils.canRead(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.isRemoteProcessGroup(selection);
|
return canvasUtils.isRemoteProcessGroup(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the components in the specified selection support starting transmission.
|
* Determines if the components in the specified selection support starting transmission.
|
||||||
*
|
*
|
||||||
* @param {selection} selection
|
* @param {selection} selection
|
||||||
*/
|
*/
|
||||||
var canStartTransmission = function (selection) {
|
var canStartTransmission = function (selection) {
|
||||||
if (nf.CanvasUtils.canModify(selection) === false) {
|
if (canvasUtils.canModify(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.canAllStartTransmitting(selection);
|
return canvasUtils.canAllStartTransmitting(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the components in the specified selection support stopping transmission.
|
* Determines if the components in the specified selection support stopping transmission.
|
||||||
*
|
*
|
||||||
* @param {selection} selection
|
* @param {selection} selection
|
||||||
*/
|
*/
|
||||||
var canStopTransmission = function (selection) {
|
var canStopTransmission = function (selection) {
|
||||||
if (nf.CanvasUtils.canModify(selection) === false) {
|
if (canvasUtils.canModify(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.CanvasUtils.canAllStopTransmitting(selection);
|
return canvasUtils.canAllStopTransmitting(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only DFMs can empty a queue.
|
* Only DFMs can empty a queue.
|
||||||
*
|
*
|
||||||
* @param {selection} selection
|
* @param {selection} selection
|
||||||
*/
|
*/
|
||||||
var canEmptyQueue = function (selection) {
|
var canEmptyQueue = function (selection) {
|
||||||
|
@ -332,31 +362,31 @@ nf.ContextMenu = (function () {
|
||||||
var canListQueue = function (selection) {
|
var canListQueue = function (selection) {
|
||||||
return isConnection(selection);
|
return isConnection(selection);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if the components in the specified selection can be moved into a parent group.
|
* Determines if the components in the specified selection can be moved into a parent group.
|
||||||
*
|
*
|
||||||
* @param {type} selection
|
* @param {type} selection
|
||||||
*/
|
*/
|
||||||
var canMoveToParent = function (selection) {
|
var canMoveToParent = function (selection) {
|
||||||
if (nf.CanvasUtils.canModify(selection) === false) {
|
if (canvasUtils.canModify(selection) === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - also check can modify in parent
|
// TODO - also check can modify in parent
|
||||||
|
|
||||||
return !selection.empty() && nf.CanvasUtils.isDisconnected(selection) && nf.Canvas.getParentGroupId() !== null;
|
return !selection.empty() && canvasUtils.getComponentByType('Connection').isDisconnected(selection) && canvasUtils.getParentGroupId() !== null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a menu item to the context menu.
|
* Adds a menu item to the context menu.
|
||||||
*
|
*
|
||||||
* {
|
* {
|
||||||
* click: refresh (function),
|
* click: refresh (function),
|
||||||
* text: 'Start' (string),
|
* text: 'Start' (string),
|
||||||
* clazz: 'fa fa-refresh'
|
* clazz: 'fa fa-refresh'
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @param {jQuery} contextMenu The context menu
|
* @param {jQuery} contextMenu The context menu
|
||||||
* @param {object} item The menu item configuration
|
* @param {object} item The menu item configuration
|
||||||
*/
|
*/
|
||||||
|
@ -377,10 +407,10 @@ nf.ContextMenu = (function () {
|
||||||
|
|
||||||
// create the img and conditionally add the style
|
// create the img and conditionally add the style
|
||||||
var img = $('<div class="context-menu-item-img"></div>').addClass(item['clazz']).appendTo(menuItem);
|
var img = $('<div class="context-menu-item-img"></div>').addClass(item['clazz']).appendTo(menuItem);
|
||||||
if (nf.Common.isDefinedAndNotNull(item['imgStyle'])) {
|
if (common.isDefinedAndNotNull(item['imgStyle'])) {
|
||||||
img.addClass(item['imgStyle']);
|
img.addClass(item['imgStyle']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<div class="context-menu-item-text"></div>').text(item['text']).appendTo(menuItem);
|
$('<div class="context-menu-item-text"></div>').text(item['text']).appendTo(menuItem);
|
||||||
$('<div class="clear"></div>').appendTo(menuItem);
|
$('<div class="clear"></div>').appendTo(menuItem);
|
||||||
}
|
}
|
||||||
|
@ -388,7 +418,7 @@ nf.ContextMenu = (function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Positions and shows the context menu.
|
* Positions and shows the context menu.
|
||||||
*
|
*
|
||||||
* @param {jQuery} contextMenu The context menu
|
* @param {jQuery} contextMenu The context menu
|
||||||
* @param {object} options The context menu configuration
|
* @param {object} options The context menu configuration
|
||||||
*/
|
*/
|
||||||
|
@ -401,17 +431,17 @@ nf.ContextMenu = (function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the specified action with the optional selection.
|
* Executes the specified action with the optional selection.
|
||||||
*
|
*
|
||||||
* @param {string} action
|
* @param {string} action
|
||||||
* @param {selection} selection
|
* @param {selection} selection
|
||||||
* @param {mouse event} evt
|
* @param {mouse event} evt
|
||||||
*/
|
*/
|
||||||
var executeAction = function (action, selection, evt) {
|
var executeAction = function (action, selection, evt) {
|
||||||
// execute the action
|
// execute the action
|
||||||
nf.Actions[action](selection, evt);
|
nfActions[action](selection, evt);
|
||||||
|
|
||||||
// close the context menu
|
// close the context menu
|
||||||
nf.ContextMenu.hide();
|
nfContextMenu.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
// defines the available actions and the conditions which they apply
|
// defines the available actions and the conditions which they apply
|
||||||
|
@ -425,7 +455,7 @@ nf.ContextMenu = (function () {
|
||||||
{condition: isStoppable, menuItem: {clazz: 'fa fa-stop', text: 'Stop', action: 'stop'}},
|
{condition: isStoppable, menuItem: {clazz: 'fa fa-stop', text: 'Stop', action: 'stop'}},
|
||||||
{condition: isRemoteProcessGroup, menuItem: {clazz: 'fa fa-cloud', text: 'Remote ports', action: 'remotePorts'}},
|
{condition: isRemoteProcessGroup, menuItem: {clazz: 'fa fa-cloud', text: 'Remote ports', action: 'remotePorts'}},
|
||||||
{condition: canStartTransmission, menuItem: {clazz: 'fa fa-bullseye', text: 'Enable transmission', action: 'enableTransmission'}},
|
{condition: canStartTransmission, menuItem: {clazz: 'fa fa-bullseye', text: 'Enable transmission', action: 'enableTransmission'}},
|
||||||
{condition: canStopTransmission, menuItem: {clazz: 'icon icon-transmit-false', text: 'Disable transmission', action: 'disableTransmission'}},
|
{condition: canStopTransmission, menuItem: { clazz: 'icon icon-transmit-false', text: 'Disable transmission', action: 'disableTransmission'}},
|
||||||
{condition: supportsStats, menuItem: {clazz: 'fa fa-area-chart', text: 'Status History', action: 'showStats'}},
|
{condition: supportsStats, menuItem: {clazz: 'fa fa-area-chart', text: 'Status History', action: 'showStats'}},
|
||||||
{condition: canAccessProvenance, menuItem: {clazz: 'icon icon-provenance', imgStyle: 'context-menu-provenance', text: 'Data provenance', action: 'openProvenance'}},
|
{condition: canAccessProvenance, menuItem: {clazz: 'icon icon-provenance', imgStyle: 'context-menu-provenance', text: 'Data provenance', action: 'openProvenance'}},
|
||||||
{condition: isStatefulProcessor, menuItem: {clazz: 'fa fa-tasks', text: 'View state', action: 'viewState'}},
|
{condition: isStatefulProcessor, menuItem: {clazz: 'fa fa-tasks', text: 'View state', action: 'viewState'}},
|
||||||
|
@ -446,20 +476,28 @@ nf.ContextMenu = (function () {
|
||||||
{condition: canEmptyQueue, menuItem: {clazz: 'fa fa-minus-circle', text: 'Empty queue', action: 'emptyQueue'}},
|
{condition: canEmptyQueue, menuItem: {clazz: 'fa fa-minus-circle', text: 'Empty queue', action: 'emptyQueue'}},
|
||||||
{condition: isDeletable, menuItem: {clazz: 'fa fa-trash', text: 'Delete', action: 'delete'}},
|
{condition: isDeletable, menuItem: {clazz: 'fa fa-trash', text: 'Delete', action: 'delete'}},
|
||||||
{condition: canAlign, menuItem: {clazz: 'fa fa-align-center', text: 'Align vertical', action: 'alignVertical'}},
|
{condition: canAlign, menuItem: {clazz: 'fa fa-align-center', text: 'Align vertical', action: 'alignVertical'}},
|
||||||
{condition: canAlign, menuItem: {clazz: 'fa fa-align-center fa-rotate-90', text: 'Align horizontal', action: 'alignHorizontal'}}
|
{condition: canAlign, menuItem: { clazz: 'fa fa-align-center fa-rotate-90', text: 'Align horizontal', action: 'alignHorizontal'}}
|
||||||
];
|
];
|
||||||
|
|
||||||
return {
|
var nfContextMenu = {
|
||||||
init: function () {
|
|
||||||
$('#context-menu').on('contextmenu', function(evt) {
|
/**
|
||||||
|
* Initialize the context menu.
|
||||||
|
*
|
||||||
|
* @param actions The reference to the actions controller.
|
||||||
|
*/
|
||||||
|
init: function (actions) {
|
||||||
|
nfActions = actions;
|
||||||
|
|
||||||
|
$('#context-menu').on('contextmenu', function (evt) {
|
||||||
// stop propagation and prevent default
|
// stop propagation and prevent default
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows the context menu.
|
* Shows the context menu.
|
||||||
*/
|
*/
|
||||||
show: function () {
|
show: function () {
|
||||||
var contextMenu = $('#context-menu').empty();
|
var contextMenu = $('#context-menu').empty();
|
||||||
|
@ -468,17 +506,17 @@ nf.ContextMenu = (function () {
|
||||||
var breadCrumb = $('#breadcrumbs').get(0);
|
var breadCrumb = $('#breadcrumbs').get(0);
|
||||||
|
|
||||||
// get the current selection
|
// get the current selection
|
||||||
var selection = nf.CanvasUtils.getSelection();
|
var selection = canvasUtils.getSelection();
|
||||||
|
|
||||||
// consider each component action for the current selection
|
// consider each component action for the current selection
|
||||||
$.each(actions, function (_, action) {
|
$.each(actions, function (_, action) {
|
||||||
// determine if this action is application for this selection
|
// determine if this action is application for this selection
|
||||||
if (action.condition(selection)) {
|
if (action.condition(selection, canvasUtils.getComponentByType('Connection'))) {
|
||||||
var menuItem = action.menuItem;
|
var menuItem = action.menuItem;
|
||||||
|
|
||||||
addMenuItem(contextMenu, {
|
addMenuItem(contextMenu, {
|
||||||
clazz: menuItem.clazz,
|
clazz: menuItem.clazz,
|
||||||
imgStyle: menuItem.imgStyle,
|
imgStyle: menuItem.imgStyle,
|
||||||
text: menuItem.text,
|
text: menuItem.text,
|
||||||
click: function (evt) {
|
click: function (evt) {
|
||||||
executeAction(menuItem.action, selection, evt);
|
executeAction(menuItem.action, selection, evt);
|
||||||
|
@ -505,25 +543,25 @@ nf.ContextMenu = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// inform Angular app incase we've click on the canvas
|
// inform Angular app incase we've click on the canvas
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the context menu.
|
* Hides the context menu.
|
||||||
*/
|
*/
|
||||||
hide: function () {
|
hide: function () {
|
||||||
$('#context-menu').hide();
|
$('#context-menu').hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates the context menu for the components in the specified selection.
|
* Activates the context menu for the components in the specified selection.
|
||||||
*
|
*
|
||||||
* @param {selection} components The components to enable the context menu for
|
* @param {selection} components The components to enable the context menu for
|
||||||
*/
|
*/
|
||||||
activate: function (components) {
|
activate: function (components) {
|
||||||
components.on('contextmenu.selection', function () {
|
components.on('contextmenu.selection', function () {
|
||||||
// get the clicked component to update selection
|
// get the clicked component to update selection
|
||||||
nf.ContextMenu.show();
|
nfContextMenu.show();
|
||||||
|
|
||||||
// stop propagation and prevent default
|
// stop propagation and prevent default
|
||||||
d3.event.preventDefault();
|
d3.event.preventDefault();
|
||||||
|
@ -531,4 +569,6 @@ nf.ContextMenu = (function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfContextMenu;
|
||||||
|
}));
|
|
@ -15,9 +15,58 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ControllerService = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.ControllerServices',
|
||||||
|
'nf.Settings',
|
||||||
|
'nf.UniversalCapture',
|
||||||
|
'nf.CustomUi',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ReportingTask',
|
||||||
|
'nf.Processor'],
|
||||||
|
function ($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor) {
|
||||||
|
return (nf.ControllerService = factory($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ControllerService =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.ControllerServices'),
|
||||||
|
require('nf.Settings'),
|
||||||
|
require('nf.UniversalCapture'),
|
||||||
|
require('nf.CustomUi'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ReportingTask'),
|
||||||
|
require('nf.Processor')));
|
||||||
|
} else {
|
||||||
|
nf.ControllerService = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.ControllerServices,
|
||||||
|
root.nf.Settings,
|
||||||
|
root.nf.UniversalCapture,
|
||||||
|
root.nf.CustomUi,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ReportingTask,
|
||||||
|
root.nf.Processor);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, dialog, client, controllerServices, settings, universalCapture, customUi, canvasUtils, reportingTask, processor) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
edit: 'edit',
|
edit: 'edit',
|
||||||
|
@ -44,15 +93,15 @@ nf.ControllerService = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: content,
|
dialogContent: content,
|
||||||
headerText: 'Controller Service'
|
headerText: 'Controller Service'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +177,7 @@ nf.ControllerService = (function () {
|
||||||
// service B that has been removed. attempting to enable/disable/remove A
|
// service B that has been removed. attempting to enable/disable/remove A
|
||||||
// will attempt to reload B which is no longer a known service. also ensure
|
// will attempt to reload B which is no longer a known service. also ensure
|
||||||
// we have permissions to reload the service
|
// we have permissions to reload the service
|
||||||
if (nf.Common.isUndefined(controllerServiceEntity) || controllerServiceEntity.permissions.canRead === false) {
|
if (common.isUndefined(controllerServiceEntity) || controllerServiceEntity.permissions.canRead === false) {
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
}).promise();
|
}).promise();
|
||||||
|
@ -140,7 +189,7 @@ nf.ControllerService = (function () {
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
renderControllerService(serviceTable, response);
|
renderControllerService(serviceTable, response);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,7 +216,7 @@ nf.ControllerService = (function () {
|
||||||
* @param {type} controllerService
|
* @param {type} controllerService
|
||||||
*/
|
*/
|
||||||
var reloadControllerServiceAndReferencingComponents = function (serviceTable, controllerService) {
|
var reloadControllerServiceAndReferencingComponents = function (serviceTable, controllerService) {
|
||||||
reloadControllerService(serviceTable, controllerService.id).done(function(response) {
|
reloadControllerService(serviceTable, controllerService.id).done(function (response) {
|
||||||
reloadControllerServiceReferences(serviceTable, response.component);
|
reloadControllerServiceReferences(serviceTable, response.component);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -190,8 +239,8 @@ nf.ControllerService = (function () {
|
||||||
var reference = referencingComponentEntity.component;
|
var reference = referencingComponentEntity.component;
|
||||||
if (reference.referenceType === 'Processor') {
|
if (reference.referenceType === 'Processor') {
|
||||||
// reload the processor on the canvas if appropriate
|
// reload the processor on the canvas if appropriate
|
||||||
if (nf.Canvas.getGroupId() === reference.groupId) {
|
if (canvasUtils.getGroupId() === reference.groupId) {
|
||||||
nf.Processor.reload(reference.id);
|
processor.reload(reference.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the current active thread count
|
// update the current active thread count
|
||||||
|
@ -204,7 +253,7 @@ nf.ControllerService = (function () {
|
||||||
}
|
}
|
||||||
} else if (reference.referenceType === 'ReportingTask') {
|
} else if (reference.referenceType === 'ReportingTask') {
|
||||||
// reload the referencing reporting tasks
|
// reload the referencing reporting tasks
|
||||||
nf.ReportingTask.reload(reference.id);
|
reportingTask.reload(reference.id);
|
||||||
|
|
||||||
// update the current active thread count
|
// update the current active thread count
|
||||||
$('div.' + reference.id + '-active-threads').text(reference.activeThreadCount);
|
$('div.' + reference.id + '-active-threads').text(reference.activeThreadCount);
|
||||||
|
@ -217,7 +266,7 @@ nf.ControllerService = (function () {
|
||||||
} else {
|
} else {
|
||||||
// reload the referencing services
|
// reload the referencing services
|
||||||
reloadControllerService(serviceTable, reference.id);
|
reloadControllerService(serviceTable, reference.id);
|
||||||
|
|
||||||
// update the current state of this service
|
// update the current state of this service
|
||||||
var referencingComponentState = $('div.' + reference.id + '-state');
|
var referencingComponentState = $('div.' + reference.id + '-state');
|
||||||
if (referencingComponentState.length) {
|
if (referencingComponentState.length) {
|
||||||
|
@ -233,9 +282,9 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
// see if this controller service references another controller service
|
// see if this controller service references another controller service
|
||||||
// in order to update the referenced service referencing components
|
// in order to update the referenced service referencing components
|
||||||
nf.ControllerService.reloadReferencedServices(serviceTable, controllerService);
|
nfControllerService.reloadReferencedServices(serviceTable, controllerService);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a border to the controller service referencing components if necessary.
|
* Adds a border to the controller service referencing components if necessary.
|
||||||
*
|
*
|
||||||
|
@ -264,22 +313,22 @@ nf.ControllerService = (function () {
|
||||||
var currentBulletins = bulletinIcon.data('bulletins');
|
var currentBulletins = bulletinIcon.data('bulletins');
|
||||||
|
|
||||||
// update the bulletins if necessary
|
// update the bulletins if necessary
|
||||||
if (nf.Common.doBulletinsDiffer(currentBulletins, bulletins)) {
|
if (common.doBulletinsDiffer(currentBulletins, bulletins)) {
|
||||||
bulletinIcon.data('bulletins', bulletins);
|
bulletinIcon.data('bulletins', bulletins);
|
||||||
|
|
||||||
// format the new bulletins
|
// format the new bulletins
|
||||||
var formattedBulletins = nf.Common.getFormattedBulletins(bulletins);
|
var formattedBulletins = common.getFormattedBulletins(bulletins);
|
||||||
|
|
||||||
// if there are bulletins update them
|
// if there are bulletins update them
|
||||||
if (bulletins.length > 0) {
|
if (bulletins.length > 0) {
|
||||||
var list = nf.Common.formatUnorderedList(formattedBulletins);
|
var list = common.formatUnorderedList(formattedBulletins);
|
||||||
|
|
||||||
// update existing tooltip or initialize a new one if appropriate
|
// update existing tooltip or initialize a new one if appropriate
|
||||||
if (bulletinIcon.data('qtip')) {
|
if (bulletinIcon.data('qtip')) {
|
||||||
bulletinIcon.qtip('option', 'content.text', list);
|
bulletinIcon.qtip('option', 'content.text', list);
|
||||||
} else {
|
} else {
|
||||||
bulletinIcon.addClass('has-bulletins').show().qtip($.extend({},
|
bulletinIcon.addClass('has-bulletins').show().qtip($.extend({},
|
||||||
nf.CanvasUtils.config.systemTooltipConfig,
|
canvasUtils.config.systemTooltipConfig,
|
||||||
{
|
{
|
||||||
content: list
|
content: list
|
||||||
}));
|
}));
|
||||||
|
@ -301,16 +350,16 @@ nf.ControllerService = (function () {
|
||||||
var icon = $(this);
|
var icon = $(this);
|
||||||
|
|
||||||
var state = referencingComponent.state.toLowerCase();
|
var state = referencingComponent.state.toLowerCase();
|
||||||
if (state === 'stopped' && !nf.Common.isEmpty(referencingComponent.validationErrors)) {
|
if (state === 'stopped' && !common.isEmpty(referencingComponent.validationErrors)) {
|
||||||
state = 'invalid';
|
state = 'invalid';
|
||||||
|
|
||||||
// add tooltip for the warnings
|
// add tooltip for the warnings
|
||||||
var list = nf.Common.formatUnorderedList(referencingComponent.validationErrors);
|
var list = common.formatUnorderedList(referencingComponent.validationErrors);
|
||||||
if (icon.data('qtip')) {
|
if (icon.data('qtip')) {
|
||||||
icon.qtip('option', 'content.text', list);
|
icon.qtip('option', 'content.text', list);
|
||||||
} else {
|
} else {
|
||||||
icon.qtip($.extend({},
|
icon.qtip($.extend({},
|
||||||
nf.CanvasUtils.config.systemTooltipConfig,
|
canvasUtils.config.systemTooltipConfig,
|
||||||
{
|
{
|
||||||
content: list
|
content: list
|
||||||
}));
|
}));
|
||||||
|
@ -333,16 +382,16 @@ nf.ControllerService = (function () {
|
||||||
var icon = $(this);
|
var icon = $(this);
|
||||||
|
|
||||||
var state = referencingService.state === 'ENABLED' ? 'enabled' : 'disabled';
|
var state = referencingService.state === 'ENABLED' ? 'enabled' : 'disabled';
|
||||||
if (state === 'disabled' && !nf.Common.isEmpty(referencingService.validationErrors)) {
|
if (state === 'disabled' && !common.isEmpty(referencingService.validationErrors)) {
|
||||||
state = 'invalid';
|
state = 'invalid';
|
||||||
|
|
||||||
// add tooltip for the warnings
|
// add tooltip for the warnings
|
||||||
var list = nf.Common.formatUnorderedList(referencingService.validationErrors);
|
var list = common.formatUnorderedList(referencingService.validationErrors);
|
||||||
if (icon.data('qtip')) {
|
if (icon.data('qtip')) {
|
||||||
icon.qtip('option', 'content.text', list);
|
icon.qtip('option', 'content.text', list);
|
||||||
} else {
|
} else {
|
||||||
icon.qtip($.extend({},
|
icon.qtip($.extend({},
|
||||||
nf.CanvasUtils.config.systemTooltipConfig,
|
canvasUtils.config.systemTooltipConfig,
|
||||||
{
|
{
|
||||||
content: list
|
content: list
|
||||||
}));
|
}));
|
||||||
|
@ -377,11 +426,11 @@ nf.ControllerService = (function () {
|
||||||
* Adds the specified reference for this controller service.
|
* Adds the specified reference for this controller service.
|
||||||
*
|
*
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
* @param {jQuery} referenceContainer
|
* @param {jQuery} referenceContainer
|
||||||
* @param {array} referencingComponents
|
* @param {array} referencingComponents
|
||||||
*/
|
*/
|
||||||
var createReferencingComponents = function (serviceTable, referenceContainer, referencingComponents) {
|
var createReferencingComponents = function (serviceTable, referenceContainer, referencingComponents) {
|
||||||
if (nf.Common.isEmpty(referencingComponents)) {
|
if (common.isEmpty(referencingComponents)) {
|
||||||
referenceContainer.append('<div class="unset">No referencing components.</div>');
|
referenceContainer.append('<div class="unset">No referencing components.</div>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +463,7 @@ nf.ControllerService = (function () {
|
||||||
if (referencingComponent.referenceType === 'Processor') {
|
if (referencingComponent.referenceType === 'Processor') {
|
||||||
var processorLink = $('<span class="referencing-component-name link"></span>').text(referencingComponent.name).on('click', function () {
|
var processorLink = $('<span class="referencing-component-name link"></span>').text(referencingComponent.name).on('click', function () {
|
||||||
// show the component
|
// show the component
|
||||||
nf.CanvasUtils.showComponent(referencingComponent.groupId, referencingComponent.id);
|
canvasUtils.showComponent(referencingComponent.groupId, referencingComponent.id);
|
||||||
|
|
||||||
// close the dialog and shell
|
// close the dialog and shell
|
||||||
referenceContainer.closest('.dialog').modal('hide');
|
referenceContainer.closest('.dialog').modal('hide');
|
||||||
|
@ -429,11 +478,11 @@ nf.ControllerService = (function () {
|
||||||
var processorBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
|
var processorBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
|
||||||
|
|
||||||
// type
|
// type
|
||||||
var processorType = $('<span class="referencing-component-type"></span>').text(nf.Common.substringAfterLast(referencingComponent.type, '.'));
|
var processorType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.'));
|
||||||
|
|
||||||
// active thread count
|
// active thread count
|
||||||
var processorActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads');
|
var processorActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads');
|
||||||
if (nf.Common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) {
|
if (common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) {
|
||||||
processorActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')');
|
processorActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +533,7 @@ nf.ControllerService = (function () {
|
||||||
var serviceBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
|
var serviceBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
|
||||||
|
|
||||||
// type
|
// type
|
||||||
var serviceType = $('<span class="referencing-component-type"></span>').text(nf.Common.substringAfterLast(referencingComponent.type, '.'));
|
var serviceType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.'));
|
||||||
|
|
||||||
// service
|
// service
|
||||||
var serviceItem = $('<li></li>').append(serviceTwist).append(serviceState).append(serviceBulletins).append(serviceLink).append(serviceType).append(referencingServiceReferencesContainer);
|
var serviceItem = $('<li></li>').append(serviceTwist).append(serviceState).append(serviceBulletins).append(serviceLink).append(serviceType).append(referencingServiceReferencesContainer);
|
||||||
|
@ -515,11 +564,11 @@ nf.ControllerService = (function () {
|
||||||
var reportingTaskBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
|
var reportingTaskBulletins = $('<div class="referencing-component-bulletins"></div>').addClass(referencingComponent.id + '-bulletins');
|
||||||
|
|
||||||
// type
|
// type
|
||||||
var reportingTaskType = $('<span class="referencing-component-type"></span>').text(nf.Common.substringAfterLast(referencingComponent.type, '.'));
|
var reportingTaskType = $('<span class="referencing-component-type"></span>').text(common.substringAfterLast(referencingComponent.type, '.'));
|
||||||
|
|
||||||
// active thread count
|
// active thread count
|
||||||
var reportingTaskActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads');
|
var reportingTaskActiveThreadCount = $('<span class="referencing-component-active-thread-count"></span>').addClass(referencingComponent.id + '-active-threads');
|
||||||
if (nf.Common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) {
|
if (common.isDefinedAndNotNull(referencingComponent.activeThreadCount) && referencingComponent.activeThreadCount > 0) {
|
||||||
reportingTaskActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')');
|
reportingTaskActiveThreadCount.text('(' + referencingComponent.activeThreadCount + ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +632,7 @@ nf.ControllerService = (function () {
|
||||||
sourceId: ids
|
sourceId: ids
|
||||||
},
|
},
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -597,7 +646,7 @@ nf.ControllerService = (function () {
|
||||||
var setEnabled = function (serviceTable, controllerServiceEntity, enabled, pollCondition) {
|
var setEnabled = function (serviceTable, controllerServiceEntity, enabled, pollCondition) {
|
||||||
// build the request entity
|
// build the request entity
|
||||||
var updateControllerServiceEntity = {
|
var updateControllerServiceEntity = {
|
||||||
'revision': nf.Client.getRevision(controllerServiceEntity),
|
'revision': client.getRevision(controllerServiceEntity),
|
||||||
'component': {
|
'component': {
|
||||||
'id': controllerServiceEntity.id,
|
'id': controllerServiceEntity.id,
|
||||||
'state': enabled ? 'ENABLED' : 'DISABLED'
|
'state': enabled ? 'ENABLED' : 'DISABLED'
|
||||||
|
@ -612,7 +661,7 @@ nf.ControllerService = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
renderControllerService(serviceTable, response);
|
renderControllerService(serviceTable, response);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// wait until the polling of each service finished
|
// wait until the polling of each service finished
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
|
@ -691,11 +740,11 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
if (serviceOnly) {
|
if (serviceOnly) {
|
||||||
if (referencingComponent.referenceType === 'ControllerService') {
|
if (referencingComponent.referenceType === 'ControllerService') {
|
||||||
referencingComponentRevisions[referencingComponentEntity.id] = nf.Client.getRevision(referencingComponentEntity);
|
referencingComponentRevisions[referencingComponentEntity.id] = client.getRevision(referencingComponentEntity);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (referencingComponent.referenceType !== 'ControllerService') {
|
if (referencingComponent.referenceType !== 'ControllerService') {
|
||||||
referencingComponentRevisions[referencingComponentEntity.id] = nf.Client.getRevision(referencingComponentEntity);
|
referencingComponentRevisions[referencingComponentEntity.id] = client.getRevision(referencingComponentEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +779,7 @@ nf.ControllerService = (function () {
|
||||||
data: JSON.stringify(referenceEntity),
|
data: JSON.stringify(referenceEntity),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// Note: updated revisions will be retrieved after updateReferencingSchedulableComponents is invoked
|
// Note: updated revisions will be retrieved after updateReferencingSchedulableComponents is invoked
|
||||||
|
|
||||||
|
@ -810,7 +859,7 @@ nf.ControllerService = (function () {
|
||||||
conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins);
|
conditionMet(serviceResponse.component, bulletinResponse.bulletinBoard.bulletins);
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -832,7 +881,7 @@ nf.ControllerService = (function () {
|
||||||
conditionMet(controllerService, response.bulletinBoard.bulletins);
|
conditionMet(controllerService, response.bulletinBoard.bulletins);
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
});
|
});
|
||||||
}).promise();
|
}).promise();
|
||||||
};
|
};
|
||||||
|
@ -1002,7 +1051,7 @@ nf.ControllerService = (function () {
|
||||||
data: JSON.stringify(referenceEntity),
|
data: JSON.stringify(referenceEntity),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// Note: updated revisions will be retrieved after updateReferencingServices is invoked
|
// Note: updated revisions will be retrieved after updateReferencingServices is invoked
|
||||||
|
|
||||||
|
@ -1135,7 +1184,7 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
// show the dialog
|
// show the dialog
|
||||||
$('#enable-controller-service-dialog').modal('setButtonModel', buttons).modal('show');
|
$('#enable-controller-service-dialog').modal('setButtonModel', buttons).modal('show');
|
||||||
|
|
||||||
// load the bulletins
|
// load the bulletins
|
||||||
queryBulletins([controllerService.id]).done(function (response) {
|
queryBulletins([controllerService.id]).done(function (response) {
|
||||||
updateBulletins(response.bulletinBoard.bulletins, $('#enable-controller-service-bulletins'));
|
updateBulletins(response.bulletinBoard.bulletins, $('#enable-controller-service-bulletins'));
|
||||||
|
@ -1157,7 +1206,7 @@ nf.ControllerService = (function () {
|
||||||
*
|
*
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
*/
|
*/
|
||||||
var disableHandler = function(serviceTable) {
|
var disableHandler = function (serviceTable) {
|
||||||
var disableDialog = $('#disable-controller-service-dialog');
|
var disableDialog = $('#disable-controller-service-dialog');
|
||||||
var canceled = false;
|
var canceled = false;
|
||||||
|
|
||||||
|
@ -1214,7 +1263,7 @@ nf.ControllerService = (function () {
|
||||||
if (hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) {
|
if (hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) {
|
||||||
setCloseButton();
|
setCloseButton();
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Controller Service',
|
headerText: 'Controller Service',
|
||||||
dialogContent: 'Unable to disable due to unauthorized referencing components.'
|
dialogContent: 'Unable to disable due to unauthorized referencing components.'
|
||||||
});
|
});
|
||||||
|
@ -1263,7 +1312,7 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
// inform the user if the action was canceled
|
// inform the user if the action was canceled
|
||||||
if (canceled === true && $('#nf-ok-dialog').not(':visible')) {
|
if (canceled === true && $('#nf-ok-dialog').not(':visible')) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Controller Service',
|
headerText: 'Controller Service',
|
||||||
dialogContent: 'The request to disable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.'
|
dialogContent: 'The request to disable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.'
|
||||||
});
|
});
|
||||||
|
@ -1301,7 +1350,7 @@ nf.ControllerService = (function () {
|
||||||
*
|
*
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
*/
|
*/
|
||||||
var enableHandler = function(serviceTable) {
|
var enableHandler = function (serviceTable) {
|
||||||
var enableDialog = $('#enable-controller-service-dialog');
|
var enableDialog = $('#enable-controller-service-dialog');
|
||||||
var canceled = false;
|
var canceled = false;
|
||||||
|
|
||||||
|
@ -1367,7 +1416,7 @@ nf.ControllerService = (function () {
|
||||||
if (scope === config.serviceAndReferencingComponents && hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) {
|
if (scope === config.serviceAndReferencingComponents && hasUnauthorizedReferencingComponent(controllerService.referencingComponents)) {
|
||||||
setCloseButton();
|
setCloseButton();
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Controller Service',
|
headerText: 'Controller Service',
|
||||||
dialogContent: 'Unable to enable due to unauthorized referencing components.'
|
dialogContent: 'Unable to enable due to unauthorized referencing components.'
|
||||||
});
|
});
|
||||||
|
@ -1396,7 +1445,7 @@ nf.ControllerService = (function () {
|
||||||
var enableReferencingSchedulable = $('#enable-referencing-schedulable').addClass('ajax-loading');
|
var enableReferencingSchedulable = $('#enable-referencing-schedulable').addClass('ajax-loading');
|
||||||
|
|
||||||
// start all referencing schedulable components
|
// start all referencing schedulable components
|
||||||
updateReferencingSchedulableComponents(serviceTable, controllerServiceEntity, true, continuePolling).done(function() {
|
updateReferencingSchedulableComponents(serviceTable, controllerServiceEntity, true, continuePolling).done(function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
enableReferencingSchedulable.removeClass('ajax-loading').addClass('ajax-complete');
|
enableReferencingSchedulable.removeClass('ajax-loading').addClass('ajax-complete');
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
|
@ -1426,7 +1475,7 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
// inform the user if the action was canceled
|
// inform the user if the action was canceled
|
||||||
if (canceled === true && $('#nf-ok-dialog').not(':visible')) {
|
if (canceled === true && $('#nf-ok-dialog').not(':visible')) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Controller Service',
|
headerText: 'Controller Service',
|
||||||
dialogContent: 'The request to enable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.'
|
dialogContent: 'The request to enable has been canceled. Parts of this request may have already completed. Please verify the state of this service and all referencing components.'
|
||||||
});
|
});
|
||||||
|
@ -1448,7 +1497,7 @@ nf.ControllerService = (function () {
|
||||||
propertyName: propertyName
|
propertyName: propertyName
|
||||||
},
|
},
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1464,7 +1513,7 @@ nf.ControllerService = (function () {
|
||||||
// determine if changes have been made
|
// determine if changes have been made
|
||||||
if (isSaveRequired()) {
|
if (isSaveRequired()) {
|
||||||
// see if those changes should be saved
|
// see if those changes should be saved
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Save',
|
headerText: 'Save',
|
||||||
dialogContent: 'Save changes before going to this Controller Service?',
|
dialogContent: 'Save changes before going to this Controller Service?',
|
||||||
noHandler: function () {
|
noHandler: function () {
|
||||||
|
@ -1484,19 +1533,19 @@ nf.ControllerService = (function () {
|
||||||
}
|
}
|
||||||
}).promise();
|
}).promise();
|
||||||
};
|
};
|
||||||
|
|
||||||
var saveControllerService = function (serviceTable, controllerServiceEntity) {
|
var saveControllerService = function (serviceTable, controllerServiceEntity) {
|
||||||
// marshal the settings and properties and update the controller service
|
// marshal the settings and properties and update the controller service
|
||||||
var updatedControllerService = marshalDetails();
|
var updatedControllerService = marshalDetails();
|
||||||
|
|
||||||
// ensure details are valid as far as we can tell
|
// ensure details are valid as far as we can tell
|
||||||
if (validateDetails(updatedControllerService)) {
|
if (validateDetails(updatedControllerService)) {
|
||||||
updatedControllerService['revision'] = nf.Client.getRevision(controllerServiceEntity);
|
updatedControllerService['revision'] = client.getRevision(controllerServiceEntity);
|
||||||
|
|
||||||
var previouslyReferencedServiceIds = [];
|
var previouslyReferencedServiceIds = [];
|
||||||
$.each(identifyReferencedServiceDescriptors(controllerServiceEntity.component), function (_, descriptor) {
|
$.each(identifyReferencedServiceDescriptors(controllerServiceEntity.component), function (_, descriptor) {
|
||||||
var modifyingService = !nf.Common.isUndefined(updatedControllerService.component.properties) && !nf.Common.isUndefined(updatedControllerService.component.properties[descriptor.name]);
|
var modifyingService = !common.isUndefined(updatedControllerService.component.properties) && !common.isUndefined(updatedControllerService.component.properties[descriptor.name]);
|
||||||
var isCurrentlyConfigured = nf.Common.isDefinedAndNotNull(controllerServiceEntity.component.properties[descriptor.name]);
|
var isCurrentlyConfigured = common.isDefinedAndNotNull(controllerServiceEntity.component.properties[descriptor.name]);
|
||||||
|
|
||||||
// if we are attempting to update a controller service reference
|
// if we are attempting to update a controller service reference
|
||||||
if (modifyingService && isCurrentlyConfigured) {
|
if (modifyingService && isCurrentlyConfigured) {
|
||||||
|
@ -1516,9 +1565,9 @@ nf.ControllerService = (function () {
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// reload the controller service
|
// reload the controller service
|
||||||
renderControllerService(serviceTable, response);
|
renderControllerService(serviceTable, response);
|
||||||
|
|
||||||
// reload all previously referenced controller services
|
// reload all previously referenced controller services
|
||||||
$.each(previouslyReferencedServiceIds, function(_, oldServiceReferenceId) {
|
$.each(previouslyReferencedServiceIds, function (_, oldServiceReferenceId) {
|
||||||
reloadControllerService(serviceTable, oldServiceReferenceId);
|
reloadControllerService(serviceTable, oldServiceReferenceId);
|
||||||
});
|
});
|
||||||
}).fail(handleControllerServiceConfigurationError);
|
}).fail(handleControllerServiceConfigurationError);
|
||||||
|
@ -1538,7 +1587,7 @@ nf.ControllerService = (function () {
|
||||||
var referencedServiceDescriptors = [];
|
var referencedServiceDescriptors = [];
|
||||||
|
|
||||||
$.each(component.descriptors, function (_, descriptor) {
|
$.each(component.descriptors, function (_, descriptor) {
|
||||||
if (nf.Common.isDefinedAndNotNull(descriptor.identifiesControllerService)) {
|
if (common.isDefinedAndNotNull(descriptor.identifiesControllerService)) {
|
||||||
referencedServiceDescriptors.push(descriptor);
|
referencedServiceDescriptors.push(descriptor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1558,7 +1607,7 @@ nf.ControllerService = (function () {
|
||||||
var referencedServiceId = component.properties[descriptor.name];
|
var referencedServiceId = component.properties[descriptor.name];
|
||||||
|
|
||||||
// ensure the property is configured
|
// ensure the property is configured
|
||||||
if (nf.Common.isDefinedAndNotNull(referencedServiceId) && $.trim(referencedServiceId).length > 0) {
|
if (common.isDefinedAndNotNull(referencedServiceId) && $.trim(referencedServiceId).length > 0) {
|
||||||
referencedServices.push(referencedServiceId);
|
referencedServices.push(referencedServiceId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1571,7 +1620,7 @@ nf.ControllerService = (function () {
|
||||||
*/
|
*/
|
||||||
var currentTable;
|
var currentTable;
|
||||||
|
|
||||||
return {
|
var nfControllerService = {
|
||||||
/**
|
/**
|
||||||
* Initializes the controller service configuration dialog.
|
* Initializes the controller service configuration dialog.
|
||||||
*/
|
*/
|
||||||
|
@ -1593,7 +1642,7 @@ nf.ControllerService = (function () {
|
||||||
}],
|
}],
|
||||||
select: function () {
|
select: function () {
|
||||||
// remove all property detail dialogs
|
// remove all property detail dialogs
|
||||||
nf.UniversalCapture.removeAllPropertyDetailDialogs();
|
universalCapture.removeAllPropertyDetailDialogs();
|
||||||
|
|
||||||
// update the property table size in case this is the first time its rendered
|
// update the property table size in case this is the first time its rendered
|
||||||
if ($(this).text() === 'Properties') {
|
if ($(this).text() === 'Properties') {
|
||||||
|
@ -1617,8 +1666,8 @@ nf.ControllerService = (function () {
|
||||||
close: function () {
|
close: function () {
|
||||||
// empty the referencing components list
|
// empty the referencing components list
|
||||||
var referencingComponents = $('#controller-service-referencing-components');
|
var referencingComponents = $('#controller-service-referencing-components');
|
||||||
nf.Common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
|
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
|
||||||
nf.Common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
|
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
|
||||||
referencingComponents.css('border-width', '0').empty();
|
referencingComponents.css('border-width', '0').empty();
|
||||||
|
|
||||||
// cancel any active edits
|
// cancel any active edits
|
||||||
|
@ -1628,13 +1677,13 @@ nf.ControllerService = (function () {
|
||||||
$('#controller-service-properties').propertytable('clear');
|
$('#controller-service-properties').propertytable('clear');
|
||||||
|
|
||||||
// clear the comments
|
// clear the comments
|
||||||
nf.Common.clearField('read-only-controller-service-comments');
|
common.clearField('read-only-controller-service-comments');
|
||||||
|
|
||||||
// removed the cached controller service details
|
// removed the cached controller service details
|
||||||
$('#controller-service-configuration').removeData('controllerServiceDetails');
|
$('#controller-service-configuration').removeData('controllerServiceDetails');
|
||||||
},
|
},
|
||||||
open: function () {
|
open: function () {
|
||||||
nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
|
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1657,15 +1706,15 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
// bulletins
|
// bulletins
|
||||||
$('#disable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide();
|
$('#disable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide();
|
||||||
nf.Common.cleanUpTooltips($('#disable-controller-service-service-container'), '#disable-controller-service-bulletins');
|
common.cleanUpTooltips($('#disable-controller-service-service-container'), '#disable-controller-service-bulletins');
|
||||||
|
|
||||||
// reset progress
|
// reset progress
|
||||||
$('div.disable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error');
|
$('div.disable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error');
|
||||||
|
|
||||||
// referencing components
|
// referencing components
|
||||||
var referencingComponents = $('#disable-controller-service-referencing-components');
|
var referencingComponents = $('#disable-controller-service-referencing-components');
|
||||||
nf.Common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
|
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
|
||||||
nf.Common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
|
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
|
||||||
referencingComponents.css('border-width', '0').empty();
|
referencingComponents.css('border-width', '0').empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1703,15 +1752,15 @@ nf.ControllerService = (function () {
|
||||||
|
|
||||||
// bulletins
|
// bulletins
|
||||||
$('#enable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide();
|
$('#enable-controller-service-bulletins').removeClass('has-bulletins').removeData('bulletins').hide();
|
||||||
nf.Common.cleanUpTooltips($('#enable-controller-service-service-container'), '#enable-controller-service-bulletins');
|
common.cleanUpTooltips($('#enable-controller-service-service-container'), '#enable-controller-service-bulletins');
|
||||||
|
|
||||||
// reset progress
|
// reset progress
|
||||||
$('div.enable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error');
|
$('div.enable-referencing-components').removeClass('ajax-loading ajax-complete ajax-error');
|
||||||
|
|
||||||
// referencing components
|
// referencing components
|
||||||
var referencingComponents = $('#enable-controller-service-referencing-components');
|
var referencingComponents = $('#enable-controller-service-referencing-components');
|
||||||
nf.Common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
|
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-state');
|
||||||
nf.Common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
|
common.cleanUpTooltips(referencingComponents, 'div.referencing-component-bulletins');
|
||||||
referencingComponents.css('border-width', '0').empty();
|
referencingComponents.css('border-width', '0').empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1725,7 +1774,7 @@ nf.ControllerService = (function () {
|
||||||
* @argument {object} controllerServiceEntity The controller service
|
* @argument {object} controllerServiceEntity The controller service
|
||||||
*/
|
*/
|
||||||
showConfiguration: function (serviceTable, controllerServiceEntity) {
|
showConfiguration: function (serviceTable, controllerServiceEntity) {
|
||||||
if (nf.Common.isUndefined(currentTable)){
|
if (common.isUndefined(currentTable)) {
|
||||||
currentTable = serviceTable;
|
currentTable = serviceTable;
|
||||||
}
|
}
|
||||||
var controllerServiceDialog = $('#controller-service-configuration');
|
var controllerServiceDialog = $('#controller-service-configuration');
|
||||||
|
@ -1740,20 +1789,20 @@ nf.ControllerService = (function () {
|
||||||
supportsGoTo: true,
|
supportsGoTo: true,
|
||||||
dialogContainer: '#new-controller-service-property-container',
|
dialogContainer: '#new-controller-service-property-container',
|
||||||
descriptorDeferred: getControllerServicePropertyDescriptor,
|
descriptorDeferred: getControllerServicePropertyDescriptor,
|
||||||
controllerServiceCreatedDeferred: function(response) {
|
controllerServiceCreatedDeferred: function (response) {
|
||||||
var controllerServicesUri;
|
var controllerServicesUri;
|
||||||
var createdControllerServicesTable;
|
var createdControllerServicesTable;
|
||||||
|
|
||||||
// calculate the correct uri
|
// calculate the correct uri
|
||||||
var createdControllerService = response.component;
|
var createdControllerService = response.component;
|
||||||
if (nf.Common.isDefinedAndNotNull(createdControllerService.parentGroupId)) {
|
if (common.isDefinedAndNotNull(createdControllerService.parentGroupId)) {
|
||||||
controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(createdControllerService.parentGroupId) + '/controller-services';
|
controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(createdControllerService.parentGroupId) + '/controller-services';
|
||||||
} else {
|
} else {
|
||||||
controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
|
controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the controller services accordingly
|
// load the controller services accordingly
|
||||||
return nf.ControllerServices.loadControllerServices(controllerServicesUri, serviceTable);
|
return controllerServices.loadControllerServices(controllerServicesUri, serviceTable);
|
||||||
},
|
},
|
||||||
goToServiceDeferred: function () {
|
goToServiceDeferred: function () {
|
||||||
return goToServiceFromProperty(serviceTable);
|
return goToServiceFromProperty(serviceTable);
|
||||||
|
@ -1794,8 +1843,8 @@ nf.ControllerService = (function () {
|
||||||
controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity);
|
controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity);
|
||||||
|
|
||||||
// populate the controller service settings
|
// populate the controller service settings
|
||||||
nf.Common.populateField('controller-service-id', controllerService['id']);
|
common.populateField('controller-service-id', controllerService['id']);
|
||||||
nf.Common.populateField('controller-service-type', nf.Common.substringAfterLast(controllerService['type'], '.'));
|
common.populateField('controller-service-type', common.substringAfterLast(controllerService['type'], '.'));
|
||||||
$('#controller-service-name').val(controllerService['name']);
|
$('#controller-service-name').val(controllerService['name']);
|
||||||
$('#controller-service-comments').val(controllerService['comments']);
|
$('#controller-service-comments').val(controllerService['comments']);
|
||||||
|
|
||||||
|
@ -1817,31 +1866,31 @@ nf.ControllerService = (function () {
|
||||||
// close all fields currently being edited
|
// close all fields currently being edited
|
||||||
$('#controller-service-properties').propertytable('saveRow');
|
$('#controller-service-properties').propertytable('saveRow');
|
||||||
|
|
||||||
// save the controller service
|
// save the controller service
|
||||||
saveControllerService(serviceTable, controllerServiceEntity).done(function (response) {
|
saveControllerService(serviceTable, controllerServiceEntity).done(function (response) {
|
||||||
reloadControllerServiceReferences(serviceTable, response.component);
|
reloadControllerServiceReferences(serviceTable, response.component);
|
||||||
|
|
||||||
// close the details panel
|
// close the details panel
|
||||||
controllerServiceDialog.modal('hide');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
buttonText: 'Cancel',
|
|
||||||
color: {
|
|
||||||
base: '#E3E8EB',
|
|
||||||
hover: '#C7D2D7',
|
|
||||||
text: '#004849'
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: function () {
|
|
||||||
controllerServiceDialog.modal('hide');
|
controllerServiceDialog.modal('hide');
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}];
|
}
|
||||||
|
}, {
|
||||||
|
buttonText: 'Cancel',
|
||||||
|
color: {
|
||||||
|
base: '#E3E8EB',
|
||||||
|
hover: '#C7D2D7',
|
||||||
|
text: '#004849'
|
||||||
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
controllerServiceDialog.modal('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
// determine if we should show the advanced button
|
// determine if we should show the advanced button
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
|
if (common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
buttonText: 'Advanced',
|
buttonText: 'Advanced',
|
||||||
clazz: 'fa fa-cog button-icon',
|
clazz: 'fa fa-cog button-icon',
|
||||||
|
@ -1860,12 +1909,12 @@ nf.ControllerService = (function () {
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// show the custom ui
|
// show the custom ui
|
||||||
nf.CustomUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, true).done(function () {
|
customUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, true).done(function () {
|
||||||
// once the custom ui is closed, reload the controller service
|
// once the custom ui is closed, reload the controller service
|
||||||
reloadControllerServiceAndReferencingComponents(serviceTable, controllerService);
|
reloadControllerServiceAndReferencingComponents(serviceTable, controllerService);
|
||||||
|
|
||||||
// show the settings
|
// show the settings
|
||||||
nf.Settings.showSettings();
|
settings.showSettings();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1875,7 +1924,7 @@ nf.ControllerService = (function () {
|
||||||
// determine if changes have been made
|
// determine if changes have been made
|
||||||
if (isSaveRequired()) {
|
if (isSaveRequired()) {
|
||||||
// see if those changes should be saved
|
// see if those changes should be saved
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Save',
|
headerText: 'Save',
|
||||||
dialogContent: 'Save changes before opening the advanced configuration?',
|
dialogContent: 'Save changes before opening the advanced configuration?',
|
||||||
noHandler: openCustomUi,
|
noHandler: openCustomUi,
|
||||||
|
@ -1910,7 +1959,7 @@ nf.ControllerService = (function () {
|
||||||
updateReferencingComponentsBorder(referenceContainer);
|
updateReferencingComponentsBorder(referenceContainer);
|
||||||
|
|
||||||
$('#controller-service-properties').propertytable('resetTableSize');
|
$('#controller-service-properties').propertytable('resetTableSize');
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1919,7 +1968,7 @@ nf.ControllerService = (function () {
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
* @param {object} controllerServiceEntity
|
* @param {object} controllerServiceEntity
|
||||||
*/
|
*/
|
||||||
showDetails: function(serviceTable, controllerServiceEntity) {
|
showDetails: function (serviceTable, controllerServiceEntity) {
|
||||||
var controllerServiceDialog = $('#controller-service-configuration');
|
var controllerServiceDialog = $('#controller-service-configuration');
|
||||||
if (controllerServiceDialog.data('mode') !== config.readOnly) {
|
if (controllerServiceDialog.data('mode') !== config.readOnly) {
|
||||||
// update the visibility
|
// update the visibility
|
||||||
|
@ -1963,17 +2012,17 @@ nf.ControllerService = (function () {
|
||||||
controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity);
|
controllerServiceDialog.data('controllerServiceDetails', controllerServiceEntity);
|
||||||
|
|
||||||
// populate the controller service settings
|
// populate the controller service settings
|
||||||
nf.Common.populateField('controller-service-id', controllerService['id']);
|
common.populateField('controller-service-id', controllerService['id']);
|
||||||
nf.Common.populateField('controller-service-type', nf.Common.substringAfterLast(controllerService['type'], '.'));
|
common.populateField('controller-service-type', common.substringAfterLast(controllerService['type'], '.'));
|
||||||
nf.Common.populateField('read-only-controller-service-name', controllerService['name']);
|
common.populateField('read-only-controller-service-name', controllerService['name']);
|
||||||
nf.Common.populateField('read-only-controller-service-comments', controllerService['comments']);
|
common.populateField('read-only-controller-service-comments', controllerService['comments']);
|
||||||
|
|
||||||
// get the reference container
|
// get the reference container
|
||||||
var referenceContainer = $('#controller-service-referencing-components');
|
var referenceContainer = $('#controller-service-referencing-components');
|
||||||
|
|
||||||
// load the controller referencing components list
|
// load the controller referencing components list
|
||||||
createReferencingComponents(serviceTable, referenceContainer, controllerService.referencingComponents);
|
createReferencingComponents(serviceTable, referenceContainer, controllerService.referencingComponents);
|
||||||
|
|
||||||
var buttons = [{
|
var buttons = [{
|
||||||
buttonText: 'Ok',
|
buttonText: 'Ok',
|
||||||
color: {
|
color: {
|
||||||
|
@ -1990,7 +2039,7 @@ nf.ControllerService = (function () {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// determine if we should show the advanced button
|
// determine if we should show the advanced button
|
||||||
if (nf.Common.isDefinedAndNotNull(nf.CustomUi) && nf.Common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
|
if (common.isDefinedAndNotNull(customUi) && common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
buttonText: 'Advanced',
|
buttonText: 'Advanced',
|
||||||
clazz: 'fa fa-cog button-icon',
|
clazz: 'fa fa-cog button-icon',
|
||||||
|
@ -2008,8 +2057,8 @@ nf.ControllerService = (function () {
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// show the custom ui
|
// show the custom ui
|
||||||
nf.CustomUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, false).done(function () {
|
customUi.showCustomUi(controllerServiceEntity, controllerService.customUiUrl, false).done(function () {
|
||||||
nf.Settings.showSettings();
|
settings.showSettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2038,7 +2087,7 @@ nf.ControllerService = (function () {
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
* @param {object} controllerServiceEntity
|
* @param {object} controllerServiceEntity
|
||||||
*/
|
*/
|
||||||
enable: function(serviceTable, controllerServiceEntity) {
|
enable: function (serviceTable, controllerServiceEntity) {
|
||||||
showEnableControllerServiceDialog(serviceTable, controllerServiceEntity.component);
|
showEnableControllerServiceDialog(serviceTable, controllerServiceEntity.component);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2048,7 +2097,7 @@ nf.ControllerService = (function () {
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
* @param {object} controllerServiceEntity
|
* @param {object} controllerServiceEntity
|
||||||
*/
|
*/
|
||||||
disable: function(serviceTable, controllerServiceEntity) {
|
disable: function (serviceTable, controllerServiceEntity) {
|
||||||
showDisableControllerServiceDialog(serviceTable, controllerServiceEntity.component);
|
showDisableControllerServiceDialog(serviceTable, controllerServiceEntity.component);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2060,12 +2109,12 @@ nf.ControllerService = (function () {
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
* @param {object} component
|
* @param {object} component
|
||||||
*/
|
*/
|
||||||
reloadReferencedServices: function(serviceTable, component) {
|
reloadReferencedServices: function (serviceTable, component) {
|
||||||
$.each(getReferencedServices(component), function (_, referencedServiceId) {
|
$.each(getReferencedServices(component), function (_, referencedServiceId) {
|
||||||
reloadControllerService(serviceTable, referencedServiceId);
|
reloadControllerService(serviceTable, referencedServiceId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts the user before attempting to delete the specified controller service.
|
* Prompts the user before attempting to delete the specified controller service.
|
||||||
*
|
*
|
||||||
|
@ -2074,11 +2123,11 @@ nf.ControllerService = (function () {
|
||||||
*/
|
*/
|
||||||
promptToDeleteController: function (serviceTable, controllerServiceEntity) {
|
promptToDeleteController: function (serviceTable, controllerServiceEntity) {
|
||||||
// prompt for deletion
|
// prompt for deletion
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Delete Controller Service',
|
headerText: 'Delete Controller Service',
|
||||||
dialogContent: 'Delete controller service \'' + nf.Common.escapeHtml(controllerServiceEntity.component.name) + '\'?',
|
dialogContent: 'Delete controller service \'' + common.escapeHtml(controllerServiceEntity.component.name) + '\'?',
|
||||||
yesHandler: function () {
|
yesHandler: function () {
|
||||||
nf.ControllerService.remove(serviceTable, controllerServiceEntity);
|
nfControllerService.remove(serviceTable, controllerServiceEntity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -2089,10 +2138,10 @@ nf.ControllerService = (function () {
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
* @param {object} controllerServiceEntity
|
* @param {object} controllerServiceEntity
|
||||||
*/
|
*/
|
||||||
remove: function(serviceTable, controllerServiceEntity) {
|
remove: function (serviceTable, controllerServiceEntity) {
|
||||||
// prompt for removal?
|
// prompt for removal?
|
||||||
|
|
||||||
var revision = nf.Client.getRevision(controllerServiceEntity);
|
var revision = client.getRevision(controllerServiceEntity);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
url: controllerServiceEntity.uri + '?' + $.param({
|
url: controllerServiceEntity.uri + '?' + $.param({
|
||||||
|
@ -2110,7 +2159,9 @@ nf.ControllerService = (function () {
|
||||||
if (controllerServiceEntity.permissions.canRead) {
|
if (controllerServiceEntity.permissions.canRead) {
|
||||||
reloadControllerServiceReferences(serviceTable, controllerServiceEntity.component);
|
reloadControllerServiceReferences(serviceTable, controllerServiceEntity.component);
|
||||||
}
|
}
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfControllerService;
|
||||||
|
}));
|
||||||
|
|
|
@ -15,9 +15,64 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, Slick, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ControllerServices = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'Slick',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.ProcessGroupConfiguration',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.ControllerService',
|
||||||
|
'nf.ProcessGroup',
|
||||||
|
'nf.PolicyManagement',
|
||||||
|
'nf.ComponentState',
|
||||||
|
'nf.ng.Bridge'],
|
||||||
|
function ($, d3, Slick, client, shell, processGroupConfiguration, canvasUtils, errorHandler, dialog, common, controllerService, processGroup, policyManagement, componentState, angularBridge) {
|
||||||
|
return (nf.ControllerServices = factory($, d3, Slick, client, shell, processGroupConfiguration, canvasUtils, errorHandler, dialog, common, controllerService, processGroup, policyManagement, componentState, angularBridge));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ControllerServices =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('Slick'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.ProcessGroupConfiguration'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.ControllerService'),
|
||||||
|
require('nf.ProcessGroup'),
|
||||||
|
require('nf.PolicyManagement'),
|
||||||
|
require('nf.ComponentState'),
|
||||||
|
require('nf.ng.Bridge')));
|
||||||
|
} else {
|
||||||
|
nf.ControllerServices = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.Slick,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.ProcessGroupConfiguration,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.ControllerService,
|
||||||
|
root.nf.ProcessGroup,
|
||||||
|
root.nf.PolicyManagement,
|
||||||
|
root.nf.ComponentState,
|
||||||
|
root.nf.ng.Bridge);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, Slick, client, shell, processGroupConfiguration, canvasUtils, errorHandler, dialog, common, controllerService, processGroup, policyManagement, componentState, angularBridge) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var dblClick = null;
|
var dblClick = null;
|
||||||
var initialized = false;
|
var initialized = false;
|
||||||
|
@ -45,7 +100,7 @@ nf.ControllerServices = (function () {
|
||||||
* @param item controller service type
|
* @param item controller service type
|
||||||
*/
|
*/
|
||||||
var isSelectable = function (item) {
|
var isSelectable = function (item) {
|
||||||
return nf.Common.isBlank(item.usageRestriction) || nf.Common.canAccessRestrictedComponents();
|
return common.isBlank(item.usageRestriction) || common.canAccessRestrictedComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +120,7 @@ nf.ControllerServices = (function () {
|
||||||
var controllerServiceTypesGrid = $('#controller-service-types-table').data('gridInstance');
|
var controllerServiceTypesGrid = $('#controller-service-types-table').data('gridInstance');
|
||||||
|
|
||||||
// ensure the grid has been initialized
|
// ensure the grid has been initialized
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerServiceTypesGrid)) {
|
if (common.isDefinedAndNotNull(controllerServiceTypesGrid)) {
|
||||||
var controllerServiceTypesData = controllerServiceTypesGrid.getData();
|
var controllerServiceTypesData = controllerServiceTypesGrid.getData();
|
||||||
|
|
||||||
// update the search criteria
|
// update the search criteria
|
||||||
|
@ -202,7 +257,7 @@ nf.ControllerServices = (function () {
|
||||||
|
|
||||||
// ensure something was selected
|
// ensure something was selected
|
||||||
if (selectedServiceType === '') {
|
if (selectedServiceType === '') {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Controller Service',
|
headerText: 'Controller Service',
|
||||||
dialogContent: 'The type of controller service to create must be selected.'
|
dialogContent: 'The type of controller service to create must be selected.'
|
||||||
});
|
});
|
||||||
|
@ -221,7 +276,7 @@ nf.ControllerServices = (function () {
|
||||||
var addControllerService = function (controllerServicesUri, serviceTable, controllerServiceType) {
|
var addControllerService = function (controllerServicesUri, serviceTable, controllerServiceType) {
|
||||||
// build the controller service entity
|
// build the controller service entity
|
||||||
var controllerServiceEntity = {
|
var controllerServiceEntity = {
|
||||||
'revision': nf.Client.getRevision({
|
'revision': client.getRevision({
|
||||||
'revision': {
|
'revision': {
|
||||||
'version': 0
|
'version': 0
|
||||||
}
|
}
|
||||||
|
@ -252,7 +307,7 @@ nf.ControllerServices = (function () {
|
||||||
var row = controllerServicesData.getRowById(controllerServiceEntity.id);
|
var row = controllerServicesData.getRowById(controllerServiceEntity.id);
|
||||||
controllerServicesGrid.setSelectedRows([row]);
|
controllerServicesGrid.setSelectedRows([row]);
|
||||||
controllerServicesGrid.scrollRowIntoView(row);
|
controllerServicesGrid.scrollRowIntoView(row);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// hide the dialog
|
// hide the dialog
|
||||||
$('#new-controller-service-dialog').modal('hide');
|
$('#new-controller-service-dialog').modal('hide');
|
||||||
|
@ -270,7 +325,7 @@ nf.ControllerServices = (function () {
|
||||||
id: 'type',
|
id: 'type',
|
||||||
name: 'Type',
|
name: 'Type',
|
||||||
field: 'label',
|
field: 'label',
|
||||||
formatter: nf.Common.typeFormatter,
|
formatter: common.typeFormatter,
|
||||||
sortable: false,
|
sortable: false,
|
||||||
resizable: true
|
resizable: true
|
||||||
},
|
},
|
||||||
|
@ -304,11 +359,11 @@ nf.ControllerServices = (function () {
|
||||||
var controllerServiceType = controllerServiceTypesGrid.getDataItem(controllerServiceTypeIndex);
|
var controllerServiceType = controllerServiceTypesGrid.getDataItem(controllerServiceTypeIndex);
|
||||||
|
|
||||||
// set the controller service type description
|
// set the controller service type description
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerServiceType)) {
|
if (common.isDefinedAndNotNull(controllerServiceType)) {
|
||||||
// show the selected controller service
|
// show the selected controller service
|
||||||
$('#controller-service-description-container').show();
|
$('#controller-service-description-container').show();
|
||||||
|
|
||||||
if (nf.Common.isBlank(controllerServiceType.description)) {
|
if (common.isBlank(controllerServiceType.description)) {
|
||||||
$('#controller-service-type-description')
|
$('#controller-service-type-description')
|
||||||
.attr('title', '')
|
.attr('title', '')
|
||||||
.html('<span class="unset">No description specified</span>');
|
.html('<span class="unset">No description specified</span>');
|
||||||
|
@ -330,7 +385,7 @@ nf.ControllerServices = (function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controllerServiceTypesGrid.onViewportChanged.subscribe(function (e, args) {
|
controllerServiceTypesGrid.onViewportChanged.subscribe(function (e, args) {
|
||||||
nf.Common.cleanUpTooltips($('#controller-service-types-table'), 'div.view-usage-restriction');
|
common.cleanUpTooltips($('#controller-service-types-table'), 'div.view-usage-restriction');
|
||||||
});
|
});
|
||||||
|
|
||||||
// wire up the dataview to the grid
|
// wire up the dataview to the grid
|
||||||
|
@ -357,8 +412,8 @@ nf.ControllerServices = (function () {
|
||||||
var item = controllerServiceTypesData.getItemById(rowId);
|
var item = controllerServiceTypesData.getItemById(rowId);
|
||||||
|
|
||||||
// show the tooltip
|
// show the tooltip
|
||||||
if (nf.Common.isDefinedAndNotNull(item.usageRestriction)) {
|
if (common.isDefinedAndNotNull(item.usageRestriction)) {
|
||||||
usageRestriction.qtip($.extend({}, nf.Common.config.tooltipConfig, {
|
usageRestriction.qtip($.extend({}, common.config.tooltipConfig, {
|
||||||
content: item.usageRestriction,
|
content: item.usageRestriction,
|
||||||
position: {
|
position: {
|
||||||
container: $('#summary'),
|
container: $('#summary'),
|
||||||
|
@ -391,10 +446,10 @@ nf.ControllerServices = (function () {
|
||||||
// add the documented type
|
// add the documented type
|
||||||
controllerServiceTypesData.addItem({
|
controllerServiceTypesData.addItem({
|
||||||
id: id++,
|
id: id++,
|
||||||
label: nf.Common.substringAfterLast(documentedType.type, '.'),
|
label: common.substringAfterLast(documentedType.type, '.'),
|
||||||
type: documentedType.type,
|
type: documentedType.type,
|
||||||
description: nf.Common.escapeHtml(documentedType.description),
|
description: common.escapeHtml(documentedType.description),
|
||||||
usageRestriction: nf.Common.escapeHtml(documentedType.usageRestriction),
|
usageRestriction: common.escapeHtml(documentedType.usageRestriction),
|
||||||
tags: documentedType.tags.join(', ')
|
tags: documentedType.tags.join(', ')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -416,7 +471,7 @@ nf.ControllerServices = (function () {
|
||||||
select: applyControllerServiceTypeFilter,
|
select: applyControllerServiceTypeFilter,
|
||||||
remove: applyControllerServiceTypeFilter
|
remove: applyControllerServiceTypeFilter
|
||||||
});
|
});
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// initialize the controller service dialog
|
// initialize the controller service dialog
|
||||||
$('#new-controller-service-dialog').modal({
|
$('#new-controller-service-dialog').modal({
|
||||||
|
@ -484,7 +539,7 @@ nf.ControllerServices = (function () {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.Common.substringAfterLast(dataContext.component.type, '.');
|
return common.substringAfterLast(dataContext.component.type, '.');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -502,7 +557,7 @@ nf.ControllerServices = (function () {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
|
if (common.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
|
||||||
return dataContext.component.parentGroupId;
|
return dataContext.component.parentGroupId;
|
||||||
} else {
|
} else {
|
||||||
return 'Controller';
|
return 'Controller';
|
||||||
|
@ -519,7 +574,7 @@ nf.ControllerServices = (function () {
|
||||||
// we know the process group for this controller service is part
|
// we know the process group for this controller service is part
|
||||||
// of the current breadcrumb trail
|
// of the current breadcrumb trail
|
||||||
var canWriteProcessGroupParent = function (processGroupId) {
|
var canWriteProcessGroupParent = function (processGroupId) {
|
||||||
var breadcrumbs = nf.ng.Bridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
|
var breadcrumbs = angularBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
|
||||||
|
|
||||||
var isAuthorized = false;
|
var isAuthorized = false;
|
||||||
$.each(breadcrumbs, function (_, breadcrumbEntity) {
|
$.each(breadcrumbs, function (_, breadcrumbEntity) {
|
||||||
|
@ -532,10 +587,10 @@ nf.ControllerServices = (function () {
|
||||||
return isAuthorized;
|
return isAuthorized;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
|
if (common.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
|
||||||
return canWriteProcessGroupParent(dataContext.component.parentGroupId);
|
return canWriteProcessGroupParent(dataContext.component.parentGroupId);
|
||||||
} else {
|
} else {
|
||||||
return nf.Common.canModifyController();
|
return common.canModifyController();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -551,31 +606,31 @@ nf.ControllerServices = (function () {
|
||||||
if(a.permissions.canRead && b.permissions.canRead) {
|
if(a.permissions.canRead && b.permissions.canRead) {
|
||||||
if (sortDetails.columnId === 'moreDetails') {
|
if (sortDetails.columnId === 'moreDetails') {
|
||||||
var aBulletins = 0;
|
var aBulletins = 0;
|
||||||
if (!nf.Common.isEmpty(a.bulletins)) {
|
if (!common.isEmpty(a.bulletins)) {
|
||||||
aBulletins = a.bulletins.length;
|
aBulletins = a.bulletins.length;
|
||||||
}
|
}
|
||||||
var bBulletins = 0;
|
var bBulletins = 0;
|
||||||
if (!nf.Common.isEmpty(b.bulletins)) {
|
if (!common.isEmpty(b.bulletins)) {
|
||||||
bBulletins = b.bulletins.length;
|
bBulletins = b.bulletins.length;
|
||||||
}
|
}
|
||||||
return aBulletins - bBulletins;
|
return aBulletins - bBulletins;
|
||||||
} else if (sortDetails.columnId === 'type') {
|
} else if (sortDetails.columnId === 'type') {
|
||||||
var aType = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? nf.Common.substringAfterLast(a.component[sortDetails.columnId], '.') : '';
|
var aType = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? common.substringAfterLast(a.component[sortDetails.columnId], '.') : '';
|
||||||
var bType = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? nf.Common.substringAfterLast(b.component[sortDetails.columnId], '.') : '';
|
var bType = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? common.substringAfterLast(b.component[sortDetails.columnId], '.') : '';
|
||||||
return aType === bType ? 0 : aType > bType ? 1 : -1;
|
return aType === bType ? 0 : aType > bType ? 1 : -1;
|
||||||
} else if (sortDetails.columnId === 'state') {
|
} else if (sortDetails.columnId === 'state') {
|
||||||
var aState = 'Invalid';
|
var aState = 'Invalid';
|
||||||
if (nf.Common.isEmpty(a.component.validationErrors)) {
|
if (common.isEmpty(a.component.validationErrors)) {
|
||||||
aState = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
aState = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
||||||
}
|
}
|
||||||
var bState = 'Invalid';
|
var bState = 'Invalid';
|
||||||
if (nf.Common.isEmpty(b.component.validationErrors)) {
|
if (common.isEmpty(b.component.validationErrors)) {
|
||||||
bState = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
bState = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
||||||
}
|
}
|
||||||
return aState === bState ? 0 : aState > bState ? 1 : -1;
|
return aState === bState ? 0 : aState > bState ? 1 : -1;
|
||||||
} else {
|
} else {
|
||||||
var aString = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
||||||
var bString = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
||||||
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -598,8 +653,9 @@ nf.ControllerServices = (function () {
|
||||||
* Initializes the controller services tab.
|
* Initializes the controller services tab.
|
||||||
*
|
*
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
|
* @param {function} showSettings
|
||||||
*/
|
*/
|
||||||
var initControllerServices = function (serviceTable) {
|
var initControllerServices = function (serviceTable, showSettings) {
|
||||||
// more details formatter
|
// more details formatter
|
||||||
var moreControllerServiceDetails = function (row, cell, value, columnDef, dataContext) {
|
var moreControllerServiceDetails = function (row, cell, value, columnDef, dataContext) {
|
||||||
if (!dataContext.permissions.canRead) {
|
if (!dataContext.permissions.canRead) {
|
||||||
|
@ -611,8 +667,8 @@ nf.ControllerServices = (function () {
|
||||||
// always include a button to view the usage
|
// always include a button to view the usage
|
||||||
markup += '<div title="Usage" class="pointer controller-service-usage fa fa-book" style="margin-top: 5px; margin-right: 3px;" ></div>';
|
markup += '<div title="Usage" class="pointer controller-service-usage fa fa-book" style="margin-top: 5px; margin-right: 3px;" ></div>';
|
||||||
|
|
||||||
var hasErrors = !nf.Common.isEmpty(dataContext.component.validationErrors);
|
var hasErrors = !common.isEmpty(dataContext.component.validationErrors);
|
||||||
var hasBulletins = !nf.Common.isEmpty(dataContext.bulletins);
|
var hasBulletins = !common.isEmpty(dataContext.bulletins);
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
markup += '<div class="pointer has-errors fa fa-warning" style="margin-top: 4px; margin-right: 3px; float: left;" ></div>';
|
markup += '<div class="pointer has-errors fa fa-warning" style="margin-top: 4px; margin-right: 3px; float: left;" ></div>';
|
||||||
|
@ -623,7 +679,7 @@ nf.ControllerServices = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrors || hasBulletins) {
|
if (hasErrors || hasBulletins) {
|
||||||
markup += '<span class="hidden row-id">' + nf.Common.escapeHtml(dataContext.id) + '</span>';
|
markup += '<span class="hidden row-id">' + common.escapeHtml(dataContext.id) + '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return markup;
|
return markup;
|
||||||
|
@ -636,7 +692,7 @@ nf.ControllerServices = (function () {
|
||||||
|
|
||||||
// determine the appropriate label
|
// determine the appropriate label
|
||||||
var icon = '', label = '';
|
var icon = '', label = '';
|
||||||
if (!nf.Common.isEmpty(dataContext.component.validationErrors)) {
|
if (!common.isEmpty(dataContext.component.validationErrors)) {
|
||||||
icon = 'invalid fa fa-warning';
|
icon = 'invalid fa fa-warning';
|
||||||
label = 'Invalid';
|
label = 'Invalid';
|
||||||
} else {
|
} else {
|
||||||
|
@ -670,7 +726,7 @@ nf.ControllerServices = (function () {
|
||||||
markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||||
|
|
||||||
// if there are no validation errors allow enabling
|
// if there are no validation errors allow enabling
|
||||||
if (nf.Common.isEmpty(dataContext.component.validationErrors)) {
|
if (common.isEmpty(dataContext.component.validationErrors)) {
|
||||||
markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
|
markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,7 +741,7 @@ nf.ControllerServices = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow policy configuration conditionally
|
// allow policy configuration conditionally
|
||||||
if (nf.Canvas.isConfigurableAuthorizer() && nf.Common.canAccessTenants()) {
|
if (canvasUtils.isConfigurableAuthorizer() && common.canAccessTenants()) {
|
||||||
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
|
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,46 +827,46 @@ nf.ControllerServices = (function () {
|
||||||
// determine the desired action
|
// determine the desired action
|
||||||
if (controllerServicesGrid.getColumns()[args.cell].id === 'actions') {
|
if (controllerServicesGrid.getColumns()[args.cell].id === 'actions') {
|
||||||
if (target.hasClass('edit-controller-service')) {
|
if (target.hasClass('edit-controller-service')) {
|
||||||
nf.ControllerService.showConfiguration(serviceTable, controllerServiceEntity);
|
controllerService.showConfiguration(serviceTable, controllerServiceEntity);
|
||||||
} else if (target.hasClass('enable-controller-service')) {
|
} else if (target.hasClass('enable-controller-service')) {
|
||||||
nf.ControllerService.enable(serviceTable, controllerServiceEntity);
|
controllerService.enable(serviceTable, controllerServiceEntity);
|
||||||
} else if (target.hasClass('disable-controller-service')) {
|
} else if (target.hasClass('disable-controller-service')) {
|
||||||
nf.ControllerService.disable(serviceTable, controllerServiceEntity);
|
controllerService.disable(serviceTable, controllerServiceEntity);
|
||||||
} else if (target.hasClass('delete-controller-service')) {
|
} else if (target.hasClass('delete-controller-service')) {
|
||||||
nf.ControllerService.promptToDeleteController(serviceTable, controllerServiceEntity);
|
controllerService.promptToDeleteController(serviceTable, controllerServiceEntity);
|
||||||
} else if (target.hasClass('view-state-controller-service')) {
|
} else if (target.hasClass('view-state-controller-service')) {
|
||||||
nf.ComponentState.showState(controllerServiceEntity, controllerServiceEntity.state === 'DISABLED');
|
componentState.showState(controllerServiceEntity, controllerServiceEntity.state === 'DISABLED');
|
||||||
} else if (target.hasClass('edit-access-policies')) {
|
} else if (target.hasClass('edit-access-policies')) {
|
||||||
// show the policies for this service
|
// show the policies for this service
|
||||||
nf.PolicyManagement.showControllerServicePolicy(controllerServiceEntity);
|
policyManagement.showControllerServicePolicy(controllerServiceEntity);
|
||||||
|
|
||||||
// close the settings dialog
|
// close the settings dialog
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
}
|
}
|
||||||
} else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') {
|
} else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') {
|
||||||
if (target.hasClass('view-controller-service')) {
|
if (target.hasClass('view-controller-service')) {
|
||||||
nf.ControllerService.showDetails(serviceTable, controllerServiceEntity);
|
controllerService.showDetails(serviceTable, controllerServiceEntity);
|
||||||
} else if (target.hasClass('controller-service-usage')) {
|
} else if (target.hasClass('controller-service-usage')) {
|
||||||
// close the settings dialog
|
// close the settings dialog
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// open the documentation for this controller service
|
// open the documentation for this controller service
|
||||||
nf.Shell.showPage('../nifi-docs/documentation?' + $.param({
|
shell.showPage('../nifi-docs/documentation?' + $.param({
|
||||||
select: nf.Common.substringAfterLast(controllerServiceEntity.component.type, '.')
|
select: common.substringAfterLast(controllerServiceEntity.component.type, '.')
|
||||||
})).done(function() {
|
})).done(function() {
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerServiceEntity.component.parentGroupId)) {
|
if (common.isDefinedAndNotNull(controllerServiceEntity.component.parentGroupId)) {
|
||||||
var groupId;
|
var groupId;
|
||||||
var processGroup = nf.ProcessGroup.get(controllerServiceEntity.component.parentGroupId);
|
var processGroup = processGroup.get(controllerServiceEntity.component.parentGroupId);
|
||||||
if (nf.Common.isDefinedAndNotNull(processGroup)) {
|
if (common.isDefinedAndNotNull(processGroup)) {
|
||||||
groupId = processGroup.id;
|
groupId = processGroup.id;
|
||||||
} else {
|
} else {
|
||||||
groupId = nf.Canvas.getGroupId();
|
groupId = canvasUtils.getGroupId();
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload the corresponding group
|
// reload the corresponding group
|
||||||
nf.ProcessGroupConfiguration.showConfiguration(groupId);
|
processGroupConfiguration.showConfiguration(groupId);
|
||||||
} else {
|
} else {
|
||||||
nf.Settings.showSettings();
|
showSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -838,12 +894,12 @@ nf.ControllerServices = (function () {
|
||||||
var controllerServiceEntity = controllerServicesData.getItemById(serviceId);
|
var controllerServiceEntity = controllerServicesData.getItemById(serviceId);
|
||||||
|
|
||||||
// format the errors
|
// format the errors
|
||||||
var tooltip = nf.Common.formatUnorderedList(controllerServiceEntity.component.validationErrors);
|
var tooltip = common.formatUnorderedList(controllerServiceEntity.component.validationErrors);
|
||||||
|
|
||||||
// show the tooltip
|
// show the tooltip
|
||||||
if (nf.Common.isDefinedAndNotNull(tooltip)) {
|
if (common.isDefinedAndNotNull(tooltip)) {
|
||||||
errorIcon.qtip($.extend({},
|
errorIcon.qtip($.extend({},
|
||||||
nf.Common.config.tooltipConfig,
|
common.config.tooltipConfig,
|
||||||
{
|
{
|
||||||
content: tooltip,
|
content: tooltip,
|
||||||
position: {
|
position: {
|
||||||
|
@ -867,13 +923,13 @@ nf.ControllerServices = (function () {
|
||||||
var controllerServiceEntity = controllerServicesData.getItemById(taskId);
|
var controllerServiceEntity = controllerServicesData.getItemById(taskId);
|
||||||
|
|
||||||
// format the tooltip
|
// format the tooltip
|
||||||
var bulletins = nf.Common.getFormattedBulletins(controllerServiceEntity.bulletins);
|
var bulletins = common.getFormattedBulletins(controllerServiceEntity.bulletins);
|
||||||
var tooltip = nf.Common.formatUnorderedList(bulletins);
|
var tooltip = common.formatUnorderedList(bulletins);
|
||||||
|
|
||||||
// show the tooltip
|
// show the tooltip
|
||||||
if (nf.Common.isDefinedAndNotNull(tooltip)) {
|
if (common.isDefinedAndNotNull(tooltip)) {
|
||||||
bulletinIcon.qtip($.extend({},
|
bulletinIcon.qtip($.extend({},
|
||||||
nf.Common.config.tooltipConfig,
|
common.config.tooltipConfig,
|
||||||
{
|
{
|
||||||
content: tooltip,
|
content: tooltip,
|
||||||
position: {
|
position: {
|
||||||
|
@ -910,8 +966,8 @@ nf.ControllerServices = (function () {
|
||||||
}, service));
|
}, service));
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.Common.cleanUpTooltips(serviceTable, 'div.has-errors');
|
common.cleanUpTooltips(serviceTable, 'div.has-errors');
|
||||||
nf.Common.cleanUpTooltips(serviceTable, 'div.has-bulletins');
|
common.cleanUpTooltips(serviceTable, 'div.has-bulletins');
|
||||||
|
|
||||||
var controllerServicesGrid = serviceTable.data('gridInstance');
|
var controllerServicesGrid = serviceTable.data('gridInstance');
|
||||||
var controllerServicesData = controllerServicesGrid.getData();
|
var controllerServicesData = controllerServicesGrid.getData();
|
||||||
|
@ -927,10 +983,11 @@ nf.ControllerServices = (function () {
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Initializes the status page.
|
* Initializes the status page.
|
||||||
*
|
*
|
||||||
* @param {jQuery} serviceTable
|
* @param {jQuery} serviceTable
|
||||||
|
* @param {function} showSettings
|
||||||
*/
|
*/
|
||||||
init: function (serviceTable) {
|
init: function (serviceTable, showSettings) {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
// initialize the new controller service dialog
|
// initialize the new controller service dialog
|
||||||
initNewControllerServiceDialog();
|
initNewControllerServiceDialog();
|
||||||
|
@ -940,7 +997,7 @@ nf.ControllerServices = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the controller service table
|
// initialize the controller service table
|
||||||
initControllerServices(serviceTable);
|
initControllerServices(serviceTable, showSettings);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1027,7 +1084,7 @@ nf.ControllerServices = (function () {
|
||||||
controllerServiceTypesGrid.onDblClick.subscribe(dblClick);
|
controllerServiceTypesGrid.onDblClick.subscribe(dblClick);
|
||||||
|
|
||||||
// reset the canvas size after the dialog is shown
|
// reset the canvas size after the dialog is shown
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerServiceTypesGrid)) {
|
if (common.isDefinedAndNotNull(controllerServiceTypesGrid)) {
|
||||||
controllerServiceTypesGrid.setSelectedRows([0]);
|
controllerServiceTypesGrid.setSelectedRows([0]);
|
||||||
controllerServiceTypesGrid.resizeCanvas();
|
controllerServiceTypesGrid.resizeCanvas();
|
||||||
}
|
}
|
||||||
|
@ -1043,7 +1100,7 @@ nf.ControllerServices = (function () {
|
||||||
*/
|
*/
|
||||||
resetTableSize: function (serviceTable) {
|
resetTableSize: function (serviceTable) {
|
||||||
var controllerServicesGrid = serviceTable.data('gridInstance');
|
var controllerServicesGrid = serviceTable.data('gridInstance');
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerServicesGrid)) {
|
if (common.isDefinedAndNotNull(controllerServicesGrid)) {
|
||||||
controllerServicesGrid.resizeCanvas();
|
controllerServicesGrid.resizeCanvas();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1071,14 +1128,14 @@ nf.ControllerServices = (function () {
|
||||||
controllerServicesData.beginUpdate();
|
controllerServicesData.beginUpdate();
|
||||||
|
|
||||||
// if there are some bulletins process them
|
// if there are some bulletins process them
|
||||||
if (!nf.Common.isEmpty(controllerServiceBulletins)) {
|
if (!common.isEmpty(controllerServiceBulletins)) {
|
||||||
var controllerServiceBulletinsBySource = d3.nest()
|
var controllerServiceBulletinsBySource = d3.nest()
|
||||||
.key(function(d) { return d.sourceId; })
|
.key(function(d) { return d.sourceId; })
|
||||||
.map(controllerServiceBulletins, d3.map);
|
.map(controllerServiceBulletins, d3.map);
|
||||||
|
|
||||||
controllerServiceBulletinsBySource.forEach(function(sourceId, sourceBulletins) {
|
controllerServiceBulletinsBySource.forEach(function(sourceId, sourceBulletins) {
|
||||||
var controllerService = controllerServicesData.getItemById(sourceId);
|
var controllerService = controllerServicesData.getItemById(sourceId);
|
||||||
if (nf.Common.isDefinedAndNotNull(controllerService)) {
|
if (common.isDefinedAndNotNull(controllerService)) {
|
||||||
controllerServicesData.updateItem(sourceId, $.extend(controllerService, {
|
controllerServicesData.updateItem(sourceId, $.extend(controllerService, {
|
||||||
bulletins: sourceBulletins
|
bulletins: sourceBulletins
|
||||||
}));
|
}));
|
||||||
|
@ -1096,4 +1153,4 @@ nf.ControllerServices = (function () {
|
||||||
controllerServicesData.endUpdate();
|
controllerServicesData.endUpdate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,10 +15,48 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Draggable = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Connection',
|
||||||
|
'nf.Birdseye',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.ErrorHandler'],
|
||||||
|
function ($, d3, connection, birdseye, canvasUtils, common, dialog, client, errorHandler) {
|
||||||
|
return (nf.Draggable = factory($, d3, connection, birdseye, canvasUtils, common, dialog, client, errorHandler));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Draggable =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Connection'),
|
||||||
|
require('nf.Birdseye'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.ErrorHandler')));
|
||||||
|
} else {
|
||||||
|
nf.Draggable = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Connection,
|
||||||
|
root.nf.Birdseye,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.ErrorHandler);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, connection, birdseye, canvasUtils, common, dialog, client, errorHandler) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfCanvas;
|
||||||
var drag;
|
var drag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +83,8 @@ nf.Draggable = (function () {
|
||||||
var selectedComponents = d3.selectAll('g.component.selected');
|
var selectedComponents = d3.selectAll('g.component.selected');
|
||||||
|
|
||||||
// ensure every component is writable
|
// ensure every component is writable
|
||||||
if (nf.CanvasUtils.canModify(selectedConnections) === false || nf.CanvasUtils.canModify(selectedComponents) === false) {
|
if (canvasUtils.canModify(selectedConnections) === false || canvasUtils.canModify(selectedComponents) === false) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Component Position',
|
headerText: 'Component Position',
|
||||||
dialogContent: 'Must be authorized to modify every component selected.'
|
dialogContent: 'Must be authorized to modify every component selected.'
|
||||||
});
|
});
|
||||||
|
@ -55,7 +93,7 @@ nf.Draggable = (function () {
|
||||||
|
|
||||||
// go through each selected connection
|
// go through each selected connection
|
||||||
selectedConnections.each(function (d) {
|
selectedConnections.each(function (d) {
|
||||||
var connectionUpdate = nf.Draggable.updateConnectionPosition(d, delta);
|
var connectionUpdate = nfDraggable.updateConnectionPosition(d, delta);
|
||||||
if (connectionUpdate !== null) {
|
if (connectionUpdate !== null) {
|
||||||
updates.set(d.id, connectionUpdate);
|
updates.set(d.id, connectionUpdate);
|
||||||
}
|
}
|
||||||
|
@ -64,10 +102,10 @@ nf.Draggable = (function () {
|
||||||
// go through each selected component
|
// go through each selected component
|
||||||
selectedComponents.each(function (d) {
|
selectedComponents.each(function (d) {
|
||||||
// consider any self looping connections
|
// consider any self looping connections
|
||||||
var connections = nf.Connection.getComponentConnections(d.id);
|
var connections = connection.getComponentConnections(d.id);
|
||||||
$.each(connections, function(_, connection) {
|
$.each(connections, function (_, connection) {
|
||||||
if (!updates.has(connection.id) && nf.CanvasUtils.getConnectionSourceComponentId(connection) === nf.CanvasUtils.getConnectionDestinationComponentId(connection)) {
|
if (!updates.has(connection.id) && canvasUtils.getConnectionSourceComponentId(connection) === canvasUtils.getConnectionDestinationComponentId(connection)) {
|
||||||
var connectionUpdate = nf.Draggable.updateConnectionPosition(nf.Connection.get(connection.id), delta);
|
var connectionUpdate = nfDraggable.updateConnectionPosition(connection.get(connection.id), delta);
|
||||||
if (connectionUpdate !== null) {
|
if (connectionUpdate !== null) {
|
||||||
updates.set(connection.id, connectionUpdate);
|
updates.set(connection.id, connectionUpdate);
|
||||||
}
|
}
|
||||||
|
@ -75,10 +113,10 @@ nf.Draggable = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// consider the component itself
|
// consider the component itself
|
||||||
updates.set(d.id, nf.Draggable.updateComponentPosition(d, delta));
|
updates.set(d.id, nfDraggable.updateComponentPosition(d, delta));
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.Draggable.refreshConnections(updates);
|
nfDraggable.refreshConnections(updates);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,15 +126,15 @@ nf.Draggable = (function () {
|
||||||
var selection = d3.selectAll('g.component.selected, g.connection.selected');
|
var selection = d3.selectAll('g.component.selected, g.connection.selected');
|
||||||
var group = d3.select('g.drop');
|
var group = d3.select('g.drop');
|
||||||
|
|
||||||
if (nf.CanvasUtils.canModify(selection) === false) {
|
if (canvasUtils.canModify(selection) === false) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Component Position',
|
headerText: 'Component Position',
|
||||||
dialogContent: 'Must be authorized to modify every component selected.'
|
dialogContent: 'Must be authorized to modify every component selected.'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (nf.CanvasUtils.canModify(group) === false) {
|
if (canvasUtils.canModify(group) === false) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Component Position',
|
headerText: 'Component Position',
|
||||||
dialogContent: 'Not authorized to modify the destination group.'
|
dialogContent: 'Not authorized to modify the destination group.'
|
||||||
});
|
});
|
||||||
|
@ -104,102 +142,104 @@ nf.Draggable = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the seleciton into the group
|
// move the seleciton into the group
|
||||||
nf.CanvasUtils.moveComponents(selection, group);
|
canvasUtils.moveComponents(selection, group);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfDraggable = {
|
||||||
init: function () {
|
init: function (canvas) {
|
||||||
|
nfCanvas = canvas;
|
||||||
|
|
||||||
// handle component drag events
|
// handle component drag events
|
||||||
drag = d3.behavior.drag()
|
drag = d3.behavior.drag()
|
||||||
.on('dragstart', function () {
|
.on('dragstart', function () {
|
||||||
// stop further propagation
|
// stop further propagation
|
||||||
d3.event.sourceEvent.stopPropagation();
|
d3.event.sourceEvent.stopPropagation();
|
||||||
})
|
})
|
||||||
.on('drag', function () {
|
.on('drag', function () {
|
||||||
var dragSelection = d3.select('rect.drag-selection');
|
var dragSelection = d3.select('rect.drag-selection');
|
||||||
|
|
||||||
// lazily create the drag selection box
|
// lazily create the drag selection box
|
||||||
if (dragSelection.empty()) {
|
if (dragSelection.empty()) {
|
||||||
// get the current selection
|
// get the current selection
|
||||||
var selection = d3.selectAll('g.component.selected');
|
var selection = d3.selectAll('g.component.selected');
|
||||||
|
|
||||||
// determine the appropriate bounding box
|
// determine the appropriate bounding box
|
||||||
var minX = null, maxX = null, minY = null, maxY = null;
|
var minX = null, maxX = null, minY = null, maxY = null;
|
||||||
selection.each(function (d) {
|
selection.each(function (d) {
|
||||||
if (minX === null || d.position.x < minX) {
|
if (minX === null || d.position.x < minX) {
|
||||||
minX = d.position.x;
|
minX = d.position.x;
|
||||||
}
|
}
|
||||||
if (minY === null || d.position.y < minY) {
|
if (minY === null || d.position.y < minY) {
|
||||||
minY = d.position.y;
|
minY = d.position.y;
|
||||||
}
|
}
|
||||||
var componentMaxX = d.position.x + d.dimensions.width;
|
var componentMaxX = d.position.x + d.dimensions.width;
|
||||||
var componentMaxY = d.position.y + d.dimensions.height;
|
var componentMaxY = d.position.y + d.dimensions.height;
|
||||||
if (maxX === null || componentMaxX > maxX) {
|
if (maxX === null || componentMaxX > maxX) {
|
||||||
maxX = componentMaxX;
|
maxX = componentMaxX;
|
||||||
}
|
}
|
||||||
if (maxY === null || componentMaxY > maxY) {
|
if (maxY === null || componentMaxY > maxY) {
|
||||||
maxY = componentMaxY;
|
maxY = componentMaxY;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// create a selection box for the move
|
||||||
|
d3.select('#canvas').append('rect')
|
||||||
|
.attr('rx', 6)
|
||||||
|
.attr('ry', 6)
|
||||||
|
.attr('x', minX)
|
||||||
|
.attr('y', minY)
|
||||||
|
.attr('class', 'drag-selection')
|
||||||
|
.attr('pointer-events', 'none')
|
||||||
|
.attr('width', maxX - minX)
|
||||||
|
.attr('height', maxY - minY)
|
||||||
|
.attr('stroke-width', function () {
|
||||||
|
return 1 / canvasUtils.scaleCanvasView();
|
||||||
|
})
|
||||||
|
.attr('stroke-dasharray', function () {
|
||||||
|
return 4 / canvasUtils.scaleCanvasView();
|
||||||
|
})
|
||||||
|
.datum({
|
||||||
|
original: {
|
||||||
|
x: minX,
|
||||||
|
y: minY
|
||||||
|
},
|
||||||
|
x: minX,
|
||||||
|
y: minY
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// update the position of the drag selection
|
||||||
|
dragSelection.attr('x', function (d) {
|
||||||
|
d.x += d3.event.dx;
|
||||||
|
return d.x;
|
||||||
|
})
|
||||||
|
.attr('y', function (d) {
|
||||||
|
d.y += d3.event.dy;
|
||||||
|
return d.y;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.on('dragend', function () {
|
||||||
|
// stop further propagation
|
||||||
|
d3.event.sourceEvent.stopPropagation();
|
||||||
|
|
||||||
// create a selection box for the move
|
// get the drag selection
|
||||||
d3.select('#canvas').append('rect')
|
var dragSelection = d3.select('rect.drag-selection');
|
||||||
.attr('rx', 6)
|
|
||||||
.attr('ry', 6)
|
|
||||||
.attr('x', minX)
|
|
||||||
.attr('y', minY)
|
|
||||||
.attr('class', 'drag-selection')
|
|
||||||
.attr('pointer-events', 'none')
|
|
||||||
.attr('width', maxX - minX)
|
|
||||||
.attr('height', maxY - minY)
|
|
||||||
.attr('stroke-width', function () {
|
|
||||||
return 1 / nf.Canvas.View.scale();
|
|
||||||
})
|
|
||||||
.attr('stroke-dasharray', function () {
|
|
||||||
return 4 / nf.Canvas.View.scale();
|
|
||||||
})
|
|
||||||
.datum({
|
|
||||||
original: {
|
|
||||||
x: minX,
|
|
||||||
y: minY
|
|
||||||
},
|
|
||||||
x: minX,
|
|
||||||
y: minY
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// update the position of the drag selection
|
|
||||||
dragSelection.attr('x', function (d) {
|
|
||||||
d.x += d3.event.dx;
|
|
||||||
return d.x;
|
|
||||||
})
|
|
||||||
.attr('y', function (d) {
|
|
||||||
d.y += d3.event.dy;
|
|
||||||
return d.y;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.on('dragend', function () {
|
|
||||||
// stop further propagation
|
|
||||||
d3.event.sourceEvent.stopPropagation();
|
|
||||||
|
|
||||||
// get the drag selection
|
// ensure we found a drag selection
|
||||||
var dragSelection = d3.select('rect.drag-selection');
|
if (dragSelection.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// ensure we found a drag selection
|
// either move or update the selections group as appropriate
|
||||||
if (dragSelection.empty()) {
|
if (d3.select('g.drop').empty()) {
|
||||||
return;
|
updateComponentsPosition(dragSelection);
|
||||||
}
|
} else {
|
||||||
|
updateComponentsGroup();
|
||||||
|
}
|
||||||
|
|
||||||
// either move or update the selections group as appropriate
|
// remove the drag selection
|
||||||
if (d3.select('g.drop').empty()) {
|
dragSelection.remove();
|
||||||
updateComponentsPosition(dragSelection);
|
});
|
||||||
} else {
|
|
||||||
updateComponentsGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove the drag selection
|
|
||||||
dragSelection.remove();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -209,7 +249,7 @@ nf.Draggable = (function () {
|
||||||
* @param delta The change in position
|
* @param delta The change in position
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
updateComponentPosition: function(d, delta) {
|
updateComponentPosition: function (d, delta) {
|
||||||
var newPosition = {
|
var newPosition = {
|
||||||
'x': d.position.x + delta.x,
|
'x': d.position.x + delta.x,
|
||||||
'y': d.position.y + delta.y
|
'y': d.position.y + delta.y
|
||||||
|
@ -217,7 +257,7 @@ nf.Draggable = (function () {
|
||||||
|
|
||||||
// build the entity
|
// build the entity
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision(d),
|
'revision': client.getRevision(d),
|
||||||
'component': {
|
'component': {
|
||||||
'id': d.id,
|
'id': d.id,
|
||||||
'position': newPosition
|
'position': newPosition
|
||||||
|
@ -234,7 +274,7 @@ nf.Draggable = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// update the component
|
// update the component
|
||||||
nf[d.type].set(response);
|
canvasUtils.getComponentByType(d.type).set(response);
|
||||||
|
|
||||||
// resolve with an object so we can refresh when finished
|
// resolve with an object so we can refresh when finished
|
||||||
deferred.resolve({
|
deferred.resolve({
|
||||||
|
@ -243,12 +283,12 @@ nf.Draggable = (function () {
|
||||||
});
|
});
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Component Position',
|
headerText: 'Component Position',
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText)
|
dialogContent: common.escapeHtml(xhr.responseText)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
|
@ -263,7 +303,7 @@ nf.Draggable = (function () {
|
||||||
* @param delta The change in position
|
* @param delta The change in position
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
updateConnectionPosition: function(d, delta) {
|
updateConnectionPosition: function (d, delta) {
|
||||||
// only update if necessary
|
// only update if necessary
|
||||||
if (d.bends.length === 0) {
|
if (d.bends.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -278,7 +318,7 @@ nf.Draggable = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision(d),
|
'revision': client.getRevision(d),
|
||||||
'component': {
|
'component': {
|
||||||
id: d.id,
|
id: d.id,
|
||||||
bends: newBends
|
bends: newBends
|
||||||
|
@ -295,7 +335,7 @@ nf.Draggable = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// update the component
|
// update the component
|
||||||
nf.Connection.set(response);
|
connection.set(response);
|
||||||
|
|
||||||
// resolve with an object so we can refresh when finished
|
// resolve with an object so we can refresh when finished
|
||||||
deferred.resolve({
|
deferred.resolve({
|
||||||
|
@ -304,12 +344,12 @@ nf.Draggable = (function () {
|
||||||
});
|
});
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
if (xhr.status === 400 || xhr.status === 404 || xhr.status === 409) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Component Position',
|
headerText: 'Component Position',
|
||||||
dialogContent: nf.Common.escapeHtml(xhr.responseText)
|
dialogContent: common.escapeHtml(xhr.responseText)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
|
@ -322,7 +362,7 @@ nf.Draggable = (function () {
|
||||||
*
|
*
|
||||||
* @param updates
|
* @param updates
|
||||||
*/
|
*/
|
||||||
refreshConnections: function(updates) {
|
refreshConnections: function (updates) {
|
||||||
// wait for all updates to complete
|
// wait for all updates to complete
|
||||||
$.when.apply(window, updates.values()).done(function () {
|
$.when.apply(window, updates.values()).done(function () {
|
||||||
var dragged = $.makeArray(arguments);
|
var dragged = $.makeArray(arguments);
|
||||||
|
@ -335,7 +375,7 @@ nf.Draggable = (function () {
|
||||||
connections.add(component.id);
|
connections.add(component.id);
|
||||||
} else {
|
} else {
|
||||||
// get connections that need to be refreshed because its attached to this component
|
// get connections that need to be refreshed because its attached to this component
|
||||||
var componentConnections = nf.Connection.getComponentConnections(component.id);
|
var componentConnections = connection.getComponentConnections(component.id);
|
||||||
$.each(componentConnections, function (_, connection) {
|
$.each(componentConnections, function (_, connection) {
|
||||||
connections.add(connection.id);
|
connections.add(connection.id);
|
||||||
});
|
});
|
||||||
|
@ -344,10 +384,10 @@ nf.Draggable = (function () {
|
||||||
|
|
||||||
// refresh the connections
|
// refresh the connections
|
||||||
connections.forEach(function (connectionId) {
|
connections.forEach(function (connectionId) {
|
||||||
nf.Connection.refresh(connectionId);
|
connection.refresh(connectionId);
|
||||||
});
|
});
|
||||||
}).always(function(){
|
}).always(function () {
|
||||||
nf.Birdseye.refresh();
|
birdseye.refresh();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -369,4 +409,6 @@ nf.Draggable = (function () {
|
||||||
components.classed('moveable', false).on('.drag', null);
|
components.classed('moveable', false).on('.drag', null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfDraggable;
|
||||||
|
}));
|
|
@ -15,9 +15,39 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Funnel = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, common, client, canvasUtils) {
|
||||||
|
return (nf.Funnel = factory($, d3, common, client, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Funnel =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.Funnel = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, common, client, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfConnectable;
|
||||||
|
var nfDraggable;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
var dimensions = {
|
var dimensions = {
|
||||||
width: 48,
|
width: 48,
|
||||||
|
@ -75,7 +105,7 @@ nf.Funnel = (function () {
|
||||||
'class': 'funnel component'
|
'class': 'funnel component'
|
||||||
})
|
})
|
||||||
.classed('selected', selected)
|
.classed('selected', selected)
|
||||||
.call(nf.CanvasUtils.position);
|
.call(canvasUtils.position);
|
||||||
|
|
||||||
// funnel border
|
// funnel border
|
||||||
funnel.append('rect')
|
funnel.append('rect')
|
||||||
|
@ -119,7 +149,7 @@ nf.Funnel = (function () {
|
||||||
.text('\ue803');
|
.text('\ue803');
|
||||||
|
|
||||||
// always support selection
|
// always support selection
|
||||||
funnel.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
|
funnel.call(nfSelectable.activate).call(nfContextMenu.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +178,7 @@ nf.Funnel = (function () {
|
||||||
var funnel = d3.select(this);
|
var funnel = d3.select(this);
|
||||||
|
|
||||||
// update the component behavior as appropriate
|
// update the component behavior as appropriate
|
||||||
nf.CanvasUtils.editable(funnel);
|
canvasUtils.editable(funnel, nfConnectable, nfDraggable);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -161,11 +191,16 @@ nf.Funnel = (function () {
|
||||||
removed.remove();
|
removed.remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfFunnel = {
|
||||||
/**
|
/**
|
||||||
* Initializes of the Processor handler.
|
* Initializes of the Processor handler.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (connectable, draggable, selectable, contextMenu) {
|
||||||
|
nfConnectable = connectable;
|
||||||
|
nfDraggable = draggable;
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
funnelMap = d3.map();
|
funnelMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -186,8 +221,8 @@ nf.Funnel = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (funnelEntities, options) {
|
add: function (funnelEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current time
|
// get the current time
|
||||||
|
@ -208,7 +243,7 @@ nf.Funnel = (function () {
|
||||||
$.each(funnelEntities, function (_, funnelEntity) {
|
$.each(funnelEntities, function (_, funnelEntity) {
|
||||||
add(funnelEntity);
|
add(funnelEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(funnelEntities)) {
|
} else if (common.isDefinedAndNotNull(funnelEntities)) {
|
||||||
add(funnelEntities);
|
add(funnelEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +252,7 @@ nf.Funnel = (function () {
|
||||||
selection.enter().call(renderFunnels, selectAll);
|
selection.enter().call(renderFunnels, selectAll);
|
||||||
selection.call(updateFunnels);
|
selection.call(updateFunnels);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the graph with the specified funnels.
|
* Populates the graph with the specified funnels.
|
||||||
*
|
*
|
||||||
|
@ -227,16 +262,16 @@ nf.Funnel = (function () {
|
||||||
set: function (funnelEntities, options) {
|
set: function (funnelEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = function (proposedFunnelEntity) {
|
var set = function (proposedFunnelEntity) {
|
||||||
var currentFunnelEntity = funnelMap.get(proposedFunnelEntity.id);
|
var currentFunnelEntity = funnelMap.get(proposedFunnelEntity.id);
|
||||||
|
|
||||||
// set the funnel if appropriate due to revision and wasn't previously removed
|
// set the funnel if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentFunnelEntity, proposedFunnelEntity) && !removedCache.has(proposedFunnelEntity.id)) {
|
if (client.isNewerRevision(currentFunnelEntity, proposedFunnelEntity) && !removedCache.has(proposedFunnelEntity.id)) {
|
||||||
funnelMap.set(proposedFunnelEntity.id, $.extend({
|
funnelMap.set(proposedFunnelEntity.id, $.extend({
|
||||||
type: 'Funnel',
|
type: 'Funnel',
|
||||||
dimensions: dimensions
|
dimensions: dimensions
|
||||||
|
@ -259,14 +294,14 @@ nf.Funnel = (function () {
|
||||||
$.each(funnelEntities, function (_, funnelEntity) {
|
$.each(funnelEntities, function (_, funnelEntity) {
|
||||||
set(funnelEntity);
|
set(funnelEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(funnelEntities)) {
|
} else if (common.isDefinedAndNotNull(funnelEntities)) {
|
||||||
set(funnelEntities);
|
set(funnelEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the selection and handle all new processors
|
// apply the selection and handle all new processors
|
||||||
var selection = select();
|
var selection = select();
|
||||||
selection.enter().call(renderFunnels, selectAll);
|
selection.enter().call(renderFunnels, selectAll);
|
||||||
selection.call(updateFunnels).call(nf.CanvasUtils.position, transition);
|
selection.call(updateFunnels).call(canvasUtils.position, transition);
|
||||||
selection.exit().call(removeFunnels);
|
selection.exit().call(removeFunnels);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -277,7 +312,7 @@ nf.Funnel = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return funnelMap.values();
|
return funnelMap.values();
|
||||||
} else {
|
} else {
|
||||||
return funnelMap.get(id);
|
return funnelMap.get(id);
|
||||||
|
@ -291,7 +326,7 @@ nf.Funnel = (function () {
|
||||||
* @param {string} id Optional
|
* @param {string} id Optional
|
||||||
*/
|
*/
|
||||||
refresh: function (id) {
|
refresh: function (id) {
|
||||||
if (nf.Common.isDefinedAndNotNull(id)) {
|
if (common.isDefinedAndNotNull(id)) {
|
||||||
d3.select('#id-' + id).call(updateFunnels);
|
d3.select('#id-' + id).call(updateFunnels);
|
||||||
} else {
|
} else {
|
||||||
d3.selectAll('g.funnel').call(updateFunnels);
|
d3.selectAll('g.funnel').call(updateFunnels);
|
||||||
|
@ -312,7 +347,7 @@ nf.Funnel = (function () {
|
||||||
url: funnelEntity.uri,
|
url: funnelEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.Funnel.set(response);
|
nfFunnel.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -323,7 +358,7 @@ nf.Funnel = (function () {
|
||||||
* @param {string} id The id
|
* @param {string} id The id
|
||||||
*/
|
*/
|
||||||
position: function (id) {
|
position: function (id) {
|
||||||
d3.select('#id-' + id).call(nf.CanvasUtils.position);
|
d3.select('#id-' + id).call(canvasUtils.position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,7 +387,7 @@ nf.Funnel = (function () {
|
||||||
* Removes all processors.
|
* Removes all processors.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.Funnel.remove(funnelMap.keys());
|
nfFunnel.remove(funnelMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -373,4 +408,6 @@ nf.Funnel = (function () {
|
||||||
expire(removedCache);
|
expire(removedCache);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfFunnel;
|
||||||
|
}));
|
|
@ -15,12 +15,31 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the upstream/downstream dialogs.
|
* Handles the upstream/downstream dialogs.
|
||||||
*/
|
*/
|
||||||
nf.GoTo = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, errorHandler, canvasUtils) {
|
||||||
|
return (nf.GoTo = factory($, errorHandler, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.GoTo =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.GoTo = factory(root.$,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, errorHandler, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
urls: {
|
urls: {
|
||||||
|
@ -57,7 +76,7 @@ nf.GoTo = (function () {
|
||||||
var connectionStyle = 'unset';
|
var connectionStyle = 'unset';
|
||||||
var connectionName = 'Connection';
|
var connectionName = 'Connection';
|
||||||
if (connectionEntity.permissions.canRead === true) {
|
if (connectionEntity.permissions.canRead === true) {
|
||||||
var formattedConnectionName = nf.CanvasUtils.formatConnectionName(connectionEntity.component);
|
var formattedConnectionName = canvasUtils.formatConnectionName(connectionEntity.component);
|
||||||
if (formattedConnectionName !== '') {
|
if (formattedConnectionName !== '') {
|
||||||
connectionStyle = '';
|
connectionStyle = '';
|
||||||
connectionName = formattedConnectionName;
|
connectionName = formattedConnectionName;
|
||||||
|
@ -68,7 +87,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-connect"></div>').appendTo(connectionEntry);
|
$('<div class="search-result-icon icon-connect"></div>').appendTo(connectionEntry);
|
||||||
$('<div class="connection-entry-name go-to-link"></div>').attr('title', connectionName).addClass(connectionStyle).text(connectionName).on('click', function () {
|
$('<div class="connection-entry-name go-to-link"></div>').attr('title', connectionName).addClass(connectionStyle).text(connectionName).on('click', function () {
|
||||||
// go to the connection
|
// go to the connection
|
||||||
nf.CanvasUtils.showComponent(parentProcessGroupId, connectionEntity.id);
|
canvasUtils.showComponent(parentProcessGroupId, connectionEntity.id);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -117,7 +136,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(downstreamComponent);
|
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(downstreamComponent);
|
||||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', destinationName).text(destinationName).on('click', function () {
|
$('<div class="destination-component-name go-to-link"></div>').attr('title', destinationName).text(destinationName).on('click', function () {
|
||||||
// go to the component
|
// go to the component
|
||||||
nf.CanvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
|
canvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -152,7 +171,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-group"></div>').appendTo(downstreamComponent);
|
$('<div class="search-result-icon icon-group"></div>').appendTo(downstreamComponent);
|
||||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
|
$('<div class="destination-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
|
||||||
// go to the remote process group
|
// go to the remote process group
|
||||||
nf.CanvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
|
canvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -174,7 +193,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-port-in"></div>').appendTo(downstreamInputPort);
|
$('<div class="search-result-icon icon-port-in"></div>').appendTo(downstreamInputPort);
|
||||||
$('<div class="destination-input-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
|
$('<div class="destination-input-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
|
||||||
// go to the remote process group
|
// go to the remote process group
|
||||||
nf.CanvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
|
canvasUtils.showComponent(connectionEntity.destinationGroupId, connectionEntity.destinationId);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -209,7 +228,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(downstreamComponent);
|
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(downstreamComponent);
|
||||||
$('<div class="destination-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
|
$('<div class="destination-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
|
||||||
// go to the remote process group
|
// go to the remote process group
|
||||||
nf.CanvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
|
canvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -263,7 +282,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(sourceComponent);
|
$('<div class="search-result-icon"></div>').addClass(smallIconClass).appendTo(sourceComponent);
|
||||||
$('<div class="source-component-name go-to-link"></div>').attr('title', sourceName).text(sourceName).on('click', function () {
|
$('<div class="source-component-name go-to-link"></div>').attr('title', sourceName).text(sourceName).on('click', function () {
|
||||||
// go to the component
|
// go to the component
|
||||||
nf.CanvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
|
canvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -298,7 +317,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-group"></div>').appendTo(sourceComponent);
|
$('<div class="search-result-icon icon-group"></div>').appendTo(sourceComponent);
|
||||||
$('<div class="source-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
|
$('<div class="source-component-name go-to-link"></div>').attr('title', groupLabel).text(groupLabel).on('click', function () {
|
||||||
// go to the process group
|
// go to the process group
|
||||||
nf.CanvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
|
canvasUtils.showComponent(parentProcessGroupId, processGroupEntity.id);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -319,7 +338,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-port-out"></div>').appendTo(sourceOutputPort);
|
$('<div class="search-result-icon icon-port-out"></div>').appendTo(sourceOutputPort);
|
||||||
$('<div class="source-output-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
|
$('<div class="source-output-port-name go-to-link"></div>').attr('title', portLabel).text(portLabel).on('click', function () {
|
||||||
// go to the output port
|
// go to the output port
|
||||||
nf.CanvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
|
canvasUtils.showComponent(connectionEntity.sourceGroupId, connectionEntity.sourceId);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -354,7 +373,7 @@ nf.GoTo = (function () {
|
||||||
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(sourceComponent);
|
$('<div class="search-result-icon icon-group-remote"></div>').appendTo(sourceComponent);
|
||||||
$('<div class="source-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
|
$('<div class="source-component-name go-to-link"></div>').attr('title', remoteGroupLabel).text(remoteGroupLabel).on('click', function () {
|
||||||
// go to the remote process group
|
// go to the remote process group
|
||||||
nf.CanvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
|
canvasUtils.showComponent(parentProcessGroupId, remoteProcessGroupEntity.id);
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#connections-dialog').modal('hide');
|
$('#connections-dialog').modal('hide');
|
||||||
|
@ -432,9 +451,9 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showDownstreamFromProcessor: function (selection) {
|
showDownstreamFromProcessor: function (selection) {
|
||||||
var processorEntity = selection.datum();
|
var processorEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
var processorLabel = getDisplayName(processorEntity);
|
var processorLabel = getDisplayName(processorEntity);
|
||||||
|
|
||||||
|
@ -452,7 +471,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the source
|
// only show connections for which this selection is the source
|
||||||
if (connectionEntity.sourceId === processorEntity.id) {
|
if (connectionEntity.sourceId === processorEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -472,9 +491,9 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showUpstreamFromProcessor: function (selection) {
|
showUpstreamFromProcessor: function (selection) {
|
||||||
var processorEntity = selection.datum();
|
var processorEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
var processorLabel = getDisplayName(processorEntity);
|
var processorLabel = getDisplayName(processorEntity);
|
||||||
|
|
||||||
|
@ -492,7 +511,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the destination
|
// only show connections for which this selection is the destination
|
||||||
if (connectionEntity.destinationId === processorEntity.id) {
|
if (connectionEntity.destinationId === processorEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -512,12 +531,12 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showDownstreamFromGroup: function (selection) {
|
showDownstreamFromGroup: function (selection) {
|
||||||
var groupEntity = selection.datum();
|
var groupEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
var iconStyle = 'icon-group';
|
var iconStyle = 'icon-group';
|
||||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
iconStyle = 'icon-group-remote';
|
iconStyle = 'icon-group-remote';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +556,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the source
|
// only show connections for which this selection is the source
|
||||||
if (connectionEntity.sourceGroupId === groupEntity.id) {
|
if (connectionEntity.sourceGroupId === groupEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -557,12 +576,12 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showUpstreamFromGroup: function (selection) {
|
showUpstreamFromGroup: function (selection) {
|
||||||
var groupEntity = selection.datum();
|
var groupEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
var iconStyle = 'icon-group';
|
var iconStyle = 'icon-group';
|
||||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
iconStyle = 'icon-group-remote';
|
iconStyle = 'icon-group-remote';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +601,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the destination
|
// only show connections for which this selection is the destination
|
||||||
if (connectionEntity.destinationGroupId === groupEntity.id) {
|
if (connectionEntity.destinationGroupId === groupEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -602,9 +621,9 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showDownstreamFromInputPort: function (selection) {
|
showDownstreamFromInputPort: function (selection) {
|
||||||
var portEntity = selection.datum();
|
var portEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
var portLabel = getDisplayName(portEntity);
|
var portLabel = getDisplayName(portEntity);
|
||||||
|
|
||||||
|
@ -622,7 +641,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the source
|
// only show connections for which this selection is the source
|
||||||
if (connectionEntity.sourceId === portEntity.id) {
|
if (connectionEntity.sourceId === portEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -645,7 +664,7 @@ nf.GoTo = (function () {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: config.urls.processGroups + encodeURIComponent(nf.Canvas.getParentGroupId()),
|
url: config.urls.processGroups + encodeURIComponent(canvasUtils.getParentGroupId()),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
var flow = response.processGroupFlow.flow;
|
var flow = response.processGroupFlow.flow;
|
||||||
|
@ -662,7 +681,7 @@ nf.GoTo = (function () {
|
||||||
// populate the upstream dialog
|
// populate the upstream dialog
|
||||||
$('#connections-context')
|
$('#connections-context')
|
||||||
.append('<div class="search-result-icon icon-group"></div>')
|
.append('<div class="search-result-icon icon-group"></div>')
|
||||||
.append($('<div class="connections-component-name"></div>').text(nf.Canvas.getGroupName()))
|
.append($('<div class="connections-component-name"></div>').text(canvasUtils.getGroupName()))
|
||||||
.append('<div class="clear"></div>')
|
.append('<div class="clear"></div>')
|
||||||
.append('<div class="search-result-icon icon-port-in" style="margin-left: 20px;"></div>')
|
.append('<div class="search-result-icon icon-port-in" style="margin-left: 20px;"></div>')
|
||||||
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
||||||
|
@ -672,7 +691,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the destination
|
// only show connections for which this selection is the destination
|
||||||
if (connectionEntity.destinationId === portEntity.id) {
|
if (connectionEntity.destinationId === portEntity.id) {
|
||||||
addConnection(nf.Canvas.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -683,7 +702,7 @@ nf.GoTo = (function () {
|
||||||
|
|
||||||
// show the upstream dialog
|
// show the upstream dialog
|
||||||
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -696,7 +715,7 @@ nf.GoTo = (function () {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: config.urls.processGroups + encodeURIComponent(nf.Canvas.getParentGroupId()),
|
url: config.urls.processGroups + encodeURIComponent(canvasUtils.getParentGroupId()),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
var flow = response.processGroupFlow.flow;
|
var flow = response.processGroupFlow.flow;
|
||||||
|
@ -713,7 +732,7 @@ nf.GoTo = (function () {
|
||||||
// populate the downstream dialog
|
// populate the downstream dialog
|
||||||
$('#connections-context')
|
$('#connections-context')
|
||||||
.append('<div class="search-result-icon icon-group"></div>')
|
.append('<div class="search-result-icon icon-group"></div>')
|
||||||
.append($('<div class="connections-component-name"></div>').text(nf.Canvas.getGroupName()))
|
.append($('<div class="connections-component-name"></div>').text(canvasUtils.getGroupName()))
|
||||||
.append('<div class="clear"></div>')
|
.append('<div class="clear"></div>')
|
||||||
.append('<div class="search-result-icon icon-port-out" style="margin-left: 20px;"></div>')
|
.append('<div class="search-result-icon icon-port-out" style="margin-left: 20px;"></div>')
|
||||||
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
.append($('<div class="connections-component-name"></div>').text(portLabel))
|
||||||
|
@ -723,7 +742,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the source
|
// only show connections for which this selection is the source
|
||||||
if (connectionEntity.sourceId === portEntity.id) {
|
if (connectionEntity.sourceId === portEntity.id) {
|
||||||
addConnection(nf.Canvas.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getParentGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -734,7 +753,7 @@ nf.GoTo = (function () {
|
||||||
|
|
||||||
// show the downstream dialog
|
// show the downstream dialog
|
||||||
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
|
$('#connections-dialog').modal('setHeaderText', 'Downstream Connections').modal('show');
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -744,9 +763,9 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showUpstreamFromOutputPort: function (selection) {
|
showUpstreamFromOutputPort: function (selection) {
|
||||||
var portEntity = selection.datum();
|
var portEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
var portLabel = getDisplayName(portEntity);
|
var portLabel = getDisplayName(portEntity);
|
||||||
|
|
||||||
|
@ -764,7 +783,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the destination
|
// only show connections for which this selection is the destination
|
||||||
if (connectionEntity.destinationId === portEntity.id) {
|
if (connectionEntity.destinationId === portEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -784,9 +803,9 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showDownstreamFromFunnel: function (selection) {
|
showDownstreamFromFunnel: function (selection) {
|
||||||
var funnelEntity = selection.datum();
|
var funnelEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
// record details of the current component
|
// record details of the current component
|
||||||
currentComponentId = funnelEntity.id;
|
currentComponentId = funnelEntity.id;
|
||||||
|
@ -802,7 +821,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the source
|
// only show connections for which this selection is the source
|
||||||
if (connectionEntity.sourceId === funnelEntity.id) {
|
if (connectionEntity.sourceId === funnelEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -822,9 +841,9 @@ nf.GoTo = (function () {
|
||||||
*/
|
*/
|
||||||
showUpstreamFromFunnel: function (selection) {
|
showUpstreamFromFunnel: function (selection) {
|
||||||
var funnelEntity = selection.datum();
|
var funnelEntity = selection.datum();
|
||||||
var connections = nf.Connection.get();
|
var connections = canvasUtils.getComponentByType('Connection').get();
|
||||||
var processGroups = nf.ProcessGroup.get();
|
var processGroups = canvasUtils.getComponentByType('ProcessGroup').get();
|
||||||
var remoteProcessGroups = nf.RemoteProcessGroup.get();
|
var remoteProcessGroups = canvasUtils.getComponentByType('RemoteProcessGroup').get();
|
||||||
|
|
||||||
// record details of the current component
|
// record details of the current component
|
||||||
currentComponentId = funnelEntity.id;
|
currentComponentId = funnelEntity.id;
|
||||||
|
@ -840,7 +859,7 @@ nf.GoTo = (function () {
|
||||||
$.each(connections, function (_, connectionEntity) {
|
$.each(connections, function (_, connectionEntity) {
|
||||||
// only show connections for which this selection is the destination
|
// only show connections for which this selection is the destination
|
||||||
if (connectionEntity.destinationId === funnelEntity.id) {
|
if (connectionEntity.destinationId === funnelEntity.id) {
|
||||||
addConnection(nf.Canvas.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
addConnection(canvasUtils.getGroupId(), connectionEntity, processGroups, remoteProcessGroups);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -853,4 +872,4 @@ nf.GoTo = (function () {
|
||||||
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
$('#connections-dialog').modal('setHeaderText', 'Upstream Connections').modal('show');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,16 +15,74 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Graph = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.Label',
|
||||||
|
'nf.Funnel',
|
||||||
|
'nf.Port',
|
||||||
|
'nf.RemoteProcessGroup',
|
||||||
|
'nf.ProcessGroup',
|
||||||
|
'nf.Processor',
|
||||||
|
'nf.Connection',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Connectable',
|
||||||
|
'nf.Draggable',
|
||||||
|
'nf.Selectable',
|
||||||
|
'nf.ContextMenu'],
|
||||||
|
function ($, d3, common, angularBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, canvasUtils, connectable, draggable, selectable, contextMenu) {
|
||||||
|
return (nf.Graph = factory($, d3, common, angularBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, canvasUtils, connectable, draggable, selectable, contextMenu));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Graph =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.Label'),
|
||||||
|
require('nf.Funnel'),
|
||||||
|
require('nf.Port'),
|
||||||
|
require('nf.RemoteProcessGroup'),
|
||||||
|
require('nf.ProcessGroup'),
|
||||||
|
require('nf.Processor'),
|
||||||
|
require('nf.Connection'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Connectable'),
|
||||||
|
require('nf.Draggable'),
|
||||||
|
require('nf.Selectable'),
|
||||||
|
require('nf.ContextMenu')));
|
||||||
|
} else {
|
||||||
|
nf.Graph = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.Label,
|
||||||
|
root.nf.Funnel,
|
||||||
|
root.nf.Port,
|
||||||
|
root.nf.RemoteProcessGroup,
|
||||||
|
root.nf.ProcessGroup,
|
||||||
|
root.nf.Processor,
|
||||||
|
root.nf.Connection,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Connectable,
|
||||||
|
root.nf.Draggable,
|
||||||
|
root.nf.Selectable,
|
||||||
|
root.nf.ContextMenu);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, common, angularBridge, nfLabel, nfFunnel, nfPort, nfRemoteProcessGroup, nfProcessGroup, nfProcessor, nfConnection, canvasUtils, connectable, draggable, selectable, contextMenu) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var combinePorts = function (contents) {
|
var combinePorts = function (contents) {
|
||||||
if (nf.Common.isDefinedAndNotNull(contents.inputPorts) && nf.Common.isDefinedAndNotNull(contents.outputPorts)) {
|
if (common.isDefinedAndNotNull(contents.inputPorts) && common.isDefinedAndNotNull(contents.outputPorts)) {
|
||||||
return contents.inputPorts.concat(contents.outputPorts);
|
return contents.inputPorts.concat(contents.outputPorts);
|
||||||
} else if (nf.Common.isDefinedAndNotNull(contents.inputPorts)) {
|
} else if (common.isDefinedAndNotNull(contents.inputPorts)) {
|
||||||
return contents.inputPorts;
|
return contents.inputPorts;
|
||||||
} else if (nf.Common.isDefinedAndNotNull(contents.outputPorts)) {
|
} else if (common.isDefinedAndNotNull(contents.outputPorts)) {
|
||||||
return contents.outputPorts;
|
return contents.outputPorts;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
@ -32,31 +90,121 @@ nf.Graph = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var combinePortStatus = function (status) {
|
var combinePortStatus = function (status) {
|
||||||
if (nf.Common.isDefinedAndNotNull(status.inputPortStatusSnapshots) && nf.Common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) {
|
if (common.isDefinedAndNotNull(status.inputPortStatusSnapshots) && common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) {
|
||||||
return status.inputPortStatusSnapshots.concat(status.outputPortStatusSnapshots);
|
return status.inputPortStatusSnapshots.concat(status.outputPortStatusSnapshots);
|
||||||
} else if (nf.Common.isDefinedAndNotNull(status.inputPortStatusSnapshots)) {
|
} else if (common.isDefinedAndNotNull(status.inputPortStatusSnapshots)) {
|
||||||
return status.inputPortStatusSnapshots;
|
return status.inputPortStatusSnapshots;
|
||||||
} else if (nf.Common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) {
|
} else if (common.isDefinedAndNotNull(status.outputPortStatusSnapshots)) {
|
||||||
return status.outputPortStatusSnapshots;
|
return status.outputPortStatusSnapshots;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
/**
|
||||||
init: function () {
|
* Updates component visibility based on their proximity to the screen's viewport.
|
||||||
|
*/
|
||||||
|
var updateComponentVisibility = function () {
|
||||||
|
var canvasContainer = $('#canvas-container');
|
||||||
|
var translate = canvasUtils.translateCanvasView();
|
||||||
|
var scale = canvasUtils.scaleCanvasView();
|
||||||
|
|
||||||
|
// scale the translation
|
||||||
|
translate = [translate[0] / scale, translate[1] / scale];
|
||||||
|
|
||||||
|
// get the normalized screen width and height
|
||||||
|
var screenWidth = canvasContainer.width() / scale;
|
||||||
|
var screenHeight = canvasContainer.height() / scale;
|
||||||
|
|
||||||
|
// calculate the screen bounds one screens worth in each direction
|
||||||
|
var screenLeft = -translate[0] - screenWidth;
|
||||||
|
var screenTop = -translate[1] - screenHeight;
|
||||||
|
var screenRight = screenLeft + (screenWidth * 3);
|
||||||
|
var screenBottom = screenTop + (screenHeight * 3);
|
||||||
|
|
||||||
|
// detects whether a component is visible and should be rendered
|
||||||
|
var isComponentVisible = function (d) {
|
||||||
|
if (!canvasUtils.shouldRenderPerScale()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var left = d.position.x;
|
||||||
|
var top = d.position.y;
|
||||||
|
var right = left + d.dimensions.width;
|
||||||
|
var bottom = top + d.dimensions.height;
|
||||||
|
|
||||||
|
// determine if the component is now visible
|
||||||
|
return screenLeft < right && screenRight > left && screenTop < bottom && screenBottom > top;
|
||||||
|
};
|
||||||
|
|
||||||
|
// detects whether a connection is visible and should be rendered
|
||||||
|
var isConnectionVisible = function (d) {
|
||||||
|
if (!canvasUtils.shouldRenderPerScale()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var x, y;
|
||||||
|
if (d.bends.length > 0) {
|
||||||
|
var i = Math.min(Math.max(0, d.labelIndex), d.bends.length - 1);
|
||||||
|
x = d.bends[i].x;
|
||||||
|
y = d.bends[i].y;
|
||||||
|
} else {
|
||||||
|
x = (d.start.x + d.end.x) / 2;
|
||||||
|
y = (d.start.y + d.end.y) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return screenLeft < x && screenRight > x && screenTop < y && screenBottom > y;
|
||||||
|
};
|
||||||
|
|
||||||
|
// marks the specific component as visible and determines if its entering or leaving visibility
|
||||||
|
var updateVisibility = function (d, isVisible) {
|
||||||
|
var selection = d3.select('#id-' + d.id);
|
||||||
|
var visible = isVisible(d);
|
||||||
|
var wasVisible = selection.classed('visible');
|
||||||
|
|
||||||
|
// mark the selection as appropriate
|
||||||
|
selection.classed('visible', visible)
|
||||||
|
.classed('entering', function () {
|
||||||
|
return visible && !wasVisible;
|
||||||
|
}).classed('leaving', function () {
|
||||||
|
return !visible && wasVisible;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// get the all components
|
||||||
|
var graph = nfGraph.get();
|
||||||
|
|
||||||
|
// update the visibility for each component
|
||||||
|
$.each(graph.processors, function (_, d) {
|
||||||
|
updateVisibility(d, isComponentVisible);
|
||||||
|
});
|
||||||
|
$.each(graph.ports, function (_, d) {
|
||||||
|
updateVisibility(d, isComponentVisible);
|
||||||
|
});
|
||||||
|
$.each(graph.processGroups, function (_, d) {
|
||||||
|
updateVisibility(d, isComponentVisible);
|
||||||
|
});
|
||||||
|
$.each(graph.remoteProcessGroups, function (_, d) {
|
||||||
|
updateVisibility(d, isComponentVisible);
|
||||||
|
});
|
||||||
|
$.each(graph.connections, function (_, d) {
|
||||||
|
updateVisibility(d, isConnectionVisible);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var nfGraph = {
|
||||||
|
init: function () {
|
||||||
// initialize the object responsible for each type of component
|
// initialize the object responsible for each type of component
|
||||||
nf.Label.init();
|
nfLabel.init(connectable, draggable, selectable, contextMenu);
|
||||||
nf.Funnel.init();
|
nfFunnel.init(connectable, draggable, selectable, contextMenu);
|
||||||
nf.Port.init();
|
nfPort.init(connectable, draggable, selectable, contextMenu);
|
||||||
nf.RemoteProcessGroup.init();
|
nfRemoteProcessGroup.init(connectable, draggable, selectable, contextMenu);
|
||||||
nf.ProcessGroup.init();
|
nfProcessGroup.init(connectable, draggable, selectable, contextMenu);
|
||||||
nf.Processor.init();
|
nfProcessor.init(connectable, draggable, selectable, contextMenu);
|
||||||
nf.Connection.init();
|
nfConnection.init(selectable, contextMenu);
|
||||||
|
|
||||||
// load the graph
|
// load the graph
|
||||||
return nf.CanvasUtils.enterGroup(nf.Canvas.getGroupId());
|
return nfProcessGroup.enterGroup(canvasUtils.getGroupId());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,65 +215,65 @@ nf.Graph = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (processGroupContents, options) {
|
add: function (processGroupContents, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are going to select the new components, deselect the previous selection
|
// if we are going to select the new components, deselect the previous selection
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
nf.CanvasUtils.getSelection().classed('selected', false);
|
canvasUtils.getSelection().classed('selected', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge the ports together
|
// merge the ports together
|
||||||
var ports = combinePorts(processGroupContents);
|
var ports = combinePorts(processGroupContents);
|
||||||
|
|
||||||
// add the components to the responsible object
|
// add the components to the responsible object
|
||||||
nf.Label.add(processGroupContents.labels, options);
|
nfLabel.add(processGroupContents.labels, options);
|
||||||
nf.Funnel.add(processGroupContents.funnels, options);
|
nfFunnel.add(processGroupContents.funnels, options);
|
||||||
nf.RemoteProcessGroup.add(processGroupContents.remoteProcessGroups, options);
|
nfRemoteProcessGroup.add(processGroupContents.remoteProcessGroups, options);
|
||||||
nf.Port.add(ports, options);
|
nfPort.add(ports, options);
|
||||||
nf.ProcessGroup.add(processGroupContents.processGroups, options);
|
nfProcessGroup.add(processGroupContents.processGroups, options);
|
||||||
nf.Processor.add(processGroupContents.processors, options);
|
nfProcessor.add(processGroupContents.processors, options);
|
||||||
nf.Connection.add(processGroupContents.connections, options);
|
nfConnection.add(processGroupContents.connections, options);
|
||||||
|
|
||||||
// inform Angular app if the selection is changing
|
// inform Angular app if the selection is changing
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the graph with the resources defined in the response.
|
* Populates the graph with the resources defined in the response.
|
||||||
*
|
*
|
||||||
* @argument {object} processGroupContents The contents of the process group
|
* @argument {object} processGroupContents The contents of the process group
|
||||||
* @argument {object} options Configuration options
|
* @argument {object} options Configuration options
|
||||||
*/
|
*/
|
||||||
set: function (processGroupContents, options) {
|
set: function (processGroupContents, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are going to select the new components, deselect the previous selection
|
// if we are going to select the new components, deselect the previous selection
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
nf.CanvasUtils.getSelection().classed('selected', false);
|
canvasUtils.getSelection().classed('selected', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge the ports together
|
// merge the ports together
|
||||||
var ports = combinePorts(processGroupContents);
|
var ports = combinePorts(processGroupContents);
|
||||||
|
|
||||||
// add the components to the responsible object
|
// add the components to the responsible object
|
||||||
nf.Label.set(processGroupContents.labels, options);
|
nfLabel.set(processGroupContents.labels, options);
|
||||||
nf.Funnel.set(processGroupContents.funnels, options);
|
nfFunnel.set(processGroupContents.funnels, options);
|
||||||
nf.RemoteProcessGroup.set(processGroupContents.remoteProcessGroups, options);
|
nfRemoteProcessGroup.set(processGroupContents.remoteProcessGroups, options);
|
||||||
nf.Port.set(ports, options);
|
nfPort.set(ports, options);
|
||||||
nf.ProcessGroup.set(processGroupContents.processGroups, options);
|
nfProcessGroup.set(processGroupContents.processGroups, options);
|
||||||
nf.Processor.set(processGroupContents.processors, options);
|
nfProcessor.set(processGroupContents.processors, options);
|
||||||
nf.Connection.set(processGroupContents.connections, options);
|
nfConnection.set(processGroupContents.connections, options);
|
||||||
|
|
||||||
// inform Angular app if the selection is changing
|
// inform Angular app if the selection is changing
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -140,54 +288,133 @@ nf.Graph = (function () {
|
||||||
* @param timestamp expire caches before
|
* @param timestamp expire caches before
|
||||||
*/
|
*/
|
||||||
expireCaches: function (timestamp) {
|
expireCaches: function (timestamp) {
|
||||||
nf.Label.expireCaches(timestamp);
|
nfLabel.expireCaches(timestamp);
|
||||||
nf.Funnel.expireCaches(timestamp);
|
nfFunnel.expireCaches(timestamp);
|
||||||
nf.RemoteProcessGroup.expireCaches(timestamp);
|
nfRemoteProcessGroup.expireCaches(timestamp);
|
||||||
nf.Port.expireCaches(timestamp);
|
nfPort.expireCaches(timestamp);
|
||||||
nf.ProcessGroup.expireCaches(timestamp);
|
nfProcessGroup.expireCaches(timestamp);
|
||||||
nf.Processor.expireCaches(timestamp);
|
nfProcessor.expireCaches(timestamp);
|
||||||
nf.Connection.expireCaches(timestamp);
|
nfConnection.expireCaches(timestamp);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the components currently on the canvas.
|
* Gets the components currently on the canvas.
|
||||||
*/
|
*/
|
||||||
get: function () {
|
get: function () {
|
||||||
return {
|
return {
|
||||||
labels: nf.Label.get(),
|
labels: nfLabel.get(),
|
||||||
funnels: nf.Funnel.get(),
|
funnels: nfFunnel.get(),
|
||||||
ports: nf.Port.get(),
|
ports: nfPort.get(),
|
||||||
remoteProcessGroups: nf.RemoteProcessGroup.get(),
|
remoteProcessGroups: nfRemoteProcessGroup.get(),
|
||||||
processGroups: nf.ProcessGroup.get(),
|
processGroups: nfProcessGroup.get(),
|
||||||
processors: nf.Processor.get(),
|
processors: nfProcessor.get(),
|
||||||
connections: nf.Connection.get()
|
connections: nfConnection.get()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a graph component `type`.
|
||||||
|
*
|
||||||
|
* @param type The type of component.
|
||||||
|
*/
|
||||||
|
getComponentByType: function (type) {
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case "Label":
|
||||||
|
return nfLabel;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Funnel":
|
||||||
|
return nfFunnel;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Port":
|
||||||
|
return nfPort;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "RemoteProcessGroup":
|
||||||
|
return nfRemoteProcessGroup;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "ProcessGroup":
|
||||||
|
return nfProcessGroup;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Processor":
|
||||||
|
return nfProcessor;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Connection":
|
||||||
|
return nfConnection;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error('Unknown component type.');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all the components currently on the canvas. This function does not automatically refresh.
|
* Clears all the components currently on the canvas. This function does not automatically refresh.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
// remove all the components
|
// remove all the components
|
||||||
nf.Label.removeAll();
|
nfLabel.removeAll();
|
||||||
nf.Funnel.removeAll();
|
nfFunnel.removeAll();
|
||||||
nf.Port.removeAll();
|
nfPort.removeAll();
|
||||||
nf.RemoteProcessGroup.removeAll();
|
nfRemoteProcessGroup.removeAll();
|
||||||
nf.ProcessGroup.removeAll();
|
nfProcessGroup.removeAll();
|
||||||
nf.Processor.removeAll();
|
nfProcessor.removeAll();
|
||||||
nf.Connection.removeAll();
|
nfConnection.removeAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refreshes all components currently on the canvas.
|
* Refreshes all components currently on the canvas.
|
||||||
*/
|
*/
|
||||||
pan: function () {
|
pan: function () {
|
||||||
// refresh the components
|
// refresh the components
|
||||||
nf.Port.pan();
|
nfPort.pan();
|
||||||
nf.RemoteProcessGroup.pan();
|
nfRemoteProcessGroup.pan();
|
||||||
nf.ProcessGroup.pan();
|
nfProcessGroup.pan();
|
||||||
nf.Processor.pan();
|
nfProcessor.pan();
|
||||||
nf.Connection.pan();
|
nfConnection.pan();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates component visibility based on the current translation/scale.
|
||||||
|
*/
|
||||||
|
updateVisibility: function () {
|
||||||
|
updateComponentVisibility();
|
||||||
|
nfGraph.pan();
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the currently selected components and connections.
|
||||||
|
*
|
||||||
|
* @returns {selection} The currently selected components and connections
|
||||||
|
*/
|
||||||
|
getSelection: function () {
|
||||||
|
return d3.selectAll('g.component.selected, g.connection.selected');
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the component on the canvas.
|
||||||
|
*
|
||||||
|
* @param component The component.
|
||||||
|
*/
|
||||||
|
reload: function (component) {
|
||||||
|
var componentData = component.datum();
|
||||||
|
if (componentData.permissions.canRead) {
|
||||||
|
if (canvasUtils.isProcessor(component)) {
|
||||||
|
nfProcessor.reload(componentData.id);
|
||||||
|
} else if (canvasUtils.isInputPort(component)) {
|
||||||
|
nfPort.reload(componentData.id);
|
||||||
|
} else if (canvasUtils.isRemoteProcessGroup(component)) {
|
||||||
|
nfRemoteProcessGroup.reload(componentData.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfGraph;
|
||||||
|
}));
|
|
@ -15,9 +15,43 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.LabelConfiguration = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.Label'],
|
||||||
|
function ($, d3, errorHandler, common, client, canvasUtils, angularBridge, label) {
|
||||||
|
return (nf.LabelConfiguration = factory($, d3, errorHandler, common, client, canvasUtils, angularBridge, label));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.LabelConfiguration =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.Label')));
|
||||||
|
} else {
|
||||||
|
nf.LabelConfiguration = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.Label);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, client, canvasUtils, angularBridge, label) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var labelId = '';
|
var labelId = '';
|
||||||
|
|
||||||
|
@ -48,7 +82,7 @@ nf.LabelConfiguration = (function () {
|
||||||
|
|
||||||
// build the label entity
|
// build the label entity
|
||||||
var labelEntity = {
|
var labelEntity = {
|
||||||
'revision': nf.Client.getRevision(labelData),
|
'revision': client.getRevision(labelData),
|
||||||
'component': {
|
'component': {
|
||||||
'id': labelId,
|
'id': labelId,
|
||||||
'label': labelValue,
|
'label': labelValue,
|
||||||
|
@ -67,11 +101,11 @@ nf.LabelConfiguration = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// get the label out of the response
|
// get the label out of the response
|
||||||
nf.Label.set(response);
|
label.set(response);
|
||||||
|
|
||||||
// inform Angular app values have changed
|
// inform Angular app values have changed
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// reset and hide the dialog
|
// reset and hide the dialog
|
||||||
this.modal('hide');
|
this.modal('hide');
|
||||||
|
@ -132,18 +166,18 @@ nf.LabelConfiguration = (function () {
|
||||||
* @argument {selection} selection The selection
|
* @argument {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
showConfiguration: function (selection) {
|
showConfiguration: function (selection) {
|
||||||
if (nf.CanvasUtils.isLabel(selection)) {
|
if (canvasUtils.isLabel(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// get the label value
|
// get the label value
|
||||||
var labelValue = '';
|
var labelValue = '';
|
||||||
if (nf.Common.isDefinedAndNotNull(selectionData.component.label)) {
|
if (common.isDefinedAndNotNull(selectionData.component.label)) {
|
||||||
labelValue = selectionData.component.label;
|
labelValue = selectionData.component.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the font size
|
// get the font size
|
||||||
var fontSize = '12px';
|
var fontSize = '12px';
|
||||||
if (nf.Common.isDefinedAndNotNull(selectionData.component.style['font-size'])) {
|
if (common.isDefinedAndNotNull(selectionData.component.style['font-size'])) {
|
||||||
fontSize = selectionData.component.style['font-size'];
|
fontSize = selectionData.component.style['font-size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,4 +195,4 @@ nf.LabelConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,39 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Label = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, common, client, canvasUtils) {
|
||||||
|
return (nf.Label = factory($, d3, common, client, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Label =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.Label = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, common, client, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfConnectable;
|
||||||
|
var nfDraggable;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
var dimensions = {
|
var dimensions = {
|
||||||
width: 150,
|
width: 150,
|
||||||
|
@ -84,7 +114,7 @@ nf.Label = (function () {
|
||||||
'class': 'label component'
|
'class': 'label component'
|
||||||
})
|
})
|
||||||
.classed('selected', selected)
|
.classed('selected', selected)
|
||||||
.call(nf.CanvasUtils.position);
|
.call(canvasUtils.position);
|
||||||
|
|
||||||
// label border
|
// label border
|
||||||
label.append('rect')
|
label.append('rect')
|
||||||
|
@ -112,7 +142,7 @@ nf.Label = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// always support selecting
|
// always support selecting
|
||||||
label.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
|
label.call(nfSelectable.activate).call(nfContextMenu.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,10 +184,10 @@ nf.Label = (function () {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var color = nf.Label.defaultColor();
|
var color = nfLabel.defaultColor();
|
||||||
|
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
if (common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
||||||
color = d.component.style['background-color'];
|
color = d.component.style['background-color'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +202,7 @@ nf.Label = (function () {
|
||||||
var label = d3.select(this);
|
var label = d3.select(this);
|
||||||
|
|
||||||
// update the component behavior as appropriate
|
// update the component behavior as appropriate
|
||||||
nf.CanvasUtils.editable(label);
|
canvasUtils.editable(label, nfConnectable, nfDraggable);
|
||||||
|
|
||||||
// update the label
|
// update the label
|
||||||
var labelText = label.select('text.label-value');
|
var labelText = label.select('text.label-value');
|
||||||
|
@ -183,7 +213,7 @@ nf.Label = (function () {
|
||||||
var fontSize = '12px';
|
var fontSize = '12px';
|
||||||
|
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.style['font-size'])) {
|
if (common.isDefinedAndNotNull(d.component.style['font-size'])) {
|
||||||
fontSize = d.component.style['font-size'];
|
fontSize = d.component.style['font-size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,16 +225,16 @@ nf.Label = (function () {
|
||||||
|
|
||||||
// parse the lines in this label
|
// parse the lines in this label
|
||||||
var lines = [];
|
var lines = [];
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.label)) {
|
if (common.isDefinedAndNotNull(d.component.label)) {
|
||||||
lines = d.component.label.split('\n');
|
lines = d.component.label.split('\n');
|
||||||
} else {
|
} else {
|
||||||
lines.push('');
|
lines.push('');
|
||||||
}
|
}
|
||||||
|
|
||||||
var color = nf.Label.defaultColor();
|
var color = nfLabel.defaultColor();
|
||||||
|
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
if (common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
||||||
color = d.component.style['background-color'];
|
color = d.component.style['background-color'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +247,8 @@ nf.Label = (function () {
|
||||||
return line;
|
return line;
|
||||||
})
|
})
|
||||||
.style('fill', function (d) {
|
.style('fill', function (d) {
|
||||||
return nf.Common.determineContrastColor(
|
return common.determineContrastColor(
|
||||||
nf.Common.substringAfterLast(
|
common.substringAfterLast(
|
||||||
color, '#'));
|
color, '#'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -254,7 +284,7 @@ nf.Label = (function () {
|
||||||
} else {
|
} else {
|
||||||
// remove the previous label value
|
// remove the previous label value
|
||||||
labelText.selectAll('tspan').remove();
|
labelText.selectAll('tspan').remove();
|
||||||
|
|
||||||
// remove the label points
|
// remove the label points
|
||||||
labelPoint.remove()
|
labelPoint.remove()
|
||||||
}
|
}
|
||||||
|
@ -270,7 +300,7 @@ nf.Label = (function () {
|
||||||
removed.remove();
|
removed.remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfLabel = {
|
||||||
config: {
|
config: {
|
||||||
width: dimensions.width,
|
width: dimensions.width,
|
||||||
height: dimensions.height
|
height: dimensions.height
|
||||||
|
@ -279,7 +309,12 @@ nf.Label = (function () {
|
||||||
/**
|
/**
|
||||||
* Initializes of the Processor handler.
|
* Initializes of the Processor handler.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (connectable, draggable, selectable, contextMenu) {
|
||||||
|
nfConnectable = connectable;
|
||||||
|
nfDraggable = draggable;
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
labelMap = d3.map();
|
labelMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -314,19 +349,19 @@ nf.Label = (function () {
|
||||||
|
|
||||||
// determine if the width has changed
|
// determine if the width has changed
|
||||||
var different = false;
|
var different = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(labelData.component.width) || labelData.dimensions.width !== labelData.component.width) {
|
if (common.isDefinedAndNotNull(labelData.component.width) || labelData.dimensions.width !== labelData.component.width) {
|
||||||
different = true;
|
different = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine if the height has changed
|
// determine if the height has changed
|
||||||
if (!different && nf.Common.isDefinedAndNotNull(labelData.component.height) || labelData.dimensions.height !== labelData.component.height) {
|
if (!different && common.isDefinedAndNotNull(labelData.component.height) || labelData.dimensions.height !== labelData.component.height) {
|
||||||
different = true;
|
different = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only save the updated bends if necessary
|
// only save the updated bends if necessary
|
||||||
if (different) {
|
if (different) {
|
||||||
var labelEntity = {
|
var labelEntity = {
|
||||||
'revision': nf.Client.getRevision(labelData),
|
'revision': client.getRevision(labelData),
|
||||||
'component': {
|
'component': {
|
||||||
'id': labelData.id,
|
'id': labelData.id,
|
||||||
'width': labelData.dimensions.width,
|
'width': labelData.dimensions.width,
|
||||||
|
@ -342,17 +377,17 @@ nf.Label = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// request was successful, update the entry
|
// request was successful, update the entry
|
||||||
nf.Label.set(response);
|
nfLabel.set(response);
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
// determine the previous width
|
// determine the previous width
|
||||||
var width = dimensions.width;
|
var width = dimensions.width;
|
||||||
if (nf.Common.isDefinedAndNotNull(labelData.component.width)) {
|
if (common.isDefinedAndNotNull(labelData.component.width)) {
|
||||||
width = labelData.component.width;
|
width = labelData.component.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine the previous height
|
// determine the previous height
|
||||||
var height = dimensions.height;
|
var height = dimensions.height;
|
||||||
if (nf.Common.isDefinedAndNotNull(labelData.component.height)) {
|
if (common.isDefinedAndNotNull(labelData.component.height)) {
|
||||||
height = labelData.component.height;
|
height = labelData.component.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,8 +415,8 @@ nf.Label = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (labelEntities, options) {
|
add: function (labelEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current time
|
// get the current time
|
||||||
|
@ -401,7 +436,7 @@ nf.Label = (function () {
|
||||||
$.each(labelEntities, function (_, labelEntity) {
|
$.each(labelEntities, function (_, labelEntity) {
|
||||||
add(labelEntity);
|
add(labelEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(labelEntities)) {
|
} else if (common.isDefinedAndNotNull(labelEntities)) {
|
||||||
add(labelEntities);
|
add(labelEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,16 +455,16 @@ nf.Label = (function () {
|
||||||
set: function (labelEntities, options) {
|
set: function (labelEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = function (proposedLabelEntity) {
|
var set = function (proposedLabelEntity) {
|
||||||
var currentLabelEntity = labelMap.get(proposedLabelEntity.id);
|
var currentLabelEntity = labelMap.get(proposedLabelEntity.id);
|
||||||
|
|
||||||
// set the processor if appropriate due to revision and wasn't previously removed
|
// set the processor if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentLabelEntity, proposedLabelEntity) && !removedCache.has(proposedLabelEntity.id)) {
|
if (client.isNewerRevision(currentLabelEntity, proposedLabelEntity) && !removedCache.has(proposedLabelEntity.id)) {
|
||||||
labelMap.set(proposedLabelEntity.id, $.extend({
|
labelMap.set(proposedLabelEntity.id, $.extend({
|
||||||
type: 'Label'
|
type: 'Label'
|
||||||
}, proposedLabelEntity));
|
}, proposedLabelEntity));
|
||||||
|
@ -451,14 +486,14 @@ nf.Label = (function () {
|
||||||
$.each(labelEntities, function (_, labelEntity) {
|
$.each(labelEntities, function (_, labelEntity) {
|
||||||
set(labelEntity);
|
set(labelEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(labelEntities)) {
|
} else if (common.isDefinedAndNotNull(labelEntities)) {
|
||||||
set(labelEntities);
|
set(labelEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the selection and handle all new labels
|
// apply the selection and handle all new labels
|
||||||
var selection = select();
|
var selection = select();
|
||||||
selection.enter().call(renderLabels, selectAll);
|
selection.enter().call(renderLabels, selectAll);
|
||||||
selection.call(updateLabels).call(nf.CanvasUtils.position, transition);
|
selection.call(updateLabels).call(canvasUtils.position, transition);
|
||||||
selection.exit().call(removeLabels);
|
selection.exit().call(removeLabels);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -469,7 +504,7 @@ nf.Label = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return labelMap.values();
|
return labelMap.values();
|
||||||
} else {
|
} else {
|
||||||
return labelMap.get(id);
|
return labelMap.get(id);
|
||||||
|
@ -483,7 +518,7 @@ nf.Label = (function () {
|
||||||
* @param {string} id Optional
|
* @param {string} id Optional
|
||||||
*/
|
*/
|
||||||
refresh: function (id) {
|
refresh: function (id) {
|
||||||
if (nf.Common.isDefinedAndNotNull(id)) {
|
if (common.isDefinedAndNotNull(id)) {
|
||||||
d3.select('#id-' + id).call(updateLabels);
|
d3.select('#id-' + id).call(updateLabels);
|
||||||
} else {
|
} else {
|
||||||
d3.selectAll('g.label').call(updateLabels);
|
d3.selectAll('g.label').call(updateLabels);
|
||||||
|
@ -504,7 +539,7 @@ nf.Label = (function () {
|
||||||
url: labelEntity.uri,
|
url: labelEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.Label.set(response);
|
nfLabel.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -515,7 +550,7 @@ nf.Label = (function () {
|
||||||
* @param {string} id The id
|
* @param {string} id The id
|
||||||
*/
|
*/
|
||||||
position: function (id) {
|
position: function (id) {
|
||||||
d3.select('#id-' + id).call(nf.CanvasUtils.position);
|
d3.select('#id-' + id).call(canvasUtils.position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -544,7 +579,7 @@ nf.Label = (function () {
|
||||||
* Removes all label.
|
* Removes all label.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.Label.remove(labelMap.keys());
|
nfLabel.remove(labelMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -572,4 +607,6 @@ nf.Label = (function () {
|
||||||
return '#fff7d7';
|
return '#fff7d7';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfLabel;
|
||||||
|
}));
|
|
@ -15,9 +15,46 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.PolicyManagement = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'Slick',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Shell'],
|
||||||
|
function ($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell) {
|
||||||
|
return (nf.PolicyManagement = factory($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.PolicyManagement =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('Slick'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Shell')));
|
||||||
|
} else {
|
||||||
|
nf.PolicyManagement = factory(root.$,
|
||||||
|
root.Slick,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Shell);
|
||||||
|
}
|
||||||
|
}(this, function ($, Slick, errorHandler, common, client, canvasUtils, angularBridge, dialog, shell) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
urls: {
|
urls: {
|
||||||
|
@ -240,7 +277,7 @@ nf.PolicyManagement = (function () {
|
||||||
// also consider groups already selected in the search users dialog
|
// also consider groups already selected in the search users dialog
|
||||||
container.children('li').each(function (_, allowedTenant) {
|
container.children('li').each(function (_, allowedTenant) {
|
||||||
var tenant = $(allowedTenant).data('tenant');
|
var tenant = $(allowedTenant).data('tenant');
|
||||||
if (nf.Common.isDefinedAndNotNull(tenant)) {
|
if (common.isDefinedAndNotNull(tenant)) {
|
||||||
tenants.push(tenant);
|
tenants.push(tenant);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -344,16 +381,16 @@ nf.PolicyManagement = (function () {
|
||||||
// policy type listing
|
// policy type listing
|
||||||
$('#policy-type-list').combo({
|
$('#policy-type-list').combo({
|
||||||
options: [
|
options: [
|
||||||
nf.Common.getPolicyTypeListing('flow'),
|
common.getPolicyTypeListing('flow'),
|
||||||
nf.Common.getPolicyTypeListing('controller'),
|
common.getPolicyTypeListing('controller'),
|
||||||
nf.Common.getPolicyTypeListing('provenance'),
|
common.getPolicyTypeListing('provenance'),
|
||||||
nf.Common.getPolicyTypeListing('restricted-components'),
|
common.getPolicyTypeListing('restricted-components'),
|
||||||
nf.Common.getPolicyTypeListing('policies'),
|
common.getPolicyTypeListing('policies'),
|
||||||
nf.Common.getPolicyTypeListing('tenants'),
|
common.getPolicyTypeListing('tenants'),
|
||||||
nf.Common.getPolicyTypeListing('site-to-site'),
|
common.getPolicyTypeListing('site-to-site'),
|
||||||
nf.Common.getPolicyTypeListing('system'),
|
common.getPolicyTypeListing('system'),
|
||||||
nf.Common.getPolicyTypeListing('proxy'),
|
common.getPolicyTypeListing('proxy'),
|
||||||
nf.Common.getPolicyTypeListing('counters')],
|
common.getPolicyTypeListing('counters')],
|
||||||
select: function (option) {
|
select: function (option) {
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
// record the policy type
|
// record the policy type
|
||||||
|
@ -599,8 +636,8 @@ nf.PolicyManagement = (function () {
|
||||||
// defines a function for sorting
|
// defines a function for sorting
|
||||||
var comparer = function (a, b) {
|
var comparer = function (a, b) {
|
||||||
if(a.permissions.canRead && b.permissions.canRead) {
|
if(a.permissions.canRead && b.permissions.canRead) {
|
||||||
var aString = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
||||||
var bString = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
||||||
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
||||||
} else {
|
} else {
|
||||||
if (!a.permissions.canRead && !b.permissions.canRead){
|
if (!a.permissions.canRead && !b.permissions.canRead){
|
||||||
|
@ -624,9 +661,9 @@ nf.PolicyManagement = (function () {
|
||||||
* @param item
|
* @param item
|
||||||
*/
|
*/
|
||||||
var promptToRemoveUserFromPolicy = function (item) {
|
var promptToRemoveUserFromPolicy = function (item) {
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Update Policy',
|
headerText: 'Update Policy',
|
||||||
dialogContent: 'Remove \'' + nf.Common.escapeHtml(item.component.identity) + '\' from this policy?',
|
dialogContent: 'Remove \'' + common.escapeHtml(item.component.identity) + '\' from this policy?',
|
||||||
yesHandler: function () {
|
yesHandler: function () {
|
||||||
removeUserFromPolicy(item);
|
removeUserFromPolicy(item);
|
||||||
}
|
}
|
||||||
|
@ -659,7 +696,7 @@ nf.PolicyManagement = (function () {
|
||||||
* Prompts for the deletion of the selected policy.
|
* Prompts for the deletion of the selected policy.
|
||||||
*/
|
*/
|
||||||
var promptToDeletePolicy = function () {
|
var promptToDeletePolicy = function () {
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Delete Policy',
|
headerText: 'Delete Policy',
|
||||||
dialogContent: 'By deleting this policy, the permissions for this component will revert to the inherited policy if applicable.',
|
dialogContent: 'By deleting this policy, the permissions for this component will revert to the inherited policy if applicable.',
|
||||||
yesText: 'Delete',
|
yesText: 'Delete',
|
||||||
|
@ -676,20 +713,20 @@ nf.PolicyManagement = (function () {
|
||||||
var deletePolicy = function () {
|
var deletePolicy = function () {
|
||||||
var currentEntity = $('#policy-table').data('policy');
|
var currentEntity = $('#policy-table').data('policy');
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(currentEntity)) {
|
if (common.isDefinedAndNotNull(currentEntity)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
url: currentEntity.uri + '?' + $.param(nf.Client.getRevision(currentEntity)),
|
url: currentEntity.uri + '?' + $.param(client.getRevision(currentEntity)),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Delete Policy',
|
headerText: 'Delete Policy',
|
||||||
dialogContent: 'No policy selected'
|
dialogContent: 'No policy selected'
|
||||||
});
|
});
|
||||||
|
@ -765,11 +802,11 @@ nf.PolicyManagement = (function () {
|
||||||
return $('<span>Showing effective policy inherited from the controller.</span>');
|
return $('<span>Showing effective policy inherited from the controller.</span>');
|
||||||
} else {
|
} else {
|
||||||
// extract the group id
|
// extract the group id
|
||||||
var processGroupId = nf.Common.substringAfterLast(resource, '/');
|
var processGroupId = common.substringAfterLast(resource, '/');
|
||||||
var processGroupName = processGroupId;
|
var processGroupName = processGroupId;
|
||||||
|
|
||||||
// attempt to resolve the group name
|
// attempt to resolve the group name
|
||||||
var breadcrumbs = nf.ng.Bridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
|
var breadcrumbs = angularBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
|
||||||
$.each(breadcrumbs, function (_, breadcrumbEntity) {
|
$.each(breadcrumbs, function (_, breadcrumbEntity) {
|
||||||
if (breadcrumbEntity.id === processGroupId) {
|
if (breadcrumbEntity.id === processGroupId) {
|
||||||
processGroupName = breadcrumbEntity.label;
|
processGroupName = breadcrumbEntity.label;
|
||||||
|
@ -787,11 +824,11 @@ nf.PolicyManagement = (function () {
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// load the correct group and unselect everything if necessary
|
// load the correct group and unselect everything if necessary
|
||||||
nf.CanvasUtils.enterGroup(processGroupId).done(function () {
|
canvasUtils.getComponentByType('ProcessGroup').enterGroup(processGroupId).done(function () {
|
||||||
nf.CanvasUtils.getSelection().classed('selected', false);
|
canvasUtils.getSelection().classed('selected', false);
|
||||||
|
|
||||||
// inform Angular app that values have changed
|
// inform Angular app that values have changed
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
).append('<span>.</span>');
|
).append('<span>.</span>');
|
||||||
|
@ -911,7 +948,7 @@ nf.PolicyManagement = (function () {
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).promise();
|
}).promise();
|
||||||
|
@ -969,7 +1006,7 @@ nf.PolicyManagement = (function () {
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).promise();
|
}).promise();
|
||||||
|
@ -1008,7 +1045,7 @@ nf.PolicyManagement = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision({
|
'revision': client.getRevision({
|
||||||
'revision': {
|
'revision': {
|
||||||
'version': 0
|
'version': 0
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1074,7 @@ nf.PolicyManagement = (function () {
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
}
|
}
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1065,9 +1102,9 @@ nf.PolicyManagement = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
var currentEntity = $('#policy-table').data('policy');
|
var currentEntity = $('#policy-table').data('policy');
|
||||||
if (nf.Common.isDefinedAndNotNull(currentEntity)) {
|
if (common.isDefinedAndNotNull(currentEntity)) {
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision(currentEntity),
|
'revision': client.getRevision(currentEntity),
|
||||||
'component': {
|
'component': {
|
||||||
'id': currentEntity.id,
|
'id': currentEntity.id,
|
||||||
'users': users,
|
'users': users,
|
||||||
|
@ -1092,16 +1129,16 @@ nf.PolicyManagement = (function () {
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
}
|
}
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
resetPolicy();
|
resetPolicy();
|
||||||
loadPolicy();
|
loadPolicy();
|
||||||
}).always(function () {
|
}).always(function () {
|
||||||
nf.Canvas.reload({
|
canvasUtils.reload({
|
||||||
'transition': true
|
'transition': true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Update Policy',
|
headerText: 'Update Policy',
|
||||||
dialogContent: 'No policy selected'
|
dialogContent: 'No policy selected'
|
||||||
});
|
});
|
||||||
|
@ -1113,12 +1150,12 @@ nf.PolicyManagement = (function () {
|
||||||
*/
|
*/
|
||||||
var showPolicy = function () {
|
var showPolicy = function () {
|
||||||
// show the configuration dialog
|
// show the configuration dialog
|
||||||
nf.Shell.showContent('#policy-management').always(function () {
|
shell.showContent('#policy-management').always(function () {
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
// adjust the table size
|
// adjust the table size
|
||||||
nf.PolicyManagement.resetTableSize();
|
nfPolicyManagement.resetTableSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1164,7 +1201,7 @@ nf.PolicyManagement = (function () {
|
||||||
$('div.policy-selected-component-container').hide();
|
$('div.policy-selected-component-container').hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfPolicyManagement = {
|
||||||
/**
|
/**
|
||||||
* Initializes the settings page.
|
* Initializes the settings page.
|
||||||
*/
|
*/
|
||||||
|
@ -1190,7 +1227,7 @@ nf.PolicyManagement = (function () {
|
||||||
var policyTable = $('#policy-table');
|
var policyTable = $('#policy-table');
|
||||||
if (policyTable.is(':visible')) {
|
if (policyTable.is(':visible')) {
|
||||||
var policyGrid = policyTable.data('gridInstance');
|
var policyGrid = policyTable.data('gridInstance');
|
||||||
if (nf.Common.isDefinedAndNotNull(policyGrid)) {
|
if (common.isDefinedAndNotNull(policyGrid)) {
|
||||||
policyGrid.resizeCanvas();
|
policyGrid.resizeCanvas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1344,7 +1381,7 @@ nf.PolicyManagement = (function () {
|
||||||
|
|
||||||
var resource;
|
var resource;
|
||||||
if (selection.empty()) {
|
if (selection.empty()) {
|
||||||
$('#selected-policy-component-id').text(nf.Canvas.getGroupId());
|
$('#selected-policy-component-id').text(canvasUtils.getGroupId());
|
||||||
resource = 'process-groups';
|
resource = 'process-groups';
|
||||||
|
|
||||||
// disable site to site option
|
// disable site to site option
|
||||||
|
@ -1365,19 +1402,19 @@ nf.PolicyManagement = (function () {
|
||||||
var d = selection.datum();
|
var d = selection.datum();
|
||||||
$('#selected-policy-component-id').text(d.id);
|
$('#selected-policy-component-id').text(d.id);
|
||||||
|
|
||||||
if (nf.CanvasUtils.isProcessor(selection)) {
|
if (canvasUtils.isProcessor(selection)) {
|
||||||
resource = 'processors';
|
resource = 'processors';
|
||||||
} else if (nf.CanvasUtils.isProcessGroup(selection)) {
|
} else if (canvasUtils.isProcessGroup(selection)) {
|
||||||
resource = 'process-groups';
|
resource = 'process-groups';
|
||||||
} else if (nf.CanvasUtils.isInputPort(selection)) {
|
} else if (canvasUtils.isInputPort(selection)) {
|
||||||
resource = 'input-ports';
|
resource = 'input-ports';
|
||||||
} else if (nf.CanvasUtils.isOutputPort(selection)) {
|
} else if (canvasUtils.isOutputPort(selection)) {
|
||||||
resource = 'output-ports';
|
resource = 'output-ports';
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
} else if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
resource = 'remote-process-groups';
|
resource = 'remote-process-groups';
|
||||||
} else if (nf.CanvasUtils.isLabel(selection)) {
|
} else if (canvasUtils.isLabel(selection)) {
|
||||||
resource = 'labels';
|
resource = 'labels';
|
||||||
} else if (nf.CanvasUtils.isFunnel(selection)) {
|
} else if (canvasUtils.isFunnel(selection)) {
|
||||||
resource = 'funnels';
|
resource = 'funnels';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1385,16 +1422,16 @@ nf.PolicyManagement = (function () {
|
||||||
$('#component-policy-target')
|
$('#component-policy-target')
|
||||||
.combo('setOptionEnabled', {
|
.combo('setOptionEnabled', {
|
||||||
value: 'write-receive-data'
|
value: 'write-receive-data'
|
||||||
}, nf.CanvasUtils.isInputPort(selection) && nf.Canvas.getParentGroupId() === null)
|
}, canvasUtils.isInputPort(selection) && canvasUtils.getParentGroupId() === null)
|
||||||
.combo('setOptionEnabled', {
|
.combo('setOptionEnabled', {
|
||||||
value: 'write-send-data'
|
value: 'write-send-data'
|
||||||
}, nf.CanvasUtils.isOutputPort(selection) && nf.Canvas.getParentGroupId() === null)
|
}, canvasUtils.isOutputPort(selection) && canvasUtils.getParentGroupId() === null)
|
||||||
.combo('setOptionEnabled', {
|
.combo('setOptionEnabled', {
|
||||||
value: 'read-data'
|
value: 'read-data'
|
||||||
}, !nf.CanvasUtils.isLabel(selection))
|
}, !canvasUtils.isLabel(selection))
|
||||||
.combo('setOptionEnabled', {
|
.combo('setOptionEnabled', {
|
||||||
value: 'write-data'
|
value: 'write-data'
|
||||||
}, !nf.CanvasUtils.isLabel(selection));
|
}, !canvasUtils.isLabel(selection));
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate the initial resource
|
// populate the initial resource
|
||||||
|
@ -1432,4 +1469,6 @@ nf.PolicyManagement = (function () {
|
||||||
return loadPolicy().always(showPolicy);
|
return loadPolicy().always(showPolicy);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfPolicyManagement;
|
||||||
|
}));
|
|
@ -15,9 +15,46 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.PortConfiguration = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.Port'],
|
||||||
|
function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port) {
|
||||||
|
return (nf.PortConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.PortConfiguration =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.Port')));
|
||||||
|
} else {
|
||||||
|
nf.PortConfiguration = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.Port);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, port) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the port dialog.
|
* Initializes the port dialog.
|
||||||
|
@ -60,7 +97,7 @@ nf.PortConfiguration = (function () {
|
||||||
|
|
||||||
// build the port entity
|
// build the port entity
|
||||||
var portEntity = {
|
var portEntity = {
|
||||||
'revision': nf.Client.getRevision(portData),
|
'revision': client.getRevision(portData),
|
||||||
'component': port
|
'component': port
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -73,11 +110,11 @@ nf.PortConfiguration = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// refresh the port component
|
// refresh the port component
|
||||||
nf.Port.set(response);
|
port.set(response);
|
||||||
|
|
||||||
// inform Angular app values have changed
|
// inform Angular app values have changed
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
|
|
||||||
// close the details panel
|
// close the details panel
|
||||||
$('#port-configuration').modal('hide');
|
$('#port-configuration').modal('hide');
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
|
@ -91,10 +128,10 @@ nf.PortConfiguration = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: content,
|
dialogContent: content,
|
||||||
headerText: 'Port Configuration'
|
headerText: 'Port Configuration'
|
||||||
});
|
});
|
||||||
|
@ -103,7 +140,7 @@ nf.PortConfiguration = (function () {
|
||||||
$('#port-configuration').modal('hide');
|
$('#port-configuration').modal('hide');
|
||||||
|
|
||||||
// handle the error
|
// handle the error
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -147,7 +184,7 @@ nf.PortConfiguration = (function () {
|
||||||
*/
|
*/
|
||||||
showConfiguration: function (selection) {
|
showConfiguration: function (selection) {
|
||||||
// if the specified component is a port, load its properties
|
// if the specified component is a port, load its properties
|
||||||
if (nf.CanvasUtils.isInputPort(selection) || nf.CanvasUtils.isOutputPort(selection)) {
|
if (canvasUtils.isInputPort(selection) || canvasUtils.isOutputPort(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// determine if the enabled checkbox is checked or not
|
// determine if the enabled checkbox is checked or not
|
||||||
|
@ -157,7 +194,7 @@ nf.PortConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// show concurrent tasks for root groups only
|
// show concurrent tasks for root groups only
|
||||||
if (nf.Canvas.getParentGroupId() === null) {
|
if (canvasUtils.getParentGroupId() === null) {
|
||||||
$('#port-concurrent-task-container').show();
|
$('#port-concurrent-task-container').show();
|
||||||
} else {
|
} else {
|
||||||
$('#port-concurrent-task-container').hide();
|
$('#port-concurrent-task-container').hide();
|
||||||
|
@ -175,4 +212,4 @@ nf.PortConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,28 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.PortDetails = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, common, canvasUtils) {
|
||||||
|
return (nf.PortDetails = factory($, common, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.PortDetails =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.PortDetails = factory(root.$,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, common, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
@ -42,9 +61,9 @@ nf.PortDetails = (function () {
|
||||||
handler: {
|
handler: {
|
||||||
close: function () {
|
close: function () {
|
||||||
// clear the processor details
|
// clear the processor details
|
||||||
nf.Common.clearField('read-only-port-name');
|
common.clearField('read-only-port-name');
|
||||||
nf.Common.clearField('read-only-port-id');
|
common.clearField('read-only-port-id');
|
||||||
nf.Common.clearField('read-only-port-comments');
|
common.clearField('read-only-port-comments');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -52,17 +71,17 @@ nf.PortDetails = (function () {
|
||||||
|
|
||||||
showDetails: function (selection) {
|
showDetails: function (selection) {
|
||||||
// if the specified component is a processor, load its properties
|
// if the specified component is a processor, load its properties
|
||||||
if (nf.CanvasUtils.isInputPort(selection) || nf.CanvasUtils.isOutputPort(selection)) {
|
if (canvasUtils.isInputPort(selection) || canvasUtils.isOutputPort(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// populate the port settings
|
// populate the port settings
|
||||||
nf.Common.populateField('read-only-port-name', selectionData.component.name);
|
common.populateField('read-only-port-name', selectionData.component.name);
|
||||||
nf.Common.populateField('read-only-port-id', selectionData.id);
|
common.populateField('read-only-port-id', selectionData.id);
|
||||||
nf.Common.populateField('read-only-port-comments', selectionData.component.comments);
|
common.populateField('read-only-port-comments', selectionData.component.comments);
|
||||||
|
|
||||||
// show the details
|
// show the details
|
||||||
$('#port-details').modal('show');
|
$('#port-details').modal('show');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,39 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Port = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, common, client, canvasUtils) {
|
||||||
|
return (nf.Port = factory($, d3, common, client, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Port =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.Port = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, common, client, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfConnectable;
|
||||||
|
var nfDraggable;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
var PREVIEW_NAME_LENGTH = 15;
|
var PREVIEW_NAME_LENGTH = 15;
|
||||||
var OFFSET_VALUE = 25;
|
var OFFSET_VALUE = 25;
|
||||||
|
@ -88,7 +118,7 @@ nf.Port = (function () {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.classed('selected', selected)
|
.classed('selected', selected)
|
||||||
.call(nf.CanvasUtils.position);
|
.call(canvasUtils.position);
|
||||||
|
|
||||||
// port border
|
// port border
|
||||||
port.append('rect')
|
port.append('rect')
|
||||||
|
@ -121,7 +151,7 @@ nf.Port = (function () {
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
|
|
||||||
// conditionally render the remote banner
|
// conditionally render the remote banner
|
||||||
if (nf.Canvas.getParentGroupId() === null) {
|
if (canvasUtils.getParentGroupId() === null) {
|
||||||
offset = OFFSET_VALUE;
|
offset = OFFSET_VALUE;
|
||||||
|
|
||||||
// port remote banner
|
// port remote banner
|
||||||
|
@ -162,12 +192,12 @@ nf.Port = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// make ports selectable
|
// make ports selectable
|
||||||
port.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
|
port.call(nfSelectable.activate).call(nfContextMenu.activate);
|
||||||
|
|
||||||
// only activate dragging and connecting if appropriate
|
// only activate dragging and connecting if appropriate
|
||||||
port.filter(function (d) {
|
port.filter(function (d) {
|
||||||
return d.permissions.canWrite && d.permissions.canRead;
|
return d.permissions.canWrite && d.permissions.canRead;
|
||||||
}).call(nf.Draggable.activate).call(nf.Connectable.activate);
|
}).call(nfDraggable.activate).call(nfConnectable.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,7 +227,7 @@ nf.Port = (function () {
|
||||||
var details = port.select('g.port-details');
|
var details = port.select('g.port-details');
|
||||||
|
|
||||||
// update the component behavior as appropriate
|
// update the component behavior as appropriate
|
||||||
nf.CanvasUtils.editable(port);
|
canvasUtils.editable(port, nfConnectable, nfDraggable);
|
||||||
|
|
||||||
// if this process group is visible, render everything
|
// if this process group is visible, render everything
|
||||||
if (port.classed('visible')) {
|
if (port.classed('visible')) {
|
||||||
|
@ -205,7 +235,7 @@ nf.Port = (function () {
|
||||||
details = port.append('g').attr('class', 'port-details');
|
details = port.append('g').attr('class', 'port-details');
|
||||||
|
|
||||||
var offset = 0;
|
var offset = 0;
|
||||||
if (nf.Canvas.getParentGroupId() === null) {
|
if (canvasUtils.getParentGroupId() === null) {
|
||||||
offset = OFFSET_VALUE;
|
offset = OFFSET_VALUE;
|
||||||
|
|
||||||
// port transmitting icon
|
// port transmitting icon
|
||||||
|
@ -252,7 +282,7 @@ nf.Port = (function () {
|
||||||
// -------------------
|
// -------------------
|
||||||
// active thread count
|
// active thread count
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
// active thread count
|
// active thread count
|
||||||
details.append('text')
|
details.append('text')
|
||||||
.attr({
|
.attr({
|
||||||
|
@ -283,9 +313,9 @@ nf.Port = (function () {
|
||||||
// handle based on the number of tokens in the port name
|
// handle based on the number of tokens in the port name
|
||||||
if (words.length === 1) {
|
if (words.length === 1) {
|
||||||
// apply ellipsis to the port name as necessary
|
// apply ellipsis to the port name as necessary
|
||||||
nf.CanvasUtils.ellipsis(portName, name);
|
canvasUtils.ellipsis(portName, name);
|
||||||
} else {
|
} else {
|
||||||
nf.CanvasUtils.multilineEllipsis(portName, 2, name);
|
canvasUtils.multilineEllipsis(portName, 2, name);
|
||||||
}
|
}
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return d.component.name;
|
return d.component.name;
|
||||||
|
@ -341,7 +371,7 @@ nf.Port = (function () {
|
||||||
'fill': function (d) {
|
'fill': function (d) {
|
||||||
var fill = '#728e9b';
|
var fill = '#728e9b';
|
||||||
|
|
||||||
if (d.status.aggregateSnapshot.runStatus === 'Invalid') {
|
if (d.status.aggregateSnapshot.runStatus === 'Invalid') {
|
||||||
fill = '#cf9f5d';
|
fill = '#cf9f5d';
|
||||||
} else if (d.status.aggregateSnapshot.runStatus === 'Running') {
|
} else if (d.status.aggregateSnapshot.runStatus === 'Running') {
|
||||||
fill = '#7dc7a0';
|
fill = '#7dc7a0';
|
||||||
|
@ -377,7 +407,7 @@ nf.Port = (function () {
|
||||||
var tip = d3.select('#run-status-tip-' + d.id);
|
var tip = d3.select('#run-status-tip-' + d.id);
|
||||||
|
|
||||||
// if there are validation errors generate a tooltip
|
// if there are validation errors generate a tooltip
|
||||||
if (d.permissions.canRead && !nf.Common.isEmpty(d.component.validationErrors)) {
|
if (d.permissions.canRead && !common.isEmpty(d.component.validationErrors)) {
|
||||||
// create the tip if necessary
|
// create the tip if necessary
|
||||||
if (tip.empty()) {
|
if (tip.empty()) {
|
||||||
tip = d3.select('#port-tooltips').append('div')
|
tip = d3.select('#port-tooltips').append('div')
|
||||||
|
@ -389,16 +419,16 @@ nf.Port = (function () {
|
||||||
|
|
||||||
// update the tip
|
// update the tip
|
||||||
tip.html(function () {
|
tip.html(function () {
|
||||||
var list = nf.Common.formatUnorderedList(d.component.validationErrors);
|
var list = common.formatUnorderedList(d.component.validationErrors);
|
||||||
if (list === null || list.length === 0) {
|
if (list === null || list.length === 0) {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
return $('<div></div>').append(list).html();
|
return $('<div></div>').append(list).html();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the tooltip
|
// add the tooltip
|
||||||
nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
|
canvasUtils.canvasTooltip(tip, d3.select(this));
|
||||||
} else {
|
} else {
|
||||||
// remove if necessary
|
// remove if necessary
|
||||||
if (!tip.empty()) {
|
if (!tip.empty()) {
|
||||||
|
@ -447,7 +477,7 @@ nf.Port = (function () {
|
||||||
// active thread count
|
// active thread count
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
nf.CanvasUtils.activeThreadCount(port, d, function (off) {
|
canvasUtils.activeThreadCount(port, d, function (off) {
|
||||||
offset = off;
|
offset = off;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -456,10 +486,10 @@ nf.Port = (function () {
|
||||||
// ---------
|
// ---------
|
||||||
|
|
||||||
port.select('rect.bulletin-background').classed('has-bulletins', function () {
|
port.select('rect.bulletin-background').classed('has-bulletins', function () {
|
||||||
return !nf.Common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
return !common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.CanvasUtils.bulletins(port, d, function () {
|
canvasUtils.bulletins(port, d, function () {
|
||||||
return d3.select('#port-tooltips');
|
return d3.select('#port-tooltips');
|
||||||
}, offset);
|
}, offset);
|
||||||
});
|
});
|
||||||
|
@ -491,11 +521,16 @@ nf.Port = (function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfPort = {
|
||||||
/**
|
/**
|
||||||
* Initializes of the Port handler.
|
* Initializes of the Port handler.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (connectable, draggable, selectable, contextMenu) {
|
||||||
|
nfConnectable = connectable;
|
||||||
|
nfDraggable = draggable;
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
portMap = d3.map();
|
portMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -516,13 +551,13 @@ nf.Port = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (portEntities, options) {
|
add: function (portEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine the appropriate dimensions for this port
|
// determine the appropriate dimensions for this port
|
||||||
var dimensions = portDimensions;
|
var dimensions = portDimensions;
|
||||||
if (nf.Canvas.getParentGroupId() === null) {
|
if (canvasUtils.getParentGroupId() === null) {
|
||||||
dimensions = remotePortDimensions;
|
dimensions = remotePortDimensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,7 +582,7 @@ nf.Port = (function () {
|
||||||
$.each(portEntities, function (_, portNode) {
|
$.each(portEntities, function (_, portNode) {
|
||||||
add(portNode);
|
add(portNode);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(portEntities)) {
|
} else if (common.isDefinedAndNotNull(portEntities)) {
|
||||||
add(portEntities);
|
add(portEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +591,7 @@ nf.Port = (function () {
|
||||||
selection.enter().call(renderPorts, selectAll);
|
selection.enter().call(renderPorts, selectAll);
|
||||||
selection.call(updatePorts);
|
selection.call(updatePorts);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the graph with the specified ports.
|
* Populates the graph with the specified ports.
|
||||||
*
|
*
|
||||||
|
@ -566,14 +601,14 @@ nf.Port = (function () {
|
||||||
set: function (portEntities, options) {
|
set: function (portEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine the appropriate dimensions for this port
|
// determine the appropriate dimensions for this port
|
||||||
var dimensions = portDimensions;
|
var dimensions = portDimensions;
|
||||||
if (nf.Canvas.getParentGroupId() === null) {
|
if (canvasUtils.getParentGroupId() === null) {
|
||||||
dimensions = remotePortDimensions;
|
dimensions = remotePortDimensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +616,7 @@ nf.Port = (function () {
|
||||||
var currentPortEntity = portMap.get(proposedPortEntity.id);
|
var currentPortEntity = portMap.get(proposedPortEntity.id);
|
||||||
|
|
||||||
// set the port if appropriate due to revision and wasn't previously removed
|
// set the port if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentPortEntity, proposedPortEntity) && !removedCache.has(proposedPortEntity.id)) {
|
if (client.isNewerRevision(currentPortEntity, proposedPortEntity) && !removedCache.has(proposedPortEntity.id)) {
|
||||||
// add the port
|
// add the port
|
||||||
portMap.set(proposedPortEntity.id, $.extend({
|
portMap.set(proposedPortEntity.id, $.extend({
|
||||||
type: 'Port',
|
type: 'Port',
|
||||||
|
@ -609,14 +644,14 @@ nf.Port = (function () {
|
||||||
$.each(portEntities, function (_, portNode) {
|
$.each(portEntities, function (_, portNode) {
|
||||||
set(portNode);
|
set(portNode);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(portEntities)) {
|
} else if (common.isDefinedAndNotNull(portEntities)) {
|
||||||
set(portEntities);
|
set(portEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the selection and handle all new ports
|
// apply the selection and handle all new ports
|
||||||
var selection = select();
|
var selection = select();
|
||||||
selection.enter().call(renderPorts, selectAll);
|
selection.enter().call(renderPorts, selectAll);
|
||||||
selection.call(updatePorts).call(nf.CanvasUtils.position, transition);
|
selection.call(updatePorts).call(canvasUtils.position, transition);
|
||||||
selection.exit().call(removePorts);
|
selection.exit().call(removePorts);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -627,7 +662,7 @@ nf.Port = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return portMap.values();
|
return portMap.values();
|
||||||
} else {
|
} else {
|
||||||
return portMap.get(id);
|
return portMap.get(id);
|
||||||
|
@ -641,7 +676,7 @@ nf.Port = (function () {
|
||||||
* @param {string} id Optional
|
* @param {string} id Optional
|
||||||
*/
|
*/
|
||||||
refresh: function (id) {
|
refresh: function (id) {
|
||||||
if (nf.Common.isDefinedAndNotNull(id)) {
|
if (common.isDefinedAndNotNull(id)) {
|
||||||
d3.select('#id-' + id).call(updatePorts);
|
d3.select('#id-' + id).call(updatePorts);
|
||||||
} else {
|
} else {
|
||||||
d3.selectAll('g.input-port, g.output-port').call(updatePorts);
|
d3.selectAll('g.input-port, g.output-port').call(updatePorts);
|
||||||
|
@ -669,7 +704,7 @@ nf.Port = (function () {
|
||||||
url: portEntity.uri,
|
url: portEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.Port.set(response);
|
nfPort.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -680,7 +715,7 @@ nf.Port = (function () {
|
||||||
* @param {string} id The id
|
* @param {string} id The id
|
||||||
*/
|
*/
|
||||||
position: function (id) {
|
position: function (id) {
|
||||||
d3.select('#id-' + id).call(nf.CanvasUtils.position);
|
d3.select('#id-' + id).call(canvasUtils.position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -709,7 +744,7 @@ nf.Port = (function () {
|
||||||
* Removes all ports..
|
* Removes all ports..
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.Port.remove(portMap.keys());
|
nfPort.remove(portMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -730,4 +765,6 @@ nf.Port = (function () {
|
||||||
expire(removedCache);
|
expire(removedCache);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfPort;
|
||||||
|
}));
|
|
@ -15,9 +15,48 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ProcessGroupConfiguration = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.ProcessGroup',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils) {
|
||||||
|
return (nf.ProcessGroupConfiguration = factory($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ProcessGroupConfiguration =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.ProcessGroup'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.ProcessGroupConfiguration = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.ProcessGroup,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, dialog, client, processGroup, shell, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfControllerServices;
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
urls: {
|
urls: {
|
||||||
|
@ -49,7 +88,7 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
var saveConfiguration = function (version, groupId) {
|
var saveConfiguration = function (version, groupId) {
|
||||||
// build the entity
|
// build the entity
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision({
|
'revision': client.getRevision({
|
||||||
'revision': {
|
'revision': {
|
||||||
'version': version
|
'version': version
|
||||||
}
|
}
|
||||||
|
@ -70,12 +109,12 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// refresh the process group if necessary
|
// refresh the process group if necessary
|
||||||
if (response.permissions.canRead && response.component.parentGroupId === nf.Canvas.getGroupId()) {
|
if (response.permissions.canRead && response.component.parentGroupId === canvasUtils.getGroupId()) {
|
||||||
nf.ProcessGroup.set(response);
|
processGroup.set(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the result dialog
|
// show the result dialog
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Process Group Configuration',
|
headerText: 'Process Group Configuration',
|
||||||
dialogContent: 'Process group configuration successfully saved.'
|
dialogContent: 'Process group configuration successfully saved.'
|
||||||
});
|
});
|
||||||
|
@ -85,13 +124,13 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
saveConfiguration(response.revision.version, groupId);
|
saveConfiguration(response.revision.version, groupId);
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.Canvas.reload();
|
canvasUtils.reload();
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the configuration for the specified process group.
|
* Loads the configuration for the specified process group.
|
||||||
*
|
*
|
||||||
* @param {string} groupId
|
* @param {string} groupId
|
||||||
*/
|
*/
|
||||||
var loadConfiguration = function (groupId) {
|
var loadConfiguration = function (groupId) {
|
||||||
|
@ -149,15 +188,15 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
if (xhr.status === 403) {
|
if (xhr.status === 403) {
|
||||||
if (groupId === nf.Canvas.getGroupId()) {
|
if (groupId === canvasUtils.getGroupId()) {
|
||||||
$('#process-group-configuration').data('process-group', {
|
$('#process-group-configuration').data('process-group', {
|
||||||
'permissions': {
|
'permissions': {
|
||||||
canRead: false,
|
canRead: false,
|
||||||
canWrite: nf.Canvas.canWrite()
|
canWrite: canvasUtils.canWrite()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('#process-group-configuration').data('process-group', nf.ProcessGroup.get(groupId));
|
$('#process-group-configuration').data('process-group', processGroup.get(groupId));
|
||||||
}
|
}
|
||||||
|
|
||||||
setUnauthorizedText();
|
setUnauthorizedText();
|
||||||
|
@ -171,15 +210,15 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
|
|
||||||
// load the controller services
|
// load the controller services
|
||||||
var controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
|
var controllerServicesUri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
|
||||||
var controllerServices = nf.ControllerServices.loadControllerServices(controllerServicesUri, getControllerServicesTable());
|
var controllerServices = nfControllerServices.loadControllerServices(controllerServicesUri, getControllerServicesTable());
|
||||||
|
|
||||||
// wait for everything to complete
|
// wait for everything to complete
|
||||||
return $.when(processGroup, controllerServices).done(function (processGroupResult, controllerServicesResult) {
|
return $.when(processGroup, controllerServices).done(function (processGroupResult, controllerServicesResult) {
|
||||||
var controllerServicesResponse = controllerServicesResult[0];
|
var controllerServicesResponse = controllerServicesResult[0];
|
||||||
|
|
||||||
// update the current time
|
// update the current time
|
||||||
$('#process-group-configuration-last-refreshed').text(controllerServicesResponse.currentTime);
|
$('#process-group-configuration-last-refreshed').text(controllerServicesResponse.currentTime);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -187,7 +226,7 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
*/
|
*/
|
||||||
var showConfiguration = function () {
|
var showConfiguration = function () {
|
||||||
// show the configuration dialog
|
// show the configuration dialog
|
||||||
nf.Shell.showContent('#process-group-configuration').done(function () {
|
shell.showContent('#process-group-configuration').done(function () {
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -195,7 +234,7 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
$('#process-group-configuration-tabs').find('.selected-tab').click();
|
$('#process-group-configuration-tabs').find('.selected-tab').click();
|
||||||
|
|
||||||
// adjust the table size
|
// adjust the table size
|
||||||
nf.ProcessGroupConfiguration.resetTableSize();
|
nfProcessGroupConfiguration.resetTableSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -211,12 +250,17 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
$('#process-group-name').val('');
|
$('#process-group-name').val('');
|
||||||
$('#process-group-comments').val('');
|
$('#process-group-comments').val('');
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfProcessGroupConfiguration = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the settings page.
|
* Initialize the process group configuration.
|
||||||
|
*
|
||||||
|
* @param controllerServices The reference to the controllerServices controller.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (controllerServices) {
|
||||||
|
nfControllerServices = controllerServices;
|
||||||
|
|
||||||
// initialize the process group configuration tabs
|
// initialize the process group configuration tabs
|
||||||
$('#process-group-configuration-tabs').tabbs({
|
$('#process-group-configuration-tabs').tabbs({
|
||||||
tabStyle: 'tab',
|
tabStyle: 'tab',
|
||||||
|
@ -231,7 +275,7 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
}],
|
}],
|
||||||
select: function () {
|
select: function () {
|
||||||
var processGroup = $('#process-group-configuration').data('process-group');
|
var processGroup = $('#process-group-configuration').data('process-group');
|
||||||
var canWrite = nf.Common.isDefinedAndNotNull(processGroup) ? processGroup.permissions.canWrite : false;
|
var canWrite = common.isDefinedAndNotNull(processGroup) ? processGroup.permissions.canWrite : false;
|
||||||
|
|
||||||
var tab = $(this).text();
|
var tab = $(this).text();
|
||||||
if (tab === 'General') {
|
if (tab === 'General') {
|
||||||
|
@ -254,21 +298,21 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize the table
|
// resize the table
|
||||||
nf.ProcessGroupConfiguration.resetTableSize();
|
nfProcessGroupConfiguration.resetTableSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize each tab
|
// initialize each tab
|
||||||
initGeneral();
|
initGeneral();
|
||||||
nf.ControllerServices.init(getControllerServicesTable());
|
nfControllerServices.init(getControllerServicesTable());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the size of the grid based on its container's current size.
|
* Update the size of the grid based on its container's current size.
|
||||||
*/
|
*/
|
||||||
resetTableSize: function () {
|
resetTableSize: function () {
|
||||||
nf.ControllerServices.resetTableSize(getControllerServicesTable());
|
nfControllerServices.resetTableSize(getControllerServicesTable());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -285,7 +329,7 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
var selectedTab = $('#process-group-configuration-tabs li.selected-tab').text();
|
var selectedTab = $('#process-group-configuration-tabs li.selected-tab').text();
|
||||||
if (selectedTab === 'Controller Services') {
|
if (selectedTab === 'Controller Services') {
|
||||||
var controllerServicesUri = config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
|
var controllerServicesUri = config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/controller-services';
|
||||||
nf.ControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
|
nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -320,4 +364,6 @@ nf.ProcessGroupConfiguration = (function () {
|
||||||
$('#process-group-configuration-tabs').find('li:eq(1)').click();
|
$('#process-group-configuration-tabs').find('li:eq(1)').click();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfProcessGroupConfiguration;
|
||||||
|
}));
|
|
@ -15,9 +15,45 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global d3, define, module, require, exports */
|
||||||
|
|
||||||
nf.ProcessGroup = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Connection',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Dialog'],
|
||||||
|
function ($, d3, connection, common, client, canvasUtils, dialog) {
|
||||||
|
return (nf.ProcessGroup = factory($, d3, connection, common, client, canvasUtils, dialog));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ProcessGroup =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Connection'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Dialog')));
|
||||||
|
} else {
|
||||||
|
nf.ProcessGroup = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Connection,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Dialog);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, connection, common, client, canvasUtils, dialog) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfConnectable;
|
||||||
|
var nfDraggable;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
var PREVIEW_NAME_LENGTH = 30;
|
var PREVIEW_NAME_LENGTH = 30;
|
||||||
|
|
||||||
|
@ -55,7 +91,7 @@ nf.ProcessGroup = (function () {
|
||||||
* @param {object} d
|
* @param {object} d
|
||||||
*/
|
*/
|
||||||
var getProcessGroupComments = function (d) {
|
var getProcessGroupComments = function (d) {
|
||||||
if (nf.Common.isBlank(d.component.comments)) {
|
if (common.isBlank(d.component.comments)) {
|
||||||
return 'No comments specified';
|
return 'No comments specified';
|
||||||
} else {
|
} else {
|
||||||
return d.component.comments;
|
return d.component.comments;
|
||||||
|
@ -90,7 +126,7 @@ nf.ProcessGroup = (function () {
|
||||||
'class': 'process-group component'
|
'class': 'process-group component'
|
||||||
})
|
})
|
||||||
.classed('selected', selected)
|
.classed('selected', selected)
|
||||||
.call(nf.CanvasUtils.position);
|
.call(canvasUtils.position);
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
// body
|
// body
|
||||||
|
@ -146,15 +182,15 @@ nf.ProcessGroup = (function () {
|
||||||
|
|
||||||
// always support selecting and navigation
|
// always support selecting and navigation
|
||||||
processGroup.on('dblclick', function (d) {
|
processGroup.on('dblclick', function (d) {
|
||||||
// enter this group on double click
|
// enter this group on double click
|
||||||
nf.CanvasUtils.enterGroup(d.id);
|
nfProcessGroup.enterGroup(d.id);
|
||||||
})
|
})
|
||||||
.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
|
.call(nfSelectable.activate).call(nfContextMenu.activate);
|
||||||
|
|
||||||
// only support dragging, connection, and drag and drop if appropriate
|
// only support dragging, connection, and drag and drop if appropriate
|
||||||
processGroup.filter(function (d) {
|
processGroup.filter(function (d) {
|
||||||
return d.permissions.canWrite && d.permissions.canRead;
|
return d.permissions.canWrite && d.permissions.canRead;
|
||||||
})
|
})
|
||||||
.on('mouseover.drop', function (d) {
|
.on('mouseover.drop', function (d) {
|
||||||
// Using mouseover/out to workaround chrome issue #122746
|
// Using mouseover/out to workaround chrome issue #122746
|
||||||
|
|
||||||
|
@ -167,7 +203,7 @@ nf.ProcessGroup = (function () {
|
||||||
var drag = d3.select('rect.drag-selection');
|
var drag = d3.select('rect.drag-selection');
|
||||||
if (!drag.empty()) {
|
if (!drag.empty()) {
|
||||||
// filter the current selection by this group
|
// filter the current selection by this group
|
||||||
var selection = nf.CanvasUtils.getSelection().filter(function (d) {
|
var selection = canvasUtils.getSelection().filter(function (d) {
|
||||||
return targetData.id === d.id;
|
return targetData.id === d.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -176,7 +212,7 @@ nf.ProcessGroup = (function () {
|
||||||
// mark that we are hovering over a drop area if appropriate
|
// mark that we are hovering over a drop area if appropriate
|
||||||
target.classed('drop', function () {
|
target.classed('drop', function () {
|
||||||
// get the current selection and ensure its disconnected
|
// get the current selection and ensure its disconnected
|
||||||
return nf.CanvasUtils.isDisconnected(nf.CanvasUtils.getSelection());
|
return connection.isDisconnected(canvasUtils.getSelection());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,8 +222,8 @@ nf.ProcessGroup = (function () {
|
||||||
// mark that we are no longer hovering over a drop area unconditionally
|
// mark that we are no longer hovering over a drop area unconditionally
|
||||||
d3.select(this).classed('drop', false);
|
d3.select(this).classed('drop', false);
|
||||||
})
|
})
|
||||||
.call(nf.Draggable.activate)
|
.call(nfDraggable.activate)
|
||||||
.call(nf.Connectable.activate);
|
.call(nfConnectable.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
// attempt of space between component count and icon for process group contents
|
// attempt of space between component count and icon for process group contents
|
||||||
|
@ -221,7 +257,7 @@ nf.ProcessGroup = (function () {
|
||||||
var details = processGroup.select('g.process-group-details');
|
var details = processGroup.select('g.process-group-details');
|
||||||
|
|
||||||
// update the component behavior as appropriate
|
// update the component behavior as appropriate
|
||||||
nf.CanvasUtils.editable(processGroup);
|
canvasUtils.editable(processGroup, nfConnectable, nfDraggable);
|
||||||
|
|
||||||
// if this processor is visible, render everything
|
// if this processor is visible, render everything
|
||||||
if (processGroup.classed('visible')) {
|
if (processGroup.classed('visible')) {
|
||||||
|
@ -812,9 +848,9 @@ nf.ProcessGroup = (function () {
|
||||||
processGroupComments.text(null).selectAll('tspan, title').remove();
|
processGroupComments.text(null).selectAll('tspan, title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the port name as necessary
|
// apply ellipsis to the port name as necessary
|
||||||
nf.CanvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d));
|
canvasUtils.ellipsis(processGroupComments, getProcessGroupComments(d));
|
||||||
}).classed('unset', function (d) {
|
}).classed('unset', function (d) {
|
||||||
return nf.Common.isBlank(d.component.comments);
|
return common.isBlank(d.component.comments);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return getProcessGroupComments(d);
|
return getProcessGroupComments(d);
|
||||||
});
|
});
|
||||||
|
@ -828,7 +864,7 @@ nf.ProcessGroup = (function () {
|
||||||
processGroupName.text(null).selectAll('title').remove();
|
processGroupName.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the process group name as necessary
|
// apply ellipsis to the process group name as necessary
|
||||||
nf.CanvasUtils.ellipsis(processGroupName, d.component.name);
|
canvasUtils.ellipsis(processGroupName, d.component.name);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return d.component.name;
|
return d.component.name;
|
||||||
});
|
});
|
||||||
|
@ -883,25 +919,25 @@ nf.ProcessGroup = (function () {
|
||||||
// queued count value
|
// queued count value
|
||||||
updated.select('text.process-group-queued tspan.count')
|
updated.select('text.process-group-queued tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.queued, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// queued size value
|
// queued size value
|
||||||
updated.select('text.process-group-queued tspan.size')
|
updated.select('text.process-group-queued tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.queued, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// in count value
|
// in count value
|
||||||
updated.select('text.process-group-in tspan.count')
|
updated.select('text.process-group-in tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// in size value
|
// in size value
|
||||||
updated.select('text.process-group-in tspan.size')
|
updated.select('text.process-group-in tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.input, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// in ports value
|
// in ports value
|
||||||
|
@ -925,13 +961,13 @@ nf.ProcessGroup = (function () {
|
||||||
// out count value
|
// out count value
|
||||||
updated.select('text.process-group-out tspan.count')
|
updated.select('text.process-group-out tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// out size value
|
// out size value
|
||||||
updated.select('text.process-group-out tspan.size')
|
updated.select('text.process-group-out tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.output, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
updated.each(function (d) {
|
updated.each(function (d) {
|
||||||
|
@ -942,7 +978,7 @@ nf.ProcessGroup = (function () {
|
||||||
// active thread count
|
// active thread count
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
nf.CanvasUtils.activeThreadCount(processGroup, d, function (off) {
|
canvasUtils.activeThreadCount(processGroup, d, function (off) {
|
||||||
offset = off;
|
offset = off;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -951,10 +987,10 @@ nf.ProcessGroup = (function () {
|
||||||
// ---------
|
// ---------
|
||||||
|
|
||||||
processGroup.select('rect.bulletin-background').classed('has-bulletins', function () {
|
processGroup.select('rect.bulletin-background').classed('has-bulletins', function () {
|
||||||
return !nf.Common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
return !common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.CanvasUtils.bulletins(processGroup, d, function () {
|
canvasUtils.bulletins(processGroup, d, function () {
|
||||||
return d3.select('#process-group-tooltips');
|
return d3.select('#process-group-tooltips');
|
||||||
}, offset);
|
}, offset);
|
||||||
});
|
});
|
||||||
|
@ -985,11 +1021,16 @@ nf.ProcessGroup = (function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfProcessGroup = {
|
||||||
/**
|
/**
|
||||||
* Initializes of the Process Group handler.
|
* Initializes of the Process Group handler.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (connectable, draggable, selectable, contextMenu) {
|
||||||
|
nfConnectable = connectable;
|
||||||
|
nfDraggable = draggable;
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
processGroupMap = d3.map();
|
processGroupMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -1010,8 +1051,8 @@ nf.ProcessGroup = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (processGroupEntities, options) {
|
add: function (processGroupEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current time
|
// get the current time
|
||||||
|
@ -1032,7 +1073,7 @@ nf.ProcessGroup = (function () {
|
||||||
$.each(processGroupEntities, function (_, processGroupEntity) {
|
$.each(processGroupEntities, function (_, processGroupEntity) {
|
||||||
add(processGroupEntity);
|
add(processGroupEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(processGroupEntities)) {
|
} else if (common.isDefinedAndNotNull(processGroupEntities)) {
|
||||||
add(processGroupEntities);
|
add(processGroupEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,16 +1092,16 @@ nf.ProcessGroup = (function () {
|
||||||
set: function (processGroupEntities, options) {
|
set: function (processGroupEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = function (proposedProcessGroupEntity) {
|
var set = function (proposedProcessGroupEntity) {
|
||||||
var currentProcessGroupEntity = processGroupMap.get(proposedProcessGroupEntity.id);
|
var currentProcessGroupEntity = processGroupMap.get(proposedProcessGroupEntity.id);
|
||||||
|
|
||||||
// set the process group if appropriate due to revision and wasn't previously removed
|
// set the process group if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentProcessGroupEntity, proposedProcessGroupEntity) && !removedCache.has(proposedProcessGroupEntity.id)) {
|
if (client.isNewerRevision(currentProcessGroupEntity, proposedProcessGroupEntity) && !removedCache.has(proposedProcessGroupEntity.id)) {
|
||||||
processGroupMap.set(proposedProcessGroupEntity.id, $.extend({
|
processGroupMap.set(proposedProcessGroupEntity.id, $.extend({
|
||||||
type: 'ProcessGroup',
|
type: 'ProcessGroup',
|
||||||
dimensions: dimensions
|
dimensions: dimensions
|
||||||
|
@ -1084,14 +1125,14 @@ nf.ProcessGroup = (function () {
|
||||||
$.each(processGroupEntities, function (_, processGroupEntity) {
|
$.each(processGroupEntities, function (_, processGroupEntity) {
|
||||||
set(processGroupEntity);
|
set(processGroupEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(processGroupEntities)) {
|
} else if (common.isDefinedAndNotNull(processGroupEntities)) {
|
||||||
set(processGroupEntities);
|
set(processGroupEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the selection and handle all new process group
|
// apply the selection and handle all new process group
|
||||||
var selection = select();
|
var selection = select();
|
||||||
selection.enter().call(renderProcessGroups, selectAll);
|
selection.enter().call(renderProcessGroups, selectAll);
|
||||||
selection.call(updateProcessGroups).call(nf.CanvasUtils.position, transition);
|
selection.call(updateProcessGroups).call(canvasUtils.position, transition);
|
||||||
selection.exit().call(removeProcessGroups);
|
selection.exit().call(removeProcessGroups);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1102,7 +1143,7 @@ nf.ProcessGroup = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return processGroupMap.values();
|
return processGroupMap.values();
|
||||||
} else {
|
} else {
|
||||||
return processGroupMap.get(id);
|
return processGroupMap.get(id);
|
||||||
|
@ -1116,7 +1157,7 @@ nf.ProcessGroup = (function () {
|
||||||
* @param {string} id Optional
|
* @param {string} id Optional
|
||||||
*/
|
*/
|
||||||
refresh: function (id) {
|
refresh: function (id) {
|
||||||
if (nf.Common.isDefinedAndNotNull(id)) {
|
if (common.isDefinedAndNotNull(id)) {
|
||||||
d3.select('#id-' + id).call(updateProcessGroups);
|
d3.select('#id-' + id).call(updateProcessGroups);
|
||||||
} else {
|
} else {
|
||||||
d3.selectAll('g.process-group').call(updateProcessGroups);
|
d3.selectAll('g.process-group').call(updateProcessGroups);
|
||||||
|
@ -1144,7 +1185,7 @@ nf.ProcessGroup = (function () {
|
||||||
url: processGroupEntity.uri,
|
url: processGroupEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.ProcessGroup.set(response);
|
nfProcessGroup.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1155,7 +1196,7 @@ nf.ProcessGroup = (function () {
|
||||||
* @param {string} id The id
|
* @param {string} id The id
|
||||||
*/
|
*/
|
||||||
position: function (id) {
|
position: function (id) {
|
||||||
d3.select('#id-' + id).call(nf.CanvasUtils.position);
|
d3.select('#id-' + id).call(canvasUtils.position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1184,7 +1225,7 @@ nf.ProcessGroup = (function () {
|
||||||
* Removes all process groups.
|
* Removes all process groups.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.ProcessGroup.remove(processGroupMap.keys());
|
nfProcessGroup.remove(processGroupMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1203,6 +1244,44 @@ nf.ProcessGroup = (function () {
|
||||||
|
|
||||||
expire(addedCache);
|
expire(addedCache);
|
||||||
expire(removedCache);
|
expire(removedCache);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the specified group.
|
||||||
|
*
|
||||||
|
* @param {string} groupId
|
||||||
|
*/
|
||||||
|
enterGroup: function (groupId) {
|
||||||
|
|
||||||
|
// hide the context menu
|
||||||
|
nfContextMenu.hide();
|
||||||
|
|
||||||
|
// set the new group id
|
||||||
|
canvasUtils.setGroupId(groupId);
|
||||||
|
|
||||||
|
// reload the graph
|
||||||
|
return canvasUtils.reload().done(function () {
|
||||||
|
|
||||||
|
// attempt to restore the view
|
||||||
|
var viewRestored = canvasUtils.restoreUserView();
|
||||||
|
|
||||||
|
// if the view was not restore attempt to fit
|
||||||
|
if (viewRestored === false) {
|
||||||
|
canvasUtils.fitCanvasView();
|
||||||
|
|
||||||
|
// refresh the canvas
|
||||||
|
canvasUtils.refreshCanvasView({
|
||||||
|
transition: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
dialog.showOkDialog({
|
||||||
|
headerText: 'Process Group',
|
||||||
|
dialogContent: 'Unable to enter the selected group.'
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfProcessGroup;
|
||||||
|
}));
|
|
@ -15,9 +15,55 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ProcessorConfiguration = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.Processor',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.CustomUi',
|
||||||
|
'nf.UniversalCapture',
|
||||||
|
'nf.Connection'],
|
||||||
|
function ($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection) {
|
||||||
|
return (nf.ProcessorConfiguration = factory($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ProcessorConfiguration =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.Processor'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.CustomUi'),
|
||||||
|
require('nf.UniversalCapture'),
|
||||||
|
require('nf.Connection')));
|
||||||
|
} else {
|
||||||
|
nf.ProcessorConfiguration = factory(root.$,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.Processor,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.CustomUi,
|
||||||
|
root.nf.UniversalCapture,
|
||||||
|
root.nf.Connection);
|
||||||
|
}
|
||||||
|
}(this, function ($, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfProcessor, clusterSummary, customUi, universalCapture, nfConnection) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
// possible values for a processor's run duration (in millis)
|
// possible values for a processor's run duration (in millis)
|
||||||
var RUN_DURATION_VALUES = [0, 25, 50, 100, 250, 500, 1000, 2000];
|
var RUN_DURATION_VALUES = [0, 25, 50, 100, 250, 500, 1000, 2000];
|
||||||
|
@ -87,7 +133,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
text: 'Primary node',
|
text: 'Primary node',
|
||||||
value: 'PRIMARY',
|
value: 'PRIMARY',
|
||||||
description: 'Processor will be scheduled to run only on the primary node',
|
description: 'Processor will be scheduled to run only on the primary node',
|
||||||
disabled: !nf.ClusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY'
|
disabled: !clusterSummary.isClustered() && processor.config['executionNode'] === 'PRIMARY'
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,15 +152,15 @@ nf.ProcessorConfiguration = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: content,
|
dialogContent: content,
|
||||||
headerText: 'Processor Configuration'
|
headerText: 'Processor Configuration'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -137,7 +183,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
|
|
||||||
// build the relationship container element
|
// build the relationship container element
|
||||||
var relationshipContainerElement = $('<div class="processor-relationship-container"></div>').append(relationshipCheckbox).append(relationshipLabel).append(relationshipValue).appendTo('#auto-terminate-relationship-names');
|
var relationshipContainerElement = $('<div class="processor-relationship-container"></div>').append(relationshipCheckbox).append(relationshipLabel).append(relationshipValue).appendTo('#auto-terminate-relationship-names');
|
||||||
if (!nf.Common.isBlank(relationship.description)) {
|
if (!common.isBlank(relationship.description)) {
|
||||||
var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description);
|
var relationshipDescription = $('<div class="relationship-description"></div>').text(relationship.description);
|
||||||
relationshipContainerElement.append(relationshipDescription);
|
relationshipContainerElement.append(relationshipDescription);
|
||||||
}
|
}
|
||||||
|
@ -209,7 +255,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the scheduling period
|
// check the scheduling period
|
||||||
if (nf.Common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) {
|
if (common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (details.config['schedulingPeriod'] + '')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +321,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the scheduling period if appropriate
|
// get the scheduling period if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(schedulingPeriod)) {
|
if (common.isDefinedAndNotNull(schedulingPeriod)) {
|
||||||
processorConfigDto['schedulingPeriod'] = schedulingPeriod.val();
|
processorConfigDto['schedulingPeriod'] = schedulingPeriod.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,22 +405,22 @@ nf.ProcessorConfiguration = (function () {
|
||||||
var config = processor['config'];
|
var config = processor['config'];
|
||||||
|
|
||||||
// ensure numeric fields are specified correctly
|
// ensure numeric fields are specified correctly
|
||||||
if (nf.Common.isDefinedAndNotNull(config['concurrentlySchedulableTaskCount']) && !$.isNumeric(config['concurrentlySchedulableTaskCount'])) {
|
if (common.isDefinedAndNotNull(config['concurrentlySchedulableTaskCount']) && !$.isNumeric(config['concurrentlySchedulableTaskCount'])) {
|
||||||
errors.push('Concurrent tasks must be an integer value');
|
errors.push('Concurrent tasks must be an integer value');
|
||||||
}
|
}
|
||||||
if (nf.Common.isDefinedAndNotNull(config['schedulingPeriod']) && nf.Common.isBlank(config['schedulingPeriod'])) {
|
if (common.isDefinedAndNotNull(config['schedulingPeriod']) && common.isBlank(config['schedulingPeriod'])) {
|
||||||
errors.push('Run schedule must be specified');
|
errors.push('Run schedule must be specified');
|
||||||
}
|
}
|
||||||
if (nf.Common.isBlank(config['penaltyDuration'])) {
|
if (common.isBlank(config['penaltyDuration'])) {
|
||||||
errors.push('Penalty duration must be specified');
|
errors.push('Penalty duration must be specified');
|
||||||
}
|
}
|
||||||
if (nf.Common.isBlank(config['yieldDuration'])) {
|
if (common.isBlank(config['yieldDuration'])) {
|
||||||
errors.push('Yield duration must be specified');
|
errors.push('Yield duration must be specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: nf.Common.formatUnorderedList(errors),
|
dialogContent: common.formatUnorderedList(errors),
|
||||||
headerText: 'Processor Configuration'
|
headerText: 'Processor Configuration'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
@ -389,11 +435,11 @@ nf.ProcessorConfiguration = (function () {
|
||||||
* @param {object} processor
|
* @param {object} processor
|
||||||
*/
|
*/
|
||||||
var reloadProcessorConnections = function (processor) {
|
var reloadProcessorConnections = function (processor) {
|
||||||
var connections = nf.Connection.getComponentConnections(processor.id);
|
var connections = nfConnection.getComponentConnections(processor.id);
|
||||||
$.each(connections, function (_, connection) {
|
$.each(connections, function (_, connection) {
|
||||||
if (connection.permissions.canRead) {
|
if (connection.permissions.canRead) {
|
||||||
if (connection.sourceId === processor.id) {
|
if (connection.sourceId === processor.id) {
|
||||||
nf.Connection.reload(connection.id);
|
nfConnection.reload(connection.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -410,7 +456,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
// determine if changes have been made
|
// determine if changes have been made
|
||||||
if (isSaveRequired()) {
|
if (isSaveRequired()) {
|
||||||
// see if those changes should be saved
|
// see if those changes should be saved
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Processor Configuration',
|
headerText: 'Processor Configuration',
|
||||||
dialogContent: 'Save changes before going to this Controller Service?',
|
dialogContent: 'Save changes before going to this Controller Service?',
|
||||||
noHandler: function () {
|
noHandler: function () {
|
||||||
|
@ -443,8 +489,8 @@ nf.ProcessorConfiguration = (function () {
|
||||||
// ensure details are valid as far as we can tell
|
// ensure details are valid as far as we can tell
|
||||||
if (validateDetails(updatedProcessor)) {
|
if (validateDetails(updatedProcessor)) {
|
||||||
// set the revision
|
// set the revision
|
||||||
var d = nf.Processor.get(processor.id);
|
var d = nfProcessor.get(processor.id);
|
||||||
updatedProcessor['revision'] = nf.Client.getRevision(d);
|
updatedProcessor['revision'] = client.getRevision(d);
|
||||||
|
|
||||||
// update the selected component
|
// update the selected component
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
|
@ -455,7 +501,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// set the new processor state based on the response
|
// set the new processor state based on the response
|
||||||
nf.Processor.set(response);
|
nfProcessor.set(response);
|
||||||
}).fail(handleProcessorConfigurationError);
|
}).fail(handleProcessorConfigurationError);
|
||||||
} else {
|
} else {
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
|
@ -489,7 +535,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
}],
|
}],
|
||||||
select: function () {
|
select: function () {
|
||||||
// remove all property detail dialogs
|
// remove all property detail dialogs
|
||||||
nf.UniversalCapture.removeAllPropertyDetailDialogs();
|
universalCapture.removeAllPropertyDetailDialogs();
|
||||||
|
|
||||||
// update the processor property table size in case this is the first time its rendered
|
// update the processor property table size in case this is the first time its rendered
|
||||||
if ($(this).text() === 'Properties') {
|
if ($(this).text() === 'Properties') {
|
||||||
|
@ -523,7 +569,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
$('#processor-configuration').removeData('processorDetails');
|
$('#processor-configuration').removeData('processorDetails');
|
||||||
},
|
},
|
||||||
open: function () {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -566,7 +612,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
dialogContainer: '#new-processor-property-container',
|
dialogContainer: '#new-processor-property-container',
|
||||||
descriptorDeferred: function (propertyName) {
|
descriptorDeferred: function (propertyName) {
|
||||||
var processor = $('#processor-configuration').data('processorDetails');
|
var processor = $('#processor-configuration').data('processorDetails');
|
||||||
var d = nf.Processor.get(processor.id);
|
var d = nfProcessor.get(processor.id);
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: d.uri + '/descriptors',
|
url: d.uri + '/descriptors',
|
||||||
|
@ -574,7 +620,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
propertyName: propertyName
|
propertyName: propertyName
|
||||||
},
|
},
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
goToServiceDeferred: goToServiceFromProperty
|
goToServiceDeferred: goToServiceFromProperty
|
||||||
});
|
});
|
||||||
|
@ -586,7 +632,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
* @argument {selection} selection The selection
|
* @argument {selection} selection The selection
|
||||||
*/
|
*/
|
||||||
showConfiguration: function (selection) {
|
showConfiguration: function (selection) {
|
||||||
if (nf.CanvasUtils.isProcessor(selection)) {
|
if (canvasUtils.isProcessor(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// get the processor details
|
// get the processor details
|
||||||
|
@ -595,7 +641,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
var requests = [];
|
var requests = [];
|
||||||
|
|
||||||
// reload the processor in case an property descriptors have updated
|
// reload the processor in case an property descriptors have updated
|
||||||
requests.push(nf.Processor.reload(processor.id));
|
requests.push(nfProcessor.reload(processor.id));
|
||||||
|
|
||||||
// get the processor history
|
// get the processor history
|
||||||
requests.push($.ajax({
|
requests.push($.ajax({
|
||||||
|
@ -609,7 +655,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
// get the updated processor'
|
// get the updated processor'
|
||||||
var processorResponse = processorResult[0];
|
var processorResponse = processorResult[0];
|
||||||
processor = processorResponse.component;
|
processor = processorResponse.component;
|
||||||
|
|
||||||
// get the processor history
|
// get the processor history
|
||||||
var processorHistory = historyResult[0].componentHistory;
|
var processorHistory = historyResult[0].componentHistory;
|
||||||
|
|
||||||
|
@ -624,7 +670,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
|
|
||||||
// populate the processor settings
|
// populate the processor settings
|
||||||
$('#processor-id').text(processor['id']);
|
$('#processor-id').text(processor['id']);
|
||||||
$('#processor-type').text(nf.Common.substringAfterLast(processor['type'], '.'));
|
$('#processor-type').text(common.substringAfterLast(processor['type'], '.'));
|
||||||
$('#processor-name').val(processor['name']);
|
$('#processor-name').val(processor['name']);
|
||||||
$('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle);
|
$('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle);
|
||||||
$('#penalty-duration').val(processor.config['penaltyDuration']);
|
$('#penalty-duration').val(processor.config['penaltyDuration']);
|
||||||
|
@ -690,7 +736,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
|
// show the execution node option if we're cluster or we're currently configured to run on the primary node only
|
||||||
if (nf.ClusterSummary.isClustered() || executionNode === 'PRIMARY') {
|
if (clusterSummary.isClustered() || executionNode === 'PRIMARY') {
|
||||||
$('#execution-node-options').show();
|
$('#execution-node-options').show();
|
||||||
} else {
|
} else {
|
||||||
$('#execution-node-options').hide();
|
$('#execution-node-options').hide();
|
||||||
|
@ -713,7 +759,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// conditionally allow the user to specify the concurrent tasks
|
// conditionally allow the user to specify the concurrent tasks
|
||||||
if (nf.Common.isDefinedAndNotNull(concurrentTasks)) {
|
if (common.isDefinedAndNotNull(concurrentTasks)) {
|
||||||
if (processor.supportsParallelProcessing === true) {
|
if (processor.supportsParallelProcessing === true) {
|
||||||
concurrentTasks.prop('disabled', false);
|
concurrentTasks.prop('disabled', false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -734,7 +780,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the relationship list
|
// load the relationship list
|
||||||
if (!nf.Common.isEmpty(processor.relationships)) {
|
if (!common.isEmpty(processor.relationships)) {
|
||||||
$.each(processor.relationships, function (i, relationship) {
|
$.each(processor.relationships, function (i, relationship) {
|
||||||
createRelationshipOption(relationship);
|
createRelationshipOption(relationship);
|
||||||
});
|
});
|
||||||
|
@ -763,7 +809,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
$('#processor-configuration').modal('hide');
|
$('#processor-configuration').modal('hide');
|
||||||
|
|
||||||
// inform Angular app values have changed
|
// inform Angular app values have changed
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -783,7 +829,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// determine if we should show the advanced button
|
// determine if we should show the advanced button
|
||||||
if (nf.Common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') {
|
if (common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
buttonText: 'Advanced',
|
buttonText: 'Advanced',
|
||||||
clazz: 'fa fa-cog button-icon',
|
clazz: 'fa fa-cog button-icon',
|
||||||
|
@ -799,9 +845,9 @@ nf.ProcessorConfiguration = (function () {
|
||||||
$('#processor-configuration').modal('hide');
|
$('#processor-configuration').modal('hide');
|
||||||
|
|
||||||
// show the custom ui
|
// show the custom ui
|
||||||
nf.CustomUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () {
|
customUi.showCustomUi(processorResponse, processor.config.customUiUrl, true).done(function () {
|
||||||
// once the custom ui is closed, reload the processor
|
// once the custom ui is closed, reload the processor
|
||||||
nf.Processor.reload(processor.id);
|
nfProcessor.reload(processor.id);
|
||||||
|
|
||||||
// and reload the processor's outgoing connections
|
// and reload the processor's outgoing connections
|
||||||
reloadProcessorConnections(processor);
|
reloadProcessorConnections(processor);
|
||||||
|
@ -814,7 +860,7 @@ nf.ProcessorConfiguration = (function () {
|
||||||
// determine if changes have been made
|
// determine if changes have been made
|
||||||
if (isSaveRequired()) {
|
if (isSaveRequired()) {
|
||||||
// see if those changes should be saved
|
// see if those changes should be saved
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Save',
|
headerText: 'Save',
|
||||||
dialogContent: 'Save changes before opening the advanced configuration?',
|
dialogContent: 'Save changes before opening the advanced configuration?',
|
||||||
noHandler: openCustomUi,
|
noHandler: openCustomUi,
|
||||||
|
@ -853,8 +899,8 @@ nf.ProcessorConfiguration = (function () {
|
||||||
if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > Math.round(processorRelationships.innerHeight())) {
|
if (processorRelationships.is(':visible') && processorRelationships.get(0).scrollHeight > Math.round(processorRelationships.innerHeight())) {
|
||||||
processorRelationships.css('border-width', '1px');
|
processorRelationships.css('border-width', '1px');
|
||||||
}
|
}
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
||||||
|
|
|
@ -15,9 +15,39 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Processor = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, common, client, canvasUtils) {
|
||||||
|
return (nf.Processor = factory($, d3, common, client, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Processor =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.Processor = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, common, client, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfConnectable;
|
||||||
|
var nfDraggable;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
var PREVIEW_NAME_LENGTH = 25;
|
var PREVIEW_NAME_LENGTH = 25;
|
||||||
|
|
||||||
|
@ -73,7 +103,7 @@ nf.Processor = (function () {
|
||||||
'class': 'processor component'
|
'class': 'processor component'
|
||||||
})
|
})
|
||||||
.classed('selected', selected)
|
.classed('selected', selected)
|
||||||
.call(nf.CanvasUtils.position);
|
.call(canvasUtils.position);
|
||||||
|
|
||||||
// processor border
|
// processor border
|
||||||
processor.append('rect')
|
processor.append('rect')
|
||||||
|
@ -151,7 +181,7 @@ nf.Processor = (function () {
|
||||||
.text('\uf132');
|
.text('\uf132');
|
||||||
|
|
||||||
// make processors selectable
|
// make processors selectable
|
||||||
processor.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
|
processor.call(nfSelectable.activate).call(nfContextMenu.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -181,7 +211,7 @@ nf.Processor = (function () {
|
||||||
var details = processor.select('g.processor-canvas-details');
|
var details = processor.select('g.processor-canvas-details');
|
||||||
|
|
||||||
// update the component behavior as appropriate
|
// update the component behavior as appropriate
|
||||||
nf.CanvasUtils.editable(processor);
|
canvasUtils.editable(processor, nfConnectable, nfDraggable);
|
||||||
|
|
||||||
// if this processor is visible, render everything
|
// if this processor is visible, render everything
|
||||||
if (processor.classed('visible')) {
|
if (processor.classed('visible')) {
|
||||||
|
@ -508,7 +538,7 @@ nf.Processor = (function () {
|
||||||
processorName.text(null).selectAll('title').remove();
|
processorName.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the processor name as necessary
|
// apply ellipsis to the processor name as necessary
|
||||||
nf.CanvasUtils.ellipsis(processorName, d.component.name);
|
canvasUtils.ellipsis(processorName, d.component.name);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return d.component.name;
|
return d.component.name;
|
||||||
});
|
});
|
||||||
|
@ -522,9 +552,9 @@ nf.Processor = (function () {
|
||||||
processorType.text(null).selectAll('title').remove();
|
processorType.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the processor type as necessary
|
// apply ellipsis to the processor type as necessary
|
||||||
nf.CanvasUtils.ellipsis(processorType, nf.Common.substringAfterLast(d.component.type, '.'));
|
canvasUtils.ellipsis(processorType, common.substringAfterLast(d.component.type, '.'));
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return nf.Common.substringAfterLast(d.component.type, '.');
|
return common.substringAfterLast(d.component.type, '.');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// clear the processor name
|
// clear the processor name
|
||||||
|
@ -576,8 +606,8 @@ nf.Processor = (function () {
|
||||||
processor.select('rect.border').classed('unauthorized', !processorData.permissions.canRead);
|
processor.select('rect.border').classed('unauthorized', !processorData.permissions.canRead);
|
||||||
|
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (processorData.permissions.canRead){
|
if (processorData.permissions.canRead) {
|
||||||
if (nf.Common.isDefinedAndNotNull(processorData.component.style['background-color'])) {
|
if (common.isDefinedAndNotNull(processorData.component.style['background-color'])) {
|
||||||
var color = processorData.component.style['background-color'];
|
var color = processorData.component.style['background-color'];
|
||||||
|
|
||||||
//update the processor icon container
|
//update the processor icon container
|
||||||
|
@ -599,22 +629,22 @@ nf.Processor = (function () {
|
||||||
.style('fill', function (d) {
|
.style('fill', function (d) {
|
||||||
|
|
||||||
// get the default color
|
// get the default color
|
||||||
var color = nf.Processor.defaultIconColor();
|
var color = nfProcessor.defaultIconColor();
|
||||||
|
|
||||||
if (!d.permissions.canRead) {
|
if (!d.permissions.canRead) {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use the specified color if appropriate
|
// use the specified color if appropriate
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
if (common.isDefinedAndNotNull(d.component.style['background-color'])) {
|
||||||
color = d.component.style['background-color'];
|
color = d.component.style['background-color'];
|
||||||
|
|
||||||
//special case #ffffff implies default fill
|
//special case #ffffff implies default fill
|
||||||
if (color.toLowerCase() === '#ffffff') {
|
if (color.toLowerCase() === '#ffffff') {
|
||||||
color = nf.Processor.defaultIconColor();
|
color = nfProcessor.defaultIconColor();
|
||||||
} else {
|
} else {
|
||||||
color = nf.Common.determineContrastColor(
|
color = common.determineContrastColor(
|
||||||
nf.Common.substringAfterLast(
|
common.substringAfterLast(
|
||||||
color, '#'));
|
color, '#'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -657,7 +687,7 @@ nf.Processor = (function () {
|
||||||
'fill': function (d) {
|
'fill': function (d) {
|
||||||
var fill = '#728e9b';
|
var fill = '#728e9b';
|
||||||
|
|
||||||
if (d.status.aggregateSnapshot.runStatus === 'Invalid') {
|
if (d.status.aggregateSnapshot.runStatus === 'Invalid') {
|
||||||
fill = '#cf9f5d';
|
fill = '#cf9f5d';
|
||||||
} else if (d.status.aggregateSnapshot.runStatus === 'Running') {
|
} else if (d.status.aggregateSnapshot.runStatus === 'Running') {
|
||||||
fill = '#7dc7a0';
|
fill = '#7dc7a0';
|
||||||
|
@ -693,7 +723,7 @@ nf.Processor = (function () {
|
||||||
var tip = d3.select('#run-status-tip-' + d.id);
|
var tip = d3.select('#run-status-tip-' + d.id);
|
||||||
|
|
||||||
// if there are validation errors generate a tooltip
|
// if there are validation errors generate a tooltip
|
||||||
if (d.permissions.canRead && !nf.Common.isEmpty(d.component.validationErrors)) {
|
if (d.permissions.canRead && !common.isEmpty(d.component.validationErrors)) {
|
||||||
// create the tip if necessary
|
// create the tip if necessary
|
||||||
if (tip.empty()) {
|
if (tip.empty()) {
|
||||||
tip = d3.select('#processor-tooltips').append('div')
|
tip = d3.select('#processor-tooltips').append('div')
|
||||||
|
@ -705,16 +735,16 @@ nf.Processor = (function () {
|
||||||
|
|
||||||
// update the tip
|
// update the tip
|
||||||
tip.html(function () {
|
tip.html(function () {
|
||||||
var list = nf.Common.formatUnorderedList(d.component.validationErrors);
|
var list = common.formatUnorderedList(d.component.validationErrors);
|
||||||
if (list === null || list.length === 0) {
|
if (list === null || list.length === 0) {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
return $('<div></div>').append(list).html();
|
return $('<div></div>').append(list).html();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the tooltip
|
// add the tooltip
|
||||||
nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
|
canvasUtils.canvasTooltip(tip, d3.select(this));
|
||||||
} else {
|
} else {
|
||||||
// remove the tip if necessary
|
// remove the tip if necessary
|
||||||
if (!tip.empty()) {
|
if (!tip.empty()) {
|
||||||
|
@ -726,13 +756,13 @@ nf.Processor = (function () {
|
||||||
// in count value
|
// in count value
|
||||||
updated.select('text.processor-in tspan.count')
|
updated.select('text.processor-in tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.input, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// in size value
|
// in size value
|
||||||
updated.select('text.processor-in tspan.size')
|
updated.select('text.processor-in tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.input, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.input, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// read/write value
|
// read/write value
|
||||||
|
@ -744,13 +774,13 @@ nf.Processor = (function () {
|
||||||
// out count value
|
// out count value
|
||||||
updated.select('text.processor-out tspan.count')
|
updated.select('text.processor-out tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.output, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// out size value
|
// out size value
|
||||||
updated.select('text.processor-out tspan.size')
|
updated.select('text.processor-out tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.output, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.output, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// tasks/time value
|
// tasks/time value
|
||||||
|
@ -766,17 +796,17 @@ nf.Processor = (function () {
|
||||||
// active thread count
|
// active thread count
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
nf.CanvasUtils.activeThreadCount(processor, d);
|
canvasUtils.activeThreadCount(processor, d);
|
||||||
|
|
||||||
// ---------
|
// ---------
|
||||||
// bulletins
|
// bulletins
|
||||||
// ---------
|
// ---------
|
||||||
|
|
||||||
processor.select('rect.bulletin-background').classed('has-bulletins', function () {
|
processor.select('rect.bulletin-background').classed('has-bulletins', function () {
|
||||||
return !nf.Common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
return !common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.CanvasUtils.bulletins(processor, d, function () {
|
canvasUtils.bulletins(processor, d, function () {
|
||||||
return d3.select('#processor-tooltips');
|
return d3.select('#processor-tooltips');
|
||||||
}, 286);
|
}, 286);
|
||||||
});
|
});
|
||||||
|
@ -808,11 +838,16 @@ nf.Processor = (function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfProcessor = {
|
||||||
/**
|
/**
|
||||||
* Initializes of the Processor handler.
|
* Initializes of the Processor handler.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (connectable, draggable, selectable, contextMenu) {
|
||||||
|
nfConnectable = connectable;
|
||||||
|
nfDraggable = draggable;
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
processorMap = d3.map();
|
processorMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -833,8 +868,8 @@ nf.Processor = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (processorEntities, options) {
|
add: function (processorEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current time
|
// get the current time
|
||||||
|
@ -855,7 +890,7 @@ nf.Processor = (function () {
|
||||||
$.each(processorEntities, function (_, processorEntity) {
|
$.each(processorEntities, function (_, processorEntity) {
|
||||||
add(processorEntity);
|
add(processorEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(processorEntities)) {
|
} else if (common.isDefinedAndNotNull(processorEntities)) {
|
||||||
add(processorEntities);
|
add(processorEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -874,16 +909,16 @@ nf.Processor = (function () {
|
||||||
set: function (processorEntities, options) {
|
set: function (processorEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = function (proposedProcessorEntity) {
|
var set = function (proposedProcessorEntity) {
|
||||||
var currentProcessorEntity = processorMap.get(proposedProcessorEntity.id);
|
var currentProcessorEntity = processorMap.get(proposedProcessorEntity.id);
|
||||||
|
|
||||||
// set the processor if appropriate due to revision and wasn't previously removed
|
// set the processor if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentProcessorEntity, proposedProcessorEntity) && !removedCache.has(proposedProcessorEntity.id)) {
|
if (client.isNewerRevision(currentProcessorEntity, proposedProcessorEntity) && !removedCache.has(proposedProcessorEntity.id)) {
|
||||||
processorMap.set(proposedProcessorEntity.id, $.extend({
|
processorMap.set(proposedProcessorEntity.id, $.extend({
|
||||||
type: 'Processor',
|
type: 'Processor',
|
||||||
dimensions: dimensions
|
dimensions: dimensions
|
||||||
|
@ -907,14 +942,14 @@ nf.Processor = (function () {
|
||||||
$.each(processorEntities, function (_, processorEntity) {
|
$.each(processorEntities, function (_, processorEntity) {
|
||||||
set(processorEntity);
|
set(processorEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(processorEntities)) {
|
} else if (common.isDefinedAndNotNull(processorEntities)) {
|
||||||
set(processorEntities);
|
set(processorEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the selection and handle all new processors
|
// apply the selection and handle all new processors
|
||||||
var selection = select();
|
var selection = select();
|
||||||
selection.enter().call(renderProcessors, selectAll);
|
selection.enter().call(renderProcessors, selectAll);
|
||||||
selection.call(updateProcessors).call(nf.CanvasUtils.position, transition);
|
selection.call(updateProcessors).call(canvasUtils.position, transition);
|
||||||
selection.exit().call(removeProcessors);
|
selection.exit().call(removeProcessors);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -925,7 +960,7 @@ nf.Processor = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return processorMap.values();
|
return processorMap.values();
|
||||||
} else {
|
} else {
|
||||||
return processorMap.get(id);
|
return processorMap.get(id);
|
||||||
|
@ -939,7 +974,7 @@ nf.Processor = (function () {
|
||||||
* @param {string} id Optional
|
* @param {string} id Optional
|
||||||
*/
|
*/
|
||||||
refresh: function (id) {
|
refresh: function (id) {
|
||||||
if (nf.Common.isDefinedAndNotNull(id)) {
|
if (common.isDefinedAndNotNull(id)) {
|
||||||
d3.select('#id-' + id).call(updateProcessors);
|
d3.select('#id-' + id).call(updateProcessors);
|
||||||
} else {
|
} else {
|
||||||
d3.selectAll('g.processor').call(updateProcessors);
|
d3.selectAll('g.processor').call(updateProcessors);
|
||||||
|
@ -952,7 +987,7 @@ nf.Processor = (function () {
|
||||||
* @param {string} id The id
|
* @param {string} id The id
|
||||||
*/
|
*/
|
||||||
position: function (id) {
|
position: function (id) {
|
||||||
d3.select('#id-' + id).call(nf.CanvasUtils.position);
|
d3.select('#id-' + id).call(canvasUtils.position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -976,7 +1011,7 @@ nf.Processor = (function () {
|
||||||
url: processorEntity.uri,
|
url: processorEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.Processor.set(response);
|
nfProcessor.set(response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1007,7 +1042,7 @@ nf.Processor = (function () {
|
||||||
* Removes all processors.
|
* Removes all processors.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.Processor.remove(processorMap.keys());
|
nfProcessor.remove(processorMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1042,4 +1077,6 @@ nf.Processor = (function () {
|
||||||
return '#ad9897';
|
return '#ad9897';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfProcessor;
|
||||||
|
}));
|
|
@ -15,12 +15,52 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists FlowFiles from a given connection.
|
* Lists FlowFiles from a given connection.
|
||||||
*/
|
*/
|
||||||
nf.QueueListing = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'Slick',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Storage',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils) {
|
||||||
|
return (nf.QueueListing = factory($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.QueueListing =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('Slick'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Storage'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.QueueListing = factory(root.$,
|
||||||
|
root.Slick,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Storage,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, Slick, common, dialog, shell, angularBridge, clusterSummary, errorHandler, storage, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration object used to hold a number of configuration items.
|
* Configuration object used to hold a number of configuration items.
|
||||||
|
@ -56,17 +96,17 @@ nf.QueueListing = (function () {
|
||||||
var dataUri = $('#flowfile-uri').text() + '/content';
|
var dataUri = $('#flowfile-uri').text() + '/content';
|
||||||
|
|
||||||
// perform the request once we've received a token
|
// perform the request once we've received a token
|
||||||
nf.Common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
|
common.getAccessToken(config.urls.downloadToken).done(function (downloadToken) {
|
||||||
var parameters = {};
|
var parameters = {};
|
||||||
|
|
||||||
// conditionally include the ui extension token
|
// conditionally include the ui extension token
|
||||||
if (!nf.Common.isBlank(downloadToken)) {
|
if (!common.isBlank(downloadToken)) {
|
||||||
parameters['access_token'] = downloadToken;
|
parameters['access_token'] = downloadToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
// conditionally include the cluster node id
|
// conditionally include the cluster node id
|
||||||
var clusterNodeId = $('#flowfile-cluster-node-id').text();
|
var clusterNodeId = $('#flowfile-cluster-node-id').text();
|
||||||
if (!nf.Common.isBlank(clusterNodeId)) {
|
if (!common.isBlank(clusterNodeId)) {
|
||||||
parameters['clusterNodeId'] = clusterNodeId;
|
parameters['clusterNodeId'] = clusterNodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +117,7 @@ nf.QueueListing = (function () {
|
||||||
window.open(dataUri + '?' + $.param(parameters));
|
window.open(dataUri + '?' + $.param(parameters));
|
||||||
}
|
}
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Queue Listing',
|
headerText: 'Queue Listing',
|
||||||
dialogContent: 'Unable to generate access token for downloading content.'
|
dialogContent: 'Unable to generate access token for downloading content.'
|
||||||
});
|
});
|
||||||
|
@ -92,7 +132,7 @@ nf.QueueListing = (function () {
|
||||||
|
|
||||||
// generate tokens as necessary
|
// generate tokens as necessary
|
||||||
var getAccessTokens = $.Deferred(function (deferred) {
|
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
|
// generate a token for the ui extension and another for the callback
|
||||||
var uiExtensionToken = $.ajax({
|
var uiExtensionToken = $.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
@ -109,7 +149,7 @@ nf.QueueListing = (function () {
|
||||||
var downloadToken = downloadTokenResult[0];
|
var downloadToken = downloadTokenResult[0];
|
||||||
deferred.resolve(uiExtensionToken, downloadToken);
|
deferred.resolve(uiExtensionToken, downloadToken);
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Queue Listing',
|
headerText: 'Queue Listing',
|
||||||
dialogContent: 'Unable to generate access token for viewing content.'
|
dialogContent: 'Unable to generate access token for viewing content.'
|
||||||
});
|
});
|
||||||
|
@ -126,12 +166,12 @@ nf.QueueListing = (function () {
|
||||||
|
|
||||||
// conditionally include the cluster node id
|
// conditionally include the cluster node id
|
||||||
var clusterNodeId = $('#flowfile-cluster-node-id').text();
|
var clusterNodeId = $('#flowfile-cluster-node-id').text();
|
||||||
if (!nf.Common.isBlank(clusterNodeId)) {
|
if (!common.isBlank(clusterNodeId)) {
|
||||||
dataUriParameters['clusterNodeId'] = clusterNodeId;
|
dataUriParameters['clusterNodeId'] = clusterNodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// include the download token if applicable
|
// include the download token if applicable
|
||||||
if (!nf.Common.isBlank(downloadToken)) {
|
if (!common.isBlank(downloadToken)) {
|
||||||
dataUriParameters['access_token'] = downloadToken;
|
dataUriParameters['access_token'] = downloadToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +197,7 @@ nf.QueueListing = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
// include the download token if applicable
|
// include the download token if applicable
|
||||||
if (!nf.Common.isBlank(uiExtensionToken)) {
|
if (!common.isBlank(uiExtensionToken)) {
|
||||||
contentViewerParameters['access_token'] = uiExtensionToken;
|
contentViewerParameters['access_token'] = uiExtensionToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +227,7 @@ nf.QueueListing = (function () {
|
||||||
|
|
||||||
// update the progress
|
// update the progress
|
||||||
var label = $('<div class="progress-label"></div>').text(percentComplete + '%');
|
var label = $('<div class="progress-label"></div>').text(percentComplete + '%');
|
||||||
(nf.ng.Bridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + percentComplete + '" class="md-hue-2" md-mode="determinate" aria-label="Searching Queue"></md-progress-linear>'))(nf.ng.Bridge.rootScope)).appendTo(progressBar);
|
(angularBridge.injector.get('$compile')($('<md-progress-linear ng-cloak ng-value="' + percentComplete + '" class="md-hue-2" md-mode="determinate" aria-label="Searching Queue"></md-progress-linear>'))(angularBridge.rootScope)).appendTo(progressBar);
|
||||||
progressBar.append(label);
|
progressBar.append(label);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,7 +263,7 @@ nf.QueueListing = (function () {
|
||||||
var reject = cancelled;
|
var reject = cancelled;
|
||||||
|
|
||||||
// ensure the listing requests are present
|
// ensure the listing requests are present
|
||||||
if (nf.Common.isDefinedAndNotNull(listingRequest)) {
|
if (common.isDefinedAndNotNull(listingRequest)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
url: listingRequest.uri,
|
url: listingRequest.uri,
|
||||||
|
@ -231,20 +271,20 @@ nf.QueueListing = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// use the listing request from when the listing completed
|
// use the listing request from when the listing completed
|
||||||
if (nf.Common.isEmpty(listingRequest.flowFileSummaries)) {
|
if (common.isEmpty(listingRequest.flowFileSummaries)) {
|
||||||
if (cancelled === false) {
|
if (cancelled === false) {
|
||||||
reject = true;
|
reject = true;
|
||||||
|
|
||||||
// show the dialog
|
// show the dialog
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Queue Listing',
|
headerText: 'Queue Listing',
|
||||||
dialogContent: 'The queue has no FlowFiles.'
|
dialogContent: 'The queue has no FlowFiles.'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// update the queue size
|
// update the queue size
|
||||||
$('#total-flowfiles-count').text(nf.Common.formatInteger(listingRequest.queueSize.objectCount));
|
$('#total-flowfiles-count').text(common.formatInteger(listingRequest.queueSize.objectCount));
|
||||||
$('#total-flowfiles-size').text(nf.Common.formatDataSize(listingRequest.queueSize.byteCount));
|
$('#total-flowfiles-size').text(common.formatDataSize(listingRequest.queueSize.byteCount));
|
||||||
|
|
||||||
// update the last updated time
|
// update the last updated time
|
||||||
$('#queue-listing-last-refreshed').text(listingRequest.lastUpdated);
|
$('#queue-listing-last-refreshed').text(listingRequest.lastUpdated);
|
||||||
|
@ -316,7 +356,7 @@ nf.QueueListing = (function () {
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
listingRequest = response.listingRequest;
|
listingRequest = response.listingRequest;
|
||||||
processListingRequest(nextDelay);
|
processListingRequest(nextDelay);
|
||||||
}).fail(completeListingRequest).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(completeListingRequest).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
// issue the request to list the flow files
|
// issue the request to list the flow files
|
||||||
|
@ -335,7 +375,7 @@ nf.QueueListing = (function () {
|
||||||
// process the drop request
|
// process the drop request
|
||||||
listingRequest = response.listingRequest;
|
listingRequest = response.listingRequest;
|
||||||
processListingRequest(1);
|
processListingRequest(1);
|
||||||
}).fail(completeListingRequest).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(completeListingRequest).fail(errorHandler.handleAjaxError);
|
||||||
}).promise();
|
}).promise();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -349,13 +389,13 @@ nf.QueueListing = (function () {
|
||||||
var formatFlowFileDetail = function (label, value) {
|
var formatFlowFileDetail = function (label, value) {
|
||||||
$('<div class="flowfile-detail"></div>').append(
|
$('<div class="flowfile-detail"></div>').append(
|
||||||
$('<div class="detail-name"></div>').text(label)).append(
|
$('<div class="detail-name"></div>').text(label)).append(
|
||||||
$('<div class="detail-value">' + nf.Common.formatValue(value) + '</div>').ellipsis()).append(
|
$('<div class="detail-value">' + common.formatValue(value) + '</div>').ellipsis()).append(
|
||||||
$('<div class="clear"></div>')).appendTo('#additional-flowfile-details');
|
$('<div class="clear"></div>')).appendTo('#additional-flowfile-details');
|
||||||
};
|
};
|
||||||
|
|
||||||
// formats the content value
|
// formats the content value
|
||||||
var formatContentValue = function (element, value) {
|
var formatContentValue = function (element, value) {
|
||||||
if (nf.Common.isDefinedAndNotNull(value)) {
|
if (common.isDefinedAndNotNull(value)) {
|
||||||
element.removeClass('unset').text(value);
|
element.removeClass('unset').text(value);
|
||||||
} else {
|
} else {
|
||||||
element.addClass('unset').text('No value set');
|
element.addClass('unset').text('No value set');
|
||||||
|
@ -363,7 +403,7 @@ nf.QueueListing = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var params = {};
|
var params = {};
|
||||||
if (nf.Common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) {
|
if (common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) {
|
||||||
params['clusterNodeId'] = flowFileSummary.clusterNodeId;
|
params['clusterNodeId'] = flowFileSummary.clusterNodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,16 +419,16 @@ nf.QueueListing = (function () {
|
||||||
$('#flowfile-uri').text(flowFile.uri);
|
$('#flowfile-uri').text(flowFile.uri);
|
||||||
|
|
||||||
// show the flowfile details dialog
|
// show the flowfile details dialog
|
||||||
$('#flowfile-uuid').html(nf.Common.formatValue(flowFile.uuid));
|
$('#flowfile-uuid').html(common.formatValue(flowFile.uuid));
|
||||||
$('#flowfile-filename').html(nf.Common.formatValue(flowFile.filename));
|
$('#flowfile-filename').html(common.formatValue(flowFile.filename));
|
||||||
$('#flowfile-queue-position').html(nf.Common.formatValue(flowFile.position));
|
$('#flowfile-queue-position').html(common.formatValue(flowFile.position));
|
||||||
$('#flowfile-file-size').html(nf.Common.formatValue(flowFile.contentClaimFileSize));
|
$('#flowfile-file-size').html(common.formatValue(flowFile.contentClaimFileSize));
|
||||||
$('#flowfile-queued-duration').text(nf.Common.formatDuration(flowFile.queuedDuration));
|
$('#flowfile-queued-duration').text(common.formatDuration(flowFile.queuedDuration));
|
||||||
$('#flowfile-lineage-duration').text(nf.Common.formatDuration(flowFile.lineageDuration));
|
$('#flowfile-lineage-duration').text(common.formatDuration(flowFile.lineageDuration));
|
||||||
$('#flowfile-penalized').text(flowFile.penalized === true ? 'Yes' : 'No');
|
$('#flowfile-penalized').text(flowFile.penalized === true ? 'Yes' : 'No');
|
||||||
|
|
||||||
// conditionally show the cluster node identifier
|
// conditionally show the cluster node identifier
|
||||||
if (nf.Common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) {
|
if (common.isDefinedAndNotNull(flowFileSummary.clusterNodeId)) {
|
||||||
// save the cluster node id
|
// save the cluster node id
|
||||||
$('#flowfile-cluster-node-id').text(flowFileSummary.clusterNodeId);
|
$('#flowfile-cluster-node-id').text(flowFileSummary.clusterNodeId);
|
||||||
|
|
||||||
|
@ -396,7 +436,7 @@ nf.QueueListing = (function () {
|
||||||
formatFlowFileDetail('Node Address', flowFileSummary.clusterNodeAddress);
|
formatFlowFileDetail('Node Address', flowFileSummary.clusterNodeAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nf.Common.isDefinedAndNotNull(flowFile.contentClaimContainer)) {
|
if (common.isDefinedAndNotNull(flowFile.contentClaimContainer)) {
|
||||||
// content claim
|
// content claim
|
||||||
formatContentValue($('#content-container'), flowFile.contentClaimContainer);
|
formatContentValue($('#content-container'), flowFile.contentClaimContainer);
|
||||||
formatContentValue($('#content-section'), flowFile.contentClaimSection);
|
formatContentValue($('#content-section'), flowFile.contentClaimSection);
|
||||||
|
@ -407,9 +447,9 @@ nf.QueueListing = (function () {
|
||||||
// input content file size
|
// input content file size
|
||||||
var contentSize = $('#content-size');
|
var contentSize = $('#content-size');
|
||||||
formatContentValue(contentSize, flowFile.contentClaimFileSize);
|
formatContentValue(contentSize, flowFile.contentClaimFileSize);
|
||||||
if (nf.Common.isDefinedAndNotNull(flowFile.contentClaimFileSize)) {
|
if (common.isDefinedAndNotNull(flowFile.contentClaimFileSize)) {
|
||||||
// over the default tooltip with the actual byte count
|
// over the default tooltip with the actual byte count
|
||||||
contentSize.attr('title', nf.Common.formatInteger(flowFile.contentClaimFileSizeBytes) + ' bytes');
|
contentSize.attr('title', common.formatInteger(flowFile.contentClaimFileSizeBytes) + ' bytes');
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the content details
|
// show the content details
|
||||||
|
@ -425,21 +465,21 @@ nf.QueueListing = (function () {
|
||||||
$.each(flowFile.attributes, function (attributeName, attributeValue) {
|
$.each(flowFile.attributes, function (attributeName, attributeValue) {
|
||||||
// create the attribute record
|
// create the attribute record
|
||||||
var attributeRecord = $('<div class="attribute-detail"></div>')
|
var attributeRecord = $('<div class="attribute-detail"></div>')
|
||||||
.append($('<div class="attribute-name">' + nf.Common.formatValue(attributeName) + '</div>').ellipsis())
|
.append($('<div class="attribute-name">' + common.formatValue(attributeName) + '</div>').ellipsis())
|
||||||
.appendTo(attributesContainer);
|
.appendTo(attributesContainer);
|
||||||
|
|
||||||
// add the current value
|
// add the current value
|
||||||
attributeRecord
|
attributeRecord
|
||||||
.append($('<div class="attribute-value">' + nf.Common.formatValue(attributeValue) + '</div>').ellipsis())
|
.append($('<div class="attribute-value">' + common.formatValue(attributeValue) + '</div>').ellipsis())
|
||||||
.append('<div class="clear"></div>');
|
.append('<div class="clear"></div>');
|
||||||
});
|
});
|
||||||
|
|
||||||
// show the dialog
|
// show the dialog
|
||||||
$('#flowfile-details-dialog').modal('show');
|
$('#flowfile-details-dialog').modal('show');
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfQueueListing = {
|
||||||
init: function () {
|
init: function () {
|
||||||
initializeListingRequestStatusDialog();
|
initializeListingRequestStatusDialog();
|
||||||
|
|
||||||
|
@ -456,12 +496,12 @@ nf.QueueListing = (function () {
|
||||||
|
|
||||||
// function for formatting data sizes
|
// function for formatting data sizes
|
||||||
var dataSizeFormatter = function (row, cell, value, columnDef, dataContext) {
|
var dataSizeFormatter = function (row, cell, value, columnDef, dataContext) {
|
||||||
return nf.Common.formatDataSize(value);
|
return common.formatDataSize(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// function for formatting durations
|
// function for formatting durations
|
||||||
var durationFormatter = function (row, cell, value, columnDef, dataContext) {
|
var durationFormatter = function (row, cell, value, columnDef, dataContext) {
|
||||||
return nf.Common.formatDuration(value);
|
return common.formatDuration(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// function for formatting penalization
|
// function for formatting penalization
|
||||||
|
@ -548,7 +588,7 @@ nf.QueueListing = (function () {
|
||||||
];
|
];
|
||||||
|
|
||||||
// conditionally show the cluster node identifier
|
// conditionally show the cluster node identifier
|
||||||
if (nf.ClusterSummary.isClustered()) {
|
if (clusterSummary.isClustered()) {
|
||||||
queueListingColumns.push({
|
queueListingColumns.push({
|
||||||
id: 'clusterNodeAddress',
|
id: 'clusterNodeAddress',
|
||||||
name: 'Node',
|
name: 'Node',
|
||||||
|
@ -559,7 +599,7 @@ nf.QueueListing = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add an actions column when the user can access provenance
|
// add an actions column when the user can access provenance
|
||||||
if (nf.Common.canAccessProvenance()) {
|
if (common.canAccessProvenance()) {
|
||||||
// function for formatting actions
|
// function for formatting actions
|
||||||
var actionsFormatter = function () {
|
var actionsFormatter = function () {
|
||||||
return '<div title="Provenance" class="pointer icon icon-provenance view-provenance"></div>';
|
return '<div title="Provenance" class="pointer icon icon-provenance view-provenance"></div>';
|
||||||
|
@ -614,7 +654,7 @@ nf.QueueListing = (function () {
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// open the provenance page with the specified component
|
// open the provenance page with the specified component
|
||||||
nf.Shell.showPage('provenance?' + $.param({
|
shell.showPage('provenance?' + $.param({
|
||||||
flowFileUuid: item.uuid
|
flowFileUuid: item.uuid
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -648,7 +688,7 @@ nf.QueueListing = (function () {
|
||||||
$('#content-download').on('click', downloadContent);
|
$('#content-download').on('click', downloadContent);
|
||||||
|
|
||||||
// only show if content viewer is configured
|
// only show if content viewer is configured
|
||||||
if (nf.Common.isContentViewConfigured()) {
|
if (common.isContentViewConfigured()) {
|
||||||
$('#content-view').show();
|
$('#content-view').show();
|
||||||
$('#content-view').on('click', viewContent);
|
$('#content-view').on('click', viewContent);
|
||||||
}
|
}
|
||||||
|
@ -690,7 +730,7 @@ nf.QueueListing = (function () {
|
||||||
$('#additional-flowfile-details').empty();
|
$('#additional-flowfile-details').empty();
|
||||||
},
|
},
|
||||||
open: function () {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -701,7 +741,7 @@ nf.QueueListing = (function () {
|
||||||
*/
|
*/
|
||||||
resetTableSize: function () {
|
resetTableSize: function () {
|
||||||
var queueListingGrid = $('#queue-listing-table').data('gridInstance');
|
var queueListingGrid = $('#queue-listing-table').data('gridInstance');
|
||||||
if (nf.Common.isDefinedAndNotNull(queueListingGrid)) {
|
if (common.isDefinedAndNotNull(queueListingGrid)) {
|
||||||
queueListingGrid.resizeCanvas();
|
queueListingGrid.resizeCanvas();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -717,7 +757,7 @@ nf.QueueListing = (function () {
|
||||||
// update the connection name
|
// update the connection name
|
||||||
var connectionName = '';
|
var connectionName = '';
|
||||||
if (connection.permissions.canRead) {
|
if (connection.permissions.canRead) {
|
||||||
connectionName = nf.CanvasUtils.formatConnectionName(connection.component);
|
connectionName = canvasUtils.formatConnectionName(connection.component);
|
||||||
}
|
}
|
||||||
if (connectionName === '') {
|
if (connectionName === '') {
|
||||||
connectionName = 'Connection';
|
connectionName = 'Connection';
|
||||||
|
@ -725,7 +765,7 @@ nf.QueueListing = (function () {
|
||||||
$('#queue-listing-header-text').text(connectionName);
|
$('#queue-listing-header-text').text(connectionName);
|
||||||
|
|
||||||
// show the listing container
|
// show the listing container
|
||||||
nf.Shell.showContent('#queue-listing-container').done(function () {
|
shell.showContent('#queue-listing-container').done(function () {
|
||||||
$('#queue-listing-table').removeData('connection');
|
$('#queue-listing-table').removeData('connection');
|
||||||
|
|
||||||
// clear the table
|
// clear the table
|
||||||
|
@ -739,15 +779,17 @@ nf.QueueListing = (function () {
|
||||||
|
|
||||||
// reset stats
|
// reset stats
|
||||||
$('#displayed-flowfiles, #total-flowfiles-count').text('0');
|
$('#displayed-flowfiles, #total-flowfiles-count').text('0');
|
||||||
$('#total-flowfiles-size').text(nf.Common.formatDataSize(0));
|
$('#total-flowfiles-size').text(common.formatDataSize(0));
|
||||||
});
|
});
|
||||||
|
|
||||||
// adjust the table size
|
// adjust the table size
|
||||||
nf.QueueListing.resetTableSize();
|
nfQueueListing.resetTableSize();
|
||||||
|
|
||||||
// store the connection for access later
|
// store the connection for access later
|
||||||
$('#queue-listing-table').data('connection', connection);
|
$('#queue-listing-table').data('connection', connection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfQueueListing;
|
||||||
|
}));
|
|
@ -15,9 +15,47 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.RemoteProcessGroup'],
|
||||||
|
function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) {
|
||||||
|
return (nf.RemoteProcessGroupConfiguration = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.RemoteProcessGroupConfiguration =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.RemoteProcessGroup')));
|
||||||
|
} else {
|
||||||
|
nf.RemoteProcessGroupConfiguration = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.RemoteProcessGroup);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
nf.RemoteProcessGroupConfiguration = (function () {
|
|
||||||
return {
|
return {
|
||||||
init: function () {
|
init: function () {
|
||||||
$('#remote-process-group-configuration').modal({
|
$('#remote-process-group-configuration').modal({
|
||||||
|
@ -35,20 +73,20 @@ nf.RemoteProcessGroupConfiguration = (function () {
|
||||||
var remoteProcessGroupId = $('#remote-process-group-id').text();
|
var remoteProcessGroupId = $('#remote-process-group-id').text();
|
||||||
var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum();
|
var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum();
|
||||||
|
|
||||||
// create the remote process group details
|
// create the remote process group details
|
||||||
var remoteProcessGroupEntity = {
|
var remoteProcessGroupEntity = {
|
||||||
'revision': nf.Client.getRevision(remoteProcessGroupData),
|
'revision': client.getRevision(remoteProcessGroupData),
|
||||||
'component': {
|
'component': {
|
||||||
id: remoteProcessGroupId,
|
id: remoteProcessGroupId,
|
||||||
communicationsTimeout: $('#remote-process-group-timeout').val(),
|
communicationsTimeout: $('#remote-process-group-timeout').val(),
|
||||||
yieldDuration: $('#remote-process-group-yield-duration').val(),
|
yieldDuration: $('#remote-process-group-yield-duration').val(),
|
||||||
transportProtocol: $('#remote-process-group-transport-protocol-combo').combo('getSelectedOption').value,
|
transportProtocol: $('#remote-process-group-transport-protocol-combo').combo('getSelectedOption').value,
|
||||||
proxyHost: $('#remote-process-group-proxy-host').val(),
|
proxyHost: $('#remote-process-group-proxy-host').val(),
|
||||||
proxyPort: $('#remote-process-group-proxy-port').val(),
|
proxyPort: $('#remote-process-group-proxy-port').val(),
|
||||||
proxyUser: $('#remote-process-group-proxy-user').val(),
|
proxyUser: $('#remote-process-group-proxy-user').val(),
|
||||||
proxyPassword: $('#remote-process-group-proxy-password').val()
|
proxyPassword: $('#remote-process-group-proxy-password').val()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// update the selected component
|
// update the selected component
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -59,11 +97,11 @@ nf.RemoteProcessGroupConfiguration = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// refresh the remote process group component
|
// refresh the remote process group component
|
||||||
nf.RemoteProcessGroup.set(response);
|
nfRemoteProcessGroup.set(response);
|
||||||
|
|
||||||
// inform Angular app values have changed
|
// inform Angular app values have changed
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
|
|
||||||
// close the details panel
|
// close the details panel
|
||||||
$('#remote-process-group-configuration').modal('hide');
|
$('#remote-process-group-configuration').modal('hide');
|
||||||
}).fail(function (xhr, status, error) {
|
}).fail(function (xhr, status, error) {
|
||||||
|
@ -74,15 +112,15 @@ nf.RemoteProcessGroupConfiguration = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: content,
|
dialogContent: content,
|
||||||
headerText: 'Remote Process Group Configuration'
|
headerText: 'Remote Process Group Configuration'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -122,12 +160,12 @@ nf.RemoteProcessGroupConfiguration = (function () {
|
||||||
// initialize the transport protocol combo
|
// initialize the transport protocol combo
|
||||||
$('#remote-process-group-transport-protocol-combo').combo({
|
$('#remote-process-group-transport-protocol-combo').combo({
|
||||||
options: [{
|
options: [{
|
||||||
text: 'RAW',
|
text: 'RAW',
|
||||||
value: 'RAW'
|
value: 'RAW'
|
||||||
}, {
|
}, {
|
||||||
text: 'HTTP',
|
text: 'HTTP',
|
||||||
value: 'HTTP'
|
value: 'HTTP'
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -138,7 +176,7 @@ nf.RemoteProcessGroupConfiguration = (function () {
|
||||||
*/
|
*/
|
||||||
showConfiguration: function (selection) {
|
showConfiguration: function (selection) {
|
||||||
// if the specified component is a remote process group, load its properties
|
// if the specified component is a remote process group, load its properties
|
||||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// populate the port settings
|
// populate the port settings
|
||||||
|
@ -164,4 +202,4 @@ nf.RemoteProcessGroupConfiguration = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,29 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, common, canvasUtils) {
|
||||||
|
return (nf.RemoteProcessGroupDetails = factory($, common, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.RemoteProcessGroupDetails =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.RemoteProcessGroupDetails = factory(root.$,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, common, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
nf.RemoteProcessGroupDetails = (function () {
|
|
||||||
return {
|
return {
|
||||||
init: function () {
|
init: function () {
|
||||||
$('#remote-process-group-details').modal({
|
$('#remote-process-group-details').modal({
|
||||||
|
@ -39,16 +59,16 @@ nf.RemoteProcessGroupDetails = (function () {
|
||||||
handler: {
|
handler: {
|
||||||
close: function () {
|
close: function () {
|
||||||
// clear the remote process group details
|
// clear the remote process group details
|
||||||
nf.Common.clearField('read-only-remote-process-group-id');
|
common.clearField('read-only-remote-process-group-id');
|
||||||
nf.Common.clearField('read-only-remote-process-group-name');
|
common.clearField('read-only-remote-process-group-name');
|
||||||
nf.Common.clearField('read-only-remote-process-group-urls');
|
common.clearField('read-only-remote-process-group-urls');
|
||||||
nf.Common.clearField('read-only-remote-process-group-timeout');
|
common.clearField('read-only-remote-process-group-timeout');
|
||||||
nf.Common.clearField('read-only-remote-process-group-yield-duration');
|
common.clearField('read-only-remote-process-group-yield-duration');
|
||||||
nf.Common.clearField('read-only-remote-process-group-transport-protocol');
|
common.clearField('read-only-remote-process-group-transport-protocol');
|
||||||
nf.Common.clearField('read-only-remote-process-group-proxy-host');
|
common.clearField('read-only-remote-process-group-proxy-host');
|
||||||
nf.Common.clearField('read-only-remote-process-group-proxy-port');
|
common.clearField('read-only-remote-process-group-proxy-port');
|
||||||
nf.Common.clearField('read-only-remote-process-group-proxy-user');
|
common.clearField('read-only-remote-process-group-proxy-user');
|
||||||
nf.Common.clearField('read-only-remote-process-group-proxy-password');
|
common.clearField('read-only-remote-process-group-proxy-password');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -61,24 +81,24 @@ nf.RemoteProcessGroupDetails = (function () {
|
||||||
*/
|
*/
|
||||||
showDetails: function (selection) {
|
showDetails: function (selection) {
|
||||||
// if the specified component is a remote process group, load its properties
|
// if the specified component is a remote process group, load its properties
|
||||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// populate the port settings
|
// populate the port settings
|
||||||
nf.Common.populateField('read-only-remote-process-group-id', selectionData.id);
|
common.populateField('read-only-remote-process-group-id', selectionData.id);
|
||||||
nf.Common.populateField('read-only-remote-process-group-name', selectionData.component.name);
|
common.populateField('read-only-remote-process-group-name', selectionData.component.name);
|
||||||
nf.Common.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris);
|
common.populateField('read-only-remote-process-group-urls', selectionData.component.targetUris);
|
||||||
nf.Common.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout);
|
common.populateField('read-only-remote-process-group-timeout', selectionData.component.communicationsTimeout);
|
||||||
nf.Common.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration);
|
common.populateField('read-only-remote-process-group-yield-duration', selectionData.component.yieldDuration);
|
||||||
nf.Common.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol);
|
common.populateField('read-only-remote-process-group-transport-protocol', selectionData.component.transportProtocol);
|
||||||
nf.Common.populateField('read-only-remote-process-group-proxy-host', selectionData.component.proxyHost);
|
common.populateField('read-only-remote-process-group-proxy-host', selectionData.component.proxyHost);
|
||||||
nf.Common.populateField('read-only-remote-process-group-proxy-port', selectionData.component.proxyPort);
|
common.populateField('read-only-remote-process-group-proxy-port', selectionData.component.proxyPort);
|
||||||
nf.Common.populateField('read-only-remote-process-group-proxy-user', selectionData.component.proxyUser);
|
common.populateField('read-only-remote-process-group-proxy-user', selectionData.component.proxyUser);
|
||||||
nf.Common.populateField('read-only-remote-process-group-proxy-password', selectionData.component.proxyPassword);
|
common.populateField('read-only-remote-process-group-proxy-password', selectionData.component.proxyPassword);
|
||||||
|
|
||||||
// show the details
|
// show the details
|
||||||
$('#remote-process-group-details').modal('show');
|
$('#remote-process-group-details').modal('show');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,46 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.RemoteProcessGroupPorts = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.RemoteProcessGroup'],
|
||||||
|
function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) {
|
||||||
|
return (nf.RemoteProcessGroupPorts = factory($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.RemoteProcessGroupPorts =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.RemoteProcessGroup')));
|
||||||
|
} else {
|
||||||
|
nf.RemoteProcessGroupPorts = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.RemoteProcessGroup);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, errorHandler, common, dialog, client, canvasUtils, angularBridge, nfRemoteProcessGroup) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the remote port configuration dialog.
|
* Initializes the remote port configuration dialog.
|
||||||
|
@ -45,7 +82,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
|
|
||||||
// create the remote process group details
|
// create the remote process group details
|
||||||
var remoteProcessGroupPortEntity = {
|
var remoteProcessGroupPortEntity = {
|
||||||
'revision': nf.Client.getRevision(remoteProcessGroupData),
|
'revision': client.getRevision(remoteProcessGroupData),
|
||||||
'remoteProcessGroupPort': {
|
'remoteProcessGroupPort': {
|
||||||
id: remotePortId,
|
id: remotePortId,
|
||||||
groupId: remoteProcessGroupId,
|
groupId: remoteProcessGroupId,
|
||||||
|
@ -92,22 +129,22 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: content,
|
dialogContent: content,
|
||||||
headerText: 'Remote Process Group Ports'
|
headerText: 'Remote Process Group Ports'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
}).always(function () {
|
}).always(function () {
|
||||||
// close the dialog
|
// close the dialog
|
||||||
$('#remote-port-configuration').modal('hide');
|
$('#remote-port-configuration').modal('hide');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Remote Process Group Ports',
|
headerText: 'Remote Process Group Ports',
|
||||||
dialogContent: 'Concurrent tasks must be an integer value.'
|
dialogContent: 'Concurrent tasks must be an integer value.'
|
||||||
});
|
});
|
||||||
|
@ -165,9 +202,9 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
var remoteProcessGroupData = remoteProcessGroup.datum();
|
var remoteProcessGroupData = remoteProcessGroup.datum();
|
||||||
|
|
||||||
// if can modify, the over status of this node may have changed
|
// if can modify, the over status of this node may have changed
|
||||||
if (nf.CanvasUtils.canModify(remoteProcessGroup)) {
|
if (canvasUtils.canModify(remoteProcessGroup)) {
|
||||||
// reload the remote process group
|
// reload the remote process group
|
||||||
nf.RemoteProcessGroup.reload(remoteProcessGroupData.id);
|
nfRemoteProcessGroup.reload(remoteProcessGroupData.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide the dialog
|
// hide the dialog
|
||||||
|
@ -184,8 +221,8 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
|
|
||||||
// clear any tooltips
|
// clear any tooltips
|
||||||
var dialog = $('#remote-process-group-ports');
|
var dialog = $('#remote-process-group-ports');
|
||||||
nf.Common.cleanUpTooltips(dialog, 'div.remote-port-removed');
|
common.cleanUpTooltips(dialog, 'div.remote-port-removed');
|
||||||
nf.Common.cleanUpTooltips(dialog, 'div.concurrent-tasks-info');
|
common.cleanUpTooltips(dialog, 'div.concurrent-tasks-info');
|
||||||
|
|
||||||
// clear the input and output ports
|
// clear the input and output ports
|
||||||
$('#remote-process-group-input-ports-container').empty();
|
$('#remote-process-group-input-ports-container').empty();
|
||||||
|
@ -203,7 +240,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
* @argument {string} portType The type of port
|
* @argument {string} portType The type of port
|
||||||
*/
|
*/
|
||||||
var createPortOption = function (container, port, portType) {
|
var createPortOption = function (container, port, portType) {
|
||||||
var portId = nf.Common.escapeHtml(port.id);
|
var portId = common.escapeHtml(port.id);
|
||||||
var portContainer = $('<div class="remote-port-container"></div>').appendTo(container);
|
var portContainer = $('<div class="remote-port-container"></div>').appendTo(container);
|
||||||
var portContainerEditContainer = $('<div class="remote-port-edit-container"></div>').appendTo(portContainer);
|
var portContainerEditContainer = $('<div class="remote-port-edit-container"></div>').appendTo(portContainer);
|
||||||
var portContainerDetailsContainer = $('<div class="remote-port-details-container"></div>').appendTo(portContainer);
|
var portContainerDetailsContainer = $('<div class="remote-port-details-container"></div>').appendTo(portContainer);
|
||||||
|
@ -213,25 +250,25 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
var remoteProcessGroup = d3.select('#id-' + remoteProcessGroupId);
|
var remoteProcessGroup = d3.select('#id-' + remoteProcessGroupId);
|
||||||
|
|
||||||
// if can modify, support updating the remote group port
|
// if can modify, support updating the remote group port
|
||||||
if (nf.CanvasUtils.canModify(remoteProcessGroup)) {
|
if (canvasUtils.canModify(remoteProcessGroup)) {
|
||||||
// show the enabled transmission switch
|
// show the enabled transmission switch
|
||||||
var transmissionSwitch;
|
var transmissionSwitch;
|
||||||
if (port.connected === true) {
|
if (port.connected === true) {
|
||||||
if (port.transmitting === true) {
|
if (port.transmitting === true) {
|
||||||
transmissionSwitch = (nf.ng.Bridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
transmissionSwitch = (angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
transmissionSwitch.click();
|
transmissionSwitch.click();
|
||||||
} else {
|
} else {
|
||||||
if (port.exists === true) {
|
if (port.exists === true) {
|
||||||
transmissionSwitch = (nf.ng.Bridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
transmissionSwitch = (angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
} else {
|
} else {
|
||||||
(nf.ng.Bridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
(angularBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (port.transmitting === true) {
|
if (port.transmitting === true) {
|
||||||
(nf.ng.Bridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
(angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
} else {
|
} else {
|
||||||
(nf.ng.Bridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
(angularBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,14 +292,14 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
}
|
}
|
||||||
} else if (port.exists === false) {
|
} else if (port.exists === false) {
|
||||||
$('<div class="remote-port-removed"/>').appendTo(portContainerEditContainer).qtip($.extend({},
|
$('<div class="remote-port-removed"/>').appendTo(portContainerEditContainer).qtip($.extend({},
|
||||||
nf.Common.config.tooltipConfig,
|
common.config.tooltipConfig,
|
||||||
{
|
{
|
||||||
content: 'This port has been removed.'
|
content: 'This port has been removed.'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// only allow modifications to transmission when the swtich is defined
|
// only allow modifications to transmission when the swtich is defined
|
||||||
if (nf.Common.isDefinedAndNotNull(transmissionSwitch)) {
|
if (common.isDefinedAndNotNull(transmissionSwitch)) {
|
||||||
// create toggle for changing transmission state
|
// create toggle for changing transmission state
|
||||||
transmissionSwitch.click(function () {
|
transmissionSwitch.click(function () {
|
||||||
// get the component being edited
|
// get the component being edited
|
||||||
|
@ -277,7 +314,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
|
|
||||||
// create the remote process group details
|
// create the remote process group details
|
||||||
var remoteProcessGroupPortEntity = {
|
var remoteProcessGroupPortEntity = {
|
||||||
'revision': nf.Client.getRevision(remoteProcessGroupData),
|
'revision': client.getRevision(remoteProcessGroupData),
|
||||||
'remoteProcessGroupPort': {
|
'remoteProcessGroupPort': {
|
||||||
id: port.id,
|
id: port.id,
|
||||||
groupId: remoteProcessGroupId,
|
groupId: remoteProcessGroupId,
|
||||||
|
@ -312,7 +349,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('disabled-inactive-transmission').off('click');
|
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('disabled-inactive-transmission').off('click');
|
||||||
|
|
||||||
// hide the edit button
|
// hide the edit button
|
||||||
if (nf.Common.isDefinedAndNotNull(editRemotePort)) {
|
if (common.isDefinedAndNotNull(editRemotePort)) {
|
||||||
editRemotePort.hide();
|
editRemotePort.hide();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -322,7 +359,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-active-transmission');
|
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-active-transmission');
|
||||||
|
|
||||||
// hide the edit button
|
// hide the edit button
|
||||||
if (nf.Common.isDefinedAndNotNull(editRemotePort)) {
|
if (common.isDefinedAndNotNull(editRemotePort)) {
|
||||||
editRemotePort.hide();
|
editRemotePort.hide();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -330,7 +367,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-inactive-transmission');
|
transmissionSwitch.removeClass('enabled-active-transmission enabled-inactive-transmission').addClass('enabled-inactive-transmission');
|
||||||
|
|
||||||
// show the edit button
|
// show the edit button
|
||||||
if (nf.Common.isDefinedAndNotNull(editRemotePort)) {
|
if (common.isDefinedAndNotNull(editRemotePort)) {
|
||||||
editRemotePort.show();
|
editRemotePort.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,15 +380,15 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Remote Process Group Ports',
|
headerText: 'Remote Process Group Ports',
|
||||||
dialogContent: content
|
dialogContent: content
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -359,9 +396,9 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
} else {
|
} else {
|
||||||
// show the disabled transmission switch
|
// show the disabled transmission switch
|
||||||
if (port.transmitting === true) {
|
if (port.transmitting === true) {
|
||||||
(nf.ng.Bridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
(angularBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
} else {
|
} else {
|
||||||
(nf.ng.Bridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nf.ng.Bridge.rootScope)).appendTo(portContainerEditContainer);
|
(angularBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(angularBridge.rootScope)).appendTo(portContainerEditContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +410,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
$('<div class="clear"></div>').appendTo(portContainerDetailsContainer);
|
$('<div class="clear"></div>').appendTo(portContainerDetailsContainer);
|
||||||
|
|
||||||
// add the comments for this port
|
// add the comments for this port
|
||||||
if (nf.Common.isBlank(port.comments)) {
|
if (common.isBlank(port.comments)) {
|
||||||
$('<div class="remote-port-description unset">No description specified.</div>').appendTo(portContainerDetailsContainer);
|
$('<div class="remote-port-description unset">No description specified.</div>').appendTo(portContainerDetailsContainer);
|
||||||
} else {
|
} else {
|
||||||
$('<div class="remote-port-description"></div>').text(port.comments).appendTo(portContainerDetailsContainer);
|
$('<div class="remote-port-description"></div>').text(port.comments).appendTo(portContainerDetailsContainer);
|
||||||
|
@ -394,7 +431,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
'<div class="processor-setting concurrent-tasks-info fa fa-question-circle"></div>' +
|
'<div class="processor-setting concurrent-tasks-info fa fa-question-circle"></div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>').append(concurrentTasks).appendTo(concurrentTasksContainer).find('div.concurrent-tasks-info').qtip($.extend({},
|
'</div>').append(concurrentTasks).appendTo(concurrentTasksContainer).find('div.concurrent-tasks-info').qtip($.extend({},
|
||||||
nf.Common.config.tooltipConfig,
|
common.config.tooltipConfig,
|
||||||
{
|
{
|
||||||
content: 'The number of tasks that should be concurrently scheduled for this port.'
|
content: 'The number of tasks that should be concurrently scheduled for this port.'
|
||||||
}));
|
}));
|
||||||
|
@ -424,7 +461,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
portContainer.find('.ellipsis').ellipsis();
|
portContainer.find('.ellipsis').ellipsis();
|
||||||
|
|
||||||
// inform Angular app values have changed
|
// inform Angular app values have changed
|
||||||
nf.ng.Bridge.digest();
|
angularBridge.digest();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -469,7 +506,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
*/
|
*/
|
||||||
showPorts: function (selection) {
|
showPorts: function (selection) {
|
||||||
// if the specified component is a remote process group, load its properties
|
// if the specified component is a remote process group, load its properties
|
||||||
if (nf.CanvasUtils.isRemoteProcessGroup(selection)) {
|
if (canvasUtils.isRemoteProcessGroup(selection)) {
|
||||||
var selectionData = selection.datum();
|
var selectionData = selection.datum();
|
||||||
|
|
||||||
// load the properties for the specified component
|
// load the properties for the specified component
|
||||||
|
@ -481,7 +518,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
var remoteProcessGroup = response.component;
|
var remoteProcessGroup = response.component;
|
||||||
|
|
||||||
// set the model locally
|
// set the model locally
|
||||||
nf.RemoteProcessGroup.set(response);
|
nfRemoteProcessGroup.set(response);
|
||||||
|
|
||||||
// populate the port settings
|
// populate the port settings
|
||||||
$('#remote-process-group-ports-id').text(remoteProcessGroup.id);
|
$('#remote-process-group-ports-id').text(remoteProcessGroup.id);
|
||||||
|
@ -490,7 +527,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
|
|
||||||
// get the contents
|
// get the contents
|
||||||
var remoteProcessGroupContents = remoteProcessGroup.contents;
|
var remoteProcessGroupContents = remoteProcessGroup.contents;
|
||||||
if (nf.Common.isDefinedAndNotNull(remoteProcessGroupContents)) {
|
if (common.isDefinedAndNotNull(remoteProcessGroupContents)) {
|
||||||
var connectedInputPorts = [];
|
var connectedInputPorts = [];
|
||||||
var disconnectedInputPorts = [];
|
var disconnectedInputPorts = [];
|
||||||
|
|
||||||
|
@ -514,7 +551,7 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
createPortOption(inputPortContainer, inputPort, 'input');
|
createPortOption(inputPortContainer, inputPort, 'input');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nf.Common.isEmpty(connectedInputPorts) && nf.Common.isEmpty(disconnectedInputPorts)) {
|
if (common.isEmpty(connectedInputPorts) && common.isEmpty(disconnectedInputPorts)) {
|
||||||
$('<div class="unset"></div>').text("No ports to display").appendTo(inputPortContainer);
|
$('<div class="unset"></div>').text("No ports to display").appendTo(inputPortContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,15 +578,15 @@ nf.RemoteProcessGroupPorts = (function () {
|
||||||
createPortOption(outputPortContainer, outputPort, 'output');
|
createPortOption(outputPortContainer, outputPort, 'output');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (nf.Common.isEmpty(connectedOutputPorts) && nf.Common.isEmpty(disconnectedOutputPorts)) {
|
if (common.isEmpty(connectedOutputPorts) && common.isEmpty(disconnectedOutputPorts)) {
|
||||||
$('<div class="unset"></div>').text("No ports to display").appendTo(outputPortContainer);
|
$('<div class="unset"></div>').text("No ports to display").appendTo(outputPortContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// show the details
|
// show the details
|
||||||
$('#remote-process-group-ports').modal('show');
|
$('#remote-process-group-ports').modal('show');
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,9 +15,42 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.RemoteProcessGroup = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.Connection',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.CanvasUtils'],
|
||||||
|
function ($, d3, connection, common, client, canvasUtils) {
|
||||||
|
return (nf.RemoteProcessGroup = factory($, d3, connection, common, client, canvasUtils));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.RemoteProcessGroup =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Connection'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.CanvasUtils')));
|
||||||
|
} else {
|
||||||
|
nf.RemoteProcessGroup = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Connection,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.CanvasUtils);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, connection, common, client, canvasUtils) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfConnectable;
|
||||||
|
var nfDraggable;
|
||||||
|
var nfSelectable;
|
||||||
|
var nfContextMenu;
|
||||||
|
|
||||||
var PREVIEW_NAME_LENGTH = 30;
|
var PREVIEW_NAME_LENGTH = 30;
|
||||||
|
|
||||||
|
@ -55,7 +88,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
* @param {object} d
|
* @param {object} d
|
||||||
*/
|
*/
|
||||||
var getProcessGroupComments = function (d) {
|
var getProcessGroupComments = function (d) {
|
||||||
if (nf.Common.isBlank(d.component.comments)) {
|
if (common.isBlank(d.component.comments)) {
|
||||||
return 'No comments specified';
|
return 'No comments specified';
|
||||||
} else {
|
} else {
|
||||||
return d.component.comments;
|
return d.component.comments;
|
||||||
|
@ -90,7 +123,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
'class': 'remote-process-group component'
|
'class': 'remote-process-group component'
|
||||||
})
|
})
|
||||||
.classed('selected', selected)
|
.classed('selected', selected)
|
||||||
.call(nf.CanvasUtils.position);
|
.call(canvasUtils.position);
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
// body
|
// body
|
||||||
|
@ -145,7 +178,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// always support selection
|
// always support selection
|
||||||
remoteProcessGroup.call(nf.Selectable.activate).call(nf.ContextMenu.activate);
|
remoteProcessGroup.call(nfSelectable.activate).call(nfContextMenu.activate);
|
||||||
};
|
};
|
||||||
|
|
||||||
// attempt of space between component count and icon for process group contents
|
// attempt of space between component count and icon for process group contents
|
||||||
|
@ -178,7 +211,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
var details = remoteProcessGroup.select('g.remote-process-group-details');
|
var details = remoteProcessGroup.select('g.remote-process-group-details');
|
||||||
|
|
||||||
// update the component behavior as appropriate
|
// update the component behavior as appropriate
|
||||||
nf.CanvasUtils.editable(remoteProcessGroup);
|
canvasUtils.editable(remoteProcessGroup, nfConnectable, nfDraggable);
|
||||||
|
|
||||||
// if this processor is visible, render everything
|
// if this processor is visible, render everything
|
||||||
if (remoteProcessGroup.classed('visible')) {
|
if (remoteProcessGroup.classed('visible')) {
|
||||||
|
@ -499,7 +532,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
remoteProcessGroupUri.text(null).selectAll('title').remove();
|
remoteProcessGroupUri.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the remote process group name as necessary
|
// apply ellipsis to the remote process group name as necessary
|
||||||
nf.CanvasUtils.ellipsis(remoteProcessGroupUri, d.component.targetUris);
|
canvasUtils.ellipsis(remoteProcessGroupUri, d.component.targetUris);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return d.component.name;
|
return d.component.name;
|
||||||
});
|
});
|
||||||
|
@ -530,15 +563,15 @@ nf.RemoteProcessGroup = (function () {
|
||||||
|
|
||||||
// update the tip
|
// update the tip
|
||||||
tip.text(function () {
|
tip.text(function () {
|
||||||
if (d.component.targetSecure === true) {
|
if (d.component.targetSecure === true) {
|
||||||
return 'Site-to-Site is secure.';
|
return 'Site-to-Site is secure.';
|
||||||
} else {
|
} else {
|
||||||
return 'Site-to-Site is NOT secure.';
|
return 'Site-to-Site is NOT secure.';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the tooltip
|
// add the tooltip
|
||||||
nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
|
canvasUtils.canvasTooltip(tip, d3.select(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---------------
|
// ---------------
|
||||||
|
@ -554,9 +587,9 @@ nf.RemoteProcessGroup = (function () {
|
||||||
remoteProcessGroupComments.text(null).selectAll('tspan, title').remove();
|
remoteProcessGroupComments.text(null).selectAll('tspan, title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the port name as necessary
|
// apply ellipsis to the port name as necessary
|
||||||
nf.CanvasUtils.ellipsis(remoteProcessGroupComments, getProcessGroupComments(d));
|
canvasUtils.ellipsis(remoteProcessGroupComments, getProcessGroupComments(d));
|
||||||
}).classed('unset', function (d) {
|
}).classed('unset', function (d) {
|
||||||
return nf.Common.isBlank(d.component.comments);
|
return common.isBlank(d.component.comments);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return getProcessGroupComments(d);
|
return getProcessGroupComments(d);
|
||||||
});
|
});
|
||||||
|
@ -567,7 +600,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
|
|
||||||
details.select('text.remote-process-group-last-refresh')
|
details.select('text.remote-process-group-last-refresh')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
if (nf.Common.isDefinedAndNotNull(d.component.flowRefreshed)) {
|
if (common.isDefinedAndNotNull(d.component.flowRefreshed)) {
|
||||||
return d.component.flowRefreshed;
|
return d.component.flowRefreshed;
|
||||||
} else {
|
} else {
|
||||||
return 'Remote flow not current';
|
return 'Remote flow not current';
|
||||||
|
@ -583,7 +616,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
remoteProcessGroupName.text(null).selectAll('title').remove();
|
remoteProcessGroupName.text(null).selectAll('title').remove();
|
||||||
|
|
||||||
// apply ellipsis to the remote process group name as necessary
|
// apply ellipsis to the remote process group name as necessary
|
||||||
nf.CanvasUtils.ellipsis(remoteProcessGroupName, d.component.name);
|
canvasUtils.ellipsis(remoteProcessGroupName, d.component.name);
|
||||||
}).append('title').text(function (d) {
|
}).append('title').text(function (d) {
|
||||||
return d.component.name;
|
return d.component.name;
|
||||||
});
|
});
|
||||||
|
@ -647,13 +680,13 @@ nf.RemoteProcessGroup = (function () {
|
||||||
// sent count value
|
// sent count value
|
||||||
updated.select('text.remote-process-group-sent tspan.count')
|
updated.select('text.remote-process-group-sent tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.sent, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.sent, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// sent size value
|
// sent size value
|
||||||
updated.select('text.remote-process-group-sent tspan.size')
|
updated.select('text.remote-process-group-sent tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.sent, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.sent, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// sent ports value
|
// sent ports value
|
||||||
|
@ -671,13 +704,13 @@ nf.RemoteProcessGroup = (function () {
|
||||||
// received count value
|
// received count value
|
||||||
updated.select('text.remote-process-group-received tspan.count')
|
updated.select('text.remote-process-group-received tspan.count')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return nf.Common.substringBeforeFirst(d.status.aggregateSnapshot.received, ' ');
|
return common.substringBeforeFirst(d.status.aggregateSnapshot.received, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// received size value
|
// received size value
|
||||||
updated.select('text.remote-process-group-received tspan.size')
|
updated.select('text.remote-process-group-received tspan.size')
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
return ' ' + nf.Common.substringAfterFirst(d.status.aggregateSnapshot.received, ' ');
|
return ' ' + common.substringAfterFirst(d.status.aggregateSnapshot.received, ' ');
|
||||||
});
|
});
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
|
@ -690,7 +723,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
var icon = '';
|
var icon = '';
|
||||||
if (d.permissions.canRead) {
|
if (d.permissions.canRead) {
|
||||||
if (!nf.Common.isEmpty(d.component.authorizationIssues)) {
|
if (!common.isEmpty(d.component.authorizationIssues)) {
|
||||||
icon = '\uf071';
|
icon = '\uf071';
|
||||||
} else if (d.component.transmitting === true) {
|
} else if (d.component.transmitting === true) {
|
||||||
icon = '\uf140';
|
icon = '\uf140';
|
||||||
|
@ -703,7 +736,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
.attr('font-family', function (d) {
|
.attr('font-family', function (d) {
|
||||||
var family = '';
|
var family = '';
|
||||||
if (d.permissions.canRead) {
|
if (d.permissions.canRead) {
|
||||||
if (!nf.Common.isEmpty(d.component.authorizationIssues) || d.component.transmitting) {
|
if (!common.isEmpty(d.component.authorizationIssues) || d.component.transmitting) {
|
||||||
family = 'FontAwesome';
|
family = 'FontAwesome';
|
||||||
} else {
|
} else {
|
||||||
family = 'flowfont';
|
family = 'flowfont';
|
||||||
|
@ -712,20 +745,20 @@ nf.RemoteProcessGroup = (function () {
|
||||||
return family;
|
return family;
|
||||||
})
|
})
|
||||||
.classed('invalid', function (d) {
|
.classed('invalid', function (d) {
|
||||||
return d.permissions.canRead && !nf.Common.isEmpty(d.component.authorizationIssues);
|
return d.permissions.canRead && !common.isEmpty(d.component.authorizationIssues);
|
||||||
})
|
})
|
||||||
.classed('transmitting', function (d) {
|
.classed('transmitting', function (d) {
|
||||||
return d.permissions.canRead && nf.Common.isEmpty(d.component.authorizationIssues) && d.component.transmitting === true;
|
return d.permissions.canRead && common.isEmpty(d.component.authorizationIssues) && d.component.transmitting === true;
|
||||||
})
|
})
|
||||||
.classed('not-transmitting', function (d) {
|
.classed('not-transmitting', function (d) {
|
||||||
return d.permissions.canRead && nf.Common.isEmpty(d.component.authorizationIssues) && d.component.transmitting === false;
|
return d.permissions.canRead && common.isEmpty(d.component.authorizationIssues) && d.component.transmitting === false;
|
||||||
})
|
})
|
||||||
.each(function (d) {
|
.each(function (d) {
|
||||||
// get the tip
|
// get the tip
|
||||||
var tip = d3.select('#authorization-issues-' + d.id);
|
var tip = d3.select('#authorization-issues-' + d.id);
|
||||||
|
|
||||||
// if there are validation errors generate a tooltip
|
// if there are validation errors generate a tooltip
|
||||||
if (d.permissions.canRead && !nf.Common.isEmpty(d.component.authorizationIssues)) {
|
if (d.permissions.canRead && !common.isEmpty(d.component.authorizationIssues)) {
|
||||||
// create the tip if necessary
|
// create the tip if necessary
|
||||||
if (tip.empty()) {
|
if (tip.empty()) {
|
||||||
tip = d3.select('#remote-process-group-tooltips').append('div')
|
tip = d3.select('#remote-process-group-tooltips').append('div')
|
||||||
|
@ -737,16 +770,16 @@ nf.RemoteProcessGroup = (function () {
|
||||||
|
|
||||||
// update the tip
|
// update the tip
|
||||||
tip.html(function () {
|
tip.html(function () {
|
||||||
var list = nf.Common.formatUnorderedList(d.component.authorizationIssues);
|
var list = common.formatUnorderedList(d.component.authorizationIssues);
|
||||||
if (list === null || list.length === 0) {
|
if (list === null || list.length === 0) {
|
||||||
return '';
|
return '';
|
||||||
} else {
|
} else {
|
||||||
return $('<div></div>').append(list).html();
|
return $('<div></div>').append(list).html();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the tooltip
|
// add the tooltip
|
||||||
nf.CanvasUtils.canvasTooltip(tip, d3.select(this));
|
canvasUtils.canvasTooltip(tip, d3.select(this));
|
||||||
} else {
|
} else {
|
||||||
if (!tip.empty()) {
|
if (!tip.empty()) {
|
||||||
tip.remove();
|
tip.remove();
|
||||||
|
@ -762,7 +795,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
// active thread count
|
// active thread count
|
||||||
// -------------------
|
// -------------------
|
||||||
|
|
||||||
nf.CanvasUtils.activeThreadCount(remoteProcessGroup, d, function (off) {
|
canvasUtils.activeThreadCount(remoteProcessGroup, d, function (off) {
|
||||||
offset = off;
|
offset = off;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -771,10 +804,10 @@ nf.RemoteProcessGroup = (function () {
|
||||||
// ---------
|
// ---------
|
||||||
|
|
||||||
remoteProcessGroup.select('rect.bulletin-background').classed('has-bulletins', function () {
|
remoteProcessGroup.select('rect.bulletin-background').classed('has-bulletins', function () {
|
||||||
return !nf.Common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
return !common.isEmpty(d.status.aggregateSnapshot.bulletins);
|
||||||
});
|
});
|
||||||
|
|
||||||
nf.CanvasUtils.bulletins(remoteProcessGroup, d, function () {
|
canvasUtils.bulletins(remoteProcessGroup, d, function () {
|
||||||
return d3.select('#remote-process-group-tooltips');
|
return d3.select('#remote-process-group-tooltips');
|
||||||
}, offset);
|
}, offset);
|
||||||
});
|
});
|
||||||
|
@ -807,11 +840,16 @@ nf.RemoteProcessGroup = (function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfRemoteProcessGroup = {
|
||||||
/**
|
/**
|
||||||
* Initializes of the Process Group handler.
|
* Initializes of the Process Group handler.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (connectable, draggable, selectable, contextMenu) {
|
||||||
|
nfConnectable = connectable;
|
||||||
|
nfDraggable = draggable;
|
||||||
|
nfSelectable = selectable;
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
|
||||||
remoteProcessGroupMap = d3.map();
|
remoteProcessGroupMap = d3.map();
|
||||||
removedCache = d3.map();
|
removedCache = d3.map();
|
||||||
addedCache = d3.map();
|
addedCache = d3.map();
|
||||||
|
@ -832,8 +870,8 @@ nf.RemoteProcessGroup = (function () {
|
||||||
*/
|
*/
|
||||||
add: function (remoteProcessGroupEntities, options) {
|
add: function (remoteProcessGroupEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the current time
|
// get the current time
|
||||||
|
@ -854,7 +892,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
$.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) {
|
$.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) {
|
||||||
add(remoteProcessGroupEntity);
|
add(remoteProcessGroupEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(remoteProcessGroupEntities)) {
|
} else if (common.isDefinedAndNotNull(remoteProcessGroupEntities)) {
|
||||||
add(remoteProcessGroupEntities);
|
add(remoteProcessGroupEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +901,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
selection.enter().call(renderRemoteProcessGroups, selectAll);
|
selection.enter().call(renderRemoteProcessGroups, selectAll);
|
||||||
selection.call(updateRemoteProcessGroups);
|
selection.call(updateRemoteProcessGroups);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the graph with the specified remote process groups.
|
* Populates the graph with the specified remote process groups.
|
||||||
*
|
*
|
||||||
|
@ -873,16 +911,16 @@ nf.RemoteProcessGroup = (function () {
|
||||||
set: function (remoteProcessGroupEntities, options) {
|
set: function (remoteProcessGroupEntities, options) {
|
||||||
var selectAll = false;
|
var selectAll = false;
|
||||||
var transition = false;
|
var transition = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(options)) {
|
if (common.isDefinedAndNotNull(options)) {
|
||||||
selectAll = nf.Common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
selectAll = common.isDefinedAndNotNull(options.selectAll) ? options.selectAll : selectAll;
|
||||||
transition = nf.Common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
transition = common.isDefinedAndNotNull(options.transition) ? options.transition : transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
var set = function (proposedRemoteProcessGroupEntity) {
|
var set = function (proposedRemoteProcessGroupEntity) {
|
||||||
var currentRemoteProcessGroupEntity = remoteProcessGroupMap.get(proposedRemoteProcessGroupEntity.id);
|
var currentRemoteProcessGroupEntity = remoteProcessGroupMap.get(proposedRemoteProcessGroupEntity.id);
|
||||||
|
|
||||||
// set the remote process group if appropriate due to revision and wasn't previously removed
|
// set the remote process group if appropriate due to revision and wasn't previously removed
|
||||||
if (nf.Client.isNewerRevision(currentRemoteProcessGroupEntity, proposedRemoteProcessGroupEntity) && !removedCache.has(proposedRemoteProcessGroupEntity.id)) {
|
if (client.isNewerRevision(currentRemoteProcessGroupEntity, proposedRemoteProcessGroupEntity) && !removedCache.has(proposedRemoteProcessGroupEntity.id)) {
|
||||||
remoteProcessGroupMap.set(proposedRemoteProcessGroupEntity.id, $.extend({
|
remoteProcessGroupMap.set(proposedRemoteProcessGroupEntity.id, $.extend({
|
||||||
type: 'RemoteProcessGroup',
|
type: 'RemoteProcessGroup',
|
||||||
dimensions: dimensions
|
dimensions: dimensions
|
||||||
|
@ -906,14 +944,14 @@ nf.RemoteProcessGroup = (function () {
|
||||||
$.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) {
|
$.each(remoteProcessGroupEntities, function (_, remoteProcessGroupEntity) {
|
||||||
set(remoteProcessGroupEntity);
|
set(remoteProcessGroupEntity);
|
||||||
});
|
});
|
||||||
} else if (nf.Common.isDefinedAndNotNull(remoteProcessGroupEntities)) {
|
} else if (common.isDefinedAndNotNull(remoteProcessGroupEntities)) {
|
||||||
set(remoteProcessGroupEntities);
|
set(remoteProcessGroupEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the selection and handle all new remote process groups
|
// apply the selection and handle all new remote process groups
|
||||||
var selection = select();
|
var selection = select();
|
||||||
selection.enter().call(renderRemoteProcessGroups, selectAll);
|
selection.enter().call(renderRemoteProcessGroups, selectAll);
|
||||||
selection.call(updateRemoteProcessGroups).call(nf.CanvasUtils.position, transition);
|
selection.call(updateRemoteProcessGroups).call(canvasUtils.position, transition);
|
||||||
selection.exit().call(removeRemoteProcessGroups);
|
selection.exit().call(removeRemoteProcessGroups);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -924,7 +962,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
get: function (id) {
|
get: function (id) {
|
||||||
if (nf.Common.isUndefined(id)) {
|
if (common.isUndefined(id)) {
|
||||||
return remoteProcessGroupMap.values();
|
return remoteProcessGroupMap.values();
|
||||||
} else {
|
} else {
|
||||||
return remoteProcessGroupMap.get(id);
|
return remoteProcessGroupMap.get(id);
|
||||||
|
@ -938,7 +976,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
* @param {string} id Optional
|
* @param {string} id Optional
|
||||||
*/
|
*/
|
||||||
refresh: function (id) {
|
refresh: function (id) {
|
||||||
if (nf.Common.isDefinedAndNotNull(id)) {
|
if (common.isDefinedAndNotNull(id)) {
|
||||||
d3.select('#id-' + id).call(updateRemoteProcessGroups);
|
d3.select('#id-' + id).call(updateRemoteProcessGroups);
|
||||||
} else {
|
} else {
|
||||||
d3.selectAll('g.remote-process-group').call(updateRemoteProcessGroups);
|
d3.selectAll('g.remote-process-group').call(updateRemoteProcessGroups);
|
||||||
|
@ -966,13 +1004,13 @@ nf.RemoteProcessGroup = (function () {
|
||||||
url: remoteProcessGroupEntity.uri,
|
url: remoteProcessGroupEntity.uri,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
nf.RemoteProcessGroup.set(response);
|
nfRemoteProcessGroup.set(response);
|
||||||
|
|
||||||
// reload the group's connections
|
// reload the group's connections
|
||||||
var connections = nf.Connection.getComponentConnections(id);
|
var connections = connection.getComponentConnections(id);
|
||||||
$.each(connections, function (_, connection) {
|
$.each(connections, function (_, connection) {
|
||||||
if (connection.permissions.canRead) {
|
if (connection.permissions.canRead) {
|
||||||
nf.Connection.reload(connection.id);
|
connection.reload(connection.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -985,7 +1023,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
* @param {string} id The id
|
* @param {string} id The id
|
||||||
*/
|
*/
|
||||||
position: function (id) {
|
position: function (id) {
|
||||||
d3.select('#id-' + id).call(nf.CanvasUtils.position);
|
d3.select('#id-' + id).call(canvasUtils.position);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1014,7 +1052,7 @@ nf.RemoteProcessGroup = (function () {
|
||||||
* Removes all remote process groups.
|
* Removes all remote process groups.
|
||||||
*/
|
*/
|
||||||
removeAll: function () {
|
removeAll: function () {
|
||||||
nf.RemoteProcessGroup.remove(remoteProcessGroupMap.keys());
|
nfRemoteProcessGroup.remove(remoteProcessGroupMap.keys());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1035,4 +1073,6 @@ nf.RemoteProcessGroup = (function () {
|
||||||
expire(removedCache);
|
expire(removedCache);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfRemoteProcessGroup;
|
||||||
|
}));
|
|
@ -15,9 +15,48 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.ReportingTask = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.ControllerService',
|
||||||
|
'nf.ControllerServices',
|
||||||
|
'nf.UniversalCapture',
|
||||||
|
'nf.CustomUi'],
|
||||||
|
function ($, errorHandler, common, dialog, client, controllerService, controllerServices, universalCapture, customUi) {
|
||||||
|
return (nf.ReportingTask = factory($, errorHandler, common, dialog, client, controllerService, controllerServices, universalCapture, customUi));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.ReportingTask =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.ControllerService'),
|
||||||
|
require('nf.ControllerServices'),
|
||||||
|
require('nf.UniversalCapture'),
|
||||||
|
require('nf.CustomUi')));
|
||||||
|
} else {
|
||||||
|
nf.ReportingTask = factory(root.$,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.ControllerService,
|
||||||
|
root.nf.ControllerServices,
|
||||||
|
root.nf.UniversalCapture,
|
||||||
|
root.nf.CustomUi);
|
||||||
|
}
|
||||||
|
}(this, function ($, errorHandler, common, dialog, client, controllerService, controllerServices, universalCapture, customUi) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var nfSettings;
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
edit: 'edit',
|
edit: 'edit',
|
||||||
|
@ -38,7 +77,7 @@ nf.ReportingTask = (function () {
|
||||||
var getControllerServicesTable = function () {
|
var getControllerServicesTable = function () {
|
||||||
return $('#controller-services-table');
|
return $('#controller-services-table');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle any expected reporting task configuration errors.
|
* Handle any expected reporting task configuration errors.
|
||||||
*
|
*
|
||||||
|
@ -54,15 +93,15 @@ nf.ReportingTask = (function () {
|
||||||
if (errors.length === 1) {
|
if (errors.length === 1) {
|
||||||
content = $('<span></span>').text(errors[0]);
|
content = $('<span></span>').text(errors[0]);
|
||||||
} else {
|
} else {
|
||||||
content = nf.Common.formatUnorderedList(errors);
|
content = common.formatUnorderedList(errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: content,
|
dialogContent: content,
|
||||||
headerText: 'Reporting Task'
|
headerText: 'Reporting Task'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.ErrorHandler.handleAjaxError(xhr, status, error);
|
errorHandler.handleAjaxError(xhr, status, error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,7 +141,7 @@ nf.ReportingTask = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the scheduling period
|
// check the scheduling period
|
||||||
if (nf.Common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (entity.component['schedulingPeriod'] + '')) {
|
if (common.isDefinedAndNotNull(schedulingPeriod) && schedulingPeriod.val() !== (entity.component['schedulingPeriod'] + '')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,13 +204,13 @@ nf.ReportingTask = (function () {
|
||||||
var errors = [];
|
var errors = [];
|
||||||
var reportingTask = details['component'];
|
var reportingTask = details['component'];
|
||||||
|
|
||||||
if (nf.Common.isBlank(reportingTask['schedulingPeriod'])) {
|
if (common.isBlank(reportingTask['schedulingPeriod'])) {
|
||||||
errors.push('Run schedule must be specified');
|
errors.push('Run schedule must be specified');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors.length > 0) {
|
if (errors.length > 0) {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
dialogContent: nf.Common.formatUnorderedList(errors),
|
dialogContent: common.formatUnorderedList(errors),
|
||||||
headerText: 'Reporting Task'
|
headerText: 'Reporting Task'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
@ -202,7 +241,7 @@ nf.ReportingTask = (function () {
|
||||||
*/
|
*/
|
||||||
var setRunning = function (reportingTaskEntity, running) {
|
var setRunning = function (reportingTaskEntity, running) {
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision(reportingTaskEntity),
|
'revision': client.getRevision(reportingTaskEntity),
|
||||||
'component': {
|
'component': {
|
||||||
'id': reportingTaskEntity.id,
|
'id': reportingTaskEntity.id,
|
||||||
'state': running === true ? 'RUNNING' : 'STOPPED'
|
'state': running === true ? 'RUNNING' : 'STOPPED'
|
||||||
|
@ -218,8 +257,8 @@ nf.ReportingTask = (function () {
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// update the task
|
// update the task
|
||||||
renderReportingTask(response);
|
renderReportingTask(response);
|
||||||
nf.ControllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
|
controllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,7 +272,7 @@ nf.ReportingTask = (function () {
|
||||||
// determine if changes have been made
|
// determine if changes have been made
|
||||||
if (isSaveRequired()) {
|
if (isSaveRequired()) {
|
||||||
// see if those changes should be saved
|
// see if those changes should be saved
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Save',
|
headerText: 'Save',
|
||||||
dialogContent: 'Save changes before going to this Controller Service?',
|
dialogContent: 'Save changes before going to this Controller Service?',
|
||||||
noHandler: function () {
|
noHandler: function () {
|
||||||
|
@ -265,7 +304,7 @@ nf.ReportingTask = (function () {
|
||||||
|
|
||||||
// ensure details are valid as far as we can tell
|
// ensure details are valid as far as we can tell
|
||||||
if (validateDetails(updatedReportingTask)) {
|
if (validateDetails(updatedReportingTask)) {
|
||||||
updatedReportingTask['revision'] = nf.Client.getRevision(reportingTaskEntity);
|
updatedReportingTask['revision'] = client.getRevision(reportingTaskEntity);
|
||||||
|
|
||||||
// update the selected component
|
// update the selected component
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
|
@ -299,14 +338,16 @@ nf.ReportingTask = (function () {
|
||||||
propertyName: propertyName
|
propertyName: propertyName
|
||||||
},
|
},
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfReportingTask = {
|
||||||
/**
|
/**
|
||||||
* Initializes the reporting task configuration dialog.
|
* Initializes the reporting task configuration dialog.
|
||||||
*/
|
*/
|
||||||
init: function () {
|
init: function (settings) {
|
||||||
|
nfSettings = settings;
|
||||||
|
|
||||||
// initialize the configuration dialog tabs
|
// initialize the configuration dialog tabs
|
||||||
$('#reporting-task-configuration-tabs').tabbs({
|
$('#reporting-task-configuration-tabs').tabbs({
|
||||||
tabStyle: 'tab',
|
tabStyle: 'tab',
|
||||||
|
@ -324,7 +365,7 @@ nf.ReportingTask = (function () {
|
||||||
}],
|
}],
|
||||||
select: function () {
|
select: function () {
|
||||||
// remove all property detail dialogs
|
// remove all property detail dialogs
|
||||||
nf.UniversalCapture.removeAllPropertyDetailDialogs();
|
universalCapture.removeAllPropertyDetailDialogs();
|
||||||
|
|
||||||
// update the property table size in case this is the first time its rendered
|
// update the property table size in case this is the first time its rendered
|
||||||
if ($(this).text() === 'Properties') {
|
if ($(this).text() === 'Properties') {
|
||||||
|
@ -349,13 +390,13 @@ nf.ReportingTask = (function () {
|
||||||
$('#reporting-task-properties').propertytable('clear');
|
$('#reporting-task-properties').propertytable('clear');
|
||||||
|
|
||||||
// clear the comments
|
// clear the comments
|
||||||
nf.Common.clearField('read-only-reporting-task-comments');
|
common.clearField('read-only-reporting-task-comments');
|
||||||
|
|
||||||
// removed the cached reporting task details
|
// removed the cached reporting task details
|
||||||
$('#reporting-task-configuration').removeData('reportingTaskDetails');
|
$('#reporting-task-configuration').removeData('reportingTaskDetails');
|
||||||
},
|
},
|
||||||
open: function () {
|
open: function () {
|
||||||
nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
|
common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -366,8 +407,8 @@ nf.ReportingTask = (function () {
|
||||||
supportsGoTo: true,
|
supportsGoTo: true,
|
||||||
dialogContainer: '#new-reporting-task-property-container',
|
dialogContainer: '#new-reporting-task-property-container',
|
||||||
descriptorDeferred: getReportingTaskPropertyDescriptor,
|
descriptorDeferred: getReportingTaskPropertyDescriptor,
|
||||||
controllerServiceCreatedDeferred: function(response){
|
controllerServiceCreatedDeferred: function (response) {
|
||||||
return nf.ControllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table'));
|
return controllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table'));
|
||||||
},
|
},
|
||||||
goToServiceDeferred: goToServiceFromProperty
|
goToServiceDeferred: goToServiceFromProperty
|
||||||
});
|
});
|
||||||
|
@ -391,8 +432,8 @@ nf.ReportingTask = (function () {
|
||||||
supportsGoTo: true,
|
supportsGoTo: true,
|
||||||
dialogContainer: '#new-reporting-task-property-container',
|
dialogContainer: '#new-reporting-task-property-container',
|
||||||
descriptorDeferred: getReportingTaskPropertyDescriptor,
|
descriptorDeferred: getReportingTaskPropertyDescriptor,
|
||||||
controllerServiceCreatedDeferred: function(response){
|
controllerServiceCreatedDeferred: function (response) {
|
||||||
return nf.ControllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table'));
|
return controllerServices.loadControllerServices(controllerServicesUri, $('#controller-services-table'));
|
||||||
},
|
},
|
||||||
goToServiceDeferred: goToServiceFromProperty
|
goToServiceDeferred: goToServiceFromProperty
|
||||||
});
|
});
|
||||||
|
@ -434,8 +475,8 @@ nf.ReportingTask = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate the reporting task settings
|
// populate the reporting task settings
|
||||||
nf.Common.populateField('reporting-task-id', reportingTask['id']);
|
common.populateField('reporting-task-id', reportingTask['id']);
|
||||||
nf.Common.populateField('reporting-task-type', nf.Common.substringAfterLast(reportingTask['type'], '.'));
|
common.populateField('reporting-task-type', common.substringAfterLast(reportingTask['type'], '.'));
|
||||||
$('#reporting-task-name').val(reportingTask['name']);
|
$('#reporting-task-name').val(reportingTask['name']);
|
||||||
$('#reporting-task-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(reportingTaskEnableStyle);
|
$('#reporting-task-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(reportingTaskEnableStyle);
|
||||||
$('#reporting-task-comments').val(reportingTask['comments']);
|
$('#reporting-task-comments').val(reportingTask['comments']);
|
||||||
|
@ -489,10 +530,10 @@ nf.ReportingTask = (function () {
|
||||||
// close all fields currently being edited
|
// close all fields currently being edited
|
||||||
$('#reporting-task-properties').propertytable('saveRow');
|
$('#reporting-task-properties').propertytable('saveRow');
|
||||||
|
|
||||||
// save the reporting task
|
// save the reporting task
|
||||||
saveReportingTask(reportingTaskEntity).done(function (response) {
|
saveReportingTask(reportingTaskEntity).done(function (response) {
|
||||||
// reload the reporting task
|
// reload the reporting task
|
||||||
nf.ControllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
|
controllerService.reloadReferencedServices(getControllerServicesTable(), response.component);
|
||||||
|
|
||||||
// close the details panel
|
// close the details panel
|
||||||
$('#reporting-task-configuration').modal('hide');
|
$('#reporting-task-configuration').modal('hide');
|
||||||
|
@ -515,7 +556,7 @@ nf.ReportingTask = (function () {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// determine if we should show the advanced button
|
// determine if we should show the advanced button
|
||||||
if (nf.Common.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') {
|
if (common.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
buttonText: 'Advanced',
|
buttonText: 'Advanced',
|
||||||
clazz: 'fa fa-cog button-icon',
|
clazz: 'fa fa-cog button-icon',
|
||||||
|
@ -534,14 +575,14 @@ nf.ReportingTask = (function () {
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// show the custom ui
|
// show the custom ui
|
||||||
nf.CustomUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, true).done(function () {
|
customUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, true).done(function () {
|
||||||
// once the custom ui is closed, reload the reporting task
|
// once the custom ui is closed, reload the reporting task
|
||||||
nf.ReportingTask.reload(reportingTaskEntity.id).done(function (response) {
|
nfReportingTask.reload(reportingTaskEntity.id).done(function (response) {
|
||||||
nf.ControllerService.reloadReferencedServices(getControllerServicesTable(), response.reportingTask);
|
controllerService.reloadReferencedServices(getControllerServicesTable(), response.reportingTask);
|
||||||
});
|
});
|
||||||
|
|
||||||
// show the settings
|
// show the settings
|
||||||
nf.Settings.showSettings();
|
nfSettings.showSettings();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -551,7 +592,7 @@ nf.ReportingTask = (function () {
|
||||||
// determine if changes have been made
|
// determine if changes have been made
|
||||||
if (isSaveRequired()) {
|
if (isSaveRequired()) {
|
||||||
// see if those changes should be saved
|
// see if those changes should be saved
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Save',
|
headerText: 'Save',
|
||||||
dialogContent: 'Save changes before opening the advanced configuration?',
|
dialogContent: 'Save changes before opening the advanced configuration?',
|
||||||
noHandler: openCustomUi,
|
noHandler: openCustomUi,
|
||||||
|
@ -583,7 +624,7 @@ nf.ReportingTask = (function () {
|
||||||
$('#reporting-task-configuration').modal('show');
|
$('#reporting-task-configuration').modal('show');
|
||||||
|
|
||||||
$('#reporting-task-properties').propertytable('resetTableSize');
|
$('#reporting-task-properties').propertytable('resetTableSize');
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -632,10 +673,10 @@ nf.ReportingTask = (function () {
|
||||||
var reportingTaskHistory = historyResponse[0].componentHistory;
|
var reportingTaskHistory = historyResponse[0].componentHistory;
|
||||||
|
|
||||||
// populate the reporting task settings
|
// populate the reporting task settings
|
||||||
nf.Common.populateField('reporting-task-id', reportingTask['id']);
|
common.populateField('reporting-task-id', reportingTask['id']);
|
||||||
nf.Common.populateField('reporting-task-type', nf.Common.substringAfterLast(reportingTask['type'], '.'));
|
common.populateField('reporting-task-type', common.substringAfterLast(reportingTask['type'], '.'));
|
||||||
nf.Common.populateField('read-only-reporting-task-name', reportingTask['name']);
|
common.populateField('read-only-reporting-task-name', reportingTask['name']);
|
||||||
nf.Common.populateField('read-only-reporting-task-comments', reportingTask['comments']);
|
common.populateField('read-only-reporting-task-comments', reportingTask['comments']);
|
||||||
|
|
||||||
// make the scheduling strategy human readable
|
// make the scheduling strategy human readable
|
||||||
var schedulingStrategy = reportingTask['schedulingStrategy'];
|
var schedulingStrategy = reportingTask['schedulingStrategy'];
|
||||||
|
@ -644,8 +685,8 @@ nf.ReportingTask = (function () {
|
||||||
} else {
|
} else {
|
||||||
schedulingStrategy = "Timer driven";
|
schedulingStrategy = "Timer driven";
|
||||||
}
|
}
|
||||||
nf.Common.populateField('read-only-reporting-task-scheduling-strategy', schedulingStrategy);
|
common.populateField('read-only-reporting-task-scheduling-strategy', schedulingStrategy);
|
||||||
nf.Common.populateField('read-only-reporting-task-scheduling-period', reportingTask['schedulingPeriod']);
|
common.populateField('read-only-reporting-task-scheduling-period', reportingTask['schedulingPeriod']);
|
||||||
|
|
||||||
var buttons = [{
|
var buttons = [{
|
||||||
buttonText: 'Ok',
|
buttonText: 'Ok',
|
||||||
|
@ -663,7 +704,7 @@ nf.ReportingTask = (function () {
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// determine if we should show the advanced button
|
// determine if we should show the advanced button
|
||||||
if (nf.Common.isDefinedAndNotNull(nf.CustomUi) && nf.Common.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') {
|
if (common.isDefinedAndNotNull(customUi) && common.isDefinedAndNotNull(reportingTask.customUiUrl) && reportingTask.customUiUrl !== '') {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
buttonText: 'Advanced',
|
buttonText: 'Advanced',
|
||||||
clazz: 'fa fa-cog button-icon',
|
clazz: 'fa fa-cog button-icon',
|
||||||
|
@ -681,8 +722,8 @@ nf.ReportingTask = (function () {
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// show the custom ui
|
// show the custom ui
|
||||||
nf.CustomUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, false).done(function() {
|
customUi.showCustomUi(reportingTaskEntity, reportingTask.customUiUrl, false).done(function () {
|
||||||
nf.Settings.showSettings();
|
nfSettings.showSettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -736,9 +777,9 @@ nf.ReportingTask = (function () {
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
renderReportingTask(response);
|
renderReportingTask(response);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts the user before attempting to delete the specified reporting task.
|
* Prompts the user before attempting to delete the specified reporting task.
|
||||||
*
|
*
|
||||||
|
@ -746,11 +787,11 @@ nf.ReportingTask = (function () {
|
||||||
*/
|
*/
|
||||||
promptToDeleteReportingTask: function (reportingTaskEntity) {
|
promptToDeleteReportingTask: function (reportingTaskEntity) {
|
||||||
// prompt for deletion
|
// prompt for deletion
|
||||||
nf.Dialog.showYesNoDialog({
|
dialog.showYesNoDialog({
|
||||||
headerText: 'Delete Reporting Task',
|
headerText: 'Delete Reporting Task',
|
||||||
dialogContent: 'Delete reporting task \'' + nf.Common.escapeHtml(reportingTaskEntity.component.name) + '\'?',
|
dialogContent: 'Delete reporting task \'' + common.escapeHtml(reportingTaskEntity.component.name) + '\'?',
|
||||||
yesHandler: function () {
|
yesHandler: function () {
|
||||||
nf.ReportingTask.remove(reportingTaskEntity);
|
nfReportingTask.remove(reportingTaskEntity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -763,7 +804,7 @@ nf.ReportingTask = (function () {
|
||||||
remove: function (reportingTaskEntity) {
|
remove: function (reportingTaskEntity) {
|
||||||
// prompt for removal?
|
// prompt for removal?
|
||||||
|
|
||||||
var revision = nf.Client.getRevision(reportingTaskEntity);
|
var revision = client.getRevision(reportingTaskEntity);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
url: reportingTaskEntity.uri + '?' + $.param({
|
url: reportingTaskEntity.uri + '?' + $.param({
|
||||||
|
@ -776,7 +817,9 @@ nf.ReportingTask = (function () {
|
||||||
var reportingTaskGrid = $('#reporting-tasks-table').data('gridInstance');
|
var reportingTaskGrid = $('#reporting-tasks-table').data('gridInstance');
|
||||||
var reportingTaskData = reportingTaskGrid.getData();
|
var reportingTaskData = reportingTaskGrid.getData();
|
||||||
reportingTaskData.deleteItem(reportingTaskEntity.id);
|
reportingTaskData.deleteItem(reportingTaskEntity.id);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfReportingTask;
|
||||||
|
}));
|
||||||
|
|
|
@ -15,18 +15,34 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Selectable = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['d3',
|
||||||
|
'nf.ng.Bridge',
|
||||||
|
'nf.ContextMenu'],
|
||||||
|
function (d3, angularBridge, contextMenu) {
|
||||||
|
return (nf.Selectable = factory(d3, angularBridge, contextMenu));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Selectable =
|
||||||
|
factory(require('d3'),
|
||||||
|
require('nf.ng.Bridge'),
|
||||||
|
require('nf.ContextMenu')));
|
||||||
|
} else {
|
||||||
|
nf.Selectable = factory(root.d3,
|
||||||
|
root.nf.ng.Bridge,
|
||||||
|
root.nf.ContextMenu);
|
||||||
|
}
|
||||||
|
}(this, function (d3, angularBridge, contextMenu) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
return {
|
var nfSelectable = {
|
||||||
init: function () {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
select: function (g) {
|
select: function (g) {
|
||||||
// hide any context menus as necessary
|
// hide any context menus as necessary
|
||||||
nf.ContextMenu.hide();
|
contextMenu.hide();
|
||||||
|
|
||||||
// only need to update selection if necessary
|
// only need to update selection if necessary
|
||||||
if (!g.classed('selected')) {
|
if (!g.classed('selected')) {
|
||||||
|
@ -44,18 +60,26 @@ nf.Selectable = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// inform Angular app that values have changed
|
// inform Angular app that values have changed since the
|
||||||
nf.ng.Bridge.digest();
|
// enabled operate palette buttons are based off of the selection
|
||||||
|
angularBridge.digest();
|
||||||
|
|
||||||
// stop propagation
|
// stop propagation
|
||||||
d3.event.stopPropagation();
|
d3.event.stopPropagation();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates the select behavior for the components in the specified selection.
|
||||||
|
*
|
||||||
|
* @param {selection} components
|
||||||
|
*/
|
||||||
activate: function (components) {
|
activate: function (components) {
|
||||||
components.on('mousedown.selection', function () {
|
components.on('mousedown.selection', function () {
|
||||||
// get the clicked component to update selection
|
// get the clicked component to update selection
|
||||||
nf.Selectable.select(d3.select(this));
|
nfSelectable.select(d3.select(this));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfSelectable;
|
||||||
|
}));
|
|
@ -15,9 +15,59 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, Slick, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'Slick',
|
||||||
|
'd3',
|
||||||
|
'nf.Client',
|
||||||
|
'nf.Dialog',
|
||||||
|
'nf.Common',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.ControllerServices',
|
||||||
|
'nf.ErrorHandler',
|
||||||
|
'nf.ReportingTask',
|
||||||
|
'nf.Shell',
|
||||||
|
'nf.ComponentState',
|
||||||
|
'nf.PolicyManagement'],
|
||||||
|
function ($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement) {
|
||||||
|
return (nf.Settings = factory($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Settings =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('Slick'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.Client'),
|
||||||
|
require('nf.Dialog'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.ControllerServices'),
|
||||||
|
require('nf.ErrorHandler'),
|
||||||
|
require('nf.ReportingTask'),
|
||||||
|
require('nf.Shell'),
|
||||||
|
require('nf.ComponentState'),
|
||||||
|
require('nf.PolicyManagement')));
|
||||||
|
} else {
|
||||||
|
nf.Settings = factory(root.$,
|
||||||
|
root.Slick,
|
||||||
|
root.d3,
|
||||||
|
root.nf.Client,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.ControllerServices,
|
||||||
|
root.nf.ErrorHandler,
|
||||||
|
root.nf.ReportingTask,
|
||||||
|
root.nf.Shell,
|
||||||
|
root.nf.ComponentState,
|
||||||
|
root.nf.PolicyManagement);
|
||||||
|
}
|
||||||
|
}(this, function ($, Slick, d3, client, dialog, common, canvasUtils, controllerServices, errorHandler, reportingTask, shell, componentState, policyManagement) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
nf.Settings = (function () {
|
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
urls: {
|
urls: {
|
||||||
|
@ -57,7 +107,7 @@ nf.Settings = (function () {
|
||||||
// marshal the configuration details
|
// marshal the configuration details
|
||||||
var configuration = marshalConfiguration();
|
var configuration = marshalConfiguration();
|
||||||
var entity = {
|
var entity = {
|
||||||
'revision': nf.Client.getRevision({
|
'revision': client.getRevision({
|
||||||
'revision': {
|
'revision': {
|
||||||
'version': version
|
'version': version
|
||||||
}
|
}
|
||||||
|
@ -74,7 +124,7 @@ nf.Settings = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
// close the settings dialog
|
// close the settings dialog
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Settings',
|
headerText: 'Settings',
|
||||||
dialogContent: 'Settings successfully applied.'
|
dialogContent: 'Settings successfully applied.'
|
||||||
});
|
});
|
||||||
|
@ -83,7 +133,7 @@ nf.Settings = (function () {
|
||||||
$('#settings-save').off('click').on('click', function () {
|
$('#settings-save').off('click').on('click', function () {
|
||||||
saveSettings(response.revision.version);
|
saveSettings(response.revision.version);
|
||||||
});
|
});
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +211,7 @@ nf.Settings = (function () {
|
||||||
* @param item reporting task type
|
* @param item reporting task type
|
||||||
*/
|
*/
|
||||||
var isSelectable = function (item) {
|
var isSelectable = function (item) {
|
||||||
return nf.Common.isBlank(item.usageRestriction) || nf.Common.canAccessRestrictedComponents();
|
return common.isBlank(item.usageRestriction) || common.canAccessRestrictedComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,7 +247,7 @@ nf.Settings = (function () {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return nf.Common.substringAfterLast(dataContext.component.type, '.');
|
return common.substringAfterLast(dataContext.component.type, '.');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -209,41 +259,41 @@ nf.Settings = (function () {
|
||||||
var sort = function (sortDetails, data) {
|
var sort = function (sortDetails, data) {
|
||||||
// defines a function for sorting
|
// defines a function for sorting
|
||||||
var comparer = function (a, b) {
|
var comparer = function (a, b) {
|
||||||
if(a.permissions.canRead && b.permissions.canRead) {
|
if (a.permissions.canRead && b.permissions.canRead) {
|
||||||
if (sortDetails.columnId === 'moreDetails') {
|
if (sortDetails.columnId === 'moreDetails') {
|
||||||
var aBulletins = 0;
|
var aBulletins = 0;
|
||||||
if (!nf.Common.isEmpty(a.bulletins)) {
|
if (!common.isEmpty(a.bulletins)) {
|
||||||
aBulletins = a.bulletins.length;
|
aBulletins = a.bulletins.length;
|
||||||
}
|
}
|
||||||
var bBulletins = 0;
|
var bBulletins = 0;
|
||||||
if (!nf.Common.isEmpty(b.bulletins)) {
|
if (!common.isEmpty(b.bulletins)) {
|
||||||
bBulletins = b.bulletins.length;
|
bBulletins = b.bulletins.length;
|
||||||
}
|
}
|
||||||
return aBulletins - bBulletins;
|
return aBulletins - bBulletins;
|
||||||
} else if (sortDetails.columnId === 'type') {
|
} else if (sortDetails.columnId === 'type') {
|
||||||
var aType = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? nf.Common.substringAfterLast(a.component[sortDetails.columnId], '.') : '';
|
var aType = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? common.substringAfterLast(a.component[sortDetails.columnId], '.') : '';
|
||||||
var bType = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? nf.Common.substringAfterLast(b.component[sortDetails.columnId], '.') : '';
|
var bType = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? common.substringAfterLast(b.component[sortDetails.columnId], '.') : '';
|
||||||
return aType === bType ? 0 : aType > bType ? 1 : -1;
|
return aType === bType ? 0 : aType > bType ? 1 : -1;
|
||||||
} else if (sortDetails.columnId === 'state') {
|
} else if (sortDetails.columnId === 'state') {
|
||||||
var aState = 'Invalid';
|
var aState = 'Invalid';
|
||||||
if (nf.Common.isEmpty(a.component.validationErrors)) {
|
if (common.isEmpty(a.component.validationErrors)) {
|
||||||
aState = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
aState = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
||||||
}
|
}
|
||||||
var bState = 'Invalid';
|
var bState = 'Invalid';
|
||||||
if (nf.Common.isEmpty(b.component.validationErrors)) {
|
if (common.isEmpty(b.component.validationErrors)) {
|
||||||
bState = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
bState = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
||||||
}
|
}
|
||||||
return aState === bState ? 0 : aState > bState ? 1 : -1;
|
return aState === bState ? 0 : aState > bState ? 1 : -1;
|
||||||
} else {
|
} else {
|
||||||
var aString = nf.Common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
var aString = common.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : '';
|
||||||
var bString = nf.Common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
var bString = common.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : '';
|
||||||
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
return aString === bString ? 0 : aString > bString ? 1 : -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!a.permissions.canRead && !b.permissions.canRead){
|
if (!a.permissions.canRead && !b.permissions.canRead) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(a.permissions.canRead){
|
if (a.permissions.canRead) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -272,7 +322,7 @@ nf.Settings = (function () {
|
||||||
var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance');
|
var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance');
|
||||||
|
|
||||||
// ensure the grid has been initialized
|
// ensure the grid has been initialized
|
||||||
if (nf.Common.isDefinedAndNotNull(reportingTaskTypesGrid)) {
|
if (common.isDefinedAndNotNull(reportingTaskTypesGrid)) {
|
||||||
var reportingTaskTypesData = reportingTaskTypesGrid.getData();
|
var reportingTaskTypesData = reportingTaskTypesGrid.getData();
|
||||||
|
|
||||||
// update the search criteria
|
// update the search criteria
|
||||||
|
@ -354,7 +404,7 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
// ensure something was selected
|
// ensure something was selected
|
||||||
if (selectedTaskType === '') {
|
if (selectedTaskType === '') {
|
||||||
nf.Dialog.showOkDialog({
|
dialog.showOkDialog({
|
||||||
headerText: 'Settings',
|
headerText: 'Settings',
|
||||||
dialogContent: 'The type of reporting task to create must be selected.'
|
dialogContent: 'The type of reporting task to create must be selected.'
|
||||||
});
|
});
|
||||||
|
@ -371,7 +421,7 @@ nf.Settings = (function () {
|
||||||
var addReportingTask = function (reportingTaskType) {
|
var addReportingTask = function (reportingTaskType) {
|
||||||
// build the reporting task entity
|
// build the reporting task entity
|
||||||
var reportingTaskEntity = {
|
var reportingTaskEntity = {
|
||||||
'revision': nf.Client.getRevision({
|
'revision': client.getRevision({
|
||||||
'revision': {
|
'revision': {
|
||||||
'version': 0
|
'version': 0
|
||||||
}
|
}
|
||||||
|
@ -402,7 +452,7 @@ nf.Settings = (function () {
|
||||||
var row = reportingTaskData.getRowById(reportingTaskEntity.id);
|
var row = reportingTaskData.getRowById(reportingTaskEntity.id);
|
||||||
reportingTaskGrid.setSelectedRows([row]);
|
reportingTaskGrid.setSelectedRows([row]);
|
||||||
reportingTaskGrid.scrollRowIntoView(row);
|
reportingTaskGrid.scrollRowIntoView(row);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// hide the dialog
|
// hide the dialog
|
||||||
$('#new-reporting-task-dialog').modal('hide');
|
$('#new-reporting-task-dialog').modal('hide');
|
||||||
|
@ -440,7 +490,7 @@ nf.Settings = (function () {
|
||||||
id: 'type',
|
id: 'type',
|
||||||
name: 'Type',
|
name: 'Type',
|
||||||
field: 'label',
|
field: 'label',
|
||||||
formatter: nf.Common.typeFormatter,
|
formatter: common.typeFormatter,
|
||||||
sortable: false,
|
sortable: false,
|
||||||
resizable: true
|
resizable: true
|
||||||
},
|
},
|
||||||
|
@ -474,11 +524,11 @@ nf.Settings = (function () {
|
||||||
var reportingTaskType = reportingTaskTypesGrid.getDataItem(reportingTaskTypeIndex);
|
var reportingTaskType = reportingTaskTypesGrid.getDataItem(reportingTaskTypeIndex);
|
||||||
|
|
||||||
// set the reporting task type description
|
// set the reporting task type description
|
||||||
if (nf.Common.isDefinedAndNotNull(reportingTaskType)) {
|
if (common.isDefinedAndNotNull(reportingTaskType)) {
|
||||||
// show the selected reporting task
|
// show the selected reporting task
|
||||||
$('#reporting-task-description-container').show();
|
$('#reporting-task-description-container').show();
|
||||||
|
|
||||||
if (nf.Common.isBlank(reportingTaskType.description)) {
|
if (common.isBlank(reportingTaskType.description)) {
|
||||||
$('#reporting-task-type-description')
|
$('#reporting-task-type-description')
|
||||||
.attr('title', '')
|
.attr('title', '')
|
||||||
.html('<span class="unset">No description specified</span>');
|
.html('<span class="unset">No description specified</span>');
|
||||||
|
@ -507,7 +557,7 @@ nf.Settings = (function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
reportingTaskTypesGrid.onViewportChanged.subscribe(function (e, args) {
|
reportingTaskTypesGrid.onViewportChanged.subscribe(function (e, args) {
|
||||||
nf.Common.cleanUpTooltips($('#reporting-task-types-table'), 'div.view-usage-restriction');
|
common.cleanUpTooltips($('#reporting-task-types-table'), 'div.view-usage-restriction');
|
||||||
});
|
});
|
||||||
|
|
||||||
// wire up the dataview to the grid
|
// wire up the dataview to the grid
|
||||||
|
@ -534,8 +584,8 @@ nf.Settings = (function () {
|
||||||
var item = reportingTaskTypesData.getItemById(rowId);
|
var item = reportingTaskTypesData.getItemById(rowId);
|
||||||
|
|
||||||
// show the tooltip
|
// show the tooltip
|
||||||
if (nf.Common.isDefinedAndNotNull(item.usageRestriction)) {
|
if (common.isDefinedAndNotNull(item.usageRestriction)) {
|
||||||
usageRestriction.qtip($.extend({}, nf.Common.config.tooltipConfig, {
|
usageRestriction.qtip($.extend({}, common.config.tooltipConfig, {
|
||||||
content: item.usageRestriction,
|
content: item.usageRestriction,
|
||||||
position: {
|
position: {
|
||||||
container: $('#summary'),
|
container: $('#summary'),
|
||||||
|
@ -568,10 +618,10 @@ nf.Settings = (function () {
|
||||||
// add the documented type
|
// add the documented type
|
||||||
reportingTaskTypesData.addItem({
|
reportingTaskTypesData.addItem({
|
||||||
id: id++,
|
id: id++,
|
||||||
label: nf.Common.substringAfterLast(documentedType.type, '.'),
|
label: common.substringAfterLast(documentedType.type, '.'),
|
||||||
type: documentedType.type,
|
type: documentedType.type,
|
||||||
description: nf.Common.escapeHtml(documentedType.description),
|
description: common.escapeHtml(documentedType.description),
|
||||||
usageRestriction: nf.Common.escapeHtml(documentedType.usageRestriction),
|
usageRestriction: common.escapeHtml(documentedType.usageRestriction),
|
||||||
tags: documentedType.tags.join(', ')
|
tags: documentedType.tags.join(', ')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -593,36 +643,36 @@ nf.Settings = (function () {
|
||||||
select: applyReportingTaskTypeFilter,
|
select: applyReportingTaskTypeFilter,
|
||||||
remove: applyReportingTaskTypeFilter
|
remove: applyReportingTaskTypeFilter
|
||||||
});
|
});
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// initialize the reporting task dialog
|
// initialize the reporting task dialog
|
||||||
$('#new-reporting-task-dialog').modal({
|
$('#new-reporting-task-dialog').modal({
|
||||||
scrollableContentStyle: 'scrollable',
|
scrollableContentStyle: 'scrollable',
|
||||||
headerText: 'Add Reporting Task',
|
headerText: 'Add Reporting Task',
|
||||||
buttons: [{
|
buttons: [{
|
||||||
buttonText: 'Add',
|
buttonText: 'Add',
|
||||||
color: {
|
color: {
|
||||||
base: '#728E9B',
|
base: '#728E9B',
|
||||||
hover: '#004849',
|
hover: '#004849',
|
||||||
text: '#ffffff'
|
text: '#ffffff'
|
||||||
},
|
},
|
||||||
disabled: function () {
|
disabled: function () {
|
||||||
var selected = reportingTaskTypesGrid.getSelectedRows();
|
var selected = reportingTaskTypesGrid.getSelectedRows();
|
||||||
|
|
||||||
if (selected.length > 0) {
|
if (selected.length > 0) {
|
||||||
// grid configured with multi-select = false
|
// grid configured with multi-select = false
|
||||||
var item = reportingTaskTypesGrid.getDataItem(selected[0]);
|
var item = reportingTaskTypesGrid.getDataItem(selected[0]);
|
||||||
return isSelectable(item) === false;
|
return isSelectable(item) === false;
|
||||||
} else {
|
} else {
|
||||||
return reportingTaskTypesGrid.getData().getLength() === 0;
|
return reportingTaskTypesGrid.getData().getLength() === 0;
|
||||||
}
|
|
||||||
},
|
|
||||||
handler: {
|
|
||||||
click: function () {
|
|
||||||
addSelectedReportingTask();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handler: {
|
||||||
|
click: function () {
|
||||||
|
addSelectedReportingTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
buttonText: 'Cancel',
|
buttonText: 'Cancel',
|
||||||
color: {
|
color: {
|
||||||
|
@ -682,8 +732,8 @@ nf.Settings = (function () {
|
||||||
// always include a button to view the usage
|
// always include a button to view the usage
|
||||||
markup += '<div title="Usage" class="pointer reporting-task-usage fa fa-book"></div>';
|
markup += '<div title="Usage" class="pointer reporting-task-usage fa fa-book"></div>';
|
||||||
|
|
||||||
var hasErrors = !nf.Common.isEmpty(dataContext.component.validationErrors);
|
var hasErrors = !common.isEmpty(dataContext.component.validationErrors);
|
||||||
var hasBulletins = !nf.Common.isEmpty(dataContext.bulletins);
|
var hasBulletins = !common.isEmpty(dataContext.bulletins);
|
||||||
|
|
||||||
if (hasErrors) {
|
if (hasErrors) {
|
||||||
markup += '<div class="pointer has-errors fa fa-warning" ></div>';
|
markup += '<div class="pointer has-errors fa fa-warning" ></div>';
|
||||||
|
@ -694,7 +744,7 @@ nf.Settings = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrors || hasBulletins) {
|
if (hasErrors || hasBulletins) {
|
||||||
markup += '<span class="hidden row-id">' + nf.Common.escapeHtml(dataContext.component.id) + '</span>';
|
markup += '<span class="hidden row-id">' + common.escapeHtml(dataContext.component.id) + '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return markup;
|
return markup;
|
||||||
|
@ -707,7 +757,7 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
// determine the appropriate label
|
// determine the appropriate label
|
||||||
var icon = '', label = '';
|
var icon = '', label = '';
|
||||||
if (!nf.Common.isEmpty(dataContext.component.validationErrors)) {
|
if (!common.isEmpty(dataContext.component.validationErrors)) {
|
||||||
label = 'Invalid';
|
label = 'Invalid';
|
||||||
icon = 'invalid fa fa-warning';
|
icon = 'invalid fa fa-warning';
|
||||||
} else {
|
} else {
|
||||||
|
@ -725,13 +775,13 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
// include the active thread count if appropriate
|
// include the active thread count if appropriate
|
||||||
var activeThreadCount = '';
|
var activeThreadCount = '';
|
||||||
if (nf.Common.isDefinedAndNotNull(dataContext.component.activeThreadCount) && dataContext.component.activeThreadCount > 0) {
|
if (common.isDefinedAndNotNull(dataContext.component.activeThreadCount) && dataContext.component.activeThreadCount > 0) {
|
||||||
activeThreadCount = '(' + dataContext.component.activeThreadCount + ')';
|
activeThreadCount = '(' + dataContext.component.activeThreadCount + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
// format the markup
|
// format the markup
|
||||||
var formattedValue = '<div layout="row"><div class="' + icon + '" style="margin-top: 3px;"></div>';
|
var formattedValue = '<div layout="row"><div class="' + icon + '" style="margin-top: 3px;"></div>';
|
||||||
return formattedValue + '<div class="status-text" style="margin-top: 4px;">' + nf.Common.escapeHtml(label) + '</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(label) + '</div><div style="float: left; margin-left: 4px;">' + common.escapeHtml(activeThreadCount) + '</div></div>';
|
||||||
};
|
};
|
||||||
|
|
||||||
var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) {
|
var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) {
|
||||||
|
@ -744,7 +794,7 @@ nf.Settings = (function () {
|
||||||
markup += '<div title="Edit" class="pointer edit-reporting-task fa fa-pencil" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
markup += '<div title="Edit" class="pointer edit-reporting-task fa fa-pencil" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||||
|
|
||||||
// support starting when stopped and no validation errors
|
// support starting when stopped and no validation errors
|
||||||
if (dataContext.component.state === 'STOPPED' && nf.Common.isEmpty(dataContext.component.validationErrors)) {
|
if (dataContext.component.state === 'STOPPED' && common.isEmpty(dataContext.component.validationErrors)) {
|
||||||
markup += '<div title="Start" class="pointer start-reporting-task fa fa-play" style="margin-top: 2px; margin-right: 3px;"></div>';
|
markup += '<div title="Start" class="pointer start-reporting-task fa fa-play" style="margin-top: 2px; margin-right: 3px;"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -754,12 +804,12 @@ nf.Settings = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataContext.permissions.canWrite && nf.Common.canModifyController()) {
|
if (dataContext.permissions.canWrite && common.canModifyController()) {
|
||||||
markup += '<div title="Remove" class="pointer delete-reporting-task fa fa-trash" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
markup += '<div title="Remove" class="pointer delete-reporting-task fa fa-trash" style="margin-top: 2px; margin-right: 3px;" ></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow policy configuration conditionally
|
// allow policy configuration conditionally
|
||||||
if (nf.Canvas.isConfigurableAuthorizer() && nf.Common.canAccessTenants()) {
|
if (canvasUtils.isConfigurableAuthorizer() && common.canAccessTenants()) {
|
||||||
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
|
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,14 +818,37 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
// define the column model for the reporting tasks table
|
// define the column model for the reporting tasks table
|
||||||
var reportingTasksColumnModel = [
|
var reportingTasksColumnModel = [
|
||||||
{id: 'moreDetails', name: ' ', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 90, maxWidth: 90, toolTip: 'Sorts based on presence of bulletins'},
|
{
|
||||||
|
id: 'moreDetails',
|
||||||
|
name: ' ',
|
||||||
|
resizable: false,
|
||||||
|
formatter: moreReportingTaskDetails,
|
||||||
|
sortable: true,
|
||||||
|
width: 90,
|
||||||
|
maxWidth: 90,
|
||||||
|
toolTip: 'Sorts based on presence of bulletins'
|
||||||
|
},
|
||||||
{id: 'name', name: 'Name', sortable: true, resizable: true, formatter: nameFormatter},
|
{id: 'name', name: 'Name', sortable: true, resizable: true, formatter: nameFormatter},
|
||||||
{id: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter},
|
{id: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter},
|
||||||
{id: 'state', name: 'Run Status', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter}
|
{
|
||||||
|
id: 'state',
|
||||||
|
name: 'Run Status',
|
||||||
|
sortable: true,
|
||||||
|
resizeable: true,
|
||||||
|
formatter: reportingTaskRunStatusFormatter
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
// action column should always be last
|
// action column should always be last
|
||||||
reportingTasksColumnModel.push({id: 'actions', name: ' ', resizable: false, formatter: reportingTaskActionFormatter, sortable: false, width: 90, maxWidth: 90});
|
reportingTasksColumnModel.push({
|
||||||
|
id: 'actions',
|
||||||
|
name: ' ',
|
||||||
|
resizable: false,
|
||||||
|
formatter: reportingTaskActionFormatter,
|
||||||
|
sortable: false,
|
||||||
|
width: 90,
|
||||||
|
maxWidth: 90
|
||||||
|
});
|
||||||
|
|
||||||
// initialize the dataview
|
// initialize the dataview
|
||||||
var reportingTasksData = new Slick.Data.DataView({
|
var reportingTasksData = new Slick.Data.DataView({
|
||||||
|
@ -811,35 +884,35 @@ nf.Settings = (function () {
|
||||||
// determine the desired action
|
// determine the desired action
|
||||||
if (reportingTasksGrid.getColumns()[args.cell].id === 'actions') {
|
if (reportingTasksGrid.getColumns()[args.cell].id === 'actions') {
|
||||||
if (target.hasClass('edit-reporting-task')) {
|
if (target.hasClass('edit-reporting-task')) {
|
||||||
nf.ReportingTask.showConfiguration(reportingTaskEntity);
|
reportingTask.showConfiguration(reportingTaskEntity);
|
||||||
} else if (target.hasClass('start-reporting-task')) {
|
} else if (target.hasClass('start-reporting-task')) {
|
||||||
nf.ReportingTask.start(reportingTaskEntity);
|
reportingTask.start(reportingTaskEntity);
|
||||||
} else if (target.hasClass('stop-reporting-task')) {
|
} else if (target.hasClass('stop-reporting-task')) {
|
||||||
nf.ReportingTask.stop(reportingTaskEntity);
|
reportingTask.stop(reportingTaskEntity);
|
||||||
} else if (target.hasClass('delete-reporting-task')) {
|
} else if (target.hasClass('delete-reporting-task')) {
|
||||||
nf.ReportingTask.promptToDeleteReportingTask(reportingTaskEntity);
|
reportingTask.promptToDeleteReportingTask(reportingTaskEntity);
|
||||||
} else if (target.hasClass('view-state-reporting-task')) {
|
} else if (target.hasClass('view-state-reporting-task')) {
|
||||||
var canClear = reportingTaskEntity.component.state === 'STOPPED' && reportingTaskEntity.component.activeThreadCount === 0;
|
var canClear = reportingTaskEntity.component.state === 'STOPPED' && reportingTaskEntity.component.activeThreadCount === 0;
|
||||||
nf.ComponentState.showState(reportingTaskEntity, canClear);
|
componentState.showState(reportingTaskEntity, canClear);
|
||||||
} else if (target.hasClass('edit-access-policies')) {
|
} else if (target.hasClass('edit-access-policies')) {
|
||||||
// show the policies for this service
|
// show the policies for this service
|
||||||
nf.PolicyManagement.showReportingTaskPolicy(reportingTaskEntity);
|
policyManagement.showReportingTaskPolicy(reportingTaskEntity);
|
||||||
|
|
||||||
// close the settings dialog
|
// close the settings dialog
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
}
|
}
|
||||||
} else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') {
|
} else if (reportingTasksGrid.getColumns()[args.cell].id === 'moreDetails') {
|
||||||
if (target.hasClass('view-reporting-task')) {
|
if (target.hasClass('view-reporting-task')) {
|
||||||
nf.ReportingTask.showDetails(reportingTaskEntity);
|
reportingTask.showDetails(reportingTaskEntity);
|
||||||
} else if (target.hasClass('reporting-task-usage')) {
|
} else if (target.hasClass('reporting-task-usage')) {
|
||||||
// close the settings dialog
|
// close the settings dialog
|
||||||
$('#shell-close-button').click();
|
$('#shell-close-button').click();
|
||||||
|
|
||||||
// open the documentation for this reporting task
|
// open the documentation for this reporting task
|
||||||
nf.Shell.showPage('../nifi-docs/documentation?' + $.param({
|
shell.showPage('../nifi-docs/documentation?' + $.param({
|
||||||
select: nf.Common.substringAfterLast(reportingTaskEntity.component.type, '.')
|
select: common.substringAfterLast(reportingTaskEntity.component.type, '.')
|
||||||
})).done(function () {
|
})).done(function () {
|
||||||
nf.Settings.showSettings();
|
nfSettings.showSettings();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -866,12 +939,12 @@ nf.Settings = (function () {
|
||||||
var reportingTaskEntity = reportingTasksData.getItemById(taskId);
|
var reportingTaskEntity = reportingTasksData.getItemById(taskId);
|
||||||
|
|
||||||
// format the errors
|
// format the errors
|
||||||
var tooltip = nf.Common.formatUnorderedList(reportingTaskEntity.component.validationErrors);
|
var tooltip = common.formatUnorderedList(reportingTaskEntity.component.validationErrors);
|
||||||
|
|
||||||
// show the tooltip
|
// show the tooltip
|
||||||
if (nf.Common.isDefinedAndNotNull(tooltip)) {
|
if (common.isDefinedAndNotNull(tooltip)) {
|
||||||
errorIcon.qtip($.extend({},
|
errorIcon.qtip($.extend({},
|
||||||
nf.Common.config.tooltipConfig,
|
common.config.tooltipConfig,
|
||||||
{
|
{
|
||||||
content: tooltip,
|
content: tooltip,
|
||||||
position: {
|
position: {
|
||||||
|
@ -895,13 +968,13 @@ nf.Settings = (function () {
|
||||||
var reportingTaskEntity = reportingTasksData.getItemById(taskId);
|
var reportingTaskEntity = reportingTasksData.getItemById(taskId);
|
||||||
|
|
||||||
// format the tooltip
|
// format the tooltip
|
||||||
var bulletins = nf.Common.getFormattedBulletins(reportingTaskEntity.bulletins);
|
var bulletins = common.getFormattedBulletins(reportingTaskEntity.bulletins);
|
||||||
var tooltip = nf.Common.formatUnorderedList(bulletins);
|
var tooltip = common.formatUnorderedList(bulletins);
|
||||||
|
|
||||||
// show the tooltip
|
// show the tooltip
|
||||||
if (nf.Common.isDefinedAndNotNull(tooltip)) {
|
if (common.isDefinedAndNotNull(tooltip)) {
|
||||||
bulletinIcon.qtip($.extend({},
|
bulletinIcon.qtip($.extend({},
|
||||||
nf.Common.config.tooltipConfig,
|
common.config.tooltipConfig,
|
||||||
{
|
{
|
||||||
content: tooltip,
|
content: tooltip,
|
||||||
position: {
|
position: {
|
||||||
|
@ -927,7 +1000,7 @@ nf.Settings = (function () {
|
||||||
$('#read-only-maximum-timer-driven-thread-count-field').addClass('unset').text('Unauthorized');
|
$('#read-only-maximum-timer-driven-thread-count-field').addClass('unset').text('Unauthorized');
|
||||||
$('#read-only-maximum-event-driven-thread-count-field').addClass('unset').text('Unauthorized');
|
$('#read-only-maximum-event-driven-thread-count-field').addClass('unset').text('Unauthorized');
|
||||||
};
|
};
|
||||||
|
|
||||||
var setEditable = function (editable) {
|
var setEditable = function (editable) {
|
||||||
if (editable) {
|
if (editable) {
|
||||||
$('#general-settings div.editable').show();
|
$('#general-settings div.editable').show();
|
||||||
|
@ -939,7 +1012,7 @@ nf.Settings = (function () {
|
||||||
$('#settings-save').hide();
|
$('#settings-save').hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var settings = $.Deferred(function (deferred) {
|
var settings = $.Deferred(function (deferred) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
@ -979,21 +1052,21 @@ nf.Settings = (function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).promise();
|
}).promise();
|
||||||
|
|
||||||
// load the controller services
|
// load the controller services
|
||||||
var controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
|
var controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
|
||||||
var controllerServices = nf.ControllerServices.loadControllerServices(controllerServicesUri, getControllerServicesTable());
|
var controllerServicesXhr = controllerServices.loadControllerServices(controllerServicesUri, getControllerServicesTable());
|
||||||
|
|
||||||
// load the reporting tasks
|
// load the reporting tasks
|
||||||
var reportingTasks = loadReportingTasks();
|
var reportingTasks = loadReportingTasks();
|
||||||
|
|
||||||
// return a deferred for all parts of the settings
|
// return a deferred for all parts of the settings
|
||||||
return $.when(settings, controllerServices, reportingTasks).done(function (settingsResult, controllerServicesResult) {
|
return $.when(settings, controllerServicesXhr, reportingTasks).done(function (settingsResult, controllerServicesResult) {
|
||||||
var controllerServicesResponse = controllerServicesResult[0];
|
var controllerServicesResponse = controllerServicesResult[0];
|
||||||
|
|
||||||
// update the current time
|
// update the current time
|
||||||
$('#settings-last-refreshed').text(controllerServicesResponse.currentTime);
|
$('#settings-last-refreshed').text(controllerServicesResponse.currentTime);
|
||||||
}).fail(nf.ErrorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1013,8 +1086,8 @@ nf.Settings = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
var reportingTasksElement = $('#reporting-tasks-table');
|
var reportingTasksElement = $('#reporting-tasks-table');
|
||||||
nf.Common.cleanUpTooltips(reportingTasksElement, 'div.has-errors');
|
common.cleanUpTooltips(reportingTasksElement, 'div.has-errors');
|
||||||
nf.Common.cleanUpTooltips(reportingTasksElement, 'div.has-bulletins');
|
common.cleanUpTooltips(reportingTasksElement, 'div.has-bulletins');
|
||||||
|
|
||||||
var reportingTasksGrid = reportingTasksElement.data('gridInstance');
|
var reportingTasksGrid = reportingTasksElement.data('gridInstance');
|
||||||
var reportingTasksData = reportingTasksGrid.getData();
|
var reportingTasksData = reportingTasksGrid.getData();
|
||||||
|
@ -1031,7 +1104,7 @@ nf.Settings = (function () {
|
||||||
*/
|
*/
|
||||||
var showSettings = function () {
|
var showSettings = function () {
|
||||||
// show the settings dialog
|
// show the settings dialog
|
||||||
nf.Shell.showContent('#settings').done(function () {
|
shell.showContent('#settings').done(function () {
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1039,7 +1112,7 @@ nf.Settings = (function () {
|
||||||
$('#settings-tabs').find('.selected-tab').click();
|
$('#settings-tabs').find('.selected-tab').click();
|
||||||
|
|
||||||
// adjust the table size
|
// adjust the table size
|
||||||
nf.Settings.resetTableSize();
|
nfSettings.resetTableSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1050,7 +1123,7 @@ nf.Settings = (function () {
|
||||||
$('#settings-save').mouseout();
|
$('#settings-save').mouseout();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
var nfSettings = {
|
||||||
/**
|
/**
|
||||||
* Initializes the settings page.
|
* Initializes the settings page.
|
||||||
*/
|
*/
|
||||||
|
@ -1077,9 +1150,9 @@ nf.Settings = (function () {
|
||||||
$('#settings-save').show();
|
$('#settings-save').show();
|
||||||
} else {
|
} else {
|
||||||
var canModifyController = false;
|
var canModifyController = false;
|
||||||
if (nf.Common.isDefinedAndNotNull(nf.Common.currentUser)) {
|
if (common.isDefinedAndNotNull(common.currentUser)) {
|
||||||
// only consider write permissions for creating new controller services/reporting tasks
|
// only consider write permissions for creating new controller services/reporting tasks
|
||||||
canModifyController = nf.Common.currentUser.controllerPermissions.canWrite === true;
|
canModifyController = common.currentUser.controllerPermissions.canWrite === true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canModifyController) {
|
if (canModifyController) {
|
||||||
|
@ -1102,7 +1175,7 @@ nf.Settings = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize the table
|
// resize the table
|
||||||
nf.Settings.resetTableSize();
|
nfSettings.resetTableSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1117,13 +1190,13 @@ nf.Settings = (function () {
|
||||||
var selectedTab = $('#settings-tabs li.selected-tab').text();
|
var selectedTab = $('#settings-tabs li.selected-tab').text();
|
||||||
if (selectedTab === 'Controller Services') {
|
if (selectedTab === 'Controller Services') {
|
||||||
var controllerServicesUri = config.urls.api + '/controller/controller-services';
|
var controllerServicesUri = config.urls.api + '/controller/controller-services';
|
||||||
nf.ControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
|
controllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable());
|
||||||
} else if (selectedTab === 'Reporting Tasks') {
|
} else if (selectedTab === 'Reporting Tasks') {
|
||||||
$('#new-reporting-task-dialog').modal('show');
|
$('#new-reporting-task-dialog').modal('show');
|
||||||
|
|
||||||
// reset the canvas size after the dialog is shown
|
// reset the canvas size after the dialog is shown
|
||||||
var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance');
|
var reportingTaskTypesGrid = $('#reporting-task-types-table').data('gridInstance');
|
||||||
if (nf.Common.isDefinedAndNotNull(reportingTaskTypesGrid)) {
|
if (common.isDefinedAndNotNull(reportingTaskTypesGrid)) {
|
||||||
reportingTaskTypesGrid.setSelectedRows([0]);
|
reportingTaskTypesGrid.setSelectedRows([0]);
|
||||||
reportingTaskTypesGrid.resizeCanvas();
|
reportingTaskTypesGrid.resizeCanvas();
|
||||||
}
|
}
|
||||||
|
@ -1132,10 +1205,10 @@ nf.Settings = (function () {
|
||||||
$('#reporting-task-type-filter').focus();
|
$('#reporting-task-type-filter').focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// initialize each tab
|
// initialize each tab
|
||||||
initGeneral();
|
initGeneral();
|
||||||
nf.ControllerServices.init(getControllerServicesTable());
|
controllerServices.init(getControllerServicesTable(), nfSettings.showSettings);
|
||||||
initReportingTasks();
|
initReportingTasks();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1143,10 +1216,10 @@ nf.Settings = (function () {
|
||||||
* Update the size of the grid based on its container's current size.
|
* Update the size of the grid based on its container's current size.
|
||||||
*/
|
*/
|
||||||
resetTableSize: function () {
|
resetTableSize: function () {
|
||||||
nf.ControllerServices.resetTableSize(getControllerServicesTable());
|
controllerServices.resetTableSize(getControllerServicesTable());
|
||||||
|
|
||||||
var reportingTasksGrid = $('#reporting-tasks-table').data('gridInstance');
|
var reportingTasksGrid = $('#reporting-tasks-table').data('gridInstance');
|
||||||
if (nf.Common.isDefinedAndNotNull(reportingTasksGrid)) {
|
if (common.isDefinedAndNotNull(reportingTasksGrid)) {
|
||||||
reportingTasksGrid.resizeCanvas();
|
reportingTasksGrid.resizeCanvas();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1167,7 +1240,7 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects the specified controller service.
|
* Selects the specified controller service.
|
||||||
*
|
*
|
||||||
* @param {string} controllerServiceId
|
* @param {string} controllerServiceId
|
||||||
*/
|
*/
|
||||||
selectControllerService: function (controllerServiceId) {
|
selectControllerService: function (controllerServiceId) {
|
||||||
|
@ -1180,7 +1253,7 @@ nf.Settings = (function () {
|
||||||
controllerServiceGrid.scrollRowIntoView(row);
|
controllerServiceGrid.scrollRowIntoView(row);
|
||||||
|
|
||||||
// select the controller services tab
|
// select the controller services tab
|
||||||
$('#settings-tabs').find('li:eq(1)').click();
|
$('#settings-tabs').find('li:eq(1)').click();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1189,9 +1262,9 @@ nf.Settings = (function () {
|
||||||
* @param {object} controllerServiceBulletins
|
* @param {object} controllerServiceBulletins
|
||||||
* @param {object} reportingTaskBulletins
|
* @param {object} reportingTaskBulletins
|
||||||
*/
|
*/
|
||||||
setBulletins: function(controllerServiceBulletins, reportingTaskBulletins) {
|
setBulletins: function (controllerServiceBulletins, reportingTaskBulletins) {
|
||||||
if ($('#controller-services-table').data('gridInstance')) {
|
if ($('#controller-services-table').data('gridInstance')) {
|
||||||
nf.ControllerServices.setBulletins(getControllerServicesTable(), controllerServiceBulletins);
|
controllerServices.setBulletins(getControllerServicesTable(), controllerServiceBulletins);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reporting tasks
|
// reporting tasks
|
||||||
|
@ -1200,7 +1273,7 @@ nf.Settings = (function () {
|
||||||
reportingTasksData.beginUpdate();
|
reportingTasksData.beginUpdate();
|
||||||
|
|
||||||
// if there are some bulletins process them
|
// if there are some bulletins process them
|
||||||
if (!nf.Common.isEmpty(reportingTaskBulletins)) {
|
if (!common.isEmpty(reportingTaskBulletins)) {
|
||||||
var reportingTaskBulletinsBySource = d3.nest()
|
var reportingTaskBulletinsBySource = d3.nest()
|
||||||
.key(function (d) {
|
.key(function (d) {
|
||||||
return d.sourceId;
|
return d.sourceId;
|
||||||
|
@ -1209,7 +1282,7 @@ nf.Settings = (function () {
|
||||||
|
|
||||||
reportingTaskBulletinsBySource.forEach(function (sourceId, sourceBulletins) {
|
reportingTaskBulletinsBySource.forEach(function (sourceId, sourceBulletins) {
|
||||||
var reportingTask = reportingTasksData.getItemById(sourceId);
|
var reportingTask = reportingTasksData.getItemById(sourceId);
|
||||||
if (nf.Common.isDefinedAndNotNull(reportingTask)) {
|
if (common.isDefinedAndNotNull(reportingTask)) {
|
||||||
reportingTasksData.updateItem(sourceId, $.extend(reportingTask, {
|
reportingTasksData.updateItem(sourceId, $.extend(reportingTask, {
|
||||||
bulletins: sourceBulletins
|
bulletins: sourceBulletins
|
||||||
}));
|
}));
|
||||||
|
@ -1227,4 +1300,6 @@ nf.Settings = (function () {
|
||||||
reportingTasksData.endUpdate();
|
reportingTasksData.endUpdate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
|
||||||
|
return nfSettings;
|
||||||
|
}));
|
|
@ -15,9 +15,31 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, d3 */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
nf.Snippet = (function () {
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
|
'nf.CanvasUtils',
|
||||||
|
'nf.Client'],
|
||||||
|
function ($, d3, canvasUtils, client) {
|
||||||
|
return (nf.Snippet = factory($, d3, canvasUtils, client));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
|
module.exports = (nf.Snippet =
|
||||||
|
factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Client')));
|
||||||
|
} else {
|
||||||
|
nf.Snippet = factory(root.$,
|
||||||
|
root.d3,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Client);
|
||||||
|
}
|
||||||
|
}(this, function ($, d3, canvasUtils, client) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
urls: {
|
urls: {
|
||||||
|
@ -27,14 +49,15 @@ nf.Snippet = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marshals snippet from the specified selection.
|
* Marshals snippet from the specified selection.
|
||||||
*
|
*
|
||||||
* @argument {selection} selection The selection to marshal
|
* @argument {selection} selection The selection to marshal
|
||||||
*/
|
*/
|
||||||
marshal: function (selection) {
|
marshal: function (selection) {
|
||||||
var snippet = {
|
var snippet = {
|
||||||
parentGroupId: nf.Canvas.getGroupId(),
|
parentGroupId: canvasUtils.getGroupId(),
|
||||||
processors: {},
|
processors: {},
|
||||||
funnels: {},
|
funnels: {},
|
||||||
inputPorts: {},
|
inputPorts: {},
|
||||||
|
@ -49,31 +72,31 @@ nf.Snippet = (function () {
|
||||||
selection.each(function (d) {
|
selection.each(function (d) {
|
||||||
var selected = d3.select(this);
|
var selected = d3.select(this);
|
||||||
|
|
||||||
if (nf.CanvasUtils.isProcessor(selected)) {
|
if (canvasUtils.isProcessor(selected)) {
|
||||||
snippet.processors[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.processors[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isFunnel(selected)) {
|
} else if (canvasUtils.isFunnel(selected)) {
|
||||||
snippet.funnels[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.funnels[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isLabel(selected)) {
|
} else if (canvasUtils.isLabel(selected)) {
|
||||||
snippet.labels[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.labels[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isInputPort(selected)) {
|
} else if (canvasUtils.isInputPort(selected)) {
|
||||||
snippet.inputPorts[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.inputPorts[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isOutputPort(selected)) {
|
} else if (canvasUtils.isOutputPort(selected)) {
|
||||||
snippet.outputPorts[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.outputPorts[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isProcessGroup(selected)) {
|
} else if (canvasUtils.isProcessGroup(selected)) {
|
||||||
snippet.processGroups[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.processGroups[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isRemoteProcessGroup(selected)) {
|
} else if (canvasUtils.isRemoteProcessGroup(selected)) {
|
||||||
snippet.remoteProcessGroups[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.remoteProcessGroups[d.id] = client.getRevision(selected.datum());
|
||||||
} else if (nf.CanvasUtils.isConnection(selected)) {
|
} else if (canvasUtils.isConnection(selected)) {
|
||||||
snippet.connections[d.id] = nf.Client.getRevision(selected.datum());
|
snippet.connections[d.id] = client.getRevision(selected.datum());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return snippet;
|
return snippet;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a snippet.
|
* Creates a snippet.
|
||||||
*
|
*
|
||||||
* @argument {object} snippet The snippet
|
* @argument {object} snippet The snippet
|
||||||
*/
|
*/
|
||||||
create: function (snippet) {
|
create: function (snippet) {
|
||||||
|
@ -89,10 +112,10 @@ nf.Snippet = (function () {
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the snippet to the specified group and origin.
|
* Copies the snippet to the specified group and origin.
|
||||||
*
|
*
|
||||||
* @argument {string} snippetId The snippet id
|
* @argument {string} snippetId The snippet id
|
||||||
* @argument {object} origin The origin
|
* @argument {object} origin The origin
|
||||||
*/
|
*/
|
||||||
|
@ -105,16 +128,16 @@ nf.Snippet = (function () {
|
||||||
|
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: config.urls.processGroups + '/' + encodeURIComponent(nf.Canvas.getGroupId()) + '/snippet-instance',
|
url: config.urls.processGroups + '/' + encodeURIComponent(canvasUtils.getGroupId()) + '/snippet-instance',
|
||||||
data: JSON.stringify(copySnippetRequestEntity),
|
data: JSON.stringify(copySnippetRequestEntity),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the specified snippet.
|
* Removes the specified snippet.
|
||||||
*
|
*
|
||||||
* @argument {string} snippetId The snippet id
|
* @argument {string} snippetId The snippet id
|
||||||
*/
|
*/
|
||||||
remove: function (snippetId) {
|
remove: function (snippetId) {
|
||||||
|
@ -123,10 +146,10 @@ nf.Snippet = (function () {
|
||||||
url: config.urls.snippets + '/' + encodeURIComponent(snippetId)
|
url: config.urls.snippets + '/' + encodeURIComponent(snippetId)
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the snippet into the specified group.
|
* Moves the snippet into the specified group.
|
||||||
*
|
*
|
||||||
* @argument {string} snippetId The snippet id
|
* @argument {string} snippetId The snippet id
|
||||||
* @argument {string} newGroupId The new group id
|
* @argument {string} newGroupId The new group id
|
||||||
*/
|
*/
|
||||||
|
@ -147,4 +170,4 @@ nf.Snippet = (function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}());
|
}));
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
@ -33,7 +33,10 @@
|
||||||
require('nf.Dialog'),
|
require('nf.Dialog'),
|
||||||
require('nf.Storage')));
|
require('nf.Storage')));
|
||||||
} else {
|
} else {
|
||||||
nf.Login = factory(root.$, root.nf.Common, root.nf.Dialog, root.nf.Storage);
|
nf.Login = factory(root.$,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.Dialog,
|
||||||
|
root.nf.Storage);
|
||||||
}
|
}
|
||||||
}(this, function ($, common, dialog, storage) {
|
}(this, function ($, common, dialog, storage) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,24 +15,27 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports, parseFloat */
|
/* global define, module, require, exports, parseFloat */
|
||||||
|
|
||||||
// Define a common utility class used across the entire application.
|
// Define a common utility class used across the entire application.
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(['jquery',
|
define(['jquery',
|
||||||
|
'd3',
|
||||||
'nf.Storage'],
|
'nf.Storage'],
|
||||||
function ($, storage) {
|
function ($, d3, storage) {
|
||||||
return (nf.Common = factory($, storage));
|
return (nf.Common = factory($, d3, storage));
|
||||||
});
|
});
|
||||||
} else if (typeof exports === 'object' && typeof module === 'object') {
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
module.exports = (nf.Common = factory(require('jquery'),
|
module.exports = (nf.Common = factory(require('jquery'),
|
||||||
|
require('d3'),
|
||||||
require('nf.Storage')));
|
require('nf.Storage')));
|
||||||
} else {
|
} else {
|
||||||
nf.Common = factory(root.$,
|
nf.Common = factory(root.$,
|
||||||
|
root.d3,
|
||||||
root.nf.Storage);
|
root.nf.Storage);
|
||||||
}
|
}
|
||||||
}(this, function ($, storage) {
|
}(this, function ($, d3, storage) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,28 +15,47 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(['nf.ng.Bridge'],
|
define(['nf.ng.Bridge',
|
||||||
function (angularBridge) {
|
'nf.Common',
|
||||||
return (nf.ng.AppCtrl = factory(angularBridge));
|
'nf.CanvasUtils',
|
||||||
|
'nf.ClusterSummary',
|
||||||
|
'nf.Actions'],
|
||||||
|
function (angularBridge, canvasUtils, common, clusterSummary, actions) {
|
||||||
|
return (nf.ng.AppCtrl = factory(angularBridge, canvasUtils, common, clusterSummary, actions));
|
||||||
});
|
});
|
||||||
} else if (typeof exports === 'object' && typeof module === 'object') {
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
module.exports = (nf.ng.AppCtrl = factory(require('nf.ng.Bridge')));
|
module.exports = (nf.ng.AppCtrl =
|
||||||
|
factory(require('nf.ng.Bridge'),
|
||||||
|
require('nf.CanvasUtils'),
|
||||||
|
require('nf.Common'),
|
||||||
|
require('nf.ClusterSummary'),
|
||||||
|
require('nf.Actions')));
|
||||||
} else {
|
} else {
|
||||||
nf.ng.AppCtrl = factory(root.nf.ng.Bridge);
|
nf.ng.AppCtrl = factory(root.nf.ng.Bridge,
|
||||||
|
root.nf.CanvasUtils,
|
||||||
|
root.nf.Common,
|
||||||
|
root.nf.ClusterSummary,
|
||||||
|
root.nf.Actions);
|
||||||
}
|
}
|
||||||
}(this, function (angularBridge) {
|
}(this, function (angularBridge, canvasUtils, common, clusterSummary, actions) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
return function ($scope, serviceProvider) {
|
return function ($scope, serviceProvider) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function AppCtrl(serviceProvider) {
|
function AppCtrl(serviceProvider) {
|
||||||
//global nf namespace for reference throughout angular app
|
//add essential modules to the scope for availability throughout the angular container
|
||||||
this.nf = nf;
|
this.nf = {
|
||||||
|
"Common": common,
|
||||||
|
"ClusterSummary": clusterSummary,
|
||||||
|
"Actions": actions,
|
||||||
|
"CanvasUtils": canvasUtils,
|
||||||
|
};
|
||||||
|
|
||||||
//any registered angular service is available through the serviceProvider
|
//any registered angular service is available through the serviceProvider
|
||||||
this.serviceProvider = serviceProvider;
|
this.serviceProvider = serviceProvider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,26 +15,23 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(['jquery',
|
define(['jquery',
|
||||||
'nf.Common',
|
'nf.Common'],
|
||||||
'nf.ContextMenu'],
|
function ($, common) {
|
||||||
function ($, common, contextMenu) {
|
return (nf.Shell = factory($, common));
|
||||||
return (nf.Shell = factory($, common, contextMenu));
|
|
||||||
});
|
});
|
||||||
} else if (typeof exports === 'object' && typeof module === 'object') {
|
} else if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
module.exports = (nf.Shell = factory(require('jquery'),
|
module.exports = (nf.Shell = factory(require('jquery'),
|
||||||
require('nf.Common'),
|
require('nf.Common')));
|
||||||
require('nf.ContextMenu')));
|
|
||||||
} else {
|
} else {
|
||||||
nf.Shell = factory(root.$,
|
nf.Shell = factory(root.$,
|
||||||
root.nf.Common,
|
root.nf.Common);
|
||||||
root.nf.ContextMenu);
|
|
||||||
}
|
}
|
||||||
}(this, function ($, common, contextMenu) {
|
}(this, function ($, common) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
@ -70,9 +67,19 @@
|
||||||
|
|
||||||
var showPageResize = null;
|
var showPageResize = null;
|
||||||
var showContentResize = null;
|
var showContentResize = null;
|
||||||
|
var nfContextMenu = null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the shell.
|
||||||
|
*
|
||||||
|
* @param contextMenu The reference to the contextMenu controller.
|
||||||
|
*/
|
||||||
|
init: function (contextMenu) {
|
||||||
|
nfContextMenu = contextMenu;
|
||||||
|
},
|
||||||
|
|
||||||
resizeContent: function (shell) {
|
resizeContent: function (shell) {
|
||||||
var contentContainer = shell.find('.shell-content-container');
|
var contentContainer = shell.find('.shell-content-container');
|
||||||
contentContainer.css({
|
contentContainer.css({
|
||||||
|
@ -100,8 +107,8 @@
|
||||||
*/
|
*/
|
||||||
showPage: function (uri, canUndock) {
|
showPage: function (uri, canUndock) {
|
||||||
// if the context menu is on this page, attempt to close
|
// if the context menu is on this page, attempt to close
|
||||||
if (common.isDefinedAndNotNull(contextMenu)) {
|
if (common.isDefinedAndNotNull(nfContextMenu)) {
|
||||||
contextMenu.hide();
|
nfContextMenu.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
|
@ -154,8 +161,8 @@
|
||||||
*/
|
*/
|
||||||
showContent: function (domId) {
|
showContent: function (domId) {
|
||||||
// if the context menu is on this page, attempt to close
|
// if the context menu is on this page, attempt to close
|
||||||
if (common.isDefinedAndNotNull(contextMenu)) {
|
if (common.isDefinedAndNotNull(nfContextMenu)) {
|
||||||
contextMenu.hide();
|
nfContextMenu.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $.Deferred(function (deferred) {
|
return $.Deferred(function (deferred) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
@ -1270,7 +1270,7 @@
|
||||||
*/
|
*/
|
||||||
getEventDetails: function (eventId, clusterNodeId) {
|
getEventDetails: function (eventId, clusterNodeId) {
|
||||||
var url;
|
var url;
|
||||||
if (nf.Common.isDefinedAndNotNull(clusterNodeId)) {
|
if (common.isDefinedAndNotNull(clusterNodeId)) {
|
||||||
url = config.urls.provenanceEvents + encodeURIComponent(eventId) + '?' + $.param({
|
url = config.urls.provenanceEvents + encodeURIComponent(eventId) + '?' + $.param({
|
||||||
clusterNodeId: clusterNodeId
|
clusterNodeId: clusterNodeId
|
||||||
});
|
});
|
||||||
|
@ -1282,7 +1282,7 @@
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: url,
|
url: url,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).fail(nf.Common.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
@ -1065,8 +1065,8 @@
|
||||||
// determine the desired action
|
// determine the desired action
|
||||||
if (processGroupsGrid.getColumns()[args.cell].id === 'actions') {
|
if (processGroupsGrid.getColumns()[args.cell].id === 'actions') {
|
||||||
if (target.hasClass('go-to')) {
|
if (target.hasClass('go-to')) {
|
||||||
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && common.isDefinedAndNotNull(parent.nf.Shell)) {
|
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.ProcessGroup) && common.isDefinedAndNotNull(parent.nf.Shell)) {
|
||||||
parent.nf.CanvasUtils.enterGroup(item.id);
|
parent.nf.ProcessGroup.enterGroup(item.id);
|
||||||
parent.$('#shell-close-button').click();
|
parent.$('#shell-close-button').click();
|
||||||
}
|
}
|
||||||
} else if (target.hasClass('show-process-group-status-history')) {
|
} else if (target.hasClass('show-process-group-status-history')) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
@ -293,7 +293,7 @@
|
||||||
|
|
||||||
// allow policy configuration conditionally if embedded in
|
// allow policy configuration conditionally if embedded in
|
||||||
if (top !== window && common.canAccessTenants()) {
|
if (top !== window && common.canAccessTenants()) {
|
||||||
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.Canvas) && parent.nf.Canvas.isConfigurableAuthorizer()) {
|
if (common.isDefinedAndNotNull(parent.nf) && common.isDefinedAndNotNull(parent.nf.CanvasUtils) && parent.nf.CanvasUtils.isConfigurableAuthorizer()) {
|
||||||
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
|
markup += '<div title="Access Policies" class="pointer edit-access-policies fa fa-key" style="margin-top: 2px;"></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, define, module, require, exports */
|
/* global define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
url: user.uri + '?' + $.param(client.getRevision(user)),
|
url: user.uri + '?' + $.param(client.getRevision(user)),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
self.loadUsersTable();
|
nfUsersTable.loadUsersTable();
|
||||||
}).fail(errorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
|
|
||||||
// hide the dialog
|
// hide the dialog
|
||||||
|
@ -252,7 +252,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$.when.apply(window, xhrs).always(function () {
|
$.when.apply(window, xhrs).always(function () {
|
||||||
self.loadUsersTable().done(function () {
|
nfUsersTable.loadUsersTable().done(function () {
|
||||||
// select the new user
|
// select the new user
|
||||||
var row = usersData.getRowById(userEntity.id);
|
var row = usersData.getRowById(userEntity.id);
|
||||||
usersGrid.setSelectedRows([row]);
|
usersGrid.setSelectedRows([row]);
|
||||||
|
@ -330,7 +330,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$.when.apply(window, xhrs).always(function () {
|
$.when.apply(window, xhrs).always(function () {
|
||||||
self.loadUsersTable();
|
nfUsersTable.loadUsersTable();
|
||||||
}).fail(errorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
}).fail(errorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
@ -349,7 +349,7 @@
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (groupEntity) {
|
}).done(function (groupEntity) {
|
||||||
self.loadUsersTable().done(function () {
|
nfUsersTable.loadUsersTable().done(function () {
|
||||||
// add the user
|
// add the user
|
||||||
var usersGrid = $('#users-table').data('gridInstance');
|
var usersGrid = $('#users-table').data('gridInstance');
|
||||||
var usersData = usersGrid.getData();
|
var usersData = usersGrid.getData();
|
||||||
|
@ -385,7 +385,7 @@
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).done(function (groupEntity) {
|
}).done(function (groupEntity) {
|
||||||
self.loadUsersTable();
|
nfUsersTable.loadUsersTable();
|
||||||
}).fail(errorHandler.handleAjaxError);
|
}).fail(errorHandler.handleAjaxError);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global nf, top, define, module, require, exports */
|
/* global top, define, module, require, exports */
|
||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
|
Loading…
Reference in New Issue