File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -537,10 +537,22 @@ $(document).ready(function () {
537537 const queryString = window . location . search ;
538538 const urlParams = new URLSearchParams ( queryString ) ;
539539 if ( urlParams . get ( 'update' ) === 'manual' ) {
540- $ ( "#updateModal .modal-body" ) . append ( '<h3>Manual Update: </h3><form method="POST" action="" enctype="multipart/form-data"> <p><input type="file" name="file"></p><p><input onclick="this.form.submit()" id="submit-button" type="submit" value="Submit"></p></form>' ) ;
540+ $ ( "#updateModal .modal-body" ) . append ( '<h3>Manual Update: </h3><form method="POST" action="" enctype="multipart/form-data"> <p><input type="file" name="file"></p><p><input id="submit-button" type="submit" value="Submit"></p></form>' ) ;
541+ const upd_formElt = document . querySelector ( '#updateModal div.modal-body form' ) ;
542+ upd_formElt . addEventListener ( 'submit' , handleFileSubmit ) ;
543+ function handleFileSubmit ( event ) {
544+ console . log ( 'inside function handlefilesubmit' ) ;
545+ event . preventDefault ;
546+ fetch ( upd_formElt . action , {
547+ method : "post" ,
548+ // body: new URLSearchParams(new FormData(form)) // for application/x-www-form-urlencoded
549+ body : new FormData ( upd_formElt ) // for multipart/form-data
550+ } ) ;
551+ $ ( "#updateModal .modal-body" ) . html ( '<span class="spinner-border spinner-border-sm"></span> Updating...' ) ;
552+ } ;
541553 }
542- } )
543-
554+ } ) ;
555+
544556 $ ( "#start-update-button" ) . on ( "click" , function ( ) {
545557 //$("#updateModal .modal-title").text(("Installing update"));
546558 socket . emit ( "update rtkbase" ) ;
You can’t perform that action at this time.
0 commit comments