Expand lab seed tiers, OpenAPI PARAMS, and console DATA/Params UX.

This commit is contained in:
2026-07-18 08:46:39 +03:00
parent f8d3cbdd59
commit 63cc409424
71 changed files with 38380 additions and 796 deletions
+23 -9
View File
@@ -72,6 +72,15 @@ async def list_tasks(database: Database) -> list[dict[str, Any]]:
return [_row(row) for row in rows]
def _localizable(message: str, *, message_id: str = "com.vmware.cis.task.description") -> dict[str, Any]:
return {
"id": message_id,
"default_message": message,
"args": [],
"localized": message,
}
def _row(row: Any) -> dict[str, Any]:
result = row["result"]
error = row["error"]
@@ -80,20 +89,25 @@ def _row(row: Any) -> dict[str, Any]:
if isinstance(error, str):
error = json.loads(error)
status = row["status"]
state = {
"PENDING": "PENDING",
"RUNNING": "RUNNING",
"SUCCEEDED": "SUCCEEDED",
"FAILED": "FAILED",
}.get(status, status)
completed = 100 if status in {"SUCCEEDED", "FAILED"} else 50
description_text = row["description"] or row["operation"] or "task"
# Cis Task Info wire shape (Automation) plus lab-friendly aliases used by cookbooks.
return {
"task": row["id"],
"description": row["description"],
"description": _localizable(description_text),
"status": status,
"state": state,
"state": status,
"service": row["service"],
"operation": row["operation"],
"progress": 100 if status in {"SUCCEEDED", "FAILED"} else 50,
"cancelable": False,
"progress": {
"total": 100,
"completed": completed,
"message": _localizable(
f"{completed}%",
message_id="com.vmware.cis.task.progress",
),
},
"result": result,
"error": error,
"start_time": row["created_at"].isoformat() if row["created_at"] else None,