From 8435fbfdae4a00baa3941a031a89939df40eed06 Mon Sep 17 00:00:00 2001 From: donpat1to Date: Wed, 30 Jul 2025 12:06:32 +0200 Subject: [PATCH] upsi --- Watcher/Models/Server.cs | 4 +- Watcher/ViewModels/ServerDetailsViewModel.cs | 13 +++ Watcher/Views/Server/_ServerCard.cshtml | 109 ++++++++++++++----- Watcher/Views/Server/_ServerDetails.cshtml | 97 ++++++++++++----- 4 files changed, 167 insertions(+), 56 deletions(-) diff --git a/Watcher/Models/Server.cs b/Watcher/Models/Server.cs index 83466a8..a64335d 100644 --- a/Watcher/Models/Server.cs +++ b/Watcher/Models/Server.cs @@ -25,7 +25,7 @@ public class Server public int CpuCores { get; set; } = 0; public string? GpuType { get; set; } = string.Empty; public double RamSize { get; set; } = 0; - + public string? DiskSpace { get; set; } = string.Empty; // Database public DateTime CreatedAt { get; set; } = DateTime.UtcNow; @@ -35,5 +35,5 @@ public class Server public DateTime LastSeen { get; set; } public Boolean IsVerified { get; set; } = false; - + } diff --git a/Watcher/ViewModels/ServerDetailsViewModel.cs b/Watcher/ViewModels/ServerDetailsViewModel.cs index 0d64262..58b5633 100644 --- a/Watcher/ViewModels/ServerDetailsViewModel.cs +++ b/Watcher/ViewModels/ServerDetailsViewModel.cs @@ -28,6 +28,7 @@ public class ServerDetailsViewModel public int CpuCores { get; set; } = 0; public string? GpuType { get; set; } = string.Empty; public double RamSize { get; set; } = 0; + public string? DiskSpace { get; set; } = string.Empty; // Database @@ -38,4 +39,16 @@ public class ServerDetailsViewModel public DateTime LastSeen { get; set; } public Boolean IsVerified { get; set; } = false; + + // Display Properties for View + public string DisplayCpuType => !string.IsNullOrWhiteSpace(CpuType) ? CpuType : "-"; + public string DisplayCpuCores => CpuCores > 0 ? CpuCores.ToString() : "-"; + public string DisplayGpuType => !string.IsNullOrWhiteSpace(GpuType) ? GpuType : "-"; + public string DisplayRamSize => RamSize > 0 ? $"{RamSize} GB" : "-"; + //public string DisplayDiskSpace => !string.IsNullOrWhiteSpace(DiskSpace) ? DiskSpace : "-"; + public string DisplayCreatedAt => CreatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm"); + public string DisplayLastSeen => LastSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm"); + public string StatusBadgeClass => IsOnline ? "bg-success" : "bg-danger"; + public string StatusIcon => IsOnline ? "bi-check-circle" : "bi-x-circle"; + public string StatusText => IsOnline ? "Online" : "Offline"; } \ No newline at end of file diff --git a/Watcher/Views/Server/_ServerCard.cshtml b/Watcher/Views/Server/_ServerCard.cshtml index ec6cebf..de29aa9 100644 --- a/Watcher/Views/Server/_ServerCard.cshtml +++ b/Watcher/Views/Server/_ServerCard.cshtml @@ -4,54 +4,93 @@
@foreach (var s in Model) { -
+
+
- (#@s.Id) @s.Name + (#@s.Id) @s.Name
- + @(s.IsOnline ? "Online" : "Offline")
+
-
-
IP: @s.IPAddress
-
Typ: @s.Type
-
Erstellt: @s.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm")
-
Last-Seen: @s.LastSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm")
-
CPU: @(s.CpuType ?? "not found")
-
CPU-Kerne: @s.CpuCores
-
GPU: @(s.GpuType ?? "not found")
-
RAM: @(s.RamSize)
-
Disk Space: ...
+
+ +
+ + IP: @s.IPAddress +
+ + +
+ + Typ: @s.Type +
+ + +
+ + Erstellt: @s.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy") +
+ +
+ + Last Seen: @s.LastSeen.ToLocalTime().ToString("HH:mm") +
+
+ +
+ +
+ + CPU: @(!string.IsNullOrEmpty(s.CpuType) ? s.CpuType : "-") +
+ +
+ + Kerne: @(s.CpuCores > 0 ? s.CpuCores.ToString() : "-") +
+ +
+ + GPU: @(!string.IsNullOrEmpty(s.GpuType) ? s.GpuType : "-") +
+ +
+ + RAM: @(s.RamSize > 0 ? $"{s.RamSize} GB" : "-") +
+ +
+ + Disk: @(!string.IsNullOrEmpty(s.DiskSpace) ? s.DiskSpace : "-") +
-
@@ -59,3 +98,19 @@ }
+ + \ No newline at end of file diff --git a/Watcher/Views/Server/_ServerDetails.cshtml b/Watcher/Views/Server/_ServerDetails.cshtml index 05a74fe..603c1dd 100644 --- a/Watcher/Views/Server/_ServerDetails.cshtml +++ b/Watcher/Views/Server/_ServerDetails.cshtml @@ -2,42 +2,85 @@
- Serverdetails: @Model.Name + Serverdetails: @Model.Name
- - - @(Model.IsOnline ? "Online" : "Offline") + + + @Model.StatusText
+
-
-
ID
-
@Model.Id
+
+ +
+
Systeminformationen
+
+
ID
+
@Model.Id
-
IP-Adresse
-
@Model.IPAddress
+
IP-Adresse
+
@Model.IPAddress
-
Typ
-
@Model.Type
+
Typ
+
@Model.Type
-
Erstellt am
-
@Model.CreatedAt.ToLocalTime().ToString("dd.MM.yyyy HH:mm")
+
Erstellt am
+
@Model.DisplayCreatedAt
-
Zuletzt gesehen
-
@Model.LastSeen.ToLocalTime().ToString("dd.MM.yyyy HH:mm")
-
+
Zuletzt online
+
@Model.DisplayLastSeen
+
+
+ + +
+
Hardwareinformationen
+
+
CPU-Typ
+
@Model.DisplayCpuType
+ +
CPU-Kerne
+
@Model.DisplayCpuCores
+ +
GPU-Typ
+
@Model.DisplayGpuType
+ +
RAM
+
@Model.DisplayRamSize
+ +
Festplatte
+
@Model.DisplayDiskSpace
+
+
+
+ + + @if (!string.IsNullOrEmpty(Model.Description)) + { +
+
Beschreibung
+
+ @Model.Description +
+
+ }
-
-
RAM Last
-
- -
+
RAM Last
+
+
+
\ No newline at end of file