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

Fix guestbook clear selection button #8403

Conversation

qqmyers
Copy link
Member

@qqmyers qqmyers commented Feb 5, 2022

What this PR does / why we need it: Per slack discussions, @pdurbin found that the button to clear the selected guestbook (i.e. to return to no guestbook)_on the dataset page/edit terms tab was broken. etc. This PR fixes that. (After discussion with @kcondon, I took a look to make sure this wasn't related to recent changes to accessibility/multilicenses,)

I did not see an issue yet.

Which issue(s) this PR closes:

Closes #2257

Special notes for your reviewer: I can't yet understand if/how this worked originally. The main issue is one I saw in some embargo work making controls in a form interact - changing the state in the backing bean doesn't update the state of the UI widget. In this case, the clear button was setting the guestbook to null on the server but the selected radio button remains selected and hence, when you save, it selects the indicated guestbook resulting in no overall change. Changing the 'update' attribute of the button to refresh the set of radio buttons doesn't have the intended effect of making the radio button state reflect the backing bean. (One can confirm that the radio buttons are getting updated by, for example, printing the Guestbook id within the list of guestbooks. That shows that indeed the backing bean has a null guestbook after the clear button is hit. and that the set of radio buttons has just been updated from the server in the response to the actionListener.)

While there may be a way to force such an update, I took an alternate approach and call the widget's unselectAllRows() method (listed in the PrimeFaces client API guide for the DataTable) in an oncomplete call. That appears to work and seems like a reasonable option if not the only/best one. The PR is basically that one line change.

Suggestions on how to test this: Try to clear the guestbook with the button and verify a) the UI updates to show no radio button selected and that b) after a save that the guestbook is indeed null/no guestbook selected for the dataset.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0005%) to 18.864% when pulling f787b43 on GlobalDataverseCommunityConsortium:IQSS-allow_guestbook_unselect into 8b838f3 on IQSS:develop.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this but it seems like a reasonable approach.

@kcondon
Copy link
Contributor

kcondon commented Feb 7, 2022

Testing shows it deselects the radio button but after saving, the selection persists.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test this but @qqmyers said he did (thanks!). Let's give it another try.

In the future, we might want to rename reset to something more specific like resetGuestbookSelection.

@kcondon kcondon self-assigned this Feb 7, 2022
@kcondon kcondon merged commit c4ca40f into IQSS:develop Feb 7, 2022
IQSS/dataverse (TO BE RETIRED / DELETED in favor of project 34) automation moved this from QA 🔎✅ to Done 🚀 Feb 7, 2022
@pdurbin pdurbin added this to the 5.10 milestone Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Cannot deselect guestbook for a dataverse
4 participants