Merge branch 'master' into NIFI-259

This commit is contained in:
Mark Payne 2016-01-21 15:02:00 -05:00
commit 3e13996512
4 changed files with 43 additions and 20 deletions

View File

@ -3545,8 +3545,15 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C
*/
if (mutableRequest) {
// if some (not all) nodes had a problematic response because of a missing counter, ensure the are not disconnected
if (!problematicNodeResponses.isEmpty() && problematicNodeResponses.size() < nodeResponses.size() && isMissingCounter(problematicNodeResponses, uri)) {
// all nodes failed
final boolean allNodesFailed = problematicNodeResponses.size() == nodeResponses.size();
// some nodes had a problematic response because of a missing counter, ensure the are not disconnected
final boolean someNodesFailedMissingCounter = !problematicNodeResponses.isEmpty()
&& problematicNodeResponses.size() < nodeResponses.size() && isMissingCounter(problematicNodeResponses, uri);
// ensure nodes stay connected in certain scenarios
if (allNodesFailed || someNodesFailedMissingCounter) {
for (final Map.Entry<Node, NodeResponse> updatedNodeEntry : updatedNodesMap.entrySet()) {
final NodeResponse nodeResponse = updatedNodeEntry.getValue();
final Node node = updatedNodeEntry.getKey();

View File

@ -534,6 +534,11 @@ public final class SnippetUtils {
final ConnectableDTO source = connectableMap.get(cp.getSource().getGroupId() + "-" + cp.getSource().getId());
final ConnectableDTO destination = connectableMap.get(cp.getDestination().getGroupId() + "-" + cp.getDestination().getId());
// ensure all referenced components are present
if (source == null || destination == null) {
throw new IllegalArgumentException("The flow snippet contains a Connection that references a component that is not included.");
}
cp.setId(generateId(connectionDTO.getId()));
cp.setSource(source);
cp.setDestination(destination);

View File

@ -1305,8 +1305,8 @@ nf.Actions = (function () {
// perform the paste
nf.Clipboard.paste().done(function (data) {
var copySnippet = $.Deferred(function (deferred) {
var reject = function () {
deferred.reject();
var reject = function (xhr, status, error) {
deferred.reject(xhr.responseText);
};
// create a snippet from the details
@ -1349,18 +1349,20 @@ nf.Actions = (function () {
// refresh the birdseye/toolbar
nf.Birdseye.refresh();
});
// reject the deferred
reject();
});
}).fail(reject);
}).fail(reject);
}).promise();
// show the appropriate message is the copy fails
copySnippet.fail(function () {
// unable to create the template
copySnippet.fail(function (responseText) {
// look for a message
var message = 'An error occurred while attempting to copy and paste.';
if ($.trim(responseText) !== '') {
message = responseText;
}
nf.Dialog.showOkDialog({
dialogContent: 'An error occurred while attempting to copy and paste.',
dialogContent: nf.Common.escapeHtml(message),
overlayBackground: true
});
});

View File

@ -626,6 +626,9 @@ nf.Canvas = (function () {
return;
}
// get the current selection
var selection = nf.CanvasUtils.getSelection();
// handle shortcuts
if (isCtrl) {
if (evt.keyCode === 82) {
@ -640,22 +643,28 @@ nf.Canvas = (function () {
evt.preventDefault();
} else if (evt.keyCode === 67) {
// ctrl-c
nf.Actions.copy(nf.CanvasUtils.getSelection());
if (nf.Common.isDFM() && nf.CanvasUtils.isCopyable(selection)) {
// ctrl-c
nf.Actions.copy(selection);
evt.preventDefault();
evt.preventDefault();
}
} else if (evt.keyCode === 86) {
// ctrl-p
nf.Actions.paste();
if (nf.Common.isDFM() && nf.CanvasUtils.isPastable()) {
// ctrl-p
nf.Actions.paste(selection);
evt.preventDefault();
evt.preventDefault();
}
}
} else {
if (evt.keyCode === 46) {
// delete
nf.Actions['delete'](nf.CanvasUtils.getSelection());
if (nf.Common.isDFM() && nf.CanvasUtils.isDeletable(selection)) {
// delete
nf.Actions['delete'](selection);
evt.preventDefault();
evt.preventDefault();
}
}
}
});