1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00
TiddlyWiki5/core/ui
Jeremy Ruston b95723a022
Fix syncer to handler errors properly (#4373)
* First commit

* Add throttling of saves

Now we refuse to save a tiddler more often than once per second.

* Wait for a timeout before trying again after an error

* Modest optimisations of isDirty() method

* Synchronise system tiddlers and deletions from the server

Fixes two long-standing issues:

* Changes to system tiddlers are not synchronised from the server to the browser
* Deletions of tiddlers on the server are not propagated to browser clients

* Make sure we update the dirty status even if there isn't a task to perform

* Replace save-wiki button with popup sync menu

* Remove the "Server" control panel tab

We don't need it with the enhanced sync dropdown

* Add indentation to the save-wiki button

* Fix spacing in dropdown menu items

* Switch between cloud icons according to dirty status

* Add a menu item to copy syncer logs to the clipboard

* Improve animated icon

* Remove indentation from save-wiki button

@pmario the annoying thing is that using `\trim whitespace` trims significant whitespace too, so it means we have to use <$text text=" "/> when we need a space that won't be trimmed. For the moment, I've removed the indentation but will keep thinking about it.

* Further icon, UI and copy text tweaks

Move the icons and styles from the core into the TiddlyWeb plugin

* Clean up PR diff

* Tweak animation durations

* Break the actions from the syncer dropdown into separate tiddlers

@pmario I think this makes things a bit easier to follow

* Refactor syncadaptor creation and logging

The goal is for the syncadaptor to be able to log to the same logger as the syncer, so that the "copy syncer logs to clipboard" data is more useful.

* Don't transition the dirty indicator container colour, just the SVG's colour

* Only trigger a sync for changes to tiddlers we're interested in

Otherwise it is triggered by the creation of the alert tiddlers used to display errors.

* Restore deleting local tiddlers removed from the server

(I had commented it out for some testing and accidentally commited it).

* Guard against missing adaptor info

* We still need to trigger a timeout when there was no task to process

* Avoid repeatedly polling for changes

Instead we only trigger a timeout call at if there is a pending task (ie a tiddler that has changed but isn't yet old enough to save).

* Lazy loading: include skinny versions of lazily loaded tiddlers in the index.html

* Introduce _is_skinny field for indicating that a tiddler is subject to lazy loading

* Remove savetrail plugin from prerelease

It doesn't yet work with the new syncer

* Make the savetrail plugin work again

* Clear outstanding alerts when synchronisation is restored

* Logger: only remove alerts from the same component

Missed off 9f5c0de07

* Make the saving throttle interval configurable (#4385)

After switching Bob to use the core syncer the throttle interval makes saving feel very sluggish compared to the message queue setup that I had before.
The editing lock that I use to prevent conflicts with multiple users doesn't go away until the save is completed, and with the 1 second delay it means that if you edit a tiddler and save it than you have to wait one second before you can edit it again.

* Tweaks to appearance of alerts

* Exclude temp tiddlers from offline snapshots

Otherwise alerts will persist

* Tweak appearance of status line in dropdown

* Update release note

* Web server: Don't include full path in error messages

Fixes #3724

* In change event handler check for deletions

* Disable the official plugin library when the tiddlyweb plugin is loaded

* Hide error details from browser for /files/ route

See https://github.com/Jermolene/TiddlyWiki5/issues/3724#issuecomment-565702492 -- thanks @pmario

* Revert all the changes to the relationship between the syncer and the syncadaptor

Previously we had some major rearrangements to make it possible for the syncadaptor to route it's logging to the logger used by the syncer. The motivation is so that the "copy logs to clipboard" button is more useful.

On reflection, changing the interface this drastically is undesirable from a backwards compatibility perspective, so I'm going to investigate other ways to achieve the logger sharing

* Make the tiddlyweb adaptor use the syncer's logger

So that both are availavble when copying the syncer logs to the clipboard

* Update release note

* Support setting port=0 to get an OS assigned port

Quite useful

* Update code comment

* UI: Use "Get latest changes from server" instead of "Refresh"

* Add getUpdatedTiddlers() method to syncadaptor API

See https://github.com/Jermolene/TiddlyWiki5/pull/4373#issuecomment-573579495

* Refactor revision handling within the syncer

Thanks @pmario

* Fix typo in tiddlywebadaptor

* Improve presentation of errors

See https://github.com/Jermolene/TiddlyWiki5/pull/4373#issuecomment-573695267

* Add docs for getTiddlerRevision()

* Remove unused error animation

* Update comment for GET /recipes/default/tiddlers/tiddlers.json

* Optimise SVG cloud image

* Add optional list of allowed filters for get all tiddlers route

An attempt to address @Arlen22's concern here:

https://github.com/Jermolene/TiddlyWiki5/pull/4373#pullrequestreview-342146190

* Fix network error alert text translatability

* Fix error code and logging for GET /recipes/default/tiddlers/tiddlers.json

Thanks @Arlen22

* Flip GET /recipes/default/tiddlers/tiddlers.json allowed filter handling to be secure by default

* Validate updates received from getUpdatedTiddlers()

* Add syncer method to force loading of a tiddler from the server

* Remove the release note update to remove the merge conflict

* Fix crash when there's no config section in the tiddlywiki.info file

* Use config tiddler title to check filter query (merge into fix-syncer) (#4478)

* Use config tiddler title to check filter query

* Create config-tiddlers-filter.tid

* Add config switch to enable all filters on GET /recipes/default/tiddlers/tiddlers.json

And update docs

* Fix bug when deleting a tiddler with a shadow

Reported by @kookma at https://github.com/Jermolene/TiddlyWiki5/pull/4373#issuecomment-604027528

Co-authored-by: jed <inmysocks@fastmail.com>
Co-authored-by: Arlen22 <arlenbee@gmail.com>
2020-03-30 15:24:05 +01:00
..
AboveStory Fix tw2-plugin-check warning so that more than one plugin is displayed 2016-09-30 18:27:45 +01:00
Actions Add default new-tiddler and new-journal tags mechanism and... (#4314) 2019-10-13 16:53:52 +01:00
AdvancedSearch Autofocus advanced search text edit input 2019-02-06 17:53:00 +00:00
Components Fix formatting of plugin listing in control panel 2019-09-20 14:30:52 +01:00
ControlPanel Use CamelCase for Gitea (#4496) 2020-03-13 17:36:05 +00:00
EditorToolbar Fix stamp dropdown not transcluding caption field 2020-01-15 20:29:13 +00:00
EditTemplate Make "type" input look consistent with "fields" input (#4358) 2020-01-30 15:39:38 +00:00
EditToolbar EditTemplate optimizations (#4104) 2019-10-14 14:31:57 +01:00
Filters Add advanced search canned filter for "tiddlers modified this session" 2019-02-08 11:07:06 +00:00
ImportPreviews Fix broken import previews 2018-05-16 17:40:15 +01:00
KeyboardShortcuts fix missing tag for advanced-search keyboard shortcut 2019-07-14 17:06:09 +02:00
Manager Fix usages of is[current] that can be changed to all[current] 2018-08-18 14:47:35 +01:00
MoreSideBar Create the new "tree" global macro (#2925) 2017-06-28 17:44:15 +01:00
PageControls Restore whitespace for page control buttons 2020-01-04 16:44:33 +00:00
PageTemplate Dynamic loading/unloading of plugins (#4259) 2019-09-16 12:15:39 +01:00
SideBar Improve ability to disable drag and drop 2020-03-20 10:46:17 +00:00
SideBarSegments Add whitespace trim to SideBarSegments search (#4302) 2019-10-12 09:24:05 +01:00
TiddlerInfo Show backlinks on rename (#3534) 2018-11-15 15:18:38 +00:00
TopRightBar Fix broken filters introduced in b179a6011 2020-02-29 15:56:22 +00:00
ViewTemplate Add hidden setting for default tiddler icon 2020-03-06 14:52:37 +00:00
ViewToolbar Add default new-tiddler and new-journal tags mechanism and... (#4314) 2019-10-13 16:53:52 +01:00
AdvancedSearch.tid Soften colour of system tiddler icons 2015-03-10 12:29:39 +00:00
AlertTemplate.tid Fix syncer to handler errors properly (#4373) 2020-03-30 15:24:05 +01:00
BinaryWarning.tid Add download button/link to binary tiddler warning banners in view and edit mode (#4423) 2020-01-31 09:13:28 +00:00
ControlPanel.tid Soften colour of system tiddler icons 2015-03-10 12:29:39 +00:00
DefaultSearchResultList.tid add localisable strings for search 2015-10-18 18:09:41 +09:00
EditTemplate.tid Update class settings in edit template to match view template 2019-12-17 12:01:59 +00:00
ImportListing.tid Use new state* attributes for reveal and button widgets (#3531) 2018-11-18 10:54:12 +00:00
ListItemTemplate.tid Yet more "tw-*" -> "tc-*" 2014-08-28 19:41:29 +01:00
Manager.tid Introduce tiddler manager 2016-11-29 08:36:07 +00:00
MissingTemplate.tid Yet more "tw-*" -> "tc-*" 2014-08-28 19:41:29 +01:00
PageControls.tid Fix currentTiddler in pagecontrol buttons 2019-10-03 12:13:29 +01:00
PageStylesheet.tid Typos missed from a9dd8c2 2018-09-28 18:18:07 +01:00
PageTemplate.tid Improve ability to disable drag and drop 2020-03-20 10:46:17 +00:00
PaletteManager.tid Add/refactor PaletteManager (#3832) 2019-06-26 12:36:13 +01:00
PluginInfo.tid Refactor user interface for plugin tiddlers 2016-10-18 09:23:19 +01:00
PluginInfoDefaultContents.tid Refactor user interface for plugin tiddlers 2016-10-18 09:23:19 +01:00
PluginListItemTemplate.tid Refactor user interface for plugin tiddlers 2016-10-18 09:23:19 +01:00
SearchResults.tid Addresses #1066 by moving the search results into a dropdown. 2015-09-27 22:53:46 +01:00
SideBarLists.tid Modularize the sidebar 2018-08-02 13:22:21 +01:00
TagManager.tid Add "none" as an option in the icon dropdown in tag manager (#4361) 2020-01-30 15:52:33 +00:00
TagTemplate.tid fix textnodes between tags in viewtemplate (#3587) 2018-11-29 09:49:29 +00:00
TiddlerFields.tid Yet more "tw-*" -> "tc-*" 2014-08-28 19:41:29 +01:00
TiddlerFieldTemplate.tid Yet more "tw-*" -> "tc-*" 2014-08-28 19:41:29 +01:00
TiddlerInfo.tid Add "sticky" mode for tiddler info panel 2016-11-23 18:17:54 +00:00
UntaggedTemplate.tid Yet more "tw-*" -> "tc-*" 2014-08-28 19:41:29 +01:00
ViewTemplate.tid ViewTemplate: Add tc-tiddler-overridden-shadow class 2020-03-09 20:31:42 +00:00