diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx index 205148286..1f0ab1760 100644 --- a/frontend-modern/src/components/Dashboard/GuestRow.tsx +++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx @@ -112,7 +112,9 @@ export function GuestRow(props: GuestRowProps) { {/* Uptime */} - + {formatUptime(props.guest.uptime)} diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index 4683fa43a..8cd83063f 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -931,7 +931,7 @@ func (m *Monitor) pollContainers(ctx context.Context, instanceName string, clien Status: ct.Status, Type: "lxc", CPU: safeFloat(ct.CPU), // Already in percentage - CPUs: ct.CPUs, + CPUs: int(ct.CPUs), Memory: models.Memory{ Total: int64(ct.MaxMem), Used: int64(ct.Mem), diff --git a/pkg/proxmox/client.go b/pkg/proxmox/client.go index 5c2cd5006..4c361a0e3 100644 --- a/pkg/proxmox/client.go +++ b/pkg/proxmox/client.go @@ -7,6 +7,7 @@ import ( "io" "net/http" "net/url" + "strconv" "strings" "time" @@ -14,6 +15,34 @@ import ( "github.com/rs/zerolog/log" ) +// FlexInt handles JSON fields that can be either int or string +type FlexInt int + +func (f *FlexInt) UnmarshalJSON(data []byte) error { + // Try to unmarshal as int first + var i int + if err := json.Unmarshal(data, &i); err == nil { + *f = FlexInt(i) + return nil + } + + // If that fails, try as string + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + + // Parse string to float first (handles "1.5" format from cpulimit) + floatVal, err := strconv.ParseFloat(s, 64) + if err != nil { + return err + } + + // Convert to int + *f = FlexInt(int(floatVal)) + return nil +} + // Client represents a Proxmox VE API client type Client struct { baseURL string @@ -346,7 +375,7 @@ type Container struct { Node string `json:"node"` Status string `json:"status"` CPU float64 `json:"cpu"` - CPUs int `json:"cpus"` + CPUs FlexInt `json:"cpus"` Mem uint64 `json:"mem"` MaxMem uint64 `json:"maxmem"` Swap uint64 `json:"swap"` diff --git a/pulse-v3.43-screenshot.png b/pulse-v3.43-screenshot.png new file mode 100644 index 000000000..fd0462d6d Binary files /dev/null and b/pulse-v3.43-screenshot.png differ diff --git a/pulse-v4.0-screenshot.png b/pulse-v4.0-screenshot.png new file mode 100644 index 000000000..82a811a2c Binary files /dev/null and b/pulse-v4.0-screenshot.png differ diff --git a/tmp-proxmox b/tmp-proxmox new file mode 160000 index 000000000..a2866e169 --- /dev/null +++ b/tmp-proxmox @@ -0,0 +1 @@ +Subproject commit a2866e169737ed4211b582ec9ad26219b211dd27