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 @@