How to make progress bar for jszip rendering static sites?

169 views
Skip to first unread message

Siniy-Kit

unread,
Dec 25, 2020, 5:52:21 AM12/25/20
to TiddlyWiki
Hi! I am am testing new button for making .zip with static site
Here is my "render site" button  https://heeg.ru/empty10.html#New_item%202

it looks good, but works slow.....
is it possible to make it work faster or make progress bar 0-100% ?
 

TW Tones

unread,
Dec 27, 2020, 2:39:15 AM12/27/20
to TiddlyWiki
Siniy,

I suppose rendering a site or generating zips was intended to be a webmaster tool, and thus does not show a progress, could you set the contents of a tiddler to its content + "." after every zip action, and transclude that tiddlers content on screen, thus you would get a . .. ... line increasing until complete .......... Alternatively fake it with a gif, to indicate it is still happening?, a bit like the splash screen.

Other wise you will need to count something such as the number of tiddlers and show how the number decrements.

Tones



Siniy-Kit

unread,
Dec 27, 2020, 6:04:31 AM12/27/20
to TiddlyWiki
Hi, Tony. I try to make  <$action-createtiddler $basetitle="$:\temp\z"   text= <<currentTiddler>>   .....  and {{$:\temp\z}} 
but nothing happened after long thinking I saw the last zipped tiddler. I didnt  saw   how titles changes.
Can you write your code with dots ...... ?

воскресенье, 27 декабря 2020 г. в 10:39:15 UTC+3, TW Tones:

Saq Imtiaz

unread,
Dec 27, 2020, 6:30:36 AM12/27/20
to TiddlyWiki
@siniy-kit

I do not think what is being suggested here will work. It is easy enough to calculate how many tiddlers there are to render, and where you are in the process. The issue is that the TiddlyWiki interface will not refresh until after all the actions have been executed. So any kind of progress indicator will not display or update once the zip process starts, until after it ends.

Siniy-Kit

unread,
Dec 27, 2020, 11:24:21 AM12/27/20
to TiddlyWiki
may be we can edit  $:/plugins/tiddlywiki/jszip/startup.js   and see current tiddler rendered
  $tw.rootWidget.addEventListener("tm-zip-render-file",function(event) { var paramObject = event.paramObject || {}; console.log(paramObject);  

we can add counter i=i+1, an make new  fixed div with this infomration.... 
воскресенье, 27 декабря 2020 г. в 14:30:36 UTC+3, saq.i...@gmail.com:

Saq Imtiaz

unread,
Dec 27, 2020, 1:01:59 PM12/27/20
to TiddlyWiki
@siniy-kit yes the JavaScript approach can work if you modify a DIV directly with JavaScript.
You would also need to do a bit of extra work in advance to count the total number of tiddlers to render.

It would be good to implement this as a widget. I have some ideas as to how we could do that, but I wont have the time to look into it for a few weeks at least.

Siniy-Kit

unread,
Dec 27, 2020, 1:49:39 PM12/27/20
to TiddlyWiki
document.getElementById('_z').innerHTML=paramObject.tiddler  don't work. I see only final tiddler at the end. I think, TW5 block DOM modify.

The next problem - it is too slow. Node.js static cut works faster.  May be it will be better to save all $:\temp\ tiddlers in IndexDB?
how can we do it?


воскресенье, 27 декабря 2020 г. в 21:01:59 UTC+3, saq.i...@gmail.com:

TW Tones

unread,
Dec 27, 2020, 8:27:31 PM12/27/20
to TiddlyWiki
Siniy-kit,

If you had a mechaisium to zip (re-zip) only tiddlers that were added or changed since the last Zip the process may go much quicker depending on the change rate in your wiki.

Is it only a designer who sees this delay?, I would just give a warning that it will take time and may not respond, perhaps an alert before and on completion.

Regards
Tones

Siniy-Kit

unread,
Dec 28, 2020, 2:35:46 AM12/28/20
to TiddlyWiki
Hi, Tones. This  delay see only   designers, who use my template. In TW 5.1.21 I tried to solve this problem myself. I write script, to put to local storage   tiddler's title and it's modified (created) field value, so I can cut only  changed or new tiddlers. Here is my demo https://heeg.ru/shop2_2.html?id=16gDZVsB8FOIxrsFKbkbBNWC37lPUAfKOGf-rCVxeOmY#static_cut it works without zip
BUT the problem with this variant - it is very slow  and it skips random tiddlers, and i don't know why :(
I hoped new zip variant will solve my problem, but it is slow too 

I think final variant must do static cut directly to designers hosting by their PHP login and password.  And it must work with 14000+ pages 




понедельник, 28 декабря 2020 г. в 04:27:31 UTC+3, TW Tones:

Jeremy Ruston

unread,
Dec 28, 2020, 4:07:31 AM12/28/20
to tiddl...@googlegroups.com
Hi Siniy-Kit,

As others have pointed out, the fundamental problem here is that long running JavaScript tasks that block the main thread cannot update the DOM while they are processing. DOM updates are deferred until the thread completes.

I'm interested in fixing it by building a new "workflow" mechanism that supports long running tasks with a user interface, giving them progress bars and cancel buttons.

A workflow basically means executing an action tiddler (the action widgets in a particular tiddler), waiting for the next tick, and then following some simple rules to determine the next action tiddler to be executed. The refresh process would operate as usual in between the execution of action tiddlers, so the user interface would update in the usual way.

As discussed elsewhere, the behaviour of sequential action widgets can be highly confusing. This is due to the fact that the widgets are parsed and rendered in one go before they are executed, "freezing" the values of attributes to the value they had before execution started. The workflow mechanism wouldn't change that, but it would mitigate it because there would be no such subtlety to the execution of sequential workflow steps. We'd perhaps get to the point where action widgets themselves would be hidden from the vast majority of users; most end user actions could be accomplished through stitching together existing workflow steps, rather than users having to write action widgets directly.

With any luck, we should be able to make an editable visual representation of the workflow, something like the below screenshot from the Shortcuts app on the iPad. We should also be able to make a basic debugger that highlights steps as they are executed.

Workflows would be particularly useful with integrated support for APIs, so that we could for example write workflows to use a remote service to compress images, to save individual tiddlers to GitHub, or to scrape web data.

Best wishes

Jeremy







On 28 Dec 2020, at 07:35, Siniy-Kit <nera...@gmail.com> wrote:

Hi, Tones. This  delay see only   designers, who use my template. In TW 5.1.21 I tried to solve this problem myself. I write script, to put to local storage   tiddler's title and it's modified (created) field value, so I can cut only  changed or new tiddlers. Here is my demo https://heeg.ru/shop2_2.html?id=16gDZVsB8FOIxrsFKbkbBNWC37lPUAfKOGf-rCVxeOmY#static_cut it works without zip
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d9bdc6e5-9934-424a-84ec-cf8bc4cbb58bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages