Return scada properties from API getelementproperties
This commit is contained in:
3
main.py
3
main.py
@@ -519,11 +519,12 @@ async def fast_get_node_properties(network: str, node: str) -> dict[str, Any]:
|
||||
async def fast_get_link_properties(network: str, link: str) -> dict[str, Any]:
|
||||
return get_link_properties(network, link)
|
||||
|
||||
# type can be 'node' or 'link'
|
||||
# type can be 'node' or 'link' or 'scada'
|
||||
@app.get('/getelementpropertieswithtype/')
|
||||
async def fast_get_element_properties_with_type(network: str, type: str, element: str) -> dict[str, Any]:
|
||||
return get_element_properties(network, type, element)
|
||||
|
||||
# type can be 'node' or 'link' or 'scada'
|
||||
@app.get('/getelementproperties/')
|
||||
async def fast_get_element_properties(network: str, element: str) -> dict[str, Any]:
|
||||
return get_element_properties(network, element)
|
||||
|
||||
@@ -432,14 +432,15 @@ def get_element_properties(name: str, type: str, element_id: str) -> dict[str, A
|
||||
return {}
|
||||
|
||||
# DingZQ, 2025-02-05
|
||||
# element_id can be 'node' 'link' 'scada'
|
||||
def get_element_properties(name: str, element_id: str) -> dict[str, Any]:
|
||||
if api.is_node(name, element_id):
|
||||
return get_node_properties(name, element_id)
|
||||
elif api.is_link(name, element_id):
|
||||
return get_link_properties(name, element_id)
|
||||
else:
|
||||
return {}
|
||||
|
||||
return get_scada_element(name, element_id)
|
||||
|
||||
############################################################
|
||||
# title 1.[TITLE]
|
||||
############################################################
|
||||
|
||||
Reference in New Issue
Block a user