[MGNLGROOVY-132] Running groovy script should not block the UI Created: 15/Jan/15  Updated: 09/Feb/17  Resolved: 12/Aug/16

Status: Closed
Project: Magnolia Groovy Module
Component/s: None
Affects Version/s: 2.3.2
Fix Version/s: 2.4.6, 2.5

Type: Improvement Priority: Neutral
Reporter: Christoph Meier Assignee: Federico Grilli
Resolution: Fixed Votes: 2
Labels: support
Remaining Estimate: 0d
Time Spent: 2.75d
Original Estimate: Not Specified
Environment:

M5.3.7-SNAPSHOT


Attachments: XML File scripts.addTonsOfUsers.xml    
Issue Links:
Relates
relation
is related to MGNLGROOVY-149 Provide ability to cancel script exec... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Sprint: Basel 56
Story Points: 13

 Description   

When running a groovy script from the editor (launched with "RUN" button), it blocks the UI until the script has finished/terminated.
If the script takes a long time, it leads to a session timeout (indicated by that red box).

It would be nice to have the possibility use other apps (whatever) during the script runs.
The combination of blocked UI and (possible) timeout might be confusing for users, since the don't know whether the script really has finished successfully (since the mini groovy console cannot display anything after a timeout).


Interesting read before tackling this issue https://vaadin.com/wiki/-/wiki/Main/Using+server+initiated+events



 Comments   
Comment by Federico Grilli [ 04/Aug/16 ]

What I did in the related branch is an attempt at solving the problem with Vaadin's polling mechanism and Java concurrency's Future object. As mentioned by apchelintcev best solution for 5.5 would be using Vaadin's push capabilities which entail using Servlet 3.0, if I'm not mistaken. At any rate, what I did solves the issue of having a blocked UI during long running scripts. Af far as I can see, the main downside of my solution is that polling in Vaadin affects the whole UI, meaning that if there's more than one component using polling at the same time that could end up with undesired effects, e.g. one component could set a different polling interval or stopping polling altogether while another component still isn't done with its job. As far as I know, atm, only the UploadProgressBar component is using polling.
Finally, if we need to deliver this also in 5.4 then I guess that's the only viable solution. Doing w/o polling does update the underlying component status but the UI isn't updated, unless a user interacts with it so to cause a repaint.

Generated at Mon Feb 12 05:55:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.