This is an automated email from the ASF dual-hosted git repository.

mcgilman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new d062029  NIFI-8927 - Add option to start/stop all controllers (#5247)
d062029 is described below

commit d062029258631114f201ef6c64f1552622bc9aee
Author: Eduardo Fontes <[email protected]>
AuthorDate: Mon Mar 7 15:57:35 2022 -0300

    NIFI-8927 - Add option to start/stop all controllers (#5247)
    
    * Update nf-context-menu.js
    
    Include enable/disable all controllers menu item
    
    * Update nf-actions.js
    
    Create enableAllControllers and disableAllControllers actions
    
    * Rename ...Controllers to ...ControllerServices
    
    * Rename *controllers to *controller services
    
    * Adjusts proposed by reviewer.
    
    * Refactor enable and disable AllControllerServices
    
    This closes #5247
---
 .../src/main/webapp/js/nf/canvas/nf-actions.js     | 50 ++++++++++++++++++++++
 .../main/webapp/js/nf/canvas/nf-context-menu.js    |  5 +++
 2 files changed, 55 insertions(+)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
index 24acd18..ae9345d 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
@@ -883,6 +883,56 @@
         },
 
         /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         */
+        enableAllControllerServices: function (selection) {
+            // get selected ProcessGroup id
+            var pg_id = selection.empty() ? nfCanvasUtils.getGroupId() : 
selection.datum().id;
+            // build URL
+            var url = config.urls.api + '/flow/process-groups/' + 
encodeURIComponent(pg_id) + '/controller-services';
+            // build the entity
+            var entity = {
+                'id': pg_id,
+                'state': 'ENABLED'
+            };
+
+            if (selection.empty()) {
+                updateResource(url, entity).done(updateProcessGroup);
+            } else {
+                updateResource(url, entity).done(function (response) {
+                    
nfCanvasUtils.getComponentByType('ProcessGroup').reload(pg_id);
+                })
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         */
+        disableAllControllerServices: function (selection) {
+            // get selected ProcessGroup id
+            var pg_id = selection.empty() ? nfCanvasUtils.getGroupId() : 
selection.datum().id;
+            // build URL
+            var url = config.urls.api + '/flow/process-groups/' + 
encodeURIComponent(pg_id) + '/controller-services';
+            // build the entity
+            var entity = {
+                'id': pg_id,
+                'state': 'DISABLED'
+            };
+
+            if (selection.empty()) {
+                updateResource(url, entity).done(updateProcessGroup);
+            } else {
+                updateResource(url, entity).done(function (response) {
+                    
nfCanvasUtils.getComponentByType('ProcessGroup').reload(pg_id);
+                })
+            }
+        },
+
+        /**
          * Stops the component and displays the processor configuration dialog
          *
          * @param {selection} selection      The selection
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
index 061a6bf..fd9ec47 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-context-menu.js
@@ -825,6 +825,11 @@
         {id: 'enable-transmission-menu-item', condition: canStartTransmission, 
menuItem: {clazz: 'fa fa-bullseye', text: 'Enable transmission', action: 
'enableTransmission'}},
         {id: 'disable-transmission-menu-item', condition: canStopTransmission, 
menuItem: { clazz: 'icon icon-transmit-false', text: 'Disable transmission', 
action: 'disableTransmission'}},
         {separator: true},
+        {id: 'enable-all-controller-services-menu-item', condition: 
isProcessGroup, menuItem: {clazz: 'fa fa-flash', text: 'Enable all controller 
services', action: 'enableAllControllerServices'}},
+        {id: 'enable-all-controller-services-menu-item-noselection', 
condition: emptySelection, menuItem: {clazz: 'fa fa-flash', text: 'Enable all 
controller services', action: 'enableAllControllerServices'}},
+        {id: 'disable-all-controller-services-menu-item', condition: 
isProcessGroup, menuItem: {clazz: 'icon icon-enable-false', text: 'Disable all 
controller services', action: 'disableAllControllerServices'}},
+        {id: 'disable-all-controller-services-menu-item-noselection', 
condition: emptySelection, menuItem: {clazz: 'icon icon-enable-false', text: 
'Disable all controller services', action: 'disableAllControllerServices'}},
+        {separator: true},
         {id: 'data-provenance-menu-item', condition: canAccessProvenance, 
menuItem: {clazz: 'icon icon-provenance', imgStyle: 'context-menu-provenance', 
text: 'View data provenance', action: 'openProvenance'}},
         {id: 'show-stats-menu-item', condition: supportsStats, menuItem: 
{clazz: 'fa fa-area-chart', text: 'View status history', action: 'showStats'}},
         {id: 'view-state-menu-item', condition: isStatefulProcessor, menuItem: 
{clazz: 'fa fa-tasks', text: 'View state', action: 'viewState'}},

Reply via email to