tangled
alpha
login
or
join now
futur.blue
/
pegasus
57
fork
atom
objective categorical abstract machine language personal data server
57
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
341
module BlobProgress = struct
342
let[@react.component] make ~csrf_token ~did ~blobs_imported ~blobs_failed () =
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
343
<div>
344
<div className="flex flex-col items-center py-6">
345
<div
···
358
else null )
359
</p>
360
</div>
361
-
<form className="flex justify-center">
362
<input type_="hidden" name="dream.csrf" value=csrf_token />
363
<input type_="hidden" name="action" value="continue_blobs" />
364
( match did with
···
366
<input type_="hidden" name="did" value=d />
367
| None ->
368
null )
369
-
<Button type_="submit" formMethod="post">
370
-
(string "continue importing")
371
-
</Button>
372
</form>
373
</div>
374
end
···
340
341
module BlobProgress = struct
342
let[@react.component] make ~csrf_token ~did ~blobs_imported ~blobs_failed () =
343
+
let form_ref : Dom.htmlFormElement Js.nullable React.ref = useRef Js.Nullable.null in
344
+
(* auto-submit the form after a brief delay to continue importing *)
345
+
React.useEffect0 (fun () ->
346
+
let timer_id =
347
+
Js.Global.setTimeout
348
+
~f:(fun () ->
349
+
match Js.Nullable.toOption form_ref.current with
350
+
| Some form ->
351
+
Webapi.Dom.HtmlFormElement.setAttribute "method" "post" form ;
352
+
Webapi.Dom.HtmlFormElement.submit form ;
353
+
| None ->
354
+
() )
355
+
100
356
+
in
357
+
Some (fun () -> Js.Global.clearTimeout timer_id) ) ;
358
<div>
359
<div className="flex flex-col items-center py-6">
360
<div
···
373
else null )
374
</p>
375
</div>
376
+
<form ref=(ReactDOM.Ref.domRef (Obj.magic form_ref))>
377
<input type_="hidden" name="dream.csrf" value=csrf_token />
378
<input type_="hidden" name="action" value="continue_blobs" />
379
( match did with
···
381
<input type_="hidden" name="did" value=d />
382
| None ->
383
null )
0
0
0
384
</form>
385
</div>
386
end