You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/07/25 18:52:42 UTC

[GitHub] [nifi] eduardofontes opened a new pull request #5247: NIFI-8927 - Add option to start/stop all controllers

eduardofontes opened a new pull request #5247:
URL: https://github.com/apache/nifi/pull/5247


   <!--
     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.
   -->
   Thank you for submitting a contribution to Apache NiFi.
   
   Please provide a short description of the PR here:
   
   #### Description of PR
   
   _Enables X functionality; fixes bug NIFI-8927._
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [ ] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] Have you verified that the full build is successful on JDK 8?
   - [ ] Have you verified that the full build is successful on JDK 11?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1049438919


   > Thanks again for the PR @eduardofontes! I did comment previously regarding some important pre-conditions. However, based on @markap14 feedback, it sounds like this PR is still helpful as-is. I've reviewed the changeset and left some comments.
   
   Thank you @mcgilman .
   I've made the most of changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] mcgilman commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
mcgilman commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1061022769


   Thanks for the PR @eduardofontes! Looks great. This has been merged to main.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813492052



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'DISABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStop = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to stop
+                if (!componentsToStop.empty()) {
+                    var stopRequests = [];
+
+                    // stop each selected component
+                    componentsToStop.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'DISABLED'
+                        };
+
+                        stopRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);

Review comment:
       Same comment above to keep this. :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes edited a comment on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes edited a comment on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1049438919


   > Thanks again for the PR @eduardofontes! I did comment previously regarding some important pre-conditions. However, based on @markap14 feedback, it sounds like this PR is still helpful as-is. I've reviewed the changeset and left some comments.
   
   Thank you @mcgilman .
   I've made almost all changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1015677439


   Could somebody prease review this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] joewitt commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
joewitt commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1039406858


   We need to have more information on what has been verified here.  What happens on a taxed system with many controller services?  Does this cause blocking while that is happening?  How does this play with the async handling?  I'd be hesitant to merge until someone more knowledgeable has looked at this AND we have some information on testing.
   
   Obviously this is a useful feature but needs engagement from more folks in the community with more knowledge on these parts.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813475240



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {

Review comment:
       Callback function removed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-892931518


   @markobean Done!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-892931518


   @markobean Done!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] mcgilman commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
mcgilman commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r812285773



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {

Review comment:
       Same comment as above regarding the `cb`.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'DISABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStop = selection.filter(function (d) {

Review comment:
       Same comment as above regarding the selection.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {

Review comment:
       The conditions on menu-items that could invoke this function guarantee that the selection is either empty or a single Process Group. Unless this is being invoked in a different context, we should update this to work with a single element.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {

Review comment:
       What is `cb` used for in this case? Other actions (like `stop` and `terminate`) had a callback introduced when we introduced the ability to stop a running Processor from the details dialog and subsequently open the configuration dialog (NIFI-5986). I don't see a similar capability here with enabling a Controller Service.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'DISABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStop = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to stop
+                if (!componentsToStop.empty()) {

Review comment:
       Same comment as above regarding the verb used here.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {

Review comment:
       Controller Services are not started/stopped. They are enabled/disabled. Can we update the names/comments to reflect this?

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);

Review comment:
       In the context of starting a Processor, this reload call was necessary to update the Process Group node on the canvas. There currently are no Controller Service statuses rendered on the Process Group node. I don't believe this call is necessary here.

##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'DISABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStop = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to stop
+                if (!componentsToStop.empty()) {
+                    var stopRequests = [];
+
+                    // stop each selected component
+                    componentsToStop.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'DISABLED'
+                        };
+
+                        stopRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);

Review comment:
       Same comment as above regarding the `reload` call.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813487930



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {

Review comment:
       I've changed the condition to `if (!componentsToEnable.empty() && selection.size() === 1)`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] mcgilman commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
mcgilman commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r815962313



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {

Review comment:
       @eduardofontes With the conditions on menu-items guaranteeing that selection is empty or 1 we are doing a lot of unnecessary processing here. Within this `else` we already know the selection is empty. Since the condition was for a single Process Group, we don't need to be filtering for the components to enable or the `enableRequests[]` array. 
   
   I think it would be fair to establish conditions that ensure the selection is a single Process Group.  However, code that allows the selection to contain other types of components and filters down to only the Process Groups is unnecessary. It was a requirement of the code where this snippet was copied from. However, it's not a requirement here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] mcgilman merged pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
mcgilman merged pull request #5247:
URL: https://github.com/apache/nifi/pull/5247


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] markobean commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
markobean commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-892718873


   I suggest you update references to the phrasing "controllers" to "controller services". This is most important in the user-facing UI, but also will add clarity in the code as well. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813475003



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {

Review comment:
       Callback function removed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] andrewmlim commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
andrewmlim commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1076845250


   Filed https://issues.apache.org/jira/browse/NIFI-9829 to capture some of the UX improvements discussed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes edited a comment on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes edited a comment on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1015677439


   Could somebody please review this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] markap14 commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
markap14 commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1041928487


   Thanks for your thoughts @joewitt and @mcgilman. Here's my 2 cents:
   - I'm not the one to review the code because my JavaScript skills are non-existent, so I can't review from that perspective.
   - The calls that the UI makes are to the existing endpoints, which asynchronously enable/disable controller services. So I don't think we have concerns about high load causing timeouts, failures, etc. because it shouldn't block
   - I do agree with mcgilman that I'd like to see a UI that allows the controller services to be visualized with all referencing components so that users know exactly what they are doing when they Disable All. And when enabling, ideally it would be helpful to be able to choose to start referencing components as well.
   - That said, I think this feature is extremely useful as-is. The more powerful UI capability can still be provided in a future release of NiFi, but I think this is significantly more helpful than what we have currently.
   
   So while I'm not in a position to review the code I'm a +1 personally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] mcgilman commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
mcgilman commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1039496144


   @eduardofontes Thanks for the PR! The process of enabling and disabling Controller Services is complex. Currently, the NiFi UI supports enabling and disabling a single Controller Service. When enabling the user has the option to conditionally enable any dependent Controller Services and starting any referencing Processors/Reporting Tasks. When disabling the user does not have this option as the user must stop all referencing Processors/Reporting Tasks and disable any dependent Controller Services. Since there could be any number of affected components, this helps keep the operation as concise as possible, helps guarantee its success, and provides the user the necessary insight into the operation.
   
   The API that your invoking is actually part of a larger sequence [1] to update Variables and Parameters that could be referenced by Controller Services and their referencing components across all Nodes in a cluster. The UX for those actions show the user the affected components and provides updates as the cluster performs the sequence of operations. I think this feature would also benefit from a similar UX where the user can see the full scope of their action and gets updates while the action completes.
   
   [1] https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java#L827


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813489325



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'DISABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStop = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to stop
+                if (!componentsToStop.empty()) {

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] markobean commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
markobean commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-892718873


   I suggest you update references to the phrasing "controllers" to "controller services". This is most important in the user-facing UI, but also will add clarity in the code as well. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] mcgilman commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
mcgilman commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1039496144


   @eduardofontes Thanks for the PR! The process of enabling and disabling Controller Services is complex. Currently, the NiFi UI supports enabling and disabling a single Controller Service. When enabling the user has the option to conditionally enable any dependent Controller Services and starting any referencing Processors/Reporting Tasks. When disabling the user does not have this option as the user must stop all referencing Processors/Reporting Tasks and disable any dependent Controller Services. Since there could be any number of affected components, this helps keep the operation as concise as possible, helps guarantee its success, and provides the user the necessary insight into the operation.
   
   The API that your invoking is actually part of a larger sequence [1] to update Variables and Parameters that could be referenced by Controller Services and their referencing components across all Nodes in a cluster. The UX for those actions show the user the affected components and provides updates as the cluster performs the sequence of operations. I think this feature would also benefit from a similar UX where the user can see the full scope of their action and gets updates while the action completes.
   
   [1] https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java#L827


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] joewitt commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
joewitt commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-1039406858


   We need to have more information on what has been verified here.  What happens on a taxed system with many controller services?  Does this cause blocking while that is happening?  How does this play with the async handling?  I'd be hesitant to merge until someone more knowledgeable has looked at this AND we have some information on testing.
   
   Obviously this is a useful feature but needs engagement from more folks in the community with more knowledge on these parts.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813491706



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);

Review comment:
       Actually it updates the processors status after enable/disable de controllers. I think it's better to keep this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] pvillard31 commented on pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
pvillard31 commented on pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#issuecomment-887608632


   From a pure testing perspective, this looks good. Not sure if there are corner cases though... but in the end you're just calling exposed REST APIs so I don't see why there would be an issue. This is definitely helpful. I'd still wait for someone familiar with the UI to have a look. Thanks @eduardofontes 
   
   ![Screenshot 2021-07-27 at 16 30 15](https://user-images.githubusercontent.com/11541012/127181952-e5b00540-ba7b-41b1-bf3d-67192fd92c58.png)
   ![Screenshot 2021-07-27 at 16 31 54](https://user-images.githubusercontent.com/11541012/127181958-ddce0a1d-9fdb-4670-873d-c38032ca9521.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813489064



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {
+                    var startRequests = [];
+
+                    // start each selected component
+                    componentsToStart.each(function (d) {
+                        var selected = d3.select(this);
+
+                        // prepare the request
+                        var uri, entity;
+                        uri = config.urls.api + '/flow/process-groups/' + encodeURIComponent(d.id) + '/controller-services';
+                        entity = {
+                            'id': d.id,
+                            'state': 'ENABLED'
+                        };
+
+                        startRequests.push(updateResource(uri, entity).done(function (response) {
+                            nfCanvasUtils.getComponentByType('ProcessGroup').reload(d.id);
+                        }));
+                    });
+
+                    // inform Angular app once the updates have completed
+                    if (startRequests.length > 0) {
+                        $.when.apply(window, startRequests).always(function () {
+                            nfNgBridge.digest();
+                            if(typeof cb == 'function'){
+                                cb();
+                            }
+                        });
+                    } else if(typeof cb == 'function'){
+                         cb();
+                    }
+                }
+            }
+        },
+
+        /**
+         * Disable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         disableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'DISABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStop = selection.filter(function (d) {

Review comment:
       I've changed the condition to `if (!componentsToDisable.empty() && selection.size() === 1)`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r813489209



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {
+                    return nfCanvasUtils.isProcessGroup(d3.select(this));
+                });
+
+                // ensure there are some component to start
+                if (!componentsToStart.empty()) {

Review comment:
       Done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi] eduardofontes commented on a change in pull request #5247: NIFI-8927 - Add option to start/stop all controllers

Posted by GitBox <gi...@apache.org>.
eduardofontes commented on a change in pull request #5247:
URL: https://github.com/apache/nifi/pull/5247#discussion_r820359858



##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js
##########
@@ -845,6 +845,116 @@
             }
         },
 
+        /**
+         * Enable all controller services in the specified ProcessGroup.
+         *
+         * @argument {selection} selection      The selection
+         * @argument {cb} callback              The function to call when request is processed
+         */
+         enableAllControllerServices: function (selection,cb) {
+            if (selection.empty()) {
+                // build the entity
+                var entity = {
+                    'id': nfCanvasUtils.getGroupId(),
+                    'state': 'ENABLED'
+                };
+                updateResource(config.urls.api + '/flow/process-groups/' + encodeURIComponent(nfCanvasUtils.getGroupId()) + '/controller-services', entity).done(updateProcessGroup);
+            } else {
+                var componentsToStart = selection.filter(function (d) {

Review comment:
       @mcgilman I've refactored the functions and now they're simpler.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org