Skip to content
Snippets Groups Projects
Commit a3abb6d4 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

WebUI component:

- Minor style fixing
parent 8a29bd6a
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!196Resolve "(CTTC) Incorrect endpoint lookup in NBI ETSI BWM plugin"
......@@ -45,13 +45,14 @@ def json_to_list(json_str : str) -> List[Union[str, Tuple[str, str]]]:
data = json.loads(json_str)
except: # pylint: disable=bare-except
return [('item', str(json_str))]
if isinstance(data, dict):
return [('kv', (key, value)) for key, value in data.items()]
elif isinstance(data, list) and len(data) == 1 and isinstance(data[0], dict): # BWM use-case
return [('kv', (key, value)) for key, value in data[0].items()]
elif isinstance(data, list) and all(isinstance(d, str) for d in data):
return [('item', ', '.join(data))]
elif isinstance(data, list):
if len(data) == 1 and isinstance(data[0], dict):
return [('kv', (key, value)) for key, value in data[0].items()]
else:
return [('item', ', '.join([str(d) for d in data]))]
else:
return [('item', str(data))]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment