Skip to content
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

Merged

Conversation

hstastna
Copy link
Contributor

@hstastna hstastna commented Oct 11, 2019

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:
error
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:
before

After:
after

@hstastna hstastna force-pushed the Replication_subscribtion_Save/Discard_btns branch 2 times, most recently from 741104d to a93fef7 Compare October 11, 2019 11:11
@hstastna
Copy link
Contributor Author

@miq-bot add_label bug, ivanchuk/yes

@hstastna
Copy link
Contributor Author

@h-kataria @martinpovolny @ZitaNemeckova This PR is ready for review. Thanks in advance! :)

@hstastna
Copy link
Contributor Author

@lpichler Maybe you could test this PR, too? 🙏

@hstastna
Copy link
Contributor Author

@miq-bot add_reviewer @lpichler

@miq-bot
Copy link
Member

miq-bot commented Nov 25, 2019

@hstastna 'lpichler' is an invalid reviewer, ignoring...

@himdel himdel self-assigned this Nov 25, 2019
@@ -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)) {
Copy link
Contributor

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.

Copy link
Contributor

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! :)

Copy link
Contributor Author

@hstastna hstastna Dec 5, 2019

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.

@hstastna hstastna force-pushed the Replication_subscribtion_Save/Discard_btns branch from a93fef7 to afba162 Compare December 5, 2019 13:28
@miq-bot
Copy link
Member

miq-bot commented Dec 5, 2019

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
0 files checked, 0 offenses detected
Everything looks fine. 👍

@himdel himdel added this to the Sprint 126 Ending Dec 9, 2019 milestone Dec 5, 2019
@himdel himdel merged commit 32466f6 into ManageIQ:master Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants