ome / omero-web

Django-based OMERO.web client
https://www.openmicroscopy.org/omero
16 stars 29 forks source link

Block UI for some long running tasks #543

Closed knabar closed 1 month ago

knabar commented 3 months ago

The "Save to all" function in the Preview panel can take a long time to complete for datasets or plates that have lots of images. The user may refresh or reload the page before everything (including thumbnail refresh) completes, exacerbating the already high load on the server.

The same applies to copying and pasting rendering settings using the right-click menu in the tree.

This PR introduces a UI blocking dialog until thumbnails are reloaded:

Screenshot 2024-03-13 at 15 03 59

The UI blocking is generic and can be used anywhere where a Promise is available:

OME.progress_overlay(
  new Promise((resolve, reject) => {
    // some long running task
  }),
  'Message for UI blocking dialog');
});

The dialog disappears automatically when the Promise resolves or rejects.

By default the duration of the UI blocking is logged to the console:

Screenshot 2024-04-12 at 13 12 25
will-moore commented 2 months ago

This looks good and is working fine in testing.

I wonder if we want to consolidate this with function gs_modalJson (url, data, callback) { which is used for the "Save" rendering settings button and gives a different look:

Screenshot 2024-04-15 at 14 15 08

Having the 2 different blocking UIs for adjacent buttons is slightly unexpected, but certainly not a blocker.

will-moore commented 2 months ago

In testing, I noticed that "Save to All" functionality appears to ignore LUTs. The LUTs are used to generate thumbnails but are not actually saved, leading to a case where the thumbnails (with LUTs) are out of sync with the image rendering settings (without LUTs): However, this isn't coming from this PR - same behaviour before.

Screenshot 2024-04-15 at 15 09 23

knabar commented 2 months ago

This looks good and is working fine in testing.

I wonder if we want to consolidate this with function gs_modalJson (url, data, callback) { which is used for the "Save" rendering settings button and gives a different look:

Having the 2 different blocking UIs for adjacent buttons is slightly unexpected, but certainly not a blocker.

Thanks for pointing that out - I'll dig in a bit and see if I can clean it up.

knabar commented 2 months ago

In testing, I noticed that "Save to All" functionality appears to ignore LUTs. The LUTs are used to generate thumbnails but are not actually saved, leading to a case where the thumbnails (with LUTs) are out of sync with the image rendering settings (without LUTs): However, this isn't coming from this PR - same behaviour before.

Opened a new issue #552

knabar commented 2 months ago

I wonder if we want to consolidate this with function gs_modalJson (url, data, callback) { which is used for the "Save" rendering settings button and gives a different look:

gs_modalJson was only used in one location, it's now replaced with the new functionality.