Skip to content

Adds spinner to block page while ajax petition is executed#6611

Merged
ivan-mr merged 17 commits intodevelopfrom
feat/adding_spinner_on_meetings_form_search
Dec 2, 2020
Merged

Adds spinner to block page while ajax petition is executed#6611
ivan-mr merged 17 commits intodevelopfrom
feat/adding_spinner_on_meetings_form_search

Conversation

@ivan-mr
Copy link
Copy Markdown
Contributor

@ivan-mr ivan-mr commented Oct 6, 2020

🎩 What? Why?

Please describe your pull request.
Adds a spinner to block page while ajax petition on search form is executed. With this solution we try to solve a flacky test that occurs in explore_meetings_spec file

References:

📌 Related Issues

Link your PR to an issue

Testing

Go to meetings index and make a search. Then, a spinner will appears while the search is running, and will disappear when the search has finished

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
search_form_before_after_search_process
search_form_while_search_process_runs

♥️ Thank you!

@andreslucena
Copy link
Copy Markdown
Member

This fixes #6026

I think blocking all the filtering functionality is a step back, as most of the time when you're changing filters you're going to change a couple of filters at least. With the curent implementation, it's fast to do this, but with the one that's proposed in this PR, this use case of changing multiple filters is really slow because I need to wait until every one of the filters has finished.
This spinner should block only in the filtered contents:

imatge

Also, could you add a cursor: wait?

Thanks

@Leusev Leusev linked an issue Oct 8, 2020 that may be closed by this pull request
2 tasks
@andreslucena
Copy link
Copy Markdown
Member

Hi @ivan-mr
I'm seeing that we're still with the failing flaky test Meeting issue in the last merged PR. Can we please fast-track this fix? Thanks

Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

Hi @ivan-mr ,
It seems, the flaky did not appear 😄

Is this PR ready?
It seems it's still an overall layer isn't it?

# clicking on "Search" until we find out why.
find(".icon--magnifying-glass").click
find("#content form.new_filter .icon--magnifying-glass").click
# wait_for_ajax
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't we need this anymore?
Can you remove it if it's not necessary?

@ivan-mr
Copy link
Copy Markdown
Contributor Author

ivan-mr commented Oct 15, 2020

Hi @andreslucena and @tramuntanal ,

Seems the last modifications works but maybe could be only that the server is quiet at night.
I comment on this because despite running the meeting test several times I found something very strange.

The previous modification on the reinforcement at the time of selecting the text filter field and the click on the submit button comes because we have located that inside the screen of meetings exists another identical form with the same fields.
It could be the case that certain cases of flaky were due to not correctly filling the appropriate field and then the search results are contradictory (in short that the search is not being performed where the counter test is performed of results).
It could also be that the requests were made in duplicate and that the results of one form (the completed one) were shown first and then the other, and vice versa.
Below are some images of this second form and their comparison by the name attribute that was done above:
The field was previously searched for:
fill_in "filter[search_text]"
meeting_filter_0_test_selector

Searching the element on screen:
meeting_filter_1_input_file

Counting elements with same name:
meeting_filter_2_counter_element_with_name

Searching the duplicate field on "Elements panel":
meeting_filter_3_hidden_element_with_same_name

Reveal panel removing "display: none":
meeting_filter_4_reveal_panel_search_form

We will continue to work to fix the flaky and find out the reasons why this duplicate form exists and then we will continue the modification of the spinner.
By the way @tramuntanal, the comment on the line about wait_for_ajax, you're right, if not used it should be removed. When we fix the flaky, if not necessary we will remove it.

@tramuntanal
Copy link
Copy Markdown
Contributor

@ivan-mr it is even possible that both forms are performing 2 separate ajax requests on page load? I found this strange behavior in the proposal's list a couple of days ago..

We should definitively create a separate PR with your change and keep working with the spinner here
We should also analyze why this double filter form

@mrcasals
Copy link
Copy Markdown
Contributor

@decidim/core my 2 cents on this double-form thingie: the "second" form is used on mobile. It's actually the same, but duplicated.

The index renders the filters and a "filters_small_view" partial...

<div class="columns mediumlarge-4 large-3">
<%= render partial: "filters_small_view" %>
<div class="card card--secondary show-for-mediumlarge">
<%= render partial: "filters" %>
</div>
</div>

... which renders the filters again:

If you check the classes, the filters_small_view has the hide-for-mediumlarge class, while the filters partial is rendered with the show-for-mediumlarge from the index page.

I'm not sure why and I'm not sure if it's needed or if it can be refactored so we just have one single form in the page, but the second copy is used on mobile. It's actually hidden so the tests shouldn't be able to fill those fields. It happens in all components that can be filtered from the public area (meetings, proposals, debates...)

@ivan-mr
Copy link
Copy Markdown
Contributor Author

ivan-mr commented Nov 18, 2020

This fixes #6026

I think blocking all the filtering functionality is a step back, as most of the time when you're changing filters you're going to change a couple of filters at least. With the curent implementation, it's fast to do this, but with the one that's proposed in this PR, this use case of changing multiple filters is really slow because I need to wait until every one of the filters has finished.
This spinner should block only in the filtered contents:

imatge

Also, could you add a cursor: wait?

Thanks

Now, only affects on the container results:
Captura de pantalla de 2020-11-18 17-11-13

@andreslucena
Copy link
Copy Markdown
Member

Now, only affects on the container results:

Awesome 🚀

Could you add a cursor: wait 🙏?

@ivan-mr
Copy link
Copy Markdown
Contributor Author

ivan-mr commented Nov 24, 2020

Now, only affects on the container results:

Awesome

Could you add a cursor: wait ?

Hi @andreslucena ,

Do you want the cursor: wait only when the cursor is above the refreshed content or everywhere in the page when there's the ajax calling petition?
Thanks

@ivan-mr
Copy link
Copy Markdown
Contributor Author

ivan-mr commented Nov 30, 2020

Now, only affects on the container results:

Awesome
Could you add a cursor: wait ?

Hi @andreslucena ,

Do you want the cursor: wait only when the cursor is above the refreshed content or everywhere in the page when there's the ajax calling petition?
Thanks

Hi @andreslucena . I need to know where you would like to see the cursor: wait .
Thanks!

@ivan-mr
Copy link
Copy Markdown
Contributor Author

ivan-mr commented Dec 1, 2020

Now, only affects on the container results:

Awesome
Could you add a cursor: wait ?

Hi @andreslucena ,
Do you want the cursor: wait only when the cursor is above the refreshed content or everywhere in the page when there's the ajax calling petition?
Thanks

Hi @andreslucena . I need to know where you would like to see the cursor: wait .
Thanks!

Finally I applied it above the refreshed content.

@Leusev Leusev self-requested a review December 1, 2020 14:46
@tramuntanal
Copy link
Copy Markdown
Contributor

Many jobs failed without any feedback. I'm re-runing the meetings and linters workflows to see if they succeed now

Copy link
Copy Markdown
Contributor

@Leusev Leusev left a comment

Choose a reason for hiding this comment

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

Looks good for me @ivan-mr !! 👍

@ivan-mr ivan-mr merged commit 5d6daec into develop Dec 2, 2020
@ivan-mr ivan-mr deleted the feat/adding_spinner_on_meetings_form_search branch December 2, 2020 18:51
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.

Better visual feedback on Proposals filtering

5 participants