diff --git a/app/wol/static/js/main.js b/app/wol/static/js/main.js index ec2b450d..61109a8f 100644 --- a/app/wol/static/js/main.js +++ b/app/wol/static/js/main.js @@ -108,7 +108,7 @@ window.onload = () => { (hour < 10 ? "0" + hour.toString() : hour) + ":" + (minute < 10 ? "0" + minute.toString() : minute) + utcString.substring(16, 19); - + // prepare html elements var datetimeFields = document.querySelectorAll('[id*=-input]'); for (let index = 0; index < datetimeFields.length; index++) { @@ -200,10 +200,10 @@ function setDeviceDown(device) { var statusDot = document.getElementById(device.id + "-dot"); var statusPorts = document.getElementById(device.id + "-ports"); var wakeButton = document.querySelector(`[id="btn-wake"][data-id="${device.id}"]`) - var scheduleModalButton = document.getElementById(device.id + "-btn-schedule"); + var scheduleModalButton = document.getElementById(device.id + "-btn-schedule"); // check if device was up before - if (statusDot.classList.contains("dot-up") && enableNotifications ) { + if (statusDot.classList.contains("dot-up") && enableNotifications) { notif.show("Device now down!", device.name + " is now down.", "is-danger", 5000); } @@ -287,9 +287,6 @@ socket.onmessage = function (event) { document.getElementById("visitors").innerHTML = message.visitors + ' visitor'; } else { document.getElementById("visitors").innerHTML = message.visitors + ' visitors'; - if (enableNotifications) { - notif.show("Visitors updated", "There are currently " + message.visitors + " visitors", "is-info", 5000); - } } } @@ -330,7 +327,7 @@ socket.onmessage = function (event) { if ("reload" in message) { window.location.reload(true); } - + } socket.onclose = function (event) { if (enableNotifications) { diff --git a/app/wol/static/js/settings.js b/app/wol/static/js/settings.js index 72e1c735..509a5fbe 100644 --- a/app/wol/static/js/settings.js +++ b/app/wol/static/js/settings.js @@ -99,7 +99,7 @@ async function scan() { const td2 = row.insertCell(); const td3 = row.insertCell(); const td4 = row.insertCell(); - const deviceName = "Unknown"; + let deviceName = "Unknown"; if (device.name != "") { deviceName = device.name; } @@ -110,7 +110,7 @@ async function scan() { button.classList.add("button", "is-primary", "is-small"); button.innerText = "Add"; button.addEventListener("click", function (event) { - update_device(JSON.stringify(device)); + post_settings("/settings/update/", JSON.stringify(device)); event.target.disabled = true; event.target.innerText = "Added"; }); diff --git a/app/wol/templates/wol/settings.html b/app/wol/templates/wol/settings.html index 64ef8563..988f6739 100644 --- a/app/wol/templates/wol/settings.html +++ b/app/wol/templates/wol/settings.html @@ -146,7 +146,7 @@ {% endif %} -

Add custom

+

Add devices

{% csrf_token %} @@ -257,7 +257,7 @@ -
+

Info