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.
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/0047fa45 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/0047fa45 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/0047fa45 Branch: refs/heads/NIFI-250 Commit: 0047fa4502223fbaff858f885496dd00fe035353 Parents: 4239797 Author: Matt Gilman <[email protected]> Authored: Tue Feb 17 12:34:01 2015 -0500 Committer: Matt Gilman <[email protected]> Committed: Tue Feb 17 12:34:01 2015 -0500 ---------------------------------------------------------------------- .../src/main/webapp/js/nf/canvas/nf-actions.js | 15 ++++++++++++--- .../main/webapp/js/nf/canvas/nf-canvas-toolbar.js | 8 +------- 2 files changed, 13 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0047fa45/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js index f2dc9b3..0af6198 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-actions.js @@ -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); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0047fa45/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js index e2ec53e..b5702af 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbar.js @@ -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 {
