diff --git a/ISPChk/Properties/launchSettings.json b/ISPChk/Properties/launchSettings.json index d0e4101..aa1c757 100644 --- a/ISPChk/Properties/launchSettings.json +++ b/ISPChk/Properties/launchSettings.json @@ -4,7 +4,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:4223", + "applicationUrl": "http://0.0.0.0:4223", "sslPort": 0 } }, @@ -22,7 +22,7 @@ "dotnetRunMessages": "true", "launchBrowser": true, "launchUrl": "/", - "applicationUrl": "http://localhost:4223", + "applicationUrl": "http://0.0.0.0:4223", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/ISPChk/appsettings.json b/ISPChk/appsettings.json index d9d9a9b..20d0096 100644 --- a/ISPChk/appsettings.json +++ b/ISPChk/appsettings.json @@ -6,5 +6,12 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "Kestrel": { + "Endpoints": { + "Http": { + "Url": "http://0.0.0.0:4223" + } + } + } } diff --git a/ISPChk/ispchk.db b/ISPChk/ispchk.db index 5499520..976d864 100644 Binary files a/ISPChk/ispchk.db and b/ISPChk/ispchk.db differ diff --git a/ISPChk/wwwroot/index.html b/ISPChk/wwwroot/index.html index 7d5c844..084602c 100644 --- a/ISPChk/wwwroot/index.html +++ b/ISPChk/wwwroot/index.html @@ -63,7 +63,13 @@ Testlel
- Testlel +
+
+ + +
+ +
diff --git a/ISPChk/wwwroot/ispchk.js b/ISPChk/wwwroot/ispchk.js index 59739e7..6ebaed7 100644 --- a/ISPChk/wwwroot/ispchk.js +++ b/ISPChk/wwwroot/ispchk.js @@ -22,6 +22,7 @@ async function deleteHost(hostId) { async function fetchHosts() { var tbody = $("#tblHosts > tbody"); tbody.empty(); + hosts = []; var res = await $.getJSON("/api/host"); console.log("Got hosts: ", res); for (let host of res) { @@ -33,7 +34,8 @@ async function fetchHosts() { deleteHost(host.hostId); }).appendTo(row); } - updateGraphs(res); + hosts = res; + updateGraphs(); } async function fetchPings(hostId, start, end) { @@ -54,13 +56,17 @@ async function transformChartData(pings) { return res; } -async function updateGraphs(hosts) { - var charts = $("#charts"); +async function updateGraphs() { + var chartDiv = $("#charts"); + chartDiv.empty(); + charts = []; + var pastMinutes = $("#inpHistoryPast").val(); + var start = Date.now() - pastMinutes * 60 * 1000; + var end = Date.now(); for (let host of hosts) { console.log("Appending ", host); - var before = Date.now() - 300000; - var val = await transformChartData(await fetchPings(host.hostId, before, Date.now())); - $("", { id: "chart_" + host.hostId, width: 200, height: 200 }).appendTo(charts); + var val = await transformChartData(await fetchPings(host.hostId, start, end)); + $("", { id: "chart_" + host.hostId, width: 200, height: 200 }).appendTo(chartDiv); var ctx = document.getElementById('chart_' + host.hostId).getContext('2d'); charts[host.hostId] = new Chart(ctx, { type: 'line', @@ -132,6 +138,11 @@ $('#btnDebug').click(async () => { console.log("DEBUG"); }); +$("#frmHistory").submit((event) => { + event.preventDefault(); + updateGraphs(); +}); + $("#frmHostAdd").submit((event) => { event.preventDefault(); var name = $("#inpNameAdd").val();