You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2017/03/21 19:17:18 UTC
nifi git commit: [NIFI-2697] revert transmission switch toggle on
failed update request. This closes #1600
Repository: nifi
Updated Branches:
refs/heads/master b3b65219a -> 40acd4a6e
[NIFI-2697] revert transmission switch toggle on failed update request. This closes #1600
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/40acd4a6
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/40acd4a6
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/40acd4a6
Branch: refs/heads/master
Commit: 40acd4a6e1e99ab21504e62977f2a268e23fbf06
Parents: b3b6521
Author: Scott Aslan <sc...@gmail.com>
Authored: Fri Mar 17 12:32:33 2017 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Tue Mar 21 15:17:02 2017 -0400
----------------------------------------------------------------------
.../nf/canvas/nf-remote-process-group-ports.js | 56 +++++++++++++-------
1 file changed, 37 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/40acd4a6/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js
index 2a7f282..f06182b 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js
@@ -251,26 +251,34 @@
// if can modify, support updating the remote group port
if (nfCanvasUtils.canModify(remoteProcessGroup)) {
- // show the enabled transmission switch
- var transmissionSwitch;
- if (port.connected === true) {
- if (port.transmitting === true) {
- transmissionSwitch = (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
- transmissionSwitch.click();
- } else {
- if (port.exists === true) {
- transmissionSwitch = (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
+
+ var createTransmissionSwitch = function (port) {
+ var transmissionSwitch;
+ if (port.connected === true) {
+ if (port.transmitting === true) {
+ transmissionSwitch = (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope));
+ transmissionSwitch.click();
} else {
- (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
+ if (port.exists === true) {
+ transmissionSwitch = (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary enabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope));
+ } else {
+ (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope));
+ }
}
- }
- } else {
- if (port.transmitting === true) {
- (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
} else {
- (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope)).appendTo(portContainerEditContainer);
+ if (port.transmitting === true) {
+ (nfNgBridge.injector.get('$compile')($('<md-switch style="margin:0px" class="md-primary disabled-active-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope));
+ } else {
+ (nfNgBridge.injector.get('$compile')($('<md-switch ng-disabled="true" style="margin:0px" class="md-primary disabled-inactive-transmission" aria-label="Toggle port transmission"></md-switch>'))(nfNgBridge.rootScope));
+ }
}
- }
+
+ return transmissionSwitch;
+ };
+
+ // show the enabled transmission switch
+ var transmissionSwitch = createTransmissionSwitch(port);
+ transmissionSwitch.appendTo(portContainerEditContainer);
// only support configuration when the remote port exists
if (port.exists === true && port.connected === true) {
@@ -300,8 +308,7 @@
// only allow modifications to transmission when the swtich is defined
if (nfCommon.isDefinedAndNotNull(transmissionSwitch)) {
- // create toggle for changing transmission state
- transmissionSwitch.click(function () {
+ var transmissionSwitchClickFunction = function () {
// get the component being edited
var remoteProcessGroupId = $('#remote-process-group-ports-id').text();
var remoteProcessGroupData = d3.select('#id-' + remoteProcessGroupId).datum();
@@ -373,6 +380,14 @@
}
}
}).fail(function (xhr, status, error) {
+ // create replacement switch
+ var newTransmissionSwitch = createTransmissionSwitch(port);
+ // add click handler
+ newTransmissionSwitch.click(transmissionSwitchClickFunction);
+ //replace DOM element
+ transmissionSwitch.replaceWith(newTransmissionSwitch);
+ // update transmissionSwitch variable to reference the new switch
+ transmissionSwitch = newTransmissionSwitch;
if (xhr.status === 400) {
var errors = xhr.responseText.split('\n');
@@ -391,7 +406,10 @@
nfErrorHandler.handleAjaxError(xhr, status, error);
}
});
- });
+ };
+
+ // create toggle for changing transmission state
+ transmissionSwitch.click(transmissionSwitchClickFunction);
}
} else {
// show the disabled transmission switch