v1.0.75: keep displayName in operation status
This commit is contained in:
@@ -222,6 +222,7 @@ def _finish_op(client, op_uid, instance_uid, svc_id, display_name, op_name, svc_
|
|||||||
# Обновляем stages по мере появления
|
# Обновляем stages по мере появления
|
||||||
_op_results[op_uid] = {
|
_op_results[op_uid] = {
|
||||||
"status": "RUNNING",
|
"status": "RUNNING",
|
||||||
|
"displayName": display_name,
|
||||||
"stages": op.get("stages", []),
|
"stages": op.get("stages", []),
|
||||||
"duration": round(time.time() - t0, 1),
|
"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)
|
tracker_remove(instance_uid)
|
||||||
_op_results[op_uid] = {
|
_op_results[op_uid] = {
|
||||||
"status": "OK" if is_ok else "FAIL",
|
"status": "OK" if is_ok else "FAIL",
|
||||||
|
"displayName": display_name,
|
||||||
"error": str(err) if err else "",
|
"error": str(err) if err else "",
|
||||||
"stages": op.get("stages", []),
|
"stages": op.get("stages", []),
|
||||||
"duration": round(time.time() - t0, 1),
|
"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
|
import traceback
|
||||||
print(f"[ERROR] _finish_op crashed: {traceback.format_exc()}", flush=True)
|
print(f"[ERROR] _finish_op crashed: {traceback.format_exc()}", flush=True)
|
||||||
time.sleep(5)
|
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/<op_uid>")
|
@bp.route("/api/test/status/<op_uid>")
|
||||||
@@ -262,6 +264,7 @@ def api_test_status(op_uid):
|
|||||||
return jsonify({
|
return jsonify({
|
||||||
"status": "OK" if (done and op.get("isSuccessful")) else ("FAIL" if done else "RUNNING"),
|
"status": "OK" if (done and op.get("isSuccessful")) else ("FAIL" if done else "RUNNING"),
|
||||||
"done": done,
|
"done": done,
|
||||||
|
"displayName": op.get("displayName"),
|
||||||
"isSuccessful": op.get("isSuccessful"),
|
"isSuccessful": op.get("isSuccessful"),
|
||||||
"isInProgress": op.get("isInProgress"),
|
"isInProgress": op.get("isInProgress"),
|
||||||
"duration": op.get("duration"),
|
"duration": op.get("duration"),
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ async function executeOp(params){
|
|||||||
showStages(sd.stages||[]);
|
showStages(sd.stages||[]);
|
||||||
if(sd.status!=='RUNNING'){
|
if(sd.status!=='RUNNING'){
|
||||||
stopPoll();
|
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'){
|
if(sd.status==='OK'){
|
||||||
await refreshInstances();
|
await refreshInstances();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user