Fix Save button which wasn't responding while editing Chargeback Rate #3974
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1583175
Issue with more info: #3961
Fix Save button which was not responding for Currencies' changes while editing Chargeback
Rate, under Cloud Intel > Chargeback > Rates accordion > Compute/Storage Chargeback Rates.
Original Chargeback Rate (just started editing; see the Currencies):
The currency was changed and Save button was enabled:
Before:
Currency changed back to the original value and Save button still enabled which is wrong:
After:
Currency changed back to the original value and Save button was disabled which is right:
Steps to reproduce:
=> Save button remains enabled (blue) even if we did not make any change comparing to the original currencies' values
Notes:
The problem was happening only while changing Currencies. Changing other values with enabling/disabling Save button seemed to work ok. Clicking on Reset button could fix the problem with Save button (after resetting the changes, Save button remained disabled which is right).
Details:
The core of the problem were:
edit[:new][:currency]
was not set to the new value, when changing the currency, so:https://github.com/ManageIQ/manageiq-ui-classic/pull/3974/files#diff-1b26f16afe1a647952df7cc1637f4394R557
https://github.com/ManageIQ/manageiq-ui-classic/pull/3974/files#diff-1b26f16afe1a647952df7cc1637f4394R566
@edit[:new][:currency]
and@edit[:current][:currency]
were set to integers, but later,@edit[:new][:currency]
was changed to string typeComparing the old vs. new values is happening here: https://github.com/ManageIQ/manageiq-ui-classic/pull/3974/files#diff-1b26f16afe1a647952df7cc1637f4394R183