1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Make x,y optional for creating links via API. Fixes #1630

This commit is contained in:
grossmj 2019-08-26 19:51:03 +07:00
parent 63c0bfe46e
commit 647dde1bb4
3 changed files with 7 additions and 27 deletions

View File

@ -248,11 +248,8 @@ class Link:
if label is None: if label is None:
label = { label = {
"x": -10,
"y": -10,
"rotation": 0,
"text": html.escape("{}/{}".format(adapter_number, port_number)), "text": html.escape("{}/{}".format(adapter_number, port_number)),
"style": "font-size: 10; font-style: Verdana" "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;"
} }
self._nodes.append({ self._nodes.append({

View File

@ -39,9 +39,7 @@ LABEL_OBJECT_SCHEMA = {
}, },
}, },
"required": [ "required": [
"text", "text"
"x",
"y"
], ],
"additionalProperties": False "additionalProperties": False
} }

View File

@ -78,11 +78,8 @@ def test_add_node(async_run, project, compute):
"adapter_number": 0, "adapter_number": 0,
"port_number": 4, "port_number": 4,
'label': { 'label': {
'y': -10,
'text': '0/4', 'text': '0/4',
'x': -10, 'style': 'font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;'
'rotation': 0,
'style': 'font-size: 10; font-style: Verdana'
} }
} }
] ]
@ -210,11 +207,8 @@ def test_json(async_run, project, compute, link):
"adapter_number": 0, "adapter_number": 0,
"port_number": 4, "port_number": 4,
'label': { 'label': {
'y': -10,
'text': '0/4', 'text': '0/4',
'x': -10, 'style': 'font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;'
'rotation': 0,
'style': 'font-size: 10; font-style: Verdana'
} }
}, },
{ {
@ -222,11 +216,8 @@ def test_json(async_run, project, compute, link):
"adapter_number": 1, "adapter_number": 1,
"port_number": 3, "port_number": 3,
'label': { 'label': {
'y': -10,
'text': '1/3', 'text': '1/3',
'x': -10, 'style': 'font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;'
'rotation': 0,
'style': 'font-size: 10; font-style: Verdana'
} }
} }
], ],
@ -246,11 +237,8 @@ def test_json(async_run, project, compute, link):
"adapter_number": 0, "adapter_number": 0,
"port_number": 4, "port_number": 4,
'label': { 'label': {
'y': -10,
'text': '0/4', 'text': '0/4',
'x': -10, 'style': 'font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;'
'rotation': 0,
'style': 'font-size: 10; font-style: Verdana'
} }
}, },
{ {
@ -258,11 +246,8 @@ def test_json(async_run, project, compute, link):
"adapter_number": 1, "adapter_number": 1,
"port_number": 3, "port_number": 3,
'label': { 'label': {
'y': -10,
'text': '1/3', 'text': '1/3',
'x': -10, 'style': 'font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;'
'rotation': 0,
'style': 'font-size: 10; font-style: Verdana'
} }
} }
], ],