Enhancement Added link type support on the server side

This commit is contained in:
Cristi 2026-03-17 15:29:58 +02:00
parent cb18b60c5d
commit de1b539fb6
2 changed files with 40 additions and 0 deletions

View File

@ -47,6 +47,9 @@ class LinkStyle(BaseModel):
color: Optional[str] = None
width: Optional[int] = None
type: Optional[int] = None
link_type: Optional[str] = None
bezier_curviness: Optional[int] = None
flowchart_roundness: Optional[int] = None
class LinkBase(BaseModel):

View File

@ -381,3 +381,40 @@ async def test_available_filters(project, compute):
node2._ports = [EthernetPort("E0", 0, 0, 4)]
await link.add_node(node2, 0, 4)
assert len(link.available_filters()) > 0
@pytest.mark.asyncio
async def test_update_link_style(project, compute):
node1 = Node(project, compute, "node1", node_type="qemu")
node1._ports = [EthernetPort("E0", 0, 0, 4)]
node2 = Node(project, compute, "node2", node_type="qemu")
node2._ports = [EthernetPort("E0", 0, 1, 3)]
link = Link(project)
link.create = AsyncioMagicMock()
link._project.emit_notification = MagicMock()
project.dump = MagicMock()
await link.add_node(node1, 0, 4)
await link.add_node(node2, 1, 3)
await link.update_link_style({
"color": "#00ff00",
"width": 3,
"type": 1,
"link_type": "flowchart",
"bezier_curviness": 150,
"flowchart_roundness": 20,
})
assert link.asdict()["link_style"] == {
"color": "#00ff00",
"width": 3,
"type": 1,
"link_type": "flowchart",
"bezier_curviness": 150,
"flowchart_roundness": 20,
}
link._project.emit_notification.assert_called_with("link.updated", link.asdict())
assert project.dump.called