diff --git a/watcher-monitoring/Controllers/HomeController.cs b/watcher-monitoring/Controllers/HomeController.cs index 7f722d6..5b0ac63 100644 --- a/watcher-monitoring/Controllers/HomeController.cs +++ b/watcher-monitoring/Controllers/HomeController.cs @@ -25,11 +25,14 @@ public class HomeController : Controller public async Task Index() { List servers = await _context.Servers.ToListAsync(); + List containers = await _context.Containers.ToListAsync(); + + ViewBag.Containers = containers; + ViewBag.ContainerCount = containers.Count(); ViewBag.TotalServers = servers.Count; ViewBag.OnlineServers = servers.Count(s => s.IsOnline); ViewBag.OfflineServers = servers.Count(s => !s.IsOnline); - ViewBag.ServiceCount = 8; ViewBag.Servers = servers; return View(); diff --git a/watcher-monitoring/Views/Home/Index.cshtml b/watcher-monitoring/Views/Home/Index.cshtml index 2a3e642..41fb977 100644 --- a/watcher-monitoring/Views/Home/Index.cshtml +++ b/watcher-monitoring/Views/Home/Index.cshtml @@ -33,14 +33,14 @@
-
Totoal Services
-
@ViewBag.ServiceCount
+
Total Containers
+
@ViewBag.ContainerCount
-
+

Monitored Servers

    @@ -68,6 +68,31 @@
+
+
+

Monitored Containers

+
    + @if (ViewBag.Containers != null && ViewBag.Containers.Count > 0) + { + @foreach (var container in ViewBag.Containers) + { +
  • +
    + @container.Name + Container Image +
    +
  • + } + } + else + { +
  • + No Containers added yet +
  • + } +
+
+