Repository: incubator-nifi Updated Branches: refs/heads/develop 976cfaf60 -> 1404275bd
NIFI-669: - Allowing a property that as been removed to be re-added before the configuration is saved. Previously this was not allowed as the property was hidden but still present (until that save action). Now in that case the values are cleared and user is allowed to edit the property again. Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/9480c7a9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/9480c7a9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/9480c7a9 Branch: refs/heads/develop Commit: 9480c7a9c54a64f36a178875aa0ebd082190f644 Parents: 86cbfab Author: Matt Gilman <[email protected]> Authored: Wed Jun 10 12:27:00 2015 -0400 Committer: Matt Gilman <[email protected]> Committed: Wed Jun 10 12:27:00 2015 -0400 ---------------------------------------------------------------------- .../propertytable/jquery.propertytable.js | 51 +++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/9480c7a9/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js index ca53709..de257fa 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js @@ -1142,11 +1142,10 @@ var target = $(e.target); if (target.hasClass('delete-property')) { - // mark the property in question for removal - property.hidden = true; - - // refresh the table - propertyData.updateItem(property.id, property); + // mark the property in question for removal and refresh the table + propertyData.updateItem(property.id, $.extend(property, { + hidden: true + })); // prevents standard edit logic e.stopImmediatePropagation(); @@ -1381,15 +1380,15 @@ var propertyData = propertyGrid.getData(); // ensure the property name is unique - var existingPropertyId = null; + var existingItem = null; $.each(propertyData.getItems(), function (_, item) { if (propertyName === item.property) { - existingPropertyId = item.id; + existingItem = item; return false; } }); - if (existingPropertyId === null) { + if (existingItem === null) { // load the descriptor and add the property options.descriptorDeferred(propertyName).done(function(response) { var descriptor = response.propertyDescriptor; @@ -1418,15 +1417,29 @@ propertyGrid.editActiveCell(); }); } else { - nf.Dialog.showOkDialog({ - dialogContent: 'A property with this name already exists.', - overlayBackground: false - }); - - // select the existing properties row - var row = propertyData.getRowById(existingPropertyId); - propertyGrid.setSelectedRows([row]); - propertyGrid.scrollRowIntoView(row); + // if this row is currently hidden, clear the value and show it + if (existingItem.hidden === true) { + propertyData.updateItem(existingItem.id, $.extend(existingItem, { + hidden: false, + previousValue: null, + value: null + })); + + // select the new properties row + var row = propertyData.getRowById(existingItem.id); + propertyGrid.setActiveCell(row, propertyGrid.getColumnIndex('value')); + propertyGrid.editActiveCell(); + } else { + nf.Dialog.showOkDialog({ + dialogContent: 'A property with this name already exists.', + overlayBackground: false + }); + + // select the existing properties row + var row = propertyData.getRowById(existingItem.id); + propertyGrid.setSelectedRows([row]); + propertyGrid.scrollRowIntoView(row); + } } } else { nf.Dialog.showOkDialog({ @@ -1448,6 +1461,10 @@ var code = e.keyCode ? e.keyCode : e.which; if (code === $.ui.keyCode.ENTER) { add(); + + // prevents the enter from propagating into the field for editing the new property value + e.stopImmediatePropagation(); + e.preventDefault(); } });
