docket: improve upload page

Most notably, we further restrict the desks eligible for glob upload
to just the ones whose glob is said to be hosted on the local ship.

On the upload page, we replace the desk input field with a dropdown
from which eligible desks can be selected.
Additionally we now display some instructions, instead of leaving
developers entirely on their own.
This commit is contained in:
Fang 2021-09-14 16:38:20 +02:00
parent 038784b0fe
commit 177ef73d37
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -337,31 +337,66 @@
%- as-octt:mimes:html
%- en-xml:html
^- manx
:: desks: with local globs, eligible for upload
::
=/ desks=(list desk)
%+ murn ~(tap by charges)
|= [d=desk [docket *]]
^- (unit desk)
=- ?:(- `d ~)
?& ?=(%glob -.href)
=([%ames our.bowl] glob-location.href)
==
::
;html
;head
;title:"%docket globulator"
;meta(charset "utf-8");
;style:'* { font-family: monospace; margin-top: 1em; }'
;style:'''
* { font-family: monospace; margin-top: 1em; }
li { margin-top: 0.5em; }
'''
==
;body
;h2:"%docket globulator"
;+ ?. =(~ msg)
:- [%p ~]
(join `manx`;br; (turn msg |=(m=@t `manx`:/"{(trip m)}")))
;p:"ur on ur own kid, glhf" ::TODO instructions
;form(method "post", enctype "multipart/form-data")
::TODO could be dropdown
;input(type "text", name "desk", placeholder "desk");
;br;
;input
=type "file"
=name "glob"
=directory ""
=webkitdirectory ""
=mozdirectory "";
;br;
;button(type "submit"):"Glob!"
==
;ol(start "0")
;li:"""
if necessary, create a desk whose desk.docket specifies
a glob hosted on the local ship.
"""
;li:"select the desk you want to upload the glob for."
;li:"""
select a directory containing the glob contents.
usually contains at least an /index.html.
"""
;li:"glob!"
==
;+ ?: =(~ desks)
;p:"no desks eligible for glob upload"
;form(method "post", enctype "multipart/form-data")
;label
;+ :/"desk: "
;select(name "desk")
;* %+ turn desks
|=(d=desk =+((trip d) ;option(value -):"{-}"))
==
==
;br;
;label
;+ :/"data: "
;input
=type "file"
=name "glob"
=directory ""
=webkitdirectory ""
=mozdirectory "";
==
;br;
;button(type "submit"):"glob!"
==
==
==
::
@ -375,9 +410,13 @@
=/ =charge (~(got by charges) desk)
::
=? err =(~ glob)
['no files for glob' err]
=? err ?=(%glob -.href.docket.charge)
['no files in glob' err]
=? err !?=(%glob -.href.docket.charge)
['desk does not use glob' err]
=? err ?& ?=(%glob -.href.docket.charge)
!=([%ames our.bowl] glob-location.href.docket.charge)
==
['desk\'s glob not hosted here' err]
::
?. =(~ err)
:_ [~ state]