NIFI-6602 - Fix: Apply button should be greyed out if no changes have been made

This closes #3691

Signed-off-by: Scott Aslan <scottyaslan@gmail.com>
This commit is contained in:
Rob Fellows 2019-09-03 13:56:20 -04:00 committed by Scott Aslan
parent fa8a4462e7
commit 92fd3129ba

View File

@ -1007,6 +1007,21 @@
};
var hasParameterContextChanged = function (parameterContextEntity) {
var parameters = marshalParameters();
var proposedParamContextName = $('#parameter-context-name').val();
var proposedParamContextDesc = $('#parameter-context-description-field').val();
if (_.isEmpty(parameters) &&
proposedParamContextName === _.get(parameterContextEntity, 'component.name') &&
proposedParamContextDesc === _.get(parameterContextEntity, 'component.description')) {
return false;
} else {
return true;
}
};
/**
* Updates parameter contexts by issuing an update request and polling until it's completion.
*
@ -1060,7 +1075,7 @@
text: '#ffffff'
},
disabled: function () {
if ($('#parameter-context-name').val() !== '') {
if ($('#parameter-context-name').val() !== '' && hasParameterContextChanged(parameterContextEntity)) {
return false;
}
return true;
@ -1849,6 +1864,11 @@
$('#parameter-context-dialog').modal('refreshButtons');
});
$('#parameter-context-description-field').on('keyup', function (evt) {
// update the buttons to possibly trigger the disabled state
$('#parameter-context-dialog').modal('refreshButtons');
});
$('#parameter-name').on('keyup', function (evt) {
// update the buttons to possibly trigger the disabled state
$('#parameter-dialog').modal('refreshButtons');
@ -2296,7 +2316,7 @@
text: '#ffffff'
},
disabled: function () {
if ($('#parameter-context-name').val() !== '') {
if ($('#parameter-context-name').val() !== '' && hasParameterContextChanged(currentParameterContextEntity)) {
return false;
}
return true;