mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-12 14:07:28 +00:00
- Fix CPU core display to show for all guests with CPU data - Previously only showed cores when CPU > 0 (truthy) - Now shows "(0.0/X cores)" consistently for all running/stopped guests - Improve code organization with new helper utilities - Clean up import statements and remove debug logs
58 lines
No EOL
1.7 KiB
Go
58 lines
No EOL
1.7 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/rcourtman/pulse-go-rewrite/pkg/pbs"
|
|
"github.com/rcourtman/pulse-go-rewrite/pkg/proxmox"
|
|
)
|
|
|
|
// CreateProxmoxConfig creates a proxmox.ClientConfig from a PVEInstance
|
|
func CreateProxmoxConfig(node *PVEInstance) proxmox.ClientConfig {
|
|
return proxmox.ClientConfig{
|
|
Host: node.Host,
|
|
User: node.User,
|
|
Password: node.Password,
|
|
TokenName: node.TokenName,
|
|
TokenValue: node.TokenValue,
|
|
VerifySSL: node.VerifySSL,
|
|
Fingerprint: node.Fingerprint,
|
|
}
|
|
}
|
|
|
|
// CreatePBSConfig creates a pbs.ClientConfig from a PBSInstance
|
|
func CreatePBSConfig(node *PBSInstance) pbs.ClientConfig {
|
|
return pbs.ClientConfig{
|
|
Host: node.Host,
|
|
User: node.User,
|
|
Password: node.Password,
|
|
TokenName: node.TokenName,
|
|
TokenValue: node.TokenValue,
|
|
VerifySSL: node.VerifySSL,
|
|
Fingerprint: node.Fingerprint,
|
|
}
|
|
}
|
|
|
|
// CreateProxmoxConfigFromFields creates a proxmox.ClientConfig from individual fields
|
|
func CreateProxmoxConfigFromFields(host, user, password, tokenName, tokenValue, fingerprint string, verifySSL bool) proxmox.ClientConfig {
|
|
return proxmox.ClientConfig{
|
|
Host: host,
|
|
User: user,
|
|
Password: password,
|
|
TokenName: tokenName,
|
|
TokenValue: tokenValue,
|
|
VerifySSL: verifySSL,
|
|
Fingerprint: fingerprint,
|
|
}
|
|
}
|
|
|
|
// CreatePBSConfigFromFields creates a pbs.ClientConfig from individual fields
|
|
func CreatePBSConfigFromFields(host, user, password, tokenName, tokenValue, fingerprint string, verifySSL bool) pbs.ClientConfig {
|
|
return pbs.ClientConfig{
|
|
Host: host,
|
|
User: user,
|
|
Password: password,
|
|
TokenName: tokenName,
|
|
TokenValue: tokenValue,
|
|
VerifySSL: verifySSL,
|
|
Fingerprint: fingerprint,
|
|
}
|
|
} |