diff --git a/htdocs/lib/MessagePanel.js b/htdocs/lib/MessagePanel.js
index 6cee4e71..f570ba15 100644
--- a/htdocs/lib/MessagePanel.js
+++ b/htdocs/lib/MessagePanel.js
@@ -57,9 +57,15 @@ MessagePanel.prototype.scrollToBottom = function() {
};
MessagePanel.prototype.linkToMap = function(id, contents = null, attrs = "") {
- return ''
- + (contents!=null? contents : id) + '';
+ if (id) {
+ return ''
+ + (contents!=null? contents : id) + '';
+ } else if (contents != null) {
+ return '
' + contents + '
';
+ } else {
+ return '';
+ }
};
function WsjtMessagePanel(el) {
@@ -415,8 +421,11 @@ HfdlMessagePanel.prototype.pushMessage = function(msg) {
if (msg.origin) data += ' ↰' + msg.origin;
if (msg.destination) data += ' ↳' + msg.destination;
- // If no data so far, use message type as data
- if (msg.type && !data.length) data = msg.type;
+ // If no location data in the message, use message type as data
+ if (!data.length && msg.type) data = msg.type;
+
+ // Make data point to the map
+ if (data.length && msg.mapid) data = this.linkToMap(msg.mapid, data);
// Append report
var $b = $(this.el).find('tbody');
diff --git a/owrx/aircraft.py b/owrx/aircraft.py
index a5884d74..bd13463f 100644
--- a/owrx/aircraft.py
+++ b/owrx/aircraft.py
@@ -161,6 +161,8 @@ class AircraftManager(object):
if "lat" in item and "lon" in item and "mode" in item:
loc = AircraftLocation(item)
Map.getSharedInstance().updateLocation(id, loc, item["mode"])
+ # Can later use this for linking to the map
+ data["mapid"] = id
# Update input data with computed data
for key in ["icao", "aircraft", "flight", "course"]:
if key in item: