Optimize peer tracking table counts API and UI

Enhanced the /api/getPeerTrackingTableCounts endpoint to support returning counts for all configurations when no name is provided. Updated frontend components to fetch all tracking data in a single request, improving efficiency and user experience. Bumped dashboard version to 4.3.2.
This commit is contained in:
Donald Zou
2025-12-19 07:04:07 +08:00
parent b1d7199e84
commit 40e2dddc00
5 changed files with 43 additions and 15 deletions

View File

@@ -1109,13 +1109,24 @@ def API_GetPeerTraffics():
@app.get(f'{APP_PREFIX}/api/getPeerTrackingTableCounts')
def API_GetPeerTrackingTableCounts():
configurationName = request.args.get("configurationName")
if configurationName not in WireguardConfigurations.keys():
if configurationName and configurationName not in WireguardConfigurations.keys():
return ResponseObject(False, "Configuration does not exist")
c = WireguardConfigurations.get(configurationName)
return ResponseObject(data={
"TrafficTrackingTableSize": c.getTransferTableSize(),
"HistoricalTrackingTableSize": c.getHistoricalEndpointTableSize()
})
if configurationName:
c = WireguardConfigurations.get(configurationName)
return ResponseObject(data={
"TrafficTrackingTableSize": c.getTransferTableSize(),
"HistoricalTrackingTableSize": c.getHistoricalEndpointTableSize()
})
d = {}
for i in WireguardConfigurations.keys():
c = WireguardConfigurations.get(i)
d[i] = {
"TrafficTrackingTableSize": c.getTransferTableSize(),
"HistoricalTrackingTableSize": c.getHistoricalEndpointTableSize()
}
return ResponseObject(data=d)
@app.get(f'{APP_PREFIX}/api/downloadPeerTrackingTable')
def API_DownloadPeerTackingTable():