feat: add controller update trigger + version checker (v0.1.8)
Hub now tracks controller_url from reports, periodically checks the Gitea registry for the latest controller image version, and shows a "Trigger Update" button on the customer detail page that proxies to the controller's self-update API endpoint using the shared API key. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+20
-18
@@ -110,30 +110,32 @@ func (h *Handler) handleCustomers(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type customerJSON struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ControllerVersion string `json:"controller_version"`
|
||||
HealthStatus string `json:"health_status"`
|
||||
LastSeen time.Time `json:"last_seen"`
|
||||
CPUPercent float64 `json:"cpu_percent"`
|
||||
MemoryPercent float64 `json:"memory_percent"`
|
||||
ContainerTotal int `json:"container_total"`
|
||||
ContainerRunning int `json:"container_running"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ControllerVersion string `json:"controller_version"`
|
||||
ControllerURL string `json:"controller_url,omitempty"`
|
||||
HealthStatus string `json:"health_status"`
|
||||
LastSeen time.Time `json:"last_seen"`
|
||||
CPUPercent float64 `json:"cpu_percent"`
|
||||
MemoryPercent float64 `json:"memory_percent"`
|
||||
ContainerTotal int `json:"container_total"`
|
||||
ContainerRunning int `json:"container_running"`
|
||||
BackupLastSnapshot *time.Time `json:"backup_last_snapshot"`
|
||||
}
|
||||
|
||||
result := make([]customerJSON, 0, len(customers))
|
||||
for _, c := range customers {
|
||||
result = append(result, customerJSON{
|
||||
ID: c.CustomerID,
|
||||
Name: c.CustomerName,
|
||||
ControllerVersion: c.ControllerVersion,
|
||||
HealthStatus: c.HealthStatus,
|
||||
LastSeen: c.ReceivedAt,
|
||||
CPUPercent: c.CPUPercent,
|
||||
MemoryPercent: c.MemoryPercent,
|
||||
ContainerTotal: c.ContainerTotal,
|
||||
ContainerRunning: c.ContainerRunning,
|
||||
ID: c.CustomerID,
|
||||
Name: c.CustomerName,
|
||||
ControllerVersion: c.ControllerVersion,
|
||||
ControllerURL: c.ControllerURL,
|
||||
HealthStatus: c.HealthStatus,
|
||||
LastSeen: c.ReceivedAt,
|
||||
CPUPercent: c.CPUPercent,
|
||||
MemoryPercent: c.MemoryPercent,
|
||||
ContainerTotal: c.ContainerTotal,
|
||||
ContainerRunning: c.ContainerRunning,
|
||||
BackupLastSnapshot: c.BackupLastSnapshot,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user