mirror of https://github.com/apache/nifi.git
NIFI-159:
- Allowing optional properties to be reset. - Used null to represent an unset value as previously it was considered undefined. When undefined, the property was not being included in the serialized configuration.
This commit is contained in:
parent
cb2e855fc7
commit
fe2a331820
|
@ -51,13 +51,15 @@ nf.ProcessorPropertyComboEditor = function (args) {
|
|||
optionClass: 'unset'
|
||||
});
|
||||
}
|
||||
$.each(allowableValues, function (i, allowableValue) {
|
||||
options.push({
|
||||
text: allowableValue.displayName,
|
||||
value: allowableValue.value,
|
||||
description: nf.Common.escapeHtml(allowableValue.description)
|
||||
if ($.isArray(allowableValues)) {
|
||||
$.each(allowableValues, function (i, allowableValue) {
|
||||
options.push({
|
||||
text: allowableValue.displayName,
|
||||
value: allowableValue.value,
|
||||
description: nf.Common.escapeHtml(allowableValue.description)
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ensure the options there is at least one option
|
||||
if (options.length === 0) {
|
||||
|
|
|
@ -160,18 +160,13 @@ nf.ProcessorPropertyNfelEditor = function (args) {
|
|||
// otherwise if the property is required
|
||||
if (nf.ProcessorPropertyTable.isRequiredProperty(propertyDescriptor)) {
|
||||
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
|
||||
// reset to the previous value if available
|
||||
if (nf.Common.isDefinedAndNotNull(previousValue)) {
|
||||
return previousValue;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return previousValue;
|
||||
} else {
|
||||
return propertyDescriptor.defaultValue;
|
||||
}
|
||||
} else {
|
||||
// if the property is not required, clear the value
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ nf.ProcessorPropertyTable = (function () {
|
|||
hidden: false,
|
||||
property: propertyName,
|
||||
displayName: propertyName,
|
||||
previousValue: undefined,
|
||||
previousValue: null,
|
||||
value: propertyValue,
|
||||
type: 'userDefined'
|
||||
});
|
||||
|
@ -377,7 +377,7 @@ nf.ProcessorPropertyTable = (function () {
|
|||
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
|
||||
return propertyDescriptor.allowableValues;
|
||||
} else {
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
@ -477,7 +477,7 @@ nf.ProcessorPropertyTable = (function () {
|
|||
displayName = descriptor.displayName;
|
||||
|
||||
// determine the value
|
||||
if (nf.Common.isUndefined(value) || nf.Common.isNull(value)) {
|
||||
if (nf.Common.isNull(value) && nf.Common.isDefinedAndNotNull(descriptor.defaultValue)) {
|
||||
value = descriptor.defaultValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,18 +169,13 @@ nf.ProcessorPropertyTextEditor = function (args) {
|
|||
// otherwise if the property is required
|
||||
if (nf.ProcessorPropertyTable.isRequiredProperty(propertyDescriptor)) {
|
||||
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
|
||||
// reset to the previous value if available
|
||||
if (nf.Common.isDefinedAndNotNull(previousValue)) {
|
||||
return previousValue;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
return previousValue;
|
||||
} else {
|
||||
return propertyDescriptor.defaultValue;
|
||||
}
|
||||
} else {
|
||||
// if the property is not required, clear the value
|
||||
return undefined;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -476,7 +476,7 @@ nf.ProcessorDetails = (function () {
|
|||
displayName = descriptor.displayName;
|
||||
|
||||
// determine the value
|
||||
if (nf.Common.isUndefined(value) || nf.Common.isNull(value)) {
|
||||
if (nf.Common.isNull(value) && nf.Common.isDefinedAndNotNull(descriptor.defaultValue)) {
|
||||
value = descriptor.defaultValue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue