Problem/Motivation

In cases when operations (switching widgets, fetching thumbnails, loading libraries,...) take longer, the user sees only the white background of the entity browser. This is more evident when dealing with remote media sources, where we wait for the service to reply.

Proposed resolution

Display a throbber instead of a white pages.

Remaining tasks

  • Review/improve patch (probably only works with modal now)
  • Test various scenarios

User interface changes

Added throbber in the background which is then covered by the iframe content.

API changes

None

Data model changes

None

Comments

Primsi created an issue. See original summary.

primsi’s picture

Title: Add throbber to between widget page (re)loads » Add throbber between widget page (re)loads
slashrsm’s picture

Status: Needs review » Needs work

Looks nice. It would be nice to have the same for iFrame display. This change seems to have caused propagation step of the display to become visible, which wasn't visible before AFAIK. Would be great if we could avoid that.

Please also create screenshots/animated gif and embed it to the issue.

sanja_m’s picture

Status: Needs work » Needs review
StatusFileSize
new2.66 KB
new1.79 KB
new11.48 KB
new12.71 KB
new7.37 KB
new8.59 KB

Added throbber for iFrame display and hid propagation step of the modal display.

modal_before

modal_after

iframe_before

iframe_after

slashrsm’s picture

Status: Needs review » Needs work

Thanks! We're almost there.

+++ b/js/entity_browser.modal_selection.js
@@ -17,6 +17,6 @@
-  parent.jQuery(parent.document).find('.entity-browser-modal-iframe').parents('.ui-dialog').eq(0).find('.ui-dialog-titlebar-close').click();
+  parent.jQuery(parent.document).find('.entity-browser-modal-iframe').hide().parents('.ui-dialog').eq(0).find('.ui-dialog-titlebar-close').click();

+++ b/src/Plugin/EntityBrowser/Display/Modal.php
@@ -109,6 +109,7 @@ class Modal extends IFrame {
+      '#prefix' => '<div class="ajax-progress-throbber"></div>',
       '#type' => 'html_tag',
       '#tag' => 'iframe',
       '#attributes' => [
@@ -117,7 +118,7 @@ class Modal extends IFrame {

@@ -117,7 +118,7 @@ class Modal extends IFrame {
         'width' => '100%',
         'height' => $this->configuration['height'] - 90,
         'frameborder' => 0,
-        'style' => 'padding:0',
+        'style' => 'padding:0; position:relative; z-index:10002;',

I still see the "Labels:..." text (for a shorter period of time, but anyway).

Would it make sense to move throbber inside last step of EB or at least hide that text with CSS?

sanja_m’s picture

Status: Needs work » Needs review
StatusFileSize
new2.71 KB
new1.3 KB

Added css for hiding propagation step.

mtodor’s picture

I have checked (tested) this functionality a bit. For modal it looks really good, but for iframe it's not so nice. In case when iframe width is "100%" it looks good, but if width is fixed then throbber is not centered. There is even worst case when iframe is smaller then 50% of container width, then throbber is visible all the time.

I'm not sure is there reason to have fixed iframe width instead of 100%? Because EB with iframe display looks ugly in any case with fixed width.

slashrsm’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new28.73 KB

I can confirm this:

Problem is also with height. When iFrame closes (and height becomes 0 effectively) spinner still floats on top of content.

CTaPByK’s picture

Status: Needs work » Needs review
StatusFileSize
new6.52 KB
new3.57 KB
new1.67 KB

Fixed height problem from #8. Also, throbber is centered against iframe now.

rajab natshah’s picture

+ Testing .... We need this.
Thank you.

slashrsm’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new22.58 KB
+++ b/js/entity_browser.iframe.js
@@ -45,12 +45,15 @@
+    $(this).parent().css('width', iframeSettings['width']);

This doesn't solve the problem when width is set in relative value.

e.g. Entity browser is 50% wide. Then we set container's width to 50%, which makes the Entity browser 25%. And as a bonus we didn't even solve the original problem:

What is we set width on throbber instead of the parent container?

CTaPByK’s picture

Status: Needs work » Needs review
StatusFileSize
new444 bytes
new3.84 KB

I leave width setting for iframe parent container, and set iframe width to 100%. On that way throbber should be centered and for relative values of width. Screenshot is same as throbber.png on #9.

slashrsm’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • slashrsm committed 1579f4b on 8.x-1.x authored by CTaPByK
    Issue #2830228 by sanja_m, CTaPByK, Primsi, slashrsm, mtodor: Add...

Status: Fixed » Closed (fixed)

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