diff --git a/controller/internal/setup/handlers.go b/controller/internal/setup/handlers.go index a8af0fe..b4cb32e 100644 --- a/controller/internal/setup/handlers.go +++ b/controller/internal/setup/handlers.go @@ -386,21 +386,17 @@ func (s *Server) autoProcessHubRestore(w http.ResponseWriter, r *http.Request, c s.state.SetFormField("hub_infra_backup", string(ibJSON)) s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp } - s.state.SetStep("restore-confirm") + s.state.SetStep("restore-exec") s.state.Save() - // Show confirmation page with backup details + s.logger.Printf("[INFO] Setup: hub recovery received (hasInfra=%v) — starting restore", recovery.HasInfraBackup) + + // Start the restore goroutine, then render the progress page + go s.executeHubRestore() + csrf := ensureCSRFToken(w, r) data := map[string]interface{}{ - "CSRF": csrf, - "CustomerID": customerID, - "HasInfraBackup": recovery.HasInfraBackup, - "HasConfig": recovery.ConfigYAML != "", - "Source": "hub", - } - if recovery.HasInfraBackup && recovery.InfraBackup != nil { - data["Timestamp"] = recovery.InfraBackup.Timestamp - data["StackCount"] = len(recovery.InfraBackup.DeployedStacks) + "CSRF": csrf, } s.render(w, "setup_restore_exec", data) } @@ -495,21 +491,17 @@ func (s *Server) processHubRestore(w http.ResponseWriter, r *http.Request) { s.state.SetFormField("hub_infra_backup", string(ibJSON)) s.state.SelectedBackup.Timestamp = recovery.InfraBackup.Timestamp } - s.state.SetStep("restore-confirm") + s.state.SetStep("restore-exec") s.state.Save() - // Show confirmation page with backup details + s.logger.Printf("[INFO] Setup: hub recovery received (hasInfra=%v) — starting restore", recovery.HasInfraBackup) + + // Start the restore goroutine, then render the progress page + go s.executeHubRestore() + csrf := ensureCSRFToken(w, r) data := map[string]interface{}{ - "CSRF": csrf, - "CustomerID": customerID, - "HasInfraBackup": recovery.HasInfraBackup, - "HasConfig": recovery.ConfigYAML != "", - "Source": "hub", - } - if recovery.HasInfraBackup && recovery.InfraBackup != nil { - data["Timestamp"] = recovery.InfraBackup.Timestamp - data["StackCount"] = len(recovery.InfraBackup.DeployedStacks) + "CSRF": csrf, } s.render(w, "setup_restore_exec", data) }