feat: merge PVE VM management + local features

- Merge PVE (Proxmox VE) virtual machine management from remote
  - PVE host CRUD API
  - VM status query / start / stop operations
  - PVE database tables and models
  - Frontend VM status display and control buttons
  - SPA routing fix for nested asset paths

- Keep local features:
  - Change password functionality
  - Log cleanup service
  - Docker containerization (Dockerfile + docker-compose)
  - Empty machine ping log spam fix
  - settings table for admin password storage

- Update machines handlers to support PVE fields
- Update frontend API client with PVE endpoints
This commit is contained in:
shirainbown
2026-06-18 22:33:45 +08:00
parent af306c183c
commit 6f507b319e
18 changed files with 1619 additions and 22 deletions

View File

@@ -58,6 +58,10 @@ type Machine struct {
TotalOfflineSeconds int `json:"total_offline_seconds"`
LastOfflineAt *time.Time `json:"last_offline_at"`
LastOfflineReason NullString `json:"last_offline_reason"`
// PVE 相关字段
PVEHostID *int64 `json:"pve_host_id"`
PVEVMID NullString `json:"pve_vmid"`
PVEVMStatus string `json:"pve_vm_status"` // "running", "stopped", ""
}
type OfflineLog struct {
@@ -108,6 +112,11 @@ type LoginRequest struct {
Password string `json:"password" binding:"required"`
}
type ChangePasswordRequest struct {
OldPassword string `json:"old_password" binding:"required"`
NewPassword string `json:"new_password" binding:"required,min=6"`
}
type SSHInfoRequest struct {
Username string `json:"username" binding:"required"`
Password string `json:"password"`
@@ -125,3 +134,26 @@ type SSHInfoResult struct {
RawMemoryInfo string `json:"raw_memory_info"`
RawDiskInfo string `json:"raw_disk_info"`
}
type PVEHost struct {
ID int64 `json:"id"`
Name string `json:"name"`
Hostname string `json:"hostname"`
Port int `json:"port"`
Username string `json:"username"`
PasswordEnc string `json:"password_enc"`
NodeName string `json:"node_name"`
VerifySSL bool `json:"verify_ssl"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// 运行时使用,不存储
Password string `json:"password"`
}
type PVEVMStatus struct {
Status string `json:"status"` // "running", "stopped"
Uptime int64 `json:"uptime"`
CPU float64 `json:"cpu"`
MemoryUsed int64 `json:"memory_used"`
MemoryTotal int64 `json:"memory_total"`
}