To all,
I’ve seen mention of issues with users trying to create WebDialogs with progress bars and responsive UI’s during long operations.
I found a solution which seems to work reliably. It involves either threads or fibers. My normal code is a bit more involved, but I’ve tried to explain it, along with some code. I’ve attached a pdf and an html file (renamed with a txt extension) that should get one started.
This isn’t trivial, so I haven’t taken the time to create code that one can plug in in two minutes…
Thanks,
Greg
SU long operations, progress bar, cancel.pdf (16.2 KB)
Progress bar sample.txt (4.6 KB)
2 Likes
@MSP_Greg I am trying to find a way to have a web dialog progress bar. Would you still say the method you discuss about is a reliable one?
I made an attempt at creating a progress bar, where the long process was broken into smaller segments and each segment called a JS script. The JS Script would update the progress bar, and then send an action callback to Ruby to continue the code. Unfortunately, this is not working, the web dialog is blank until the end of the operation.
Any/all advice appreciated.
smeyers,
Sorry for the delay. Yes, I’ve got some code that works very well, but I never integrated it into a plugin, so I try an look around for it. It worked with fibers, but threads seemed to work also. I think the final version I was using was different than the code that I attached.
I was using it for importing a gazillion faces into SU, I think it worked by switching to a fiber/thread that issued an execute_script, then that fiber waited for a callback from the WebDialog, which then started the main thread again. Since the main thread is ‘paused’, and the fiber is not executing code, the WebDialog can update itself.
It also allowed the user to cancel the process. Setting it up that way allowed it to be dropped into existing code.
I’ll see if I can look for it over the weekend…
Greg