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,6 +51,7 @@ nf.ProcessorPropertyComboEditor = function (args) {
|
||||||
optionClass: 'unset'
|
optionClass: 'unset'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if ($.isArray(allowableValues)) {
|
||||||
$.each(allowableValues, function (i, allowableValue) {
|
$.each(allowableValues, function (i, allowableValue) {
|
||||||
options.push({
|
options.push({
|
||||||
text: allowableValue.displayName,
|
text: allowableValue.displayName,
|
||||||
|
@ -58,6 +59,7 @@ nf.ProcessorPropertyComboEditor = function (args) {
|
||||||
description: nf.Common.escapeHtml(allowableValue.description)
|
description: nf.Common.escapeHtml(allowableValue.description)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ensure the options there is at least one option
|
// ensure the options there is at least one option
|
||||||
if (options.length === 0) {
|
if (options.length === 0) {
|
||||||
|
|
|
@ -160,18 +160,13 @@ nf.ProcessorPropertyNfelEditor = function (args) {
|
||||||
// otherwise if the property is required
|
// otherwise if the property is required
|
||||||
if (nf.ProcessorPropertyTable.isRequiredProperty(propertyDescriptor)) {
|
if (nf.ProcessorPropertyTable.isRequiredProperty(propertyDescriptor)) {
|
||||||
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
|
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
|
||||||
// reset to the previous value if available
|
|
||||||
if (nf.Common.isDefinedAndNotNull(previousValue)) {
|
|
||||||
return previousValue;
|
return previousValue;
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return propertyDescriptor.defaultValue;
|
return propertyDescriptor.defaultValue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the property is not required, clear the value
|
// if the property is not required, clear the value
|
||||||
return undefined;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,7 +40,7 @@ nf.ProcessorPropertyTable = (function () {
|
||||||
hidden: false,
|
hidden: false,
|
||||||
property: propertyName,
|
property: propertyName,
|
||||||
displayName: propertyName,
|
displayName: propertyName,
|
||||||
previousValue: undefined,
|
previousValue: null,
|
||||||
value: propertyValue,
|
value: propertyValue,
|
||||||
type: 'userDefined'
|
type: 'userDefined'
|
||||||
});
|
});
|
||||||
|
@ -377,7 +377,7 @@ nf.ProcessorPropertyTable = (function () {
|
||||||
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
|
if (nf.Common.isDefinedAndNotNull(propertyDescriptor)) {
|
||||||
return propertyDescriptor.allowableValues;
|
return propertyDescriptor.allowableValues;
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -477,7 +477,7 @@ nf.ProcessorPropertyTable = (function () {
|
||||||
displayName = descriptor.displayName;
|
displayName = descriptor.displayName;
|
||||||
|
|
||||||
// determine the value
|
// 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;
|
value = descriptor.defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,18 +169,13 @@ nf.ProcessorPropertyTextEditor = function (args) {
|
||||||
// otherwise if the property is required
|
// otherwise if the property is required
|
||||||
if (nf.ProcessorPropertyTable.isRequiredProperty(propertyDescriptor)) {
|
if (nf.ProcessorPropertyTable.isRequiredProperty(propertyDescriptor)) {
|
||||||
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
|
if (nf.Common.isBlank(propertyDescriptor.defaultValue)) {
|
||||||
// reset to the previous value if available
|
|
||||||
if (nf.Common.isDefinedAndNotNull(previousValue)) {
|
|
||||||
return previousValue;
|
return previousValue;
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return propertyDescriptor.defaultValue;
|
return propertyDescriptor.defaultValue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the property is not required, clear the value
|
// if the property is not required, clear the value
|
||||||
return undefined;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -476,7 +476,7 @@ nf.ProcessorDetails = (function () {
|
||||||
displayName = descriptor.displayName;
|
displayName = descriptor.displayName;
|
||||||
|
|
||||||
// determine the value
|
// 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;
|
value = descriptor.defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue