Add api getelementproperties without type
This commit is contained in:
10
main.py
10
main.py
@@ -382,7 +382,7 @@ async def fastapi_is_pipe(network: str, link: str) -> bool:
|
||||
|
||||
@app.get('/ispump/')
|
||||
async def fastapi_is_pump(network: str, link: str) -> bool:
|
||||
return is_pump(network, link)
|
||||
return is_pump(network, lin)
|
||||
|
||||
@app.get('/isvalve/')
|
||||
async def fastapi_is_valve(network: str, link: str) -> bool:
|
||||
@@ -447,10 +447,14 @@ 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'
|
||||
@app.get('/getelementproperties/')
|
||||
async def fast_get_element_properties(network: str, type: str, element: str) -> dict[str, Any]:
|
||||
@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)
|
||||
|
||||
@app.get('/getelementproperties/')
|
||||
async def fast_get_element_properties(network: str, element: str) -> dict[str, Any]:
|
||||
return get_element_properties(network, element)
|
||||
|
||||
############################################################
|
||||
# title 1.[TITLE]
|
||||
############################################################
|
||||
|
||||
@@ -430,6 +430,15 @@ def get_element_properties(name: str, type: str, element_id: str) -> dict[str, A
|
||||
return get_link_properties(name, element_id)
|
||||
else:
|
||||
return {}
|
||||
|
||||
# DingZQ, 2025-02-05
|
||||
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 {}
|
||||
|
||||
############################################################
|
||||
# title 1.[TITLE]
|
||||
|
||||
Reference in New Issue
Block a user