From b95cbfc62d288985887decfc3e4a2458b58c53c0 Mon Sep 17 00:00:00 2001 From: Daniel Habenicht Date: Sun, 29 Jun 2025 13:28:41 +0200 Subject: [PATCH] =?UTF-8?q?Container-=C3=9Cbersicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Watcher/Controllers/ContainerController.cs | 28 --------------------- Watcher/Models/Container.cs | 17 ++++++++----- Watcher/Views/Container/AddContainer.cshtml | 22 ---------------- Watcher/Views/Container/Overview.cshtml | 23 ++--------------- Watcher/Views/Server/_ServerCard.cshtml | 8 ------ Watcher/Views/Shared/_Layout.cshtml | 2 +- 6 files changed, 14 insertions(+), 86 deletions(-) delete mode 100644 Watcher/Views/Container/AddContainer.cshtml diff --git a/Watcher/Controllers/ContainerController.cs b/Watcher/Controllers/ContainerController.cs index e65c127..acba5cf 100644 --- a/Watcher/Controllers/ContainerController.cs +++ b/Watcher/Controllers/ContainerController.cs @@ -29,32 +29,4 @@ public class ContainerController : Controller return View(viewModel); } - - [HttpGet] - public IActionResult AddContainer() - { - return View(); - } - - [HttpPost] - public async Task AddContainer(AddContainerViewModel vm) - { - if (!ModelState.IsValid) - return View(vm); - - var container = new Container - { - Name = vm.Name, - Image = vm.Image, - Status = vm.Status, - Hostname = vm.Hostname, - IsRunning = vm.IsRunning, - CreatedAt = DateTime.UtcNow - }; - - _context.Containers.Add(container); - await _context.SaveChangesAsync(); - - return RedirectToAction("Index"); - } } diff --git a/Watcher/Models/Container.cs b/Watcher/Models/Container.cs index 2d5ab6a..0101b4f 100644 --- a/Watcher/Models/Container.cs +++ b/Watcher/Models/Container.cs @@ -4,17 +4,22 @@ public class Container { public int Id { get; set; } - public string Name { get; set; } = string.Empty; + // Container Details + public string? Name { get; set; } + + public int ExposedPort { get; set; } + + public int InternalPort { get; set; } public string Status { get; set; } = string.Empty; - public Image? Image { get; set; } + public string Health { get; set; } = string.Empty; + + public string? Image { get; set; } public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - public string Hostname { get; set; } = string.Empty; + public Boolean IsRunning { get; set; } = true; - public string Type { get; set; } = "docker"; // z.B. "docker", "vm", "lxc", etc. - - public Boolean IsRunning { get; set; } = false; + public Server? HostServer { get; set; } } diff --git a/Watcher/Views/Container/AddContainer.cshtml b/Watcher/Views/Container/AddContainer.cshtml deleted file mode 100644 index 29ab3c2..0000000 --- a/Watcher/Views/Container/AddContainer.cshtml +++ /dev/null @@ -1,22 +0,0 @@ -@model Watcher.ViewModels.AddContainerViewModel -@{ - ViewData["Title"] = "Neuen Container hinzufügen"; -} - -

Neuen Container hinzufügen

- -
-
- - -
-
- - -
-
- - -
- -
diff --git a/Watcher/Views/Container/Overview.cshtml b/Watcher/Views/Container/Overview.cshtml index d9b9cec..9ec20d4 100644 --- a/Watcher/Views/Container/Overview.cshtml +++ b/Watcher/Views/Container/Overview.cshtml @@ -3,33 +3,14 @@ ViewData["Title"] = "Containerübersicht"; } -
-

Containerübersicht

- - + Container hinzufügen - -
-
@foreach (var container in Model.Containers) {

@container.Name

Image: @container.Image

-

Hostname: @container.Hostname

-

Status: @container.Status

-

- Läuft: - - @(container.IsRunning ? "Ja" : "Nein") - -

- + +

Status: @(container.IsRunning ? "online" : "offline")

}
diff --git a/Watcher/Views/Server/_ServerCard.cshtml b/Watcher/Views/Server/_ServerCard.cshtml index 910e5d9..bedd9fa 100644 --- a/Watcher/Views/Server/_ServerCard.cshtml +++ b/Watcher/Views/Server/_ServerCard.cshtml @@ -30,14 +30,6 @@
RAM: @(s.RamSize)
Disk Space: ...
-
-
-
Metrics letzte 24h
-
- -
-
-
diff --git a/Watcher/Views/Shared/_Layout.cshtml b/Watcher/Views/Shared/_Layout.cshtml index 944f4ef..2a2ba22 100644 --- a/Watcher/Views/Shared/_Layout.cshtml +++ b/Watcher/Views/Shared/_Layout.cshtml @@ -73,10 +73,10 @@ -