mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
Stop applying UME inventory totals to empty manual root maps.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
104de449cf
commit
1373eff4ab
2 changed files with 8 additions and 23 deletions
|
|
@ -747,30 +747,15 @@ def get_topology_tree(db: Session) -> TopologyTreeOut:
|
||||||
pid = str(f.parent_id or "")
|
pid = str(f.parent_id or "")
|
||||||
by_parent.setdefault(pid, []).append(f)
|
by_parent.setdefault(pid, []).append(f)
|
||||||
|
|
||||||
root_id = str(root.id) if root is not None else ""
|
|
||||||
|
|
||||||
def _is_manual_root_map(folder: TopoFolder) -> bool:
|
|
||||||
ext = str(getattr(folder, "external_ref", None) or "").strip()
|
|
||||||
if ext:
|
|
||||||
return False
|
|
||||||
if not bool(folder.is_system):
|
|
||||||
return False
|
|
||||||
return is_manual_root_map_name(folder.name)
|
|
||||||
|
|
||||||
def _is_whole_network_folder(folder: TopoFolder) -> bool:
|
def _is_whole_network_folder(folder: TopoFolder) -> bool:
|
||||||
"""根 / 根图 / UME World / World — same inventory, different presentation."""
|
"""UME World / World / 世界地图 — same UME inventory, different presentation.
|
||||||
|
|
||||||
|
Manual「根」/「根图」are separate canvases and must use their own subtree counts
|
||||||
|
(empty root map → 0N), never the UME thousands.
|
||||||
|
"""
|
||||||
from .ume_topology_world import is_ume_world_container, is_world_drill_folder
|
from .ume_topology_world import is_ume_world_container, is_world_drill_folder
|
||||||
|
|
||||||
if is_ume_world_container(folder) or is_world_drill_folder(folder):
|
return is_ume_world_container(folder) or is_world_drill_folder(folder)
|
||||||
return True
|
|
||||||
ext = str(getattr(folder, "external_ref", None) or "").strip()
|
|
||||||
if ext.startswith("ume:"):
|
|
||||||
return False
|
|
||||||
parent = str(folder.parent_id or "").strip()
|
|
||||||
# Top-level manual「根」(nav-only under system root).
|
|
||||||
if root_id and parent == root_id and not ext:
|
|
||||||
return True
|
|
||||||
return _is_manual_root_map(folder)
|
|
||||||
|
|
||||||
def _subtree_inventory(folder_id: str) -> int:
|
def _subtree_inventory(folder_id: str) -> int:
|
||||||
"""Directory semantics: NEs owned by this folder + all descendant folders."""
|
"""Directory semantics: NEs owned by this folder + all descendant folders."""
|
||||||
|
|
|
||||||
|
|
@ -315,8 +315,8 @@ function primaryTreeView(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory NE badge from API: fabric inventory under the folder.
|
* Directory NE badge from API: fabric inventory under the folder.
|
||||||
* 根 / 根图 / UME World / World share the same whole-network total; nested regions
|
* UME World / World / 世界地图 share the UME total; manual 根/根图 use their own
|
||||||
* sum owned NEs in their subtree. Region folders themselves never count as NEs.
|
* subtree (empty → 0). Region folders themselves never count as NEs.
|
||||||
*/
|
*/
|
||||||
function folderNeCount(folder: TopologyTreeFolderItem | null | undefined): number {
|
function folderNeCount(folder: TopologyTreeFolderItem | null | undefined): number {
|
||||||
if (!folder) return 0;
|
if (!folder) return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue