NIFI-501: - Ensuring the property descriptor is loaded before adding/updating the property in the table.
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/c1959b3e Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/c1959b3e Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/c1959b3e Branch: refs/heads/NIFI-271 Commit: c1959b3e2d8f48247642655d3e8cbeb08baa3cef Parents: eb023e5 Author: Matt Gilman <matt.c.gil...@gmail.com> Authored: Fri Apr 10 06:56:51 2015 -0400 Committer: Matt Gilman <matt.c.gil...@gmail.com> Committed: Fri Apr 10 06:56:51 2015 -0400 ---------------------------------------------------------------------- .../propertytable/jquery.propertytable.js | 82 +++++++++----------- 1 file changed, 36 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/c1959b3e/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 c0b8884..b5f56b0 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 @@ -882,24 +882,16 @@ // update the revision nf.Client.setRevision(response.revision); - $.Deferred(function (deferred) { - // load the property descriptor if possible - if (typeof configurationOptions.descriptorDeferred === 'function') { - configurationOptions.descriptorDeferred(item.property).done(function(response) { - var descriptor = response.propertyDescriptor; - - // store the descriptor for use later - var descriptors = gridContainer.data('descriptors'); - if (!nf.Common.isUndefined(descriptors)) { - descriptors[descriptor.name] = descriptor; - } - - deferred.resolve(); - }); - } else { - deferred.resolve(); + // load the descriptor and update the property + configurationOptions.descriptorDeferred(item.property).done(function(descriptorResponse) { + var descriptor = descriptorResponse.propertyDescriptor; + + // store the descriptor for use later + var descriptors = gridContainer.data('descriptors'); + if (!nf.Common.isUndefined(descriptors)) { + descriptors[descriptor.name] = descriptor; } - }).done(function() { + // add a row for the new property var data = grid.getData(); data.updateItem(item.id, $.extend(item, { @@ -1385,37 +1377,35 @@ // ensure the property name and value is specified if (propertyName !== '') { - // load the property descriptor if possible - if (typeof options.descriptorDeferred === 'function') { - options.descriptorDeferred(propertyName).done(function(response) { - var descriptor = response.propertyDescriptor; - - // store the descriptor for use later - var descriptors = table.data('descriptors'); - if (!nf.Common.isUndefined(descriptors)) { - descriptors[descriptor.name] = descriptor; - } + // load the descriptor and add the property + options.descriptorDeferred(propertyName).done(function(response) { + var descriptor = response.propertyDescriptor; + + // store the descriptor for use later + var descriptors = table.data('descriptors'); + if (!nf.Common.isUndefined(descriptors)) { + descriptors[descriptor.name] = descriptor; + } + + // add a row for the new property + var propertyGrid = table.data('gridInstance'); + var propertyData = propertyGrid.getData(); + var id = propertyData.getLength(); + propertyData.addItem({ + id: id, + hidden: false, + property: propertyName, + displayName: propertyName, + previousValue: null, + value: null, + type: 'userDefined' }); - } - - // add a row for the new property - var propertyGrid = table.data('gridInstance'); - var propertyData = propertyGrid.getData(); - var id = propertyData.getLength(); - propertyData.addItem({ - id: id, - hidden: false, - property: propertyName, - displayName: propertyName, - previousValue: null, - value: null, - type: 'userDefined' + + // select the new properties row + var row = propertyData.getRowById(id); + propertyGrid.setSelectedRows([row]); + propertyGrid.scrollRowIntoView(row); }); - - // select the new properties row - var row = propertyData.getRowById(id); - propertyGrid.setSelectedRows([row]); - propertyGrid.scrollRowIntoView(row); } else { nf.Dialog.showOkDialog({ dialogContent: 'Property name must be specified.',