mirror of https://github.com/apache/nifi.git
NIFI-6505 - fix for editing parameter value. simplify logic in edit dialog for disabled state of the apply button.
This commit is contained in:
parent
a52d17628a
commit
5cbade7b1d
|
@ -836,6 +836,16 @@
|
||||||
var description = $('#parameter-description-field').val();
|
var description = $('#parameter-description-field').val();
|
||||||
var isSensitive = $('#parameter-dialog').find('input[name="sensitive"]:checked').val() === 'sensitive' ? true : false;
|
var isSensitive = $('#parameter-dialog').find('input[name="sensitive"]:checked').val() === 'sensitive' ? true : false;
|
||||||
|
|
||||||
|
var validateValue = function () {
|
||||||
|
// updates to a parameter cannot have a null value
|
||||||
|
if (!this.isNew) {
|
||||||
|
if (_.isEmpty(this.value) && !this.isEmptyStringSet) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
var parameter = {
|
var parameter = {
|
||||||
name: name,
|
name: name,
|
||||||
value: null,
|
value: null,
|
||||||
|
@ -855,7 +865,8 @@
|
||||||
sensitive: isSensitive,
|
sensitive: isSensitive,
|
||||||
isEmptyStringSet: isEmptyStringSet,
|
isEmptyStringSet: isEmptyStringSet,
|
||||||
hasValueChanged: serializedValue.hasChanged,
|
hasValueChanged: serializedValue.hasChanged,
|
||||||
hasDescriptionChanged: description !== _.get(originalParameter, 'description', '')
|
hasDescriptionChanged: description !== _.get(originalParameter, 'description', ''),
|
||||||
|
isValueValid: validateValue
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -969,6 +980,7 @@
|
||||||
isNew: originalParameter.isNew,
|
isNew: originalParameter.isNew,
|
||||||
hasValueChanged: serializedParam.hasValueChanged,
|
hasValueChanged: serializedParam.hasValueChanged,
|
||||||
hasDescriptionChanged: serializedParam.hasDescriptionChanged,
|
hasDescriptionChanged: serializedParam.hasDescriptionChanged,
|
||||||
|
value: serializedParam.value,
|
||||||
isModified: serializedParam.hasValueChanged || serializedParam.hasDescriptionChanged
|
isModified: serializedParam.hasValueChanged || serializedParam.hasDescriptionChanged
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1608,11 +1620,7 @@
|
||||||
disabled: function () {
|
disabled: function () {
|
||||||
var param = serializeParameter(parameter);
|
var param = serializeParameter(parameter);
|
||||||
if (param.hasValueChanged) {
|
if (param.hasValueChanged) {
|
||||||
if (_.isEmpty(param.value) && !param.isEmptyStringSet) {
|
return !param.isValueValid();
|
||||||
// must have a value when editing
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
} else {
|
} else {
|
||||||
return !param.hasDescriptionChanged;
|
return !param.hasDescriptionChanged;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue