Show only the worker name as the peer location

This commit is contained in:
Eduardo Silva
2026-11-23 17:37:23 -03:00
parent 9ccb8c58df
commit a5905e8ecb
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -358,7 +358,7 @@ def func_concatenate_cluster_wireguard_status_cache() -> None:
.first() .first()
) )
if master_cache and isinstance(master_cache.data, dict): if master_cache and isinstance(master_cache.data, dict):
cache_entries.append({"source_name": "master", "source_uuid": "", "data": master_cache.data,}) cache_entries.append({"source_name": "master", "source_label": "", "source_uuid": "", "data": master_cache.data,})
worker_statuses = (WorkerStatus.objects.filter( worker_statuses = (WorkerStatus.objects.filter(
worker__enabled=True, wireguard_status_updated__gt=timezone.now() - timedelta(minutes=10) worker__enabled=True, wireguard_status_updated__gt=timezone.now() - timedelta(minutes=10)
@@ -368,6 +368,7 @@ def func_concatenate_cluster_wireguard_status_cache() -> None:
cache_entries.append( cache_entries.append(
{ {
"source_name": f"worker_{ws.worker.name}", "source_name": f"worker_{ws.worker.name}",
"source_label": ws.worker.name,
"source_uuid": str(ws.worker.uuid), "source_uuid": str(ws.worker.uuid),
"data": ws.wireguard_status or {}, "data": ws.wireguard_status or {},
} }
@@ -375,6 +376,7 @@ def func_concatenate_cluster_wireguard_status_cache() -> None:
for entry in cache_entries: for entry in cache_entries:
source_name = entry["source_name"] source_name = entry["source_name"]
source_label = entry["source_label"]
source_uuid = entry["source_uuid"] source_uuid = entry["source_uuid"]
data = entry.get("data") or {} data = entry.get("data") or {}
@@ -393,6 +395,7 @@ def func_concatenate_cluster_wireguard_status_cache() -> None:
peer_info_copy = dict(peer_info) peer_info_copy = dict(peer_info)
peer_info_copy["source_name"] = source_name peer_info_copy["source_name"] = source_name
peer_info_copy["source_label"] = source_label
peer_info_copy["source_uuid"] = source_uuid peer_info_copy["source_uuid"] = source_uuid
if peer_key not in combined_data[interface]: if peer_key not in combined_data[interface]:
@@ -141,7 +141,7 @@
const getPeerLocationLabel = (peerInfo) => { const getPeerLocationLabel = (peerInfo) => {
if (peerInfo && peerInfo.source_uuid && String(peerInfo.source_uuid).trim() !== '') { if (peerInfo && peerInfo.source_uuid && String(peerInfo.source_uuid).trim() !== '') {
return peerInfo.source_name || ''; return peerInfo.source_label || peerInfo.source_name || '';
} }
return "{% trans 'Primary Server' %}"; return "{% trans 'Primary Server' %}";
}; };