v0.27.2 — copyable error popups, Tier2 hub reporting, memory bar fixes, new labels
- Replace native alert() with custom showAlert() modal (text selectable) - Manual Tier2 backup now pushes infra backup to Hub - CommittedMemory() excludes stopped/exited apps - Pre-start memory check blocks start if insufficient RAM - Add hungarian_ui metadata field + "Magyar felület" badge - Add "USB" badge on storage cards in settings page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,9 @@ type Router struct {
|
||||
// OnConfigApplied is called after a successful config apply (e.g., to push infra backup).
|
||||
OnConfigApplied func()
|
||||
|
||||
// OnCrossDriveComplete is called after a manual cross-drive backup completes (to push infra backup to Hub).
|
||||
OnCrossDriveComplete func()
|
||||
|
||||
// Asset syncer for on-demand Hub asset sync
|
||||
assetsSyncer *assets.Syncer
|
||||
|
||||
@@ -327,6 +330,26 @@ func (r *Router) actionStack(w http.ResponseWriter, action, name string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Memory check before starting a stopped app
|
||||
if action == "start" {
|
||||
stackMemMB := r.stackMgr.StackMemoryMB(name)
|
||||
if stackMemMB > 0 {
|
||||
if totalMB, memErr := system.GetTotalMemoryMB(); memErr == nil {
|
||||
reservedMB := r.cfg.System.ReservedMemoryMB
|
||||
usableMB := totalMB - reservedMB
|
||||
committedReqMB, _ := r.stackMgr.CommittedMemory()
|
||||
afterMB := committedReqMB + stackMemMB
|
||||
if afterMB > usableMB {
|
||||
writeJSON(w, http.StatusConflict, apiResponse{
|
||||
OK: false,
|
||||
Error: fmt.Sprintf("Nincs elég memória az indításhoz. Szükséges: %d MB, elérhető: %d MB (foglalt: %d MB / használható: %d MB)", stackMemMB, usableMB-committedReqMB, committedReqMB, usableMB),
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
switch action {
|
||||
case "start":
|
||||
@@ -807,6 +830,9 @@ func (r *Router) triggerCrossBackup(w http.ResponseWriter, req *http.Request, na
|
||||
if err := r.crossDriveRunner.RunAppBackup(context.Background(), name); err != nil {
|
||||
r.logger.Printf("[API] Cross-drive backup failed for %s: %v", name, err)
|
||||
}
|
||||
if r.OnCrossDriveComplete != nil {
|
||||
r.OnCrossDriveComplete()
|
||||
}
|
||||
}()
|
||||
|
||||
writeJSON(w, http.StatusOK, apiResponse{OK: true, Message: "Mentés elindítva"})
|
||||
@@ -849,6 +875,9 @@ func (r *Router) triggerAllCrossBackups(w http.ResponseWriter, _ *http.Request)
|
||||
if err := r.crossDriveRunner.RunAllScheduled(ctx, "manual"); err != nil {
|
||||
r.logger.Printf("[API] Cross-drive run-all manual error: %v", err)
|
||||
}
|
||||
if r.OnCrossDriveComplete != nil {
|
||||
r.OnCrossDriveComplete()
|
||||
}
|
||||
}()
|
||||
writeJSON(w, http.StatusOK, apiResponse{OK: true, Message: "Összes mentés elindítva"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user