mirror of https://github.com/apache/nifi.git
NIFI-501:
- Ensuring the property descriptor is loaded before adding/updating the property in the table.
This commit is contained in:
parent
eb023e57b2
commit
c1959b3e2d
|
@ -882,24 +882,16 @@
|
||||||
// update the revision
|
// update the revision
|
||||||
nf.Client.setRevision(response.revision);
|
nf.Client.setRevision(response.revision);
|
||||||
|
|
||||||
$.Deferred(function (deferred) {
|
// load the descriptor and update the property
|
||||||
// load the property descriptor if possible
|
configurationOptions.descriptorDeferred(item.property).done(function(descriptorResponse) {
|
||||||
if (typeof configurationOptions.descriptorDeferred === 'function') {
|
var descriptor = descriptorResponse.propertyDescriptor;
|
||||||
configurationOptions.descriptorDeferred(item.property).done(function(response) {
|
|
||||||
var descriptor = response.propertyDescriptor;
|
|
||||||
|
|
||||||
// store the descriptor for use later
|
// store the descriptor for use later
|
||||||
var descriptors = gridContainer.data('descriptors');
|
var descriptors = gridContainer.data('descriptors');
|
||||||
if (!nf.Common.isUndefined(descriptors)) {
|
if (!nf.Common.isUndefined(descriptors)) {
|
||||||
descriptors[descriptor.name] = descriptor;
|
descriptors[descriptor.name] = descriptor;
|
||||||
}
|
|
||||||
|
|
||||||
deferred.resolve();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
deferred.resolve();
|
|
||||||
}
|
}
|
||||||
}).done(function() {
|
|
||||||
// add a row for the new property
|
// add a row for the new property
|
||||||
var data = grid.getData();
|
var data = grid.getData();
|
||||||
data.updateItem(item.id, $.extend(item, {
|
data.updateItem(item.id, $.extend(item, {
|
||||||
|
@ -1385,37 +1377,35 @@
|
||||||
|
|
||||||
// ensure the property name and value is specified
|
// ensure the property name and value is specified
|
||||||
if (propertyName !== '') {
|
if (propertyName !== '') {
|
||||||
// load the property descriptor if possible
|
// load the descriptor and add the property
|
||||||
if (typeof options.descriptorDeferred === 'function') {
|
options.descriptorDeferred(propertyName).done(function(response) {
|
||||||
options.descriptorDeferred(propertyName).done(function(response) {
|
var descriptor = response.propertyDescriptor;
|
||||||
var descriptor = response.propertyDescriptor;
|
|
||||||
|
|
||||||
// store the descriptor for use later
|
// store the descriptor for use later
|
||||||
var descriptors = table.data('descriptors');
|
var descriptors = table.data('descriptors');
|
||||||
if (!nf.Common.isUndefined(descriptors)) {
|
if (!nf.Common.isUndefined(descriptors)) {
|
||||||
descriptors[descriptor.name] = descriptor;
|
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
|
// select the new properties row
|
||||||
var propertyGrid = table.data('gridInstance');
|
var row = propertyData.getRowById(id);
|
||||||
var propertyData = propertyGrid.getData();
|
propertyGrid.setSelectedRows([row]);
|
||||||
var id = propertyData.getLength();
|
propertyGrid.scrollRowIntoView(row);
|
||||||
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);
|
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
nf.Dialog.showOkDialog({
|
||||||
dialogContent: 'Property name must be specified.',
|
dialogContent: 'Property name must be specified.',
|
||||||
|
|
Loading…
Reference in New Issue