objective categorical abstract machine language personal data server

Auto continue importing blobs when migrating

futur.blue eac1f54e f0e70709

verified
+16 -4
+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 + 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) ) ; 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 - <form className="flex justify-center"> 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 - <Button type_="submit" formMethod="post"> 370 - (string "continue importing") 371 - </Button> 372 384 </form> 373 385 </div> 374 386 end