TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8.02k stars 1.19k forks source link

[IDEA] Show progress or some activity indicator during crypto operations #6146

Open cyrus-and opened 2 years ago

cyrus-and commented 2 years ago

I store some photos in an encrypted TW self-contained HTML file so its size is a few MBs. Opening and saving that file takes a few seconds, and during that time the page freezes. It would be nice to show a progress bar, or if that's not possible, at least some spinner or indicator that the page is doing something.

pmario commented 2 years ago

Does the "splash-screen" option help at startup? See: https://tiddlywiki.com/#Creating%20a%20splash%20screen

I think there is no feedback from the crypto library and the TW core seems to process the whole thing in 1 block.

cyrus-and commented 2 years ago

Does the "splash-screen" option help at startup?

That could help I guess (I'll try it, thanks!), but as you say it would only work for the decryption phase.

I think there is no feedback from the crypto library and the TW core seems to process the whole thing in 1 block.

Even showing a spinner with no clear indication of progress would IMHO be better than nothing. If it's not possible to split the crypto work in manageable chunks, then maybe using a web worker? I'm not aware of the internals so I'm shooting in the dark here...

pmario commented 2 years ago

I did some tests.

Is that what you want?

I think, that should be doable

grafik

I did add some images to my wiki, it needs about 10 seconds to decrypt the images.

pmario commented 2 years ago

Saving "freeze" is about 9 seconds. .. So it may be possible if a wiki is encrypted, that we start an animation at position (1) when the tm-save-wiki message is sent to the core. ... This message triggers the encryption process.

When the saving the wiki is finished, a tm-notify is triggered with the "Wiki saved" message at the top right corner. ... May be if this message is triggered and the wiki is encrypted, it may also stop the "new" animation.

grafik

cyrus-and commented 2 years ago

Is that what you want?

I'm no UX expert but I think that we can get rid of 1 and just show the rest.

By the way, does the same issue apply even for very big unencrypted TWs? If that's the case maybe the opening animation should be in a place common to both encrypted and unencrypted operations.

(Also, and unrelated, that password dialog could use some polishing IMHO :)

pmario commented 2 years ago

(Also, and unrelated, that password dialog could use some polishing IMHO :)

Yes, ... It's old ... it works ... but it definitely could profit from some love.

Help would be highly appreciated ;)

pmario commented 2 years ago

By the way, does the same issue apply even for very big unencrypted TWs?

Not really. tiddlywiki.com has a splash screen, which goes away, when the wiki is loaded. The same is true for the "password dialog".

My proposal would be to start a "new animation" when the "Decrypt" button is clicked. So the user gets a proper feedback.

cyrus-and commented 2 years ago

Not really. tiddlywiki.com has a splash screen, which goes away, when the wiki is loaded. The same is true for the "password dialog".

Cool, I didn't know that.

My proposal would be to start a "new animation" when the "Decrypt" button is clicked. So the user gets a proper feedback.

I get and agree on that part. It's the reason of the first animation that escapes me, I mean TW just waits for the user to input the password and press the button, no?

pmario commented 2 years ago

I get and agree on that part. It's the reason of the first animation that escapes me, I mean TW just waits for the user to input the password and press the button, no?

The first animation is an artefact of the splash-screen. ... It just happens to be still visible while the PW dialog hides the rest of the splash image. ...

I did use tiddlywiki.com as my "base wiki" for testing and creating the screenshots