Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63937

Form autocomplete should show the indicator when processing the AJAX request

    XMLWordPrintable

    Details

      Description

      Updated on 2018-02-20:

      Since Andrew Nicols already fixed the multiple AJAX request issue in MDL-62514. So in this PBI we only add the spinner/indicator to let the user know that their request is processing.

      ---------------------------------------------

      We are suffering from MDL-56059, which means that the Ajax requests in the enrolled users UI are taking over 10 seconds. This exposes usability problems with the autocomplete form element.

      MDL-51324 added throttling of the keyboard evens, so Ajax requests are only triggered 0.3s after the user stops typing.

      However, if you type: "T [0.5s pause] i [0.5s pause] m" then it will initiate three concurrent ajax requests, all of which take ~10s +/- a few seconds. Therefore, when everything eventually updates, you may find yourself looking at the search results for "T", not "Tim".

      So, I think that autocomplete should not send a second Ajax request until the first one is finished. That make the UI more understandable, and avoid overloading the database with multiple really slow queries.

      Also, there needs to be more visible UI status while the form control is waiting for ajax.

      The code in quiz autosave gets the waiting right, and might be worth looking at https://github.com/moodle/moodle/blob/master/mod/quiz/yui/src/autosave/js/autosave.js#L299.

      The old user-selector code took a different approach: https://github.com/moodle/moodle/blob/master/user/selector/module.js#L92. It tried to abort the current ajax request before starting a new one (line 147 there). However, I am not sure that fully works, because I don't think PHP can stop in the middle of waiting for a really slow database query to run. So, I think the quiz approach is better.

        Attachments

        1. MDL-63937.png
          166 kB
          Jennifer Bauzon
        2. Screen Shot 2018-12-31 at 11.23.27 AM.png
          27 kB
          Huong Nguyen

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 15 minutes
                  1h 15m