-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable Save/Reset buttons after discarding changes for Subscription #6292
Disable Save/Reset buttons after discarding changes for Subscription #6292
Conversation
741104d
to
a93fef7
Compare
@miq-bot add_label bug, ivanchuk/yes |
@h-kataria @martinpovolny @ZitaNemeckova This PR is ready for review. Thanks in advance! :) |
@lpichler Maybe you could test this PR, too? 🙏 |
@hstastna 'lpichler' is an invalid reviewer, ignoring... |
@@ -149,6 +149,11 @@ ManageIQ.angular.app.controller('pglogicalReplicationFormController', ['$http', | |||
} | |||
$scope.pglogicalReplicationModel.addEnabled = false; | |||
$scope.pglogicalReplicationModel.updateEnabled = false; | |||
|
|||
// check if subscriptions changed | |||
if (angular.equals($scope.pglogicalReplicationModel.subscriptions, $scope.modelCopy.subscriptions)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to check the whole model here.
When you change another field and then add a subscription identical to what was in model copy, it would mark the whole form as pristine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, in this case, the only other thing in the model is the type,
changing type to global (and saving) clears all existing subscriptions (https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_region.rb#L163-L172),
and having it set to remote without adding any subscriptions doesn't make sense,
so this can't be a problem in practice 👍
Thanks for making sure! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that if we have Global type and are changing to something else (none or remote) we delete all the subscriptions: https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_region.rb#L168 so then later if we change from Remote to Global type, all the original Subscriptions will be already deleted.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1757800 Fix responding Save/Reset buttons after discarding changes for Subscription if there is no change in all the Subscriptions.
a93fef7
to
afba162
Compare
Checked commits hstastna/manageiq-ui-classic@6dbb7af~...afba162 with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1757800
Fix responding Save/Reset buttons after discarding changes for Subscriptions if there is no change in Subscriptions. Fix also responding the buttons after clicking on Accept button. Setting the form as pristine solves the problems.
The second commit fixes error about undefined variable:
You can get this error if you create a new Subscription and before saving it, you decide to make changes so you click on Update and make some change but then you click on Discard because you've changed your mind.
Before:
After: