Skip to content

Commit aef31a2

Browse files
Update index.html
1 parent 357a773 commit aef31a2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

app/templates/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
.summary-value { font-weight:400; }
2020
.clear-btn-active { background: #ea1616!important; color:#fff!important; border:1.3px solid #e34434!important; }
2121
.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; }
2225
</style>
2326
</head>
2427
<body>
@@ -72,6 +75,14 @@ <h2 class="minimal-title">DB Endpoint Latency Checker</h2>
7275
<label for="interval">Delay Between Tests (seconds)</label>
7376
<input type="number" id="interval" name="interval" value="{{ interval|default(1) }}" min="0.1" step="0.1">
7477
</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>
7586
<footer class="minimal-footer" id="footer-btns">
7687
<button type="submit" class="minimal-btn">Run Test</button>
7788
<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>
180191
const dbSelect = document.getElementById('dbtype');
181192
const dbFields = document.getElementById('db-fields');
182193
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');
183197
function toggleDbUi() {
184198
if (dbSelect.value === 'url') {
185199
dbFields.style.display = 'none';
186200
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 = "";
187206
} else {
188207
dbFields.style.display = '';
189208
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';
190219
}
191220
}
192221
dbSelect.onchange = toggleDbUi;
@@ -196,6 +225,7 @@ <h3 style="text-align:center;margin-bottom:0.5em;">Summary of Statistics</h3>
196225
dbFields.style.display = '';
197226
urlFields.style.display = 'none';
198227
removeResults();
228+
if (customSqlBox) customSqlBox.style.display = "none";
199229
}
200230
function hardClear() {
201231
// redirect to base URL, kill cache/results

0 commit comments

Comments
 (0)