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
This commit is contained in:
Eduardo Fontes 2022-03-07 15:57:35 -03:00 committed by GitHub
parent 7d046fe3de
commit d062029258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 0 deletions

View File

@ -882,6 +882,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
*

View File

@ -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'}},