algorithm select

This commit is contained in:
Corban-Lee Jones 2025-03-05 12:11:17 +00:00
parent 8586090732
commit 237b5686e4
2 changed files with 5 additions and 6 deletions

View File

@ -213,15 +213,15 @@ $("input[name='filterType']").on("change", () => {
const openFilterForm = async id => { const openFilterForm = async id => {
$("#filterForm").removeClass("submitted"); $("#filterForm").removeClass("submitted");
HSSelect.getInstance("#formAlgorithm", true).element.setValue([]); const formAlgorithmSelect = HSSelect.getInstance("#formAlgorithm");
formAlgorithmSelect.setValue("");
if (id === -1) { if (id === -1) {
$("#formName").val(""); $("#formName").val("");
$("#formMatch").val(""); $("#formMatch").val("");
$("#formWhitelist").prop("checked", false); $("#formWhitelist").prop("checked", false);
$("#formInsensitive").prop("checked", false); $("#formInsensitive").prop("checked", false);
} } else {
else {
const data = await $.ajax({ const data = await $.ajax({
url: `/guild/${guildId}/filters/api?id=${id}`, url: `/guild/${guildId}/filters/api?id=${id}`,
method: "get" method: "get"
@ -231,8 +231,7 @@ const openFilterForm = async id => {
$("#formMatch").val(data.match); $("#formMatch").val(data.match);
$("#formWhitelist").prop("checked", data.is_whitelist); $("#formWhitelist").prop("checked", data.is_whitelist);
$("#formInsensitive").prop("checked", data.is_insensitive); $("#formInsensitive").prop("checked", data.is_insensitive);
formAlgorithmSelect.setValue(data.algorithm);
HSSelect.getInstance("#formAlgorithm").setValue(data.algorithm);
} }
HSOverlay.open($("#filterModal").get(0)); HSOverlay.open($("#filterModal").get(0));

View File

@ -241,7 +241,7 @@
<label for="formMatch" class="text-input-label">Match</label> <label for="formMatch" class="text-input-label">Match</label>
<input type="text" id="formMatch" name="match" class="form-input text-input peer group-[.submitted]:invalid:border-red-500 group-[.submitted]:invalid:ring-red-500" required> <input type="text" id="formMatch" name="match" class="form-input text-input peer group-[.submitted]:invalid:border-red-500 group-[.submitted]:invalid:ring-red-500" required>
<p class="text-input-help block group-[.submitted]:peer-[:invalid]:hidden"> <p class="text-input-help block group-[.submitted]:peer-[:invalid]:hidden">
The The statement to match against.
</p> </p>
<p class="mt-2 text-sm text-red-500 hidden group-[.submitted]:peer-[:invalid]:block"> <p class="mt-2 text-sm text-red-500 hidden group-[.submitted]:peer-[:invalid]:block">
Please enter a match. Please enter a match.