From 5cbade7b1d6ab3fe19827d393b4066db677ed309 Mon Sep 17 00:00:00 2001 From: Rob Fellows Date: Wed, 4 Sep 2019 14:36:57 -0400 Subject: [PATCH] NIFI-6505 - fix for editing parameter value. simplify logic in edit dialog for disabled state of the apply button. --- .../js/nf/canvas/nf-parameter-contexts.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js index 7764410a58..99a2e7035b 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js @@ -836,6 +836,16 @@ var description = $('#parameter-description-field').val(); 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 = { name: name, value: null, @@ -855,7 +865,8 @@ sensitive: isSensitive, isEmptyStringSet: isEmptyStringSet, hasValueChanged: serializedValue.hasChanged, - hasDescriptionChanged: description !== _.get(originalParameter, 'description', '') + hasDescriptionChanged: description !== _.get(originalParameter, 'description', ''), + isValueValid: validateValue } }; @@ -969,6 +980,7 @@ isNew: originalParameter.isNew, hasValueChanged: serializedParam.hasValueChanged, hasDescriptionChanged: serializedParam.hasDescriptionChanged, + value: serializedParam.value, isModified: serializedParam.hasValueChanged || serializedParam.hasDescriptionChanged }); @@ -1608,11 +1620,7 @@ disabled: function () { var param = serializeParameter(parameter); if (param.hasValueChanged) { - if (_.isEmpty(param.value) && !param.isEmptyStringSet) { - // must have a value when editing - return true; - } - return false; + return !param.isValueValid(); } else { return !param.hasDescriptionChanged; }