This commit is contained in:
nate 2026-03-18 20:29:35 +04:00
parent 13beacbc5a
commit f9826fbbe4
2 changed files with 7 additions and 2 deletions

View File

@ -49,6 +49,7 @@
const rb = document.getElementById(prefix + 'request-body').value.trim();
body.request_body = rb || null;
body.regions = [...document.querySelectorAll('.' + prefix + 'region-check:checked')].map(el => el.value);
if (!body.regions.length) throw new Error('Select at least one region');
if (_currentQuery) body.query = _currentQuery;
return body;
}

View File

@ -81,12 +81,16 @@
</div>
</div>
<%
// Default to eu-central if no regions selected
const selectedRegions = (monitor.regions && monitor.regions.length) ? monitor.regions : ['eu-central'];
%>
<div>
<label class="block text-sm text-gray-400 mb-1.5">Regions <span class="text-gray-600">(leave all unselected to use all regions)</span></label>
<label class="block text-sm text-gray-400 mb-1.5">Regions</label>
<div class="flex flex-wrap gap-2">
<% regions.forEach(function([val, label]) { %>
<label class="flex items-center gap-2 <%= bg %> border <%= border %> hover:border-gray-600 rounded-lg px-3 py-2 cursor-pointer transition-colors">
<input type="checkbox" value="<%= val %>" class="<%= prefix %>region-check accent-blue-500" <%= (monitor.regions && monitor.regions.includes(val)) ? 'checked' : '' %>> <span class="text-sm text-gray-300"><%~ label %></span>
<input type="checkbox" value="<%= val %>" class="<%= prefix %>region-check accent-blue-500" <%= selectedRegions.includes(val) ? 'checked' : '' %>> <span class="text-sm text-gray-300"><%~ label %></span>
</label>
<% }) %>
</div>