Repository navigation
fix(utils): keep resource rows without a parent in the tree #1479 - #1481
Open
borealisalastor-byte wants to merge 1 commit into
Open
borealisalastor-byte wants to merge 1 commit into
borealisalastor-byte wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
apps/dashboard/crud/dashboard_service.py::list_resource用build_tree_generic(nodes, root_pid="root")组装看板列表,而build_tree_generic只把pid == root_pid的行当作根节点。BaseDashboard.pid的默认值是空字符串,get_create_base_info直接CoreDashboard(**dashboard.model_dump())落库;历史数据里也可能有pid为 NULL 的行。这些行的pid既不等于"root"也不在node_dict中,于是从列表中消失(接口 200,但看不到自己创建的看板)。同一函数里,
pid指向自身的行会被追加为自己的子节点,递归序列化该结果会一直展开下去。改动
common/utils/tree_utils.py:pid(""/None)与root_pid同等视为根节点;验证(
cd backend后执行)pytest -q tests/test_resource_tree_roots.py→ 修复前 2 failed / 2 passed,修复后 4 passedpid为"root"/""/None均为根;三级父子挂载正确;自引用行可见且无子节点;未知父节点的行仍不进入树pytest -q tests --continue-on-collection-errors→ 无新增失败;本机唯一失败仍是test_model_discovery.py::test_real_route_permission_and_safe_error(缺少sqlbot_xpack,环境限制)Fixes #1479