mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
www/caddy: Show only wildcard domains in subdomain selection, show only wildcard domains in handler selection if a subdomain is selected (#4646)
This commit is contained in:
@@ -302,6 +302,9 @@
|
||||
<items>reverseproxy.reverse</items>
|
||||
<display>FromDomain,FromPort</display>
|
||||
<display_format>%s %s</display_format>
|
||||
<filters>
|
||||
<FromDomain>/^\*\./</FromDomain>
|
||||
</filters>
|
||||
</reverseproxy>
|
||||
</Model>
|
||||
</reverse>
|
||||
|
||||
@@ -336,6 +336,9 @@
|
||||
.selectpicker('val', selectedDomains)
|
||||
.selectpicker('refresh');
|
||||
}
|
||||
|
||||
// Trigger to filter the dropdowns if subdomains are selected
|
||||
$("#handle\\.subdomain").trigger("change");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -387,6 +390,26 @@
|
||||
});
|
||||
});
|
||||
|
||||
// When subdomain is selected in handler show only wildcard domains
|
||||
$("#handle\\.subdomain").on("change", function () {
|
||||
const subdomainSelected = $("#handle\\.subdomain").val() !== "";
|
||||
|
||||
$("#handle\\.reverse").find("option").each(function () {
|
||||
const isWildcard = $(this).text().includes("*.");
|
||||
$(this).toggle(!subdomainSelected || isWildcard);
|
||||
});
|
||||
|
||||
if (subdomainSelected) {
|
||||
const selectedText = $("#handle\\.reverse").find("option:selected").text();
|
||||
if (!selectedText.includes("*.")) {
|
||||
// Clear selection if not a wildcard
|
||||
$("#handle\\.reverse").val("").change();
|
||||
}
|
||||
}
|
||||
|
||||
$("#handle\\.reverse").selectpicker("refresh");
|
||||
});
|
||||
|
||||
// Trigger bootgrid setup for handlers tab too (even if not active) to ensure command buttons always work
|
||||
$('a[href="#handlers"]').trigger('shown.bs.tab');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user