1- <!doctype html>
1+ <!DOCTYPE html>
22< html lang ="en ">
33 < head >
44 < meta charset ="utf-8 ">
1616
1717 < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/js/bootstrap.bundle.min.js "
integrity ="
sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm "
crossorigin ="
anonymous "
> </ script > 1818 < script src ="https://code.jquery.com/jquery-3.7.1.min.js " integrity ="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo= " crossorigin ="anonymous "> </ script >
19-
19+
2020 < nav class ="navbar navbar-expand-lg navbar-dark bg-primary ">
2121 < div class ="container ">
2222 < a class ="navbar-brand " href ="/index.htm "> Beer Keg Monitor</ a >
5353 < div class ="spinner-border text-light " id ="spinner " role ="status "> </ div >
5454 </ div >
5555 </ nav >
56-
5756
58- <!-- START MAIN INDEX -->
57+ <!-- START MAIN INDEX -->
5958
60- < div class ="container row-margin-10 ">
59+ < div class ="container row-margin-10 ">
6160
62- < div class ="alert alert-success alert-dismissible hide fade d-none " role ="alert ">
63- < div id ="alert "> </ div >
64- < button type ="button " class ="btn-close " data-bs-dismiss ="alert " aria-label ="Close "> </ button >
65- </ div >
61+ < div class ="alert alert-success alert-dismissible hide fade d-none " role ="alert ">
62+ < div id ="alert "> </ div >
63+ < button type ="button " class ="btn-close " data-bs-dismiss ="alert " aria-label ="Close "> </ button >
64+ </ div >
6665
67- < script type =" text/javascript " >
68- function showError ( msg ) {
69- $ ( '.alert' ) . removeClass ( 'alert-success' ) . addClass ( 'alert-danger' ) . removeClass ( 'hide' ) . addClass ( 'show' ) . removeClass ( 'd-none' ) ;
70- $ ( '#alert' ) . text ( msg ) ;
71- }
66+ < script >
67+ function showError ( msg ) {
68+ $ ( '.alert' ) . removeClass ( 'alert-success' ) . addClass ( 'alert-danger' ) . removeClass ( 'hide' ) . addClass ( 'show' ) . removeClass ( 'd-none' ) ;
69+ $ ( '#alert' ) . text ( msg ) ;
70+ }
7271
73- function showSuccess ( msg ) {
74- $ ( '.alert' ) . addClass ( 'alert-success' ) . removeClass ( 'alert-danger' ) . removeClass ( 'hide' ) . addClass ( 'show' ) . removeClass ( 'd-none' ) ;
75- $ ( '#alert' ) . text ( msg ) ;
76- }
72+ function showSuccess ( msg ) {
73+ $ ( '.alert' ) . addClass ( 'alert-success' ) . removeClass ( 'alert-danger' ) . removeClass ( 'hide' ) . addClass ( 'show' ) . removeClass ( 'd-none' ) ;
74+ $ ( '#alert' ) . text ( msg ) ;
75+ }
7776
78- $ ( "#alert-btn" ) . click ( function ( e ) {
79- $ ( '.alert' ) . addClass ( 'hide' ) . removeClass ( 'show' ) . addClass ( 'd-none' ) ;
80- } ) ;
81- </ script >
77+ $ ( "#alert-btn" ) . click ( function ( e ) {
78+ $ ( '.alert' ) . addClass ( 'hide' ) . removeClass ( 'show' ) . addClass ( 'd-none' ) ;
79+ } ) ;
80+ </ script >
8281
83- < div class ="accordion " id ="accordion ">
82+ < div class ="accordion " id ="accordion ">
8483
85- < div class ="accordion-item ">
86- < h2 class ="accordion-header " id ="headingBackup ">
87- < button class ="accordion-button " type ="button " data-bs-toggle ="collapse " data-bs-target ="#collapseBackup " aria-expanded ="true " aria-controls ="collapseBackup ">
88- < b > Create backup</ b >
89- </ button >
90- </ h2 >
91- < div id ="collapseBackup " class ="accordion-collapse collapse show " aria-labelledby ="headingBackup " data-bs-parent ="#accordion ">
92- < div class ="accordion-body ">
84+ < div class ="accordion-item ">
85+ < h2 class ="accordion-header " id ="headingBackup ">
86+ < button class ="accordion-button " type ="button " data-bs-toggle ="collapse " data-bs-target ="#collapseBackup " aria-expanded ="true " aria-controls ="collapseBackup ">
87+ < b > Create backup</ b >
88+ </ button >
89+ </ h2 >
90+ < div id ="collapseBackup " class ="accordion-collapse collapse show " aria-labelledby ="headingBackup " data-bs-parent ="#accordion ">
91+ < div class ="accordion-body ">
9392
94- < div class ="row mb-3 ">
95- < div class ="col-md-12 themed-grid-col bg-light "> Backup configuration to file</ div >
96- </ div >
93+ < div class ="row mb-3 ">
94+ < div class ="col-md-12 themed-grid-col bg-light "> Backup configuration to file</ div >
95+ </ div >
9796
98- < button class ="btn btn-primary btn-sm " type ="button " data-bs-toggle ="tooltip " name ="backup-btn " id ="backup-btn " title ="Create backup of configuration ">
99- Create backup
100- </ button >
101-
97+ < button class ="btn btn-primary btn-sm " type ="button " data-bs-toggle ="tooltip " name ="backup-btn " id ="backup-btn " title ="Create backup of configuration ">
98+ Create backup
99+ </ button >
100+
101+ </ div >
102102 </ div >
103103 </ div >
104- </ div >
105104
106- < div class ="accordion-item ">
107- < h2 class ="accordion-header " id ="headingRestore ">
108- < button class ="accordion-button " type ="button " data-bs-toggle ="collapse " data-bs-target ="#collapseRestore " aria-expanded ="true " aria-controls ="collapseRestore ">
109- < b > Restore backup</ b >
110- </ button >
111- </ h2 >
112- < div id ="collapseRestore " class ="accordion-collapse collapse show " aria-labelledby ="headingRestore " data-bs-parent ="#accordion ">
113- < div class ="accordion-body ">
114-
115- < div class ="row mb-3 ">
116- < div class ="col-md-12 themed-grid-col bg-light "> Restore configuration from file</ div >
117- </ div >
105+ < div class ="accordion-item ">
106+ < h2 class ="accordion-header " id ="headingRestore ">
107+ < button class ="accordion-button " type ="button " data-bs-toggle ="collapse " data-bs-target ="#collapseRestore " aria-expanded ="true " aria-controls ="collapseRestore ">
108+ < b > Restore backup</ b >
109+ </ button >
110+ </ h2 >
111+ < div id ="collapseRestore " class ="accordion-collapse collapse show " aria-labelledby ="headingRestore " data-bs-parent ="#accordion ">
112+ < div class ="accordion-body ">
118113
119- < form id ="uploadForm " enctype ="multipart/form-data ">
120114 < div class ="row mb-3 ">
121- < div class ="col-md-8 custom-file ">
122- < input type ="file " accept =".txt " class ="custom-file-input " name ="name " id ="name " data-bs-toggle ="tooltip " title ="Select a configuration backup to upload ">
123- </ div >
115+ < div class ="col-md-12 themed-grid-col bg-light "> Restore configuration from file</ div >
124116 </ div >
125- < div class ="row mb-3 ">
126- < div class ="col-md-4 ">
127- < button type ="submit " class ="btn btn-primary " id ="restore-btn " value ="upload " data-bs-toggle ="tooltip " title ="Restore configuration from a file "> Restore configuration</ button >
117+
118+ < form id ="uploadForm " enctype ="multipart/form-data ">
119+ < div class ="row mb-3 ">
120+ < div class ="col-md-8 custom-file ">
121+ < input type ="file " accept =".txt " class ="custom-file-input " name ="name " id ="name " data-bs-toggle ="tooltip " title ="Select a configuration backup to upload ">
122+ </ div >
128123 </ div >
124+ < div class ="row mb-3 ">
125+ < div class ="col-md-4 ">
126+ < button type ="submit " class ="btn btn-primary " id ="restore-btn " value ="upload " data-bs-toggle ="tooltip " title ="Restore configuration from a file "> Restore configuration</ button >
127+ </ div >
128+ </ div >
129+ </ form >
130+
131+ < div class ="progress ">
132+ < div class ="progress-bar " role ="progressbar " aria-valuenow ="0 " aria-valuemin ="0 " aria-valuemax ="100 "> </ div >
129133 </ div >
130- </ form >
131134
132- < div class ="progress ">
133- < div class ="progress-bar " role ="progressbar " aria-valuenow ="0 " aria-valuemin ="0 " aria-valuemax ="100 "> </ div >
134135 </ div >
135-
136136 </ div >
137137 </ div >
138-
139138 </ div >
140139 </ div >
141140
142- < script type =" text/javascript " >
141+ < script >
143142 var swVer = ""
144143 var backup = { } ;
145144 var progress = 0 ;
146145 </ script >
147146
148- < script type =" text/javascript " >
147+ < script >
149148 window . onload = getStatus ;
150149
151150 function download ( content , mimeType , filename ) {
@@ -266,8 +265,8 @@ <h2 class="accordion-header" id="headingRestore">
266265 console . log ( "Selected file: " + fileElement . files [ 0 ] . name ) ;
267266
268267 let reader = new FileReader ( ) ;
269- reader . addEventListener ( 'load' , function ( e ) {
270- let text = e . target . result ;
268+ reader . addEventListener ( 'load' , function ( e ) {
269+ let text = e . target . result ;
271270
272271 try {
273272 json = JSON . parse ( text ) ;
@@ -280,7 +279,7 @@ <h2 class="accordion-header" id="headingRestore">
280279 }
281280 } catch ( error ) {
282281 console . error ( error ) ;
283- showError ( "Unable to parse configuration file for GravityMon ." )
282+ showError ( "Unable to parse configuration file." )
284283 }
285284 } ) ;
286285 reader . readAsText ( fileElement . files [ 0 ] ) ;
@@ -317,5 +316,5 @@ <h2 class="accordion-header" id="headingRestore">
317316 <!-- START FOOTER -->
318317
319318 < div class ="container themed-container bg-primary text-light row-margin-10 "> (C) Copyright 2021-23 Magnus Persson</ div >
320- </ body >
319+ </ body >
321320</ html >
0 commit comments