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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]