From b01cf1fd504b387407bc9311e509a9f752ff5cb9 Mon Sep 17 00:00:00 2001 From: triggermeelmo Date: Sun, 11 Jan 2026 20:38:58 +0100 Subject: [PATCH] Added Server View --- .../Controllers/ApiController.cs | 9 +- .../Controllers/MonitoringController.cs | 6 + .../Views/Monitoring/ContainerIndex.cshtml | 0 .../Views/Monitoring/ServerIndex.cshtml | 398 ++++++++++++++++++ 4 files changed, 412 insertions(+), 1 deletion(-) create mode 100644 watcher-monitoring/Views/Monitoring/ContainerIndex.cshtml create mode 100644 watcher-monitoring/Views/Monitoring/ServerIndex.cshtml diff --git a/watcher-monitoring/Controllers/ApiController.cs b/watcher-monitoring/Controllers/ApiController.cs index 07ea181..cae55cf 100644 --- a/watcher-monitoring/Controllers/ApiController.cs +++ b/watcher-monitoring/Controllers/ApiController.cs @@ -178,7 +178,14 @@ public class APIController : Controller var server = await _context.Servers.FindAsync(dto.ipAddress); - return Ok(server.Id); + if (server != null) + { + return Ok(server.Id); + } else + { + return BadRequest(); + } + } catch (Exception ex) { Console.WriteLine(ex.Message); diff --git a/watcher-monitoring/Controllers/MonitoringController.cs b/watcher-monitoring/Controllers/MonitoringController.cs index a790ef3..03be13a 100644 --- a/watcher-monitoring/Controllers/MonitoringController.cs +++ b/watcher-monitoring/Controllers/MonitoringController.cs @@ -25,4 +25,10 @@ public class MonitoringController : Controller return View(); } + [HttpGet("server")] + public async Task ServerIndex() + { + return View(); + } + } \ No newline at end of file diff --git a/watcher-monitoring/Views/Monitoring/ContainerIndex.cshtml b/watcher-monitoring/Views/Monitoring/ContainerIndex.cshtml new file mode 100644 index 0000000..e69de29 diff --git a/watcher-monitoring/Views/Monitoring/ServerIndex.cshtml b/watcher-monitoring/Views/Monitoring/ServerIndex.cshtml new file mode 100644 index 0000000..819fb99 --- /dev/null +++ b/watcher-monitoring/Views/Monitoring/ServerIndex.cshtml @@ -0,0 +1,398 @@ +@model dynamic + +@{ + ViewData["Title"] = "Server Overview"; +} + +
+
+

Server Overview

+ Last updated: @DateTime.Now.ToString("HH:mm:ss") +
+ +
+ +
+
+
+
+

test

+ 192.168.1.100 +
+ Online +
+ +
+ +
+
+ CPU Load + 400% +
+ +
+ + +
+
+ RAM Load + 400 MB +
+ +
+ + +
+
+ Uptime + 400 days +
+
+
+
+
+ + +
+
+
+
+

test

+ 192.168.1.101 +
+ Online +
+ +
+ +
+
+ CPU Load + 400% +
+ +
+ + +
+
+ RAM Load + 400 MB +
+ +
+ + +
+
+ Uptime + 400 days +
+
+
+
+
+ + +
+
+
+
+

test

+ 192.168.1.102 +
+ Warning +
+ +
+ +
+
+ CPU Load + 400% +
+ +
+ + +
+
+ RAM Load + 400 MB +
+ +
+ + +
+
+ Uptime + 400 days +
+
+
+
+
+ + +
+
+
+
+

test

+ 192.168.1.103 +
+ Online +
+ +
+ +
+
+ CPU Load + 400% +
+ +
+ + +
+
+ RAM Load + 400 MB +
+ +
+ + +
+
+ Uptime + 400 days +
+
+
+
+
+ + +
+
+
+
+

test

+ 192.168.1.104 +
+ Offline +
+ +
+ +
+
+ CPU Load + 400% +
+ +
+ + +
+
+ RAM Load + 400 MB +
+ +
+ + +
+
+ Uptime + 400 days +
+
+
+
+
+ + +
+
+
+
+

test

+ 192.168.1.105 +
+ Online +
+ +
+ +
+
+ CPU Load + 400% +
+ +
+ + +
+
+ RAM Load + 400 MB +
+ +
+ + +
+
+ Uptime + 400 days +
+
+
+
+
+
+
+ +@section Scripts { + + +} + +