diff --git a/site/routes/api_test.py b/site/routes/api_test.py index a6575c2..d21603c 100644 --- a/site/routes/api_test.py +++ b/site/routes/api_test.py @@ -222,6 +222,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_ # Обновляем stages по мере появления _op_results[op_uid] = { "status": "RUNNING", + "displayName": display_name, "stages": op.get("stages", []), "duration": round(time.time() - t0, 1), } @@ -234,6 +235,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_ tracker_remove(instance_uid) _op_results[op_uid] = { "status": "OK" if is_ok else "FAIL", + "displayName": display_name, "error": str(err) if err else "", "stages": op.get("stages", []), "duration": round(time.time() - t0, 1), @@ -244,7 +246,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_ import traceback print(f"[ERROR] _finish_op crashed: {traceback.format_exc()}", flush=True) time.sleep(5) - _op_results[op_uid] = {"status": "TIMEOUT", "duration": round(time.time() - t0, 1)} + _op_results[op_uid] = {"status": "TIMEOUT", "displayName": display_name, "duration": round(time.time() - t0, 1)} @bp.route("/api/test/status/") @@ -262,6 +264,7 @@ def api_test_status(op_uid): return jsonify({ "status": "OK" if (done and op.get("isSuccessful")) else ("FAIL" if done else "RUNNING"), "done": done, + "displayName": op.get("displayName"), "isSuccessful": op.get("isSuccessful"), "isInProgress": op.get("isInProgress"), "duration": op.get("duration"), diff --git a/site/templates/index.html b/site/templates/index.html index 5cff956..4952b4e 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -297,7 +297,7 @@ async function executeOp(params){ showStages(sd.stages||[]); if(sd.status!=='RUNNING'){ stopPoll(); - setFinishedState(sd.status, sd.status==='OK'?'badge-success':'badge', sd.error, sd.duration, instanceName); + setFinishedState(sd.status, sd.status==='OK'?'badge-success':'badge', sd.error||sd.errorLog, sd.duration, sd.displayName||instanceName); if(sd.status==='OK'){ await refreshInstances(); }