Enhance and group device discovery settings in web UI (#169)

This commit is contained in:
Tobias Gesellchen
2026-04-17 21:51:11 +02:00
committed by GitHub
parent 1fecb3948e
commit f14cb45680
3 changed files with 17 additions and 5 deletions
-1
View File
@@ -86,7 +86,6 @@ func (s *Server) HandleTriggerDiscovery(w http.ResponseWriter, _ *http.Request)
go s.DiscoverDevices(context.Background())
w.WriteHeader(http.StatusAccepted)
_, _ = w.Write([]byte(`{"status": "Discovery started"}`))
}
// HandleGetDiscoveryStatus returns the current discovery status.
+10 -3
View File
@@ -152,9 +152,16 @@
<span style="font-size: 0.8em; color: #666">(Standard services URL)</span>
</div>
<div style="margin-bottom: 20px">
<label for="discovery-interval">Discovery Interval:</label>
<input type="text" id="discovery-interval" placeholder="5m" style="width: 100px"/>
<label style="margin-left: 15px"><input type="checkbox" id="discovery-enabled"/> Enable Automated Discovery</label>
<strong>Device Discovery:</strong>
<div style="margin-top: 5px">
<label style="display: block; margin-bottom: 5px">
<input type="checkbox" id="discovery-enabled"/> Enable Automated Discovery
</label>
<div style="margin-left: 20px">
<label for="discovery-interval">Discovery Interval:</label>
<input type="text" id="discovery-interval" placeholder="5m" style="width: 100px"/>
</div>
</div>
</div>
<div style="margin-bottom: 20px">
<strong>DNS Discovery:</strong>
+7 -1
View File
@@ -1535,7 +1535,13 @@ async function triggerDiscovery() {
const indicator = document.getElementById("discovery-indicator");
if (indicator) indicator.style.display = "inline";
try {
await fetch("/setup/discover", {method: "POST"});
const response = await fetch("/setup/discover", {method: "POST"});
if (!response.ok) {
const err = await response.text();
alert("Failed to start discovery: " + err);
if (indicator) indicator.style.display = "none";
return;
}
pollDiscoveryStatus();
} catch (error) {
console.error("Failed to trigger discovery", error);