fix(ui): scope spatial tools to scene
This commit is contained in:
@@ -1662,7 +1662,7 @@ def test_layout_routes_round_trip_versioned_document(tmp_path: Path) -> None:
|
||||
put_route = endpoint(router, "/api/v1/workspace-layouts/{workspace_id}", "PUT")
|
||||
get_route = endpoint(router, "/api/v1/workspace-layouts/{workspace_id}", "GET")
|
||||
request = LayoutPutRequest(
|
||||
version=1,
|
||||
version=2,
|
||||
revision=0,
|
||||
workspace_id="observation.spatial",
|
||||
scene_settings={
|
||||
@@ -1678,12 +1678,6 @@ def test_layout_routes_round_trip_versioned_document(tmp_path: Path) -> None:
|
||||
"show_labels": False,
|
||||
"show_camera_frustums": True,
|
||||
},
|
||||
tool_windows={
|
||||
"sources_open": True,
|
||||
"display_open": False,
|
||||
"layers_open": False,
|
||||
"order": ["sources", "display", "layers"],
|
||||
},
|
||||
visible_source_ids=["sensor.lidar.primary"],
|
||||
active_floating_source_id=None,
|
||||
window_rects={"sensor.camera.left": {"x": 0.65, "y": 0.65, "width": 0.3, "height": 0.3}},
|
||||
@@ -1706,13 +1700,12 @@ def test_layout_routes_round_trip_versioned_document(tmp_path: Path) -> None:
|
||||
"revision",
|
||||
"workspace_id",
|
||||
"scene_settings",
|
||||
"tool_windows",
|
||||
"visible_source_ids",
|
||||
"active_floating_source_id",
|
||||
"window_rects",
|
||||
"viewport_size",
|
||||
}
|
||||
assert loaded["version"] == 1
|
||||
assert loaded["version"] == 2
|
||||
assert loaded["workspace_id"] == "observation.spatial"
|
||||
assert loaded["revision"] == 1
|
||||
assert put_response.headers["etag"] == '"1"'
|
||||
@@ -1727,3 +1720,45 @@ def test_layout_routes_round_trip_versioned_document(tmp_path: Path) -> None:
|
||||
if_match='"0"',
|
||||
)
|
||||
assert conflict.value.status_code == 412
|
||||
|
||||
|
||||
def test_layout_get_migrates_legacy_tool_windows_out_of_the_contract(tmp_path: Path) -> None:
|
||||
store = SessionStore(tmp_path / "repo", data_dir=tmp_path / "data")
|
||||
store.save_layout(
|
||||
"observation.spatial",
|
||||
schema_version=1,
|
||||
expected_revision=0,
|
||||
name="Пространственная сцена",
|
||||
layout={
|
||||
"scene_settings": {
|
||||
"projection": "3d",
|
||||
"point_size": 3.0,
|
||||
"color_mode": "intensity",
|
||||
"palette": "turbo",
|
||||
"custom_color": "#35d7c1",
|
||||
"accumulation_seconds": 12,
|
||||
"show_points": True,
|
||||
"show_trajectory": True,
|
||||
"show_grid": True,
|
||||
"show_labels": False,
|
||||
"show_camera_frustums": True,
|
||||
},
|
||||
"tool_windows": {
|
||||
"sources_open": True,
|
||||
"display_open": True,
|
||||
"layers_open": True,
|
||||
"order": ["layers", "sources", "display"],
|
||||
},
|
||||
"visible_source_ids": [],
|
||||
"active_floating_source_id": None,
|
||||
"window_rects": {},
|
||||
"viewport_size": {"width": 1440, "height": 900},
|
||||
},
|
||||
)
|
||||
router = build_session_router(store)
|
||||
get_route = endpoint(router, "/api/v1/workspace-layouts/{workspace_id}", "GET")
|
||||
|
||||
loaded = get_route(workspace_id="observation.spatial", response=Response())
|
||||
|
||||
assert loaded["version"] == 2
|
||||
assert "tool_windows" not in loaded
|
||||
|
||||
Reference in New Issue
Block a user