disabled automatic wifi scan when the configuration page loads to avoid disconnecting and added warning

This commit is contained in:
RaffaelW 2024-12-14 22:42:59 +01:00
parent b097f81c95
commit a3dc701d0b
2 changed files with 14 additions and 3 deletions

View file

@ -6,6 +6,8 @@ import {
const form = document.querySelector("form.config"); const form = document.querySelector("form.config");
export let data = {};
export async function loadData(timeout = null) { export async function loadData(timeout = null) {
const req = await fetch("/config", { const req = await fetch("/config", {
method: "GET", method: "GET",
@ -38,7 +40,7 @@ export function writeDataToInput(data) {
showLoadingScreen("Konfiguration wird geladen..."); showLoadingScreen("Konfiguration wird geladen...");
try { try {
const data = await loadData(); data = await loadData();
hideLoadingScreen(); hideLoadingScreen();
writeDataToInput(data); writeDataToInput(data);
} catch (error) { } catch (error) {

View file

@ -1,3 +1,5 @@
import { data } from "./load-data.js";
const networkDropdown = document.querySelector("#select-network"); const networkDropdown = document.querySelector("#select-network");
const refreshButton = document.querySelector("#refresh-networks"); const refreshButton = document.querySelector("#refresh-networks");
const refreshIcon = refreshButton.querySelector("img"); const refreshIcon = refreshButton.querySelector("img");
@ -5,6 +7,15 @@ const refreshIcon = refreshButton.querySelector("img");
let isLoading = false; let isLoading = false;
refreshButton.addEventListener("click", async () => { refreshButton.addEventListener("click", async () => {
// check if interface is connected via WiFi-AccessPoint
if (data.connection == 0 || data.connection == 1) {
alert(
"Um nach WLAN-Netzwerken zu scannen, muss hardware-bedingt die " +
"WLAN-Verbindung kurzzeitig unterbrochen werden.\n" +
"Wenn das DMX-Interface nach dem Scan nicht mehr verbunden " +
"ist, verbinde es bitte neu."
);
}
updateNetworks(); updateNetworks();
}); });
@ -56,5 +67,3 @@ async function updateNetworks() {
insertNetworks(networks); insertNetworks(networks);
} }
} }
updateNetworks();