Use theme function for ajax progress

Created on 10 November 2020, about 4 years ago
Updated 19 June 2024, 6 months ago

Problem/Motivation

When using the next generation drupal admin themes, the ajax progress throbber introduced in #2830228: Add throbber between widget page (re)loads β†’ is either not shown at all (claro) or broken (gin). The ajax progress element is added using markup, unfortunately this markup has changed.

Proposed resolution

Use Drupal javascript theme function to display the ajax progress elements. This will work for seven as well as claro.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Display plugins

Created by

πŸ‡©πŸ‡ͺGermany volkerk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡ͺπŸ‡ͺEstonia rang501 Viljandi

    I created an issue fork and applied the latest patch.
    There were one issue with once(), which is now fixed and the entity browser under Gin theme looks fine.

  • πŸ‡ͺπŸ‡ͺEstonia rang501 Viljandi

    Ajax throbber issue should be fixed, the z-index was wrong, caused by small class name change.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Nice, this fixes the broken throbber in Gin for me.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MariaDB 10.3.22
    last update over 1 year ago
    56 pass
  • πŸ‡§πŸ‡ͺBelgium akasake

    I am getting error with drupal 10

    Uncaught TypeError: $(...).once is not a function

    So I changed patch 3 a little.

  • D10.1.5 and patch #14 works great for me. Thank you akasake.

  • Status changed to RTBC about 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain eduardo morales alberti Spain, πŸ‡ͺπŸ‡Ί

    D10.1.6 and patch #14 working for us. RTCB!

  • πŸ‡§πŸ‡ͺBelgium tim-diels Belgium πŸ‡§πŸ‡ͺ

    Drupal 10.1.7 and entity_browser 2.9.0 and patch from #14 fixes the issue.

  • πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

    Dave Reid β†’ made their first commit to this issue’s fork.

  • Status changed to Fixed about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

    Tested both usages of the progress throbber and both work as expected. Merging to 8.x-2.x.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡§πŸ‡ͺBelgium cgoffin

    After updating to v2.10 the throbber is rendered when opening the modal, but never removed. This blocks the entire page.

  • Status changed to Fixed 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dave reid Nebraska USA

    Can you check your browser's JavaScript console for any errors that might have stopped JS from running to remove it?

  • πŸ‡©πŸ‡ͺGermany ammaletu Bonn, Germany

    We have the same problem: Since the update to version 2.10.0, the throbber is added but not removed. This makes sense, since there is no code removing it. In other instances, the throbber is set through `Drupal.Ajax.prototype.setProgressIndicatorThrobber`, where a reference to the element is saved and would later be removed. The entity browser module simply adds the HTML code for the throbber through `Drupal.theme.ajaxProgressThrobber`. This doesn't generate a reference in `this.progress.element`. The entity browser module itself has no code to remove the throbber again, as far as I can see.

    Should we open a new ticket for this?

  • πŸ‡©πŸ‡ͺGermany ammaletu Bonn, Germany

    This seems to work in Claro, because `Drupal.behaviors.entityBrowserAddThrobber` is called, but it doesn't go into `if (context === document) {`. In our own theme it does, though, and thus adds a second throbber, after a first one has been added and removed through the proper methiods (briefly, virtually impossible to see withoput debugging).

    I see that `Drupal.behaviors.entityBrowserAddThrobber` has just been added in version 2.10.0 (see commit https://git.drupalcode.org/project/entity_browser/-/commit/0a3fdfcf801b8...). I'm just not sure what the IF check is supposed to do and why this works in some themes and not in others.

  • πŸ‡ΊπŸ‡ΈUnited States joshua.boltz

    I can also confirm in my custom admin theme (which is a subtheme of Claro) that the Ajax throbber is not shown when the entity browser is loading up through the modal.

    I can confirm in dev tools, that the entity_browser.modal.js file, of this code:

    Drupal.behaviors.entityBrowserAddThrobber = {
        attach: function (context) {
          if (context === document) {
            $(window).on({
              'dialog:aftercreate': function (event, dialog, $element, settings) {
                if ($element.find('iframe.entity-browser-modal-iframe').length) {
                  $element.append(Drupal.theme('ajaxProgressThrobber'));
                }
              }
            });
          }
        }
      };

    That the code inside of the "if (context === document)" conditional does not run.
    The breakpoint hits on that line, but does not go inside of that check, which means this code does not run, which is probably why the throbber is missing.

    I am interested what needs to happen to fix that, and what happens once the throbber is shown, if I will then run into issues of it being not removed when it should like some people have mentioned.

  • πŸ‡ΊπŸ‡ΈUnited States joshua.boltz

    I confirmed by editing entity_browser.modal.js locally, that by removing the conditional, that the ajax throbber does get shown. Actually, 5 of them got shown, I assume because of the missing context. But still, the throbbers were tiny and added to the bottom of the modal. And lastly, they did not disappear after the entity browser was ready in the modal.

  • πŸ‡ͺπŸ‡ͺEstonia drugan

    I've tried the #8 πŸ› Use theme function for ajax progress Fixed solution to remove the throbber but to no avail.

    Can somebody please to explain the rationale behind this throbber or give an advice on how to remove it?

Production build 0.71.5 2024