diff --git a/src/dashboard/templates.py b/src/dashboard/templates.py
index 6ba230d..fe8e734 100644
--- a/src/dashboard/templates.py
+++ b/src/dashboard/templates.py
@@ -563,9 +563,9 @@ DASHBOARD_HTML = """
| ID |
Protocol |
- Station |
- Equipment |
- Data Type |
+ Station (Name & ID) |
+ Equipment (Name & ID) |
+ Data Type (Name & ID) |
Protocol Address |
Database Source |
Actions |
diff --git a/static/protocol_mapping.js b/static/protocol_mapping.js
index c1da8d1..bae8ee0 100644
--- a/static/protocol_mapping.js
+++ b/static/protocol_mapping.js
@@ -111,6 +111,11 @@ function selectProtocol(protocol) {
async function loadProtocolMappings() {
try {
+ // Ensure tag metadata is loaded first
+ if (tagMetadata.stations.length === 0 || tagMetadata.dataTypes.length === 0) {
+ await loadTagMetadata();
+ }
+
const params = new URLSearchParams();
if (currentProtocolFilter !== 'all') {
params.append('protocol_type', currentProtocolFilter);
@@ -140,13 +145,22 @@ function displayProtocolMappings(mappings) {
}
mappings.forEach(mapping => {
+ // Look up human-readable names from tag metadata
+ const station = tagMetadata.stations.find(s => s.id === mapping.station_id);
+ const equipment = tagMetadata.equipment.find(e => e.id === mapping.equipment_id);
+ const dataType = tagMetadata.dataTypes.find(dt => dt.id === mapping.data_type_id);
+
+ const stationDisplay = station ? `${station.name} (${station.id})` : (mapping.station_id || '-');
+ const equipmentDisplay = equipment ? `${equipment.name} (${equipment.id})` : (mapping.equipment_id || '-');
+ const dataTypeDisplay = dataType ? `${dataType.name} (${dataType.id})` : (mapping.data_type_id || '-');
+
const row = document.createElement('tr');
row.innerHTML = `
${mapping.id} |
${mapping.protocol_type} |
- ${mapping.station_id || '-'} |
- ${mapping.equipment_id || '-'} |
- ${mapping.data_type_id || '-'} |
+ ${stationDisplay} |
+ ${equipmentDisplay} |
+ ${dataTypeDisplay} |
${mapping.protocol_address} |
${mapping.db_source} |
|