Clicking on an aircraft message now leads to the map.

This commit is contained in:
Marat Fayzullin 2023-09-16 17:16:23 -04:00
parent b4eb71f296
commit d4207a2848
2 changed files with 16 additions and 5 deletions

View File

@ -57,9 +57,15 @@ MessagePanel.prototype.scrollToBottom = function() {
};
MessagePanel.prototype.linkToMap = function(id, contents = null, attrs = "") {
return '<a ' + attrs + ' href="map?callsign='
+ encodeURIComponent(id) + '" target="openwebrx-map">'
+ (contents!=null? contents : id) + '</a>';
if (id) {
return '<a ' + attrs + ' href="map?callsign='
+ encodeURIComponent(id) + '" target="openwebrx-map">'
+ (contents!=null? contents : id) + '</a>';
} else if (contents != null) {
return '<div ' + attrs + '>' + contents + '</div>';
} else {
return '';
}
};
function WsjtMessagePanel(el) {
@ -415,8 +421,11 @@ HfdlMessagePanel.prototype.pushMessage = function(msg) {
if (msg.origin) data += ' &lsh;' + msg.origin;
if (msg.destination) data += ' &rdsh;' + 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');

View File

@ -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: