mirror of
https://github.com/hansjone/netx.git
synced 2026-10-17 17:03:27 +08:00
Harden topology tree against bad view filters and allow deleting UME World.
Coerce non-dict filter JSON so /tree no longer 500s, surface API failure details, and let users remove the UME World container for local resets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
35a3980dc0
commit
961d523479
7 changed files with 89 additions and 30 deletions
|
|
@ -248,12 +248,32 @@ def api_fabric_discover_job(
|
|||
|
||||
@router.get("/tree")
|
||||
def api_topology_tree(db: Session = Depends(get_db)) -> dict[str, Any]:
|
||||
return get_topology_tree(db).model_dump()
|
||||
try:
|
||||
return get_topology_tree(db).model_dump(mode="json")
|
||||
except Exception as exc:
|
||||
import logging
|
||||
|
||||
logging.getLogger("netx.topology").exception("GET /v1/topology/tree failed")
|
||||
raise HTTPException(
|
||||
status_code=500,
|
||||
detail=f"topology_tree_failed:{type(exc).__name__}:{exc}",
|
||||
) from exc
|
||||
|
||||
|
||||
@router.post("/folders")
|
||||
def api_create_folder(body: TopologyFolderCreate, db: Session = Depends(get_db)) -> dict[str, Any]:
|
||||
return create_folder(db, body).model_dump()
|
||||
try:
|
||||
return create_folder(db, body).model_dump(mode="json")
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as exc:
|
||||
import logging
|
||||
|
||||
logging.getLogger("netx.topology").exception("POST /v1/topology/folders failed")
|
||||
raise HTTPException(
|
||||
status_code=500,
|
||||
detail=f"topology_folder_create_failed:{type(exc).__name__}:{exc}",
|
||||
) from exc
|
||||
|
||||
|
||||
@router.patch("/folders/{folder_id}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue