changes to the status displayment
This commit is contained in:
+20
-12
@@ -3470,6 +3470,7 @@ def booking_payment():
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"slug": subdomain,
|
||||
"request_id": prov_id,
|
||||
"message": "Instanz wird eingerichtet...",
|
||||
"estimated_seconds": 45,
|
||||
"status_poll_interval_ms": 3000
|
||||
@@ -4402,7 +4403,10 @@ def tenant_status():
|
||||
try:
|
||||
query = {}
|
||||
if req_id:
|
||||
query["_id"] = ObjectId(req_id)
|
||||
try:
|
||||
query["_id"] = ObjectId(req_id)
|
||||
except Exception:
|
||||
return jsonify({"status": "error", "message": "Invalid request_id"}), 400
|
||||
elif slug:
|
||||
query["tenant_slug"] = slug
|
||||
else:
|
||||
@@ -4436,21 +4440,25 @@ def tenant_status():
|
||||
if not instance:
|
||||
return jsonify({"status": "pending"}), 200
|
||||
|
||||
# Perform health check on newly provisioned container endpoint
|
||||
target_url = f"https://{instance['domain']}/health"
|
||||
# The watcher may need a few seconds to expose the proxy endpoint. The
|
||||
# database state is the authoritative provisioning result; do not leave
|
||||
# the checkout waiting forever because of a transient TLS/DNS healthcheck.
|
||||
instance_domain = instance.get("domain") or (
|
||||
f"{prov_req.get('tenant_slug', '')}.{INSTANCE_PARENT_DOMAIN}"
|
||||
)
|
||||
target_url = f"https://{instance_domain}/health"
|
||||
try:
|
||||
res = requests.get(target_url, timeout=3, verify=False)
|
||||
if res.status_code == 200:
|
||||
return jsonify({
|
||||
"status": "ready",
|
||||
"url": f"https://{instance['domain']}",
|
||||
"username": instance.get("admin_username", "admin"),
|
||||
"password": instance.get("admin_password")
|
||||
}), 200
|
||||
except requests.RequestException:
|
||||
pass
|
||||
res = None
|
||||
|
||||
return jsonify({"status": "pending"}), 200
|
||||
return jsonify({
|
||||
"status": "ready",
|
||||
"url": f"https://{instance_domain}",
|
||||
"username": instance.get("admin_username", "admin"),
|
||||
"password": instance.get("admin_password"),
|
||||
"health_check": "ok" if res is not None and res.status_code == 200 else "pending",
|
||||
}), 200
|
||||
|
||||
@app.route('/admin/instances/cancel/<instance_id>', methods=['POST'])
|
||||
@login_required
|
||||
|
||||
@@ -589,7 +589,7 @@
|
||||
loadingState.style.display = 'block';
|
||||
|
||||
// Startet den fixierten 90 Sekunden Prozess
|
||||
startProvisioningProcess(tenantSlug);
|
||||
startProvisioningProcess(result.slug || tenantSlug, result.request_id);
|
||||
|
||||
} catch (error) {
|
||||
errorAlert.textContent = error.message;
|
||||
@@ -599,7 +599,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
function startProvisioningProcess(slug) {
|
||||
function startProvisioningProcess(slug, requestId) {
|
||||
const totalDurationMs = 90 * 1000; // Exakt 1:30 Minuten (90 Sekunden)
|
||||
let startTime = Date.now();
|
||||
let backendData = null; // Speichert das finale Backend-Resultat
|
||||
@@ -621,7 +621,10 @@
|
||||
const checkBackend = async () => {
|
||||
if (isFailed) return;
|
||||
try {
|
||||
const res = await fetch(`/instance_request/status?slug=${slug}`);
|
||||
const statusQuery = requestId
|
||||
? `request_id=${encodeURIComponent(requestId)}`
|
||||
: `slug=${encodeURIComponent(slug)}`;
|
||||
const res = await fetch(`/instance_request/status?${statusQuery}`);
|
||||
const data = await res.json();
|
||||
|
||||
// Wenn Backend fertig ist, Daten merken, aber Timer weiterlaufen lassen!
|
||||
|
||||
Reference in New Issue
Block a user