19
19
.summary-value { font-weight : 400 ; }
20
20
.clear-btn-active { background : # ea1616!important ; color : # fff!important ; border : 1.3px solid # e34434!important ; }
21
21
.clear-btn-active : hover { background : # e32e2e!important ; color : # fff!important ; }
22
+ .custom-query-group { margin-top : 1.2em ; }
23
+ .custom-sql-label { font-size : 1rem ; font-weight : 500 ; color : # 1d2b36 ; vertical-align : middle; }
24
+ .custom-sql-box { width : 100% ; min-width : 0 ; font-size : 1.07rem ; line-height : 1.38 ; font-family : "JetBrains Mono" , "Fira Mono" , Monaco, "Consolas" , "Menlo" , monospace; border-radius : 8px ; border : 1.2px solid # b6c1d7 ; padding : 10px 13px ; background : # fcfcfa ; resize : vertical; }
22
25
</ style >
23
26
</ head >
24
27
< body >
@@ -72,6 +75,14 @@ <h2 class="minimal-title">DB Endpoint Latency Checker</h2>
72
75
< label for ="interval "> Delay Between Tests (seconds)</ label >
73
76
< input type ="number " id ="interval " name ="interval " value ="{{ interval|default(1) }} " min ="0.1 " step ="0.1 ">
74
77
</ div >
78
+ < div id ="custom-sql-area " class ="custom-query-group " style ="display:none; ">
79
+ < label class ="custom-sql-label ">
80
+ < input type ="checkbox " id ="custom-sql-check " name ="use_custom_sql " value ="yes " onchange ="toggleCustomSQL() " style ="vertical-align:middle; margin-right:7px; margin-bottom:2px; ">
81
+ Custom SQL Query
82
+ </ label >
83
+ < textarea id ="custom-sql-box " name ="custom_sql " rows ="12 " placeholder ="Enter your SQL query here... " style ="width:100%;display:none;margin-top:1em; "> </ textarea >
84
+ < div style ="font-size:0.98rem;color:#868b94;margin-top:0.3em; "> Use for advanced latency tests. Default is < code > SELECT 1</ code > for most DBs.</ div >
85
+ </ div >
75
86
< footer class ="minimal-footer " id ="footer-btns ">
76
87
< button type ="submit " class ="minimal-btn "> Run Test</ button >
77
88
< button type ="button " id ="clear-btn " class ="minimal-btn minimal-btn-secondary{% if result %} clear-btn-active{% endif %} " onclick ="hardClear(); return false; "> Clear</ button >
@@ -180,13 +191,31 @@ <h3 style="text-align:center;margin-bottom:0.5em;">Summary of Statistics</h3>
180
191
const dbSelect = document . getElementById ( 'dbtype' ) ;
181
192
const dbFields = document . getElementById ( 'db-fields' ) ;
182
193
const urlFields = document . getElementById ( 'url-fields' ) ;
194
+ const customSqlArea = document . getElementById ( 'custom-sql-area' ) ;
195
+ const customSqlBox = document . getElementById ( 'custom-sql-box' ) ;
196
+ const customSqlCheck = document . getElementById ( 'custom-sql-check' ) ;
183
197
function toggleDbUi ( ) {
184
198
if ( dbSelect . value === 'url' ) {
185
199
dbFields . style . display = 'none' ;
186
200
urlFields . style . display = '' ;
201
+ customSqlArea . style . display = "none" ;
202
+ } else if ( dbSelect . value ) {
203
+ dbFields . style . display = '' ;
204
+ urlFields . style . display = 'none' ;
205
+ customSqlArea . style . display = "" ;
187
206
} else {
188
207
dbFields . style . display = '' ;
189
208
urlFields . style . display = 'none' ;
209
+ customSqlArea . style . display = "none" ;
210
+ }
211
+ toggleCustomSQL ( ) ;
212
+ }
213
+ function toggleCustomSQL ( ) {
214
+ if ( customSqlCheck && customSqlCheck . checked ) {
215
+ customSqlBox . style . display = '' ;
216
+ customSqlBox . rows = 20 ;
217
+ } else {
218
+ customSqlBox . style . display = 'none' ;
190
219
}
191
220
}
192
221
dbSelect . onchange = toggleDbUi ;
@@ -196,6 +225,7 @@ <h3 style="text-align:center;margin-bottom:0.5em;">Summary of Statistics</h3>
196
225
dbFields . style . display = '' ;
197
226
urlFields . style . display = 'none' ;
198
227
removeResults ( ) ;
228
+ if ( customSqlBox ) customSqlBox . style . display = "none" ;
199
229
}
200
230
function hardClear ( ) {
201
231
// redirect to base URL, kill cache/results
0 commit comments