You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sc...@apache.org on 2017/09/13 17:05:28 UTC
nifi git commit: NIFI-3369 - Disable "Add" button on new...
Repository: nifi
Updated Branches:
refs/heads/master 0e5027946 -> 1f1269c81
NIFI-3369 - Disable "Add" button on new...
...connection dialog if no relationships selected
Disabled confirmation button for both Create and Configure Connection
dialogs when no relationship was selected.
Signed-off-by: Scott Aslan <sc...@gmail.com>
This closes #2152
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/1f1269c8
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/1f1269c8
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/1f1269c8
Branch: refs/heads/master
Commit: 1f1269c817a32b32fd19f32f942dc92cbf1e4a8d
Parents: 0e50279
Author: yuri1969 <19...@gmail.com>
Authored: Tue Sep 12 19:51:10 2017 +0200
Committer: Scott Aslan <sc...@gmail.com>
Committed: Wed Sep 13 13:04:24 2017 -0400
----------------------------------------------------------------------
.../js/nf/canvas/nf-connection-configuration.js | 63 ++++++++++----------
.../src/main/webapp/js/nf/nf-common.js | 2 +
2 files changed, 33 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/1f1269c8/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
index 9f0013f..4425e3c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-connection-configuration.js
@@ -74,6 +74,16 @@
};
/**
+ * Activates dialog's button model refresh on a connection relationships change.
+ */
+ var addDialogRelationshipsChangeListener = function() {
+ // refresh button model when a relationship selection changes
+ $('div.available-relationship').bind('change', function() {
+ $('#connection-configuration').modal('refreshButtons');
+ });
+ }
+
+ /**
* Initializes the source in the new connection dialog.
*
* @argument {selection} source The source
@@ -89,6 +99,8 @@
$.each(processor.relationships, function (i, relationship) {
createRelationshipOption(relationship.name);
});
+
+ addDialogRelationshipsChangeListener();
// if there is a single relationship auto select
var relationships = $('#relationship-names').children('div');
@@ -104,21 +116,13 @@
hover: '#004849',
text: '#ffffff'
},
+ disabled: function () {
+ // ensure some relationships were selected
+ return getSelectedRelationships().length === 0;
+ },
handler: {
click: function () {
- // get the selected relationships
- var selectedRelationships = getSelectedRelationships();
-
- // ensure some relationships were selected
- if (selectedRelationships.length > 0) {
- addConnection(selectedRelationships);
- } else {
- // inform users that no relationships were selected
- nfDialog.showOkDialog({
- headerText: 'Connection Configuration',
- dialogContent: 'The connection must have at least one relationship selected.'
- });
- }
+ addConnection(getSelectedRelationships());
// close the dialog
$('#connection-configuration').modal('hide');
@@ -1331,6 +1335,8 @@
createRelationshipOption(name);
});
+ addDialogRelationshipsChangeListener();
+
// ensure all selected relationships are present
// (may be undefined) and selected
$.each(selectedRelationships, function (i, name) {
@@ -1395,30 +1401,23 @@
hover: '#004849',
text: '#ffffff'
},
+ disabled: function () {
+ // ensure some relationships were selected with a processor as the source
+ if (nfCanvasUtils.isProcessor(source)) {
+ return getSelectedRelationships().length === 0;
+ }
+ return false;
+ },
handler: {
click: function () {
- // get the selected relationships
- var selectedRelationships = getSelectedRelationships();
-
// see if we're working with a processor as the source
if (nfCanvasUtils.isProcessor(source)) {
- if (selectedRelationships.length > 0) {
- // if there are relationships selected update
- updateConnection(selectedRelationships).done(function () {
- deferred.resolve();
- }).fail(function () {
- deferred.reject();
- });
- } else {
- // inform users that no relationships were selected and the source is a processor
- nfDialog.showOkDialog({
- headerText: 'Connection Configuration',
- dialogContent: 'The connection must have at least one relationship selected.'
- });
-
- // reject the deferred
+ // update the selected relationships
+ updateConnection(getSelectedRelationships()).done(function () {
+ deferred.resolve();
+ }).fail(function () {
deferred.reject();
- }
+ });
} else {
// there are no relationships, but the source wasn't a processor, so update anyway
updateConnection(undefined).done(function () {
http://git-wip-us.apache.org/repos/asf/nifi/blob/1f1269c8/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
index 646967e..0d55b27 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js
@@ -61,6 +61,8 @@
} else {
checkbox.removeClass('checkbox-checked').addClass('checkbox-unchecked');
}
+ // emit a state change event
+ checkbox.trigger('change');
});
// setup click areas for custom checkboxes