mapshot icon indicating copy to clipboard operation
mapshot copied to clipboard

Support listing saves versions from just the static files

Open Palats opened this issue 3 years ago • 0 comments

Currently, listing available versions of a given serve is only available through mapshot serve subcommand - the list of available saves is obtained by scanning which mapshot.json exist and built the UI dynamically.

It might be possible to maintain static files able to generate a listing without using the serve command; the trick would be to use the append mode in write_file to maintain a listing. In practice, the approach would be:

  • When creating a mapshot, append basic info to a listing file - e.g., name of the version and maybe a timestamp or similar. The format of the listing file need to support basic appends - so that rules out clean json.
  • Create also a listing.html or similar.
  • That frontend would load up the listing file from javascript, parse it, and generate a simple list UI.

Notes:

  • This is likely that the listing UI would be different from the one in serve, as less information would be readily available from static files.
  • Unclear what the default behavior should be - maybe gate that behind a parameter or something.
  • The listing file should not contain too much data; otherwise it would grow fairly large, leading to problematic load times.
  • Whether to also do that across saves (e.g., maintaining a list of saves, not just the list of versions for a given save) might be interesting but has its own problem; e.g., people might not want to show what exists to everyone.

Palats avatar Sep 25 '21 07:09 Palats