mirror of https://github.com/apache/nifi.git
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.
This commit is contained in:
parent
86cbfab14a
commit
9480c7a9c5
|
@ -1142,11 +1142,10 @@
|
||||||
|
|
||||||
var target = $(e.target);
|
var target = $(e.target);
|
||||||
if (target.hasClass('delete-property')) {
|
if (target.hasClass('delete-property')) {
|
||||||
// mark the property in question for removal
|
// mark the property in question for removal and refresh the table
|
||||||
property.hidden = true;
|
propertyData.updateItem(property.id, $.extend(property, {
|
||||||
|
hidden: true
|
||||||
// refresh the table
|
}));
|
||||||
propertyData.updateItem(property.id, property);
|
|
||||||
|
|
||||||
// prevents standard edit logic
|
// prevents standard edit logic
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
@ -1381,15 +1380,15 @@
|
||||||
var propertyData = propertyGrid.getData();
|
var propertyData = propertyGrid.getData();
|
||||||
|
|
||||||
// ensure the property name is unique
|
// ensure the property name is unique
|
||||||
var existingPropertyId = null;
|
var existingItem = null;
|
||||||
$.each(propertyData.getItems(), function (_, item) {
|
$.each(propertyData.getItems(), function (_, item) {
|
||||||
if (propertyName === item.property) {
|
if (propertyName === item.property) {
|
||||||
existingPropertyId = item.id;
|
existingItem = item;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existingPropertyId === null) {
|
if (existingItem === null) {
|
||||||
// load the descriptor and add the property
|
// load the descriptor and add the property
|
||||||
options.descriptorDeferred(propertyName).done(function(response) {
|
options.descriptorDeferred(propertyName).done(function(response) {
|
||||||
var descriptor = response.propertyDescriptor;
|
var descriptor = response.propertyDescriptor;
|
||||||
|
@ -1418,15 +1417,29 @@
|
||||||
propertyGrid.editActiveCell();
|
propertyGrid.editActiveCell();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
// if this row is currently hidden, clear the value and show it
|
||||||
dialogContent: 'A property with this name already exists.',
|
if (existingItem.hidden === true) {
|
||||||
overlayBackground: false
|
propertyData.updateItem(existingItem.id, $.extend(existingItem, {
|
||||||
});
|
hidden: false,
|
||||||
|
previousValue: null,
|
||||||
// select the existing properties row
|
value: null
|
||||||
var row = propertyData.getRowById(existingPropertyId);
|
}));
|
||||||
propertyGrid.setSelectedRows([row]);
|
|
||||||
propertyGrid.scrollRowIntoView(row);
|
// 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 {
|
} else {
|
||||||
nf.Dialog.showOkDialog({
|
nf.Dialog.showOkDialog({
|
||||||
|
@ -1448,6 +1461,10 @@
|
||||||
var code = e.keyCode ? e.keyCode : e.which;
|
var code = e.keyCode ? e.keyCode : e.which;
|
||||||
if (code === $.ui.keyCode.ENTER) {
|
if (code === $.ui.keyCode.ENTER) {
|
||||||
add();
|
add();
|
||||||
|
|
||||||
|
// prevents the enter from propagating into the field for editing the new property value
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue