tangled
alpha
login
or
join now
futur.blue
/
pegasus
56
fork
atom
objective categorical abstract machine language personal data server
56
fork
atom
overview
issues
2
pulls
pipelines
Auto continue importing blobs when migrating
futur.blue
2 months ago
eac1f54e
f0e70709
verified
This commit was signed with the committer's
known signature
.
futur.blue
SSH Key Fingerprint:
SHA256:QHGqHWNpqYyw9bt8KmPuJIyeZX9SZewBZ0PR1COtKQ0=
+16
-4
1 changed file
expand all
collapse all
unified
split
frontend
src
templates
MigratePage.mlx
+16
-4
frontend/src/templates/MigratePage.mlx
···
340
340
341
341
module BlobProgress = struct
342
342
let[@react.component] make ~csrf_token ~did ~blobs_imported ~blobs_failed () =
343
343
+
let form_ref : Dom.htmlFormElement Js.nullable React.ref = useRef Js.Nullable.null in
344
344
+
(* auto-submit the form after a brief delay to continue importing *)
345
345
+
React.useEffect0 (fun () ->
346
346
+
let timer_id =
347
347
+
Js.Global.setTimeout
348
348
+
~f:(fun () ->
349
349
+
match Js.Nullable.toOption form_ref.current with
350
350
+
| Some form ->
351
351
+
Webapi.Dom.HtmlFormElement.setAttribute "method" "post" form ;
352
352
+
Webapi.Dom.HtmlFormElement.submit form ;
353
353
+
| None ->
354
354
+
() )
355
355
+
100
356
356
+
in
357
357
+
Some (fun () -> Js.Global.clearTimeout timer_id) ) ;
343
358
<div>
344
359
<div className="flex flex-col items-center py-6">
345
360
<div
···
358
373
else null )
359
374
</p>
360
375
</div>
361
361
-
<form className="flex justify-center">
376
376
+
<form ref=(ReactDOM.Ref.domRef (Obj.magic form_ref))>
362
377
<input type_="hidden" name="dream.csrf" value=csrf_token />
363
378
<input type_="hidden" name="action" value="continue_blobs" />
364
379
( match did with
···
366
381
<input type_="hidden" name="did" value=d />
367
382
| None ->
368
383
null )
369
369
-
<Button type_="submit" formMethod="post">
370
370
-
(string "continue importing")
371
371
-
</Button>
372
384
</form>
373
385
</div>
374
386
end