Update secure-gateway-setup.tsx

This commit is contained in:
MacRimi
2026-03-14 23:09:46 +01:00
parent 9d706d3aa3
commit a7b06bd5fc

View File

@@ -192,17 +192,27 @@ export function SecureGatewaySetup() {
} }
} }
// Simulate progress while API call runs
const progressInterval = setInterval(() => {
setDeployPercent(prev => {
if (prev < 85) {
// Update messages based on progress
if (prev < 20) {
setDeployProgress("Creating LXC container...") setDeployProgress("Creating LXC container...")
setDeployPercent(20) } else if (prev < 40) {
setDeployProgress("Downloading Alpine Linux template...")
// Small delay to show progress } else if (prev < 55) {
await new Promise(resolve => setTimeout(resolve, 500))
setDeployProgress("Downloading Tailscale image...")
setDeployPercent(35)
await new Promise(resolve => setTimeout(resolve, 300))
setDeployProgress("Configuring container...") setDeployProgress("Configuring container...")
setDeployPercent(50) } else if (prev < 70) {
setDeployProgress("Installing Tailscale...")
} else {
setDeployProgress("Connecting to Tailscale network...")
}
return prev + 3
}
return prev
})
}, 400)
const result = await fetchApi("/api/oci/deploy", { const result = await fetchApi("/api/oci/deploy", {
method: "POST", method: "POST",
@@ -212,12 +222,7 @@ export function SecureGatewaySetup() {
}) })
}) })
setDeployProgress("Installing Tailscale...") clearInterval(progressInterval)
setDeployPercent(70)
await new Promise(resolve => setTimeout(resolve, 300))
setDeployProgress("Connecting to Tailscale network...")
setDeployPercent(85)
if (!result.success) { if (!result.success) {
setDeployError(result.message || "Failed to deploy gateway") setDeployError(result.message || "Failed to deploy gateway")