diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml index 8f4b06f8d03e..f73e416da70b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml @@ -559,6 +559,7 @@ ${staging.dir}/js/nf/canvas/header/components/nf-ng-remote-process-group-component.js ${staging.dir}/js/nf/canvas/header/components/nf-ng-funnel-component.js ${staging.dir}/js/nf/canvas/header/components/nf-ng-template-component.js + ${staging.dir}/js/nf/canvas/header/components/nf-ng-registry-import-component.js ${staging.dir}/js/nf/canvas/header/components/nf-ng-label-component.js ${staging.dir}/js/nf/canvas/directives/nf-ng-breadcrumbs-directive.js ${staging.dir}/js/nf/canvas/directives/nf-ng-draggable-directive.js diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/canvas.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/canvas.properties index b7ab3f60c437..102ec8a52345 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/canvas.properties +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/filters/canvas.properties @@ -89,6 +89,7 @@ nf.canvas.script.tags=\n\ \n\ \n\ +\n\ \n\ \n\ \n\ diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp index ac5abefa28d5..ee33e6af4de8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/canvas-header.jsp @@ -61,6 +61,13 @@ nf-draggable="appCtrl.serviceProvider.headerCtrl.toolboxCtrl.draggableComponentConfig(appCtrl.serviceProvider.headerCtrl.toolboxCtrl.funnelComponent);"> + ').click(function () { + var tab = $('
  • ').addClass(options.tabStyle).attr('name', tabDefinition.name ).append('').click(function () { // hide all tab content $('.' + tabContentStyle).hide(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js index 911063f2be7d..df348fd4883f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-toolbox-controller.js @@ -42,6 +42,7 @@ remoteGroupComponent, funnelComponent, templateComponent, + registryImportComponent, labelComponent) { 'use strict'; @@ -52,6 +53,7 @@ remoteGroupComponent, funnelComponent, templateComponent, + registryImportComponent, labelComponent) { this.processorComponent = processorComponent; this.inputPortComponent = inputPortComponent; @@ -60,6 +62,7 @@ this.remoteGroupComponent = remoteGroupComponent; this.funnelComponent = funnelComponent; this.templateComponent = templateComponent; + this.registryImportComponent = registryImportComponent; this.labelComponent = labelComponent; /** @@ -75,6 +78,7 @@ connection: 'Connection', funnel: 'Funnel', template: 'Template', + importFromRegistry: 'Import from Registry', label: 'Label' }, urls: { @@ -162,6 +166,7 @@ remoteGroupComponent, funnelComponent, templateComponent, + registryImportComponent, labelComponent); return toolboxCtrl; }; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-group-component.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-group-component.js index 42d90c6c48fa..e904c393b438 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-group-component.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-group-component.js @@ -569,7 +569,7 @@ }, handler: { click: function () { - nfFlowVersion.showImportFlowDialog(); + nfFlowVersion.showImportFlowDialog(pt); } } }); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-registry-import-component.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-registry-import-component.js new file mode 100644 index 000000000000..84f0d64ac459 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/header/components/nf-ng-registry-import-component.js @@ -0,0 +1,105 @@ +/* + * 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', 'nf.FlowVersion', 'nf.Settings', 'nf.Dialog', 'nf.Common'], + function ($, nfFlowVersion, nfDialog, nfCommon) { + return (nf.ng.RegistryImportComponent = factory($, nfFlowVersion,nfSettings, nfDialog, nfCommon)); + }); + } else if (typeof exports === 'object' && typeof module === 'object') { + module.exports = (nf.ng.RegistryImportComponent = + factory(require('jquery'), require('nf.FlowVersion', 'nf.Settings', 'nf.Dialog', 'nf.Common'))); + } else { + nf.ng.RegistryImportComponent = factory(root.$, root.nf.FlowVersion, root.nf.Settings, root.nf.Dialog, root.nf.Common); + } +}(this, function ($, nfFlowVersion, nfSettings, nfDialog, nfCommon) { + 'use strict'; + + return function () { + 'use strict'; + + function RegistryImportComponent() { + this.icon = 'icon icon-import-from-registry'; + this.hoverIcon = 'icon icon-import-from-registry-add'; + } + + RegistryImportComponent.prototype = { + constructor: RegistryImportComponent, + + /** + * Gets the component. + * + * @returns {*|jQuery|HTMLElement} + */ + getElement: function () { + return $('#registry-import-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) { + if (nfCommon.canVersionFlows()) { + nfFlowVersion.showImportFlowDialog(pt); + } else { + nfDialog.showYesNoDialog({ + headerText: 'No Registry Client available', + dialogContent: 'In order to import flows from a Registry a Registry Client must be configured in Controller Settings.', + noText: 'Cancel', + yesText: 'Configure', + yesHandler: function () { + // get the connection data + nfSettings.showSettings('Registry Clients'); + } + }); + } + }, + + /** + * The drag icon for the toolbox component. + * + * @param event + * @returns {*|jQuery|HTMLElement} + */ + dragIcon: function (event) { + return $('
    '); + } + } + + var registryImportComponent = new RegistryImportComponent(); + return registryImportComponent; + }; +})); \ No newline at end of file diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-bootstrap.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-bootstrap.js index 655a8ccd8e4d..070bc5b095a7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-bootstrap.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-bootstrap.js @@ -79,14 +79,15 @@ 'nf.ng.RemoteProcessGroupComponent', 'nf.ng.FunnelComponent', 'nf.ng.TemplateComponent', + 'nf.ng.RegistryImportComponent', 'nf.ng.LabelComponent', 'nf.ng.Canvas.GraphControlsCtrl', 'nf.ng.Canvas.NavigateCtrl', 'nf.ng.Canvas.OperateCtrl', 'nf.ng.BreadcrumbsDirective', 'nf.ng.DraggableDirective'], - function ($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfQuickSelect, nfShell, nfParameterContexts, nfSettings, nfActions, nfSnippet, nfQueueListing, nfVerify, nfComponentState, nfFlowVersion, nfComponentVersion, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfFlowAnalysisRule, nfParameterProvider, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) { - return factory($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfQuickSelect, nfShell, nfParameterContexts, nfSettings, nfActions, nfSnippet, nfQueueListing, nfVerify, nfComponentState, nfFlowVersion, nfComponentVersion, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfFlowAnalysisRule, nfParameterProvider, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective); + function ($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfQuickSelect, nfShell, nfParameterContexts, nfSettings, nfActions, nfSnippet, nfQueueListing, nfVerify, nfComponentState, nfFlowVersion, nfComponentVersion, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfFlowAnalysisRule, nfParameterProvider, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, registryImportComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) { + return factory($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfQuickSelect, nfShell, nfParameterContexts, nfSettings, nfActions, nfSnippet, nfQueueListing, nfVerify, nfComponentState, nfFlowVersion, nfComponentVersion, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfFlowAnalysisRule, nfParameterProvider, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, registryImportComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = factory(require('jquery'), @@ -149,6 +150,7 @@ require('nf.ng.RemoteProcessGroupComponent'), require('nf.ng.FunnelComponent'), require('nf.ng.TemplateComponent'), + require('nf.ng.RegistryImportComponent'), require('nf.ng.LabelComponent'), require('nf.ng.Canvas.GraphControlsCtrl'), require('nf.ng.Canvas.NavigateCtrl'), @@ -216,6 +218,7 @@ root.nf.ng.RemoteProcessGroupComponent, root.nf.ng.FunnelComponent, root.nf.ng.TemplateComponent, + root.nf.ng.RegistryImportComponent, root.nf.ng.LabelComponent, root.nf.ng.Canvas.GraphControlsCtrl, root.nf.ng.Canvas.NavigateCtrl, @@ -223,7 +226,7 @@ root.nf.ng.BreadcrumbsDirective, root.nf.ng.DraggableDirective); } -}(this, function ($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfQuickSelect, nfShell, nfParameterContexts, nfSettings, nfActions, nfSnippet, nfQueueListing, nfVerify, nfComponentState, nfFlowVersion, nfComponentVersion, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfFlowAnalysisRule, nfParameterProvider, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) { +}(this, function ($, angular, nfCommon, nfCanvasUtils, nfErrorHandler, nfClient, nfDialog, nfStorage, nfCanvas, nfGraph, nfContextMenu, nfQuickSelect, nfShell, nfParameterContexts, nfSettings, nfActions, nfSnippet, nfQueueListing, nfVerify, nfComponentState, nfFlowVersion, nfComponentVersion, nfDraggable, nfConnectable, nfStatusHistory, nfBirdseye, nfConnectionConfiguration, nfControllerService, nfReportingTask, nfFlowAnalysisRule, nfParameterProvider, nfPolicyManagement, nfProcessorConfiguration, nfProcessGroupConfiguration, nfControllerServices, nfRemoteProcessGroupConfiguration, nfRemoteProcessGroupPorts, nfPortConfiguration, nfLabelConfiguration, nfProcessorDetails, nfPortDetails, nfConnectionDetails, nfRemoteProcessGroupDetails, nfGoto, nfNgBridge, appCtrl, appConfig, serviceProvider, breadcrumbsCtrl, headerCtrl, flowStatusCtrl, globalMenuCtrl, toolboxCtrl, processorComponent, inputPortComponent, outputPortComponent, processGroupComponent, remoteProcessGroupComponent, funnelComponent, templateComponent, registryImportComponent, labelComponent, graphControlsCtrl, navigateCtrl, operateCtrl, breadcrumbsDirective, draggableDirective) { var config = { urls: { @@ -255,6 +258,7 @@ 'remoteGroupComponent', 'funnelComponent', 'templateComponent', + 'registryImportComponent', 'labelComponent']; processorComponent.$inject = ['serviceProvider']; inputPortComponent.$inject = ['serviceProvider']; @@ -263,6 +267,7 @@ remoteProcessGroupComponent.$inject = ['serviceProvider']; funnelComponent.$inject = ['serviceProvider']; templateComponent.$inject = ['serviceProvider']; + registryImportComponent.$inject = ['serviceProvider']; labelComponent.$inject = ['serviceProvider']; graphControlsCtrl.$inject = ['serviceProvider', 'navigateCtrl', 'operateCtrl']; navigateCtrl.$inject = ['$timeout']; @@ -290,6 +295,7 @@ app.service('remoteGroupComponent', remoteProcessGroupComponent); app.service('funnelComponent', funnelComponent); app.service('templateComponent', templateComponent); + app.service('registryImportComponent', registryImportComponent); app.service('labelComponent', labelComponent); app.service('graphControlsCtrl', graphControlsCtrl); app.service('navigateCtrl', navigateCtrl); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-flow-version.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-flow-version.js index 1bf82bf56fc8..80365699d88d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-flow-version.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-flow-version.js @@ -753,9 +753,10 @@ /** * Shows the import flow version dialog. + * + * @param pt */ - var showImportFlowVersionDialog = function () { - var pt = $('#new-process-group-dialog').data('pt'); + var showImportFlowVersionDialog = function (pt) { $('#import-flow-version-dialog').data('pt', pt); // update the registry and bucket visibility @@ -1793,8 +1794,8 @@ /** * Shows the import flow dialog. */ - showImportFlowDialog: function () { - showImportFlowVersionDialog(); + showImportFlowDialog: function (pt) { + showImportFlowVersionDialog(pt); }, /** diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js index dc8fe71bf116..f68448f12757 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js @@ -20,23 +20,23 @@ (function (root, factory) { if (typeof define === 'function' && define.amd) { define(['jquery', - 'Slick', - 'd3', - 'nf.Client', - 'nf.Dialog', - 'nf.Storage', - 'nf.Common', - 'nf.CanvasUtils', - 'nf.ControllerServices', - 'nf.ErrorHandler', - 'nf.FilteredDialogCommon', - 'nf.ReportingTask', - 'nf.FlowAnalysisRule', - 'nf.Shell', - 'nf.ComponentState', - 'nf.ComponentVersion', - 'nf.PolicyManagement', - 'nf.ParameterProvider'], + 'Slick', + 'd3', + 'nf.Client', + 'nf.Dialog', + 'nf.Storage', + 'nf.Common', + 'nf.CanvasUtils', + 'nf.ControllerServices', + 'nf.ErrorHandler', + 'nf.FilteredDialogCommon', + 'nf.ReportingTask', + 'nf.FlowAnalysisRule', + 'nf.Shell', + 'nf.ComponentState', + 'nf.ComponentVersion', + 'nf.PolicyManagement', + 'nf.ParameterProvider'], function ($, Slick, d3, nfClient, nfDialog, nfStorage, nfCommon, nfCanvasUtils, nfControllerServices, nfErrorHandler, nfFilteredDialogCommon, nfReportingTask, nfFlowAnalysisRule, nfShell, nfComponentState, nfComponentVersion, nfPolicyManagement, nfParameterProvider) { return (nf.Settings = factory($, Slick, d3, nfClient, nfDialog, nfStorage, nfCommon, nfCanvasUtils, nfControllerServices, nfErrorHandler, nfFilteredDialogCommon, nfReportingTask, nfFlowAnalysisRule, nfShell, nfComponentState, nfComponentVersion, nfPolicyManagement, nfParameterProvider)); }); @@ -98,7 +98,8 @@ createParameterProvider: '../nifi-api/controller/parameter-providers', parameterProviderTypes: '../nifi-api/flow/parameter-provider-types', parameterProviders: '../nifi-api/flow/parameter-providers', - registryTypes: '../nifi-api/controller/registry-types' + registryTypes: '../nifi-api/controller/registry-types', + currentUser: '../nifi-api/flow/current-user' } }; @@ -636,6 +637,19 @@ return addTask; }; + /** + * Loads the current users. + */ + var loadCurrentUser = function () { + $.ajax({ + type: 'GET', + url: config.urls.currentUser, + dataType: 'json' + }).done(function (currentUser) { + nfCommon.setCurrentUser(currentUser); + }); + }; + /** * Adds the specified registry entity. */ @@ -679,6 +693,10 @@ nfFilteredDialogCommon.choseRow(registriesGrid, row); registriesGrid.scrollRowIntoView(row); + // refresh the current-user after configuring or deleting a registry client + // 'canVersionFlows' property determines if we show the No Registry Client available dialog or the Import Version dialog + loadCurrentUser(); + // hide the dialog $('#registry-configuration-dialog').modal('hide'); $('#new-registry-client-dialog').modal('hide'); @@ -1021,7 +1039,7 @@ type: documentedType.type, bundle: documentedType.bundle, description: nfCommon.escapeHtml(documentedType.description), - restricted: documentedType.restricted, + restricted: documentedType.restricted, usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction), explicitRestrictions: documentedType.explicitRestrictions, tags: documentedType.tags.join(', ') @@ -1129,19 +1147,19 @@ } } }, - { - buttonText: 'Cancel', - color: { - base: '#E3E8EB', - hover: '#C7D2D7', - text: '#004849' - }, - handler: { - click: function () { - $(this).modal('hide'); - } + { + buttonText: 'Cancel', + color: { + base: '#E3E8EB', + hover: '#C7D2D7', + text: '#004849' + }, + handler: { + click: function () { + $(this).modal('hide'); } - }], + } + }], handler: { close: function () { // clear the selected row @@ -1423,7 +1441,7 @@ type: documentedType.type, bundle: documentedType.bundle, description: nfCommon.escapeHtml(documentedType.description), - restricted: documentedType.restricted, + restricted: documentedType.restricted, usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction), explicitRestrictions: documentedType.explicitRestrictions, tags: documentedType.tags.join(', ') @@ -1531,19 +1549,19 @@ } } }, - { - buttonText: 'Cancel', - color: { - base: '#E3E8EB', - hover: '#C7D2D7', - text: '#004849' - }, - handler: { - click: function () { - $(this).modal('hide'); - } + { + buttonText: 'Cancel', + color: { + base: '#E3E8EB', + hover: '#C7D2D7', + text: '#004849' + }, + handler: { + click: function () { + $(this).modal('hide'); } } + } ], handler: { close: function () { @@ -1601,7 +1619,7 @@ var hasBulletins = !nfCommon.isEmpty(dataContext.bulletins); if (hasComments) { - markup += '
    '; + markup += '
    '; } if (hasErrors) { @@ -1838,7 +1856,7 @@ $('#reporting-tasks-table').data('gridInstance', reportingTasksGrid).on('mouseenter', 'div.slick-cell', function (e) { var commentsIcon = $(this).find('div.has-comments'); if (commentsIcon.length && !commentsIcon.data('qtip')) { - var taskId = $(this).find('span.row-id').text(); + var taskId = $(this).find('span.row-id').text(); // get the task item var reportingTaskEntity = reportingTasksData.getItemById(taskId); @@ -2333,7 +2351,7 @@ type: documentedType.type, bundle: documentedType.bundle, description: nfCommon.escapeHtml(documentedType.description), - restricted: documentedType.restricted, + restricted: documentedType.restricted, usageRestriction: nfCommon.escapeHtml(documentedType.usageRestriction), explicitRestrictions: documentedType.explicitRestrictions, tags: documentedType.tags.join(', ') @@ -2441,19 +2459,19 @@ } } }, - { - buttonText: 'Cancel', - color: { - base: '#E3E8EB', - hover: '#C7D2D7', - text: '#004849' - }, - handler: { - click: function () { - $(this).modal('hide'); - } + { + buttonText: 'Cancel', + color: { + base: '#E3E8EB', + hover: '#C7D2D7', + text: '#004849' + }, + handler: { + click: function () { + $(this).modal('hide'); } - }], + } + }], handler: { close: function () { // clear the selected row @@ -3328,6 +3346,10 @@ var registryGrid = $('#registries-table').data('gridInstance'); var registryData = registryGrid.getData(); registryData.deleteItem(registryEntity.id); + + // refresh the current-user after configuring or deleting a registry client + // 'canVersionFlows' property determines if we show the No Registry Client available dialog or the Import Version dialog + loadCurrentUser(); }).fail(nfErrorHandler.handleAjaxError); }; @@ -3562,7 +3584,7 @@ * Determines whether the user has made any changes to the registry configuration * that needs to be saved. */ - var isSaveRequired = function () { + var isSaveRequired = function () { var entity = $('#registry-configuration-dialog').data('registryDetails'); // determine if any registry settings have changed @@ -3579,7 +3601,7 @@ /** * Goes to a service configuration from the property table. */ - var goToServiceFromProperty = function () { + var goToServiceFromProperty = function () { return $.Deferred(function (deferred) { // close all fields currently being edited $('#registry-properties').propertytable('saveRow'); @@ -3614,7 +3636,7 @@ * @param {type} propertyName * @param {type} sensitive Requested sensitive status */ - var getRegistryPropertyDescriptor = function (propertyName, sensitive) { + var getRegistryPropertyDescriptor = function (propertyName, sensitive) { var details = $('#registry-configuration-dialog').data('registryDetails'); return $.ajax({ type: 'GET', @@ -3629,15 +3651,17 @@ /** * Shows the process group configuration. + * + * @param {string} tabName */ - var showSettings = function () { + var showSettings = function (tabName) { // show the settings dialog nfShell.showContent('#settings').done(function () { reset(); }); //reset content to account for possible policy changes - $('#settings-tabs').find('.selected-tab').click(); + $('#settings-tabs').find(tabName ? '[name="' + tabName + '"]' : '.selected-tab').click(); // adjust the table size nfSettings.resetTableSize(); @@ -3656,7 +3680,7 @@ * * @param {object} reportingTask */ - var renderRegistry = function (registryEntity) { + var renderRegistry = function (registryEntity) { // get the table and update the row accordingly var registryGrid = $('#registries-table').data('gridInstance'); var registryData = registryGrid.getData(); @@ -3670,7 +3694,7 @@ * * @param {string} id */ - var reloadRegistryInfo = function (id) { + var reloadRegistryInfo = function (id) { var registryGrid = $('#registries-table').data('gridInstance'); var registryData = registryGrid.getData(); var registryEntity = registryData.getItemById(id); @@ -3704,9 +3728,9 @@ name: 'Reporting Tasks', tabContentId: 'reporting-tasks-tab-content' }, { - name: 'Flow Analysis Rules', - tabContentId: 'flow-analysis-rules-tab-content' - }, { + name: 'Flow Analysis Rules', + tabContentId: 'flow-analysis-rules-tab-content' + }, { name: 'Registry Clients', tabContentId: 'registries-tab-content' }, { @@ -3921,9 +3945,13 @@ /** * Shows the settings dialog. + * + * @param {string} tabName */ - showSettings: function () { - return loadSettings().done(showSettings); + showSettings: function (tabName) { + return loadSettings().done(function () { + showSettings(tabName) + }); }, /** @@ -4005,7 +4033,7 @@ // if there are some bulletins process them if (!nfCommon.isEmpty(reportingTaskBulletins)) { - var reportingTaskBulletinsBySource = new Map(reportingTaskBulletins.map(function(d) { return [d.sourceId, d]; })); + var reportingTaskBulletinsBySource = new Map(reportingTaskBulletins.map(function (d) { return [d.sourceId, d]; })); reportingTaskBulletinsBySource.forEach(function (sourceBulletins, sourceId) { var reportingTask = reportingTasksData.getItemById(sourceId);