mirror of https://github.com/apache/nifi.git
NIFI-326:
- Enabling the Enable/Disable button whenever the selection is not empty. - On Enable/Disable click, the components that support the desired action are filtered. The action (Enable/Disable) is then applied to the filtered selection.
This commit is contained in:
parent
4239797b9f
commit
0047fa4502
|
@ -349,7 +349,12 @@ nf.Actions = (function () {
|
|||
enable: function () {
|
||||
var components = d3.selectAll('g.component.selected').filter(function (d) {
|
||||
var selected = d3.select(this);
|
||||
return (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) && nf.CanvasUtils.supportsModification(selected);
|
||||
var selectedData = selected.datum();
|
||||
|
||||
// processors and ports that support modification and are not currently stopped
|
||||
return (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) &&
|
||||
nf.CanvasUtils.supportsModification(selected) &&
|
||||
selectedData.component.state !== 'STOPPED';
|
||||
});
|
||||
if (components.empty()) {
|
||||
nf.Dialog.showOkDialog({
|
||||
|
@ -379,7 +384,12 @@ nf.Actions = (function () {
|
|||
disable: function () {
|
||||
var components = d3.selectAll('g.component.selected').filter(function (d) {
|
||||
var selected = d3.select(this);
|
||||
return (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) && nf.CanvasUtils.supportsModification(selected);
|
||||
var selectedData = selected.datum();
|
||||
|
||||
// processors and ports that support modification and are not currently disabled
|
||||
return (nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected)) &&
|
||||
nf.CanvasUtils.supportsModification(selected) &&
|
||||
selectedData.component.state !== 'DISABLED';
|
||||
});
|
||||
if (components.empty()) {
|
||||
nf.Dialog.showOkDialog({
|
||||
|
@ -435,7 +445,6 @@ nf.Actions = (function () {
|
|||
data['running'] = true;
|
||||
}
|
||||
|
||||
// update the resource
|
||||
updateResource(d.component.uri, data).done(function (response) {
|
||||
if (nf.CanvasUtils.isProcessor(selected)) {
|
||||
nf.Processor.set(response.processor);
|
||||
|
|
|
@ -148,14 +148,8 @@ nf.CanvasToolbar = (function () {
|
|||
actions['fill'].disable();
|
||||
}
|
||||
|
||||
// determine if there are any selected components that support enable/disable
|
||||
var supportsEnable = selection.filter(function(d) {
|
||||
var selected = d3.select(this);
|
||||
return nf.CanvasUtils.isProcessor(selected) || nf.CanvasUtils.isInputPort(selected) || nf.CanvasUtils.isOutputPort(selected);
|
||||
});
|
||||
|
||||
// ensure the entire selection supports enable/disable
|
||||
if (!supportsEnable.empty() && supportsEnable.size() === selection.size()) {
|
||||
if (!selection.empty()) {
|
||||
actions['enable'].enable();
|
||||
actions['disable'].enable();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue