Alerts now displays a "Type" in the table not just the source. Closes #142

This commit is contained in:
Ian Renton
2026-09-11 14:43:33 +01:00
parent 8f8ff46426
commit 04f5df5260
11 changed files with 63 additions and 32 deletions
+8 -1
View File
@@ -22,11 +22,18 @@ class Hamsat(HTTPAlertProvider):
# Iterate through source data
for source_alert in http_response.json()["data"]:
# Convert to our alert format
freqs_modes = source_alert.get("mode", "")
if "mhz" in source_alert:
if "mhz_direction" in source_alert:
freqs_modes = f"{source_alert['mhz']!s} {source_alert['mhz_direction']}, {freqs_modes}"
else:
freqs_modes = f"{source_alert['mhz']!s}, {freqs_modes}"
alert = Alert(
source=self.name,
source_id=source_alert["id"],
dx_calls=[source_alert["callsign"].upper()],
freqs_modes=f"{source_alert['mhz']!s} {source_alert['mhz_direction']}, {source_alert['mode']}",
freqs_modes=freqs_modes,
comment=source_alert["comment"],
# Fudge a SIG ref to provide the remaining bits of data we need: the satellite and the operator's grid
sig_refs=[
+37 -13
View File
@@ -54,7 +54,7 @@ function updateTable() {
const showDX = $("#tableShowDX")[0].checked;
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
const showComment = $("#tableShowComment")[0].checked;
const showSource = $("#tableShowSource")[0].checked;
const showType = $("#tableShowType")[0].checked;
const showRef = $("#tableShowRef")[0].checked;
// Populate table with headers
@@ -75,8 +75,8 @@ function updateTable() {
if (showComment) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Comment</th>`);
}
if (showSource) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Source</th>`);
if (showType) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Type</th>`);
}
if (showRef) {
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Ref.</th>`);
@@ -151,7 +151,7 @@ function addAlertRowsToTable(tbody, alerts) {
const showDX = $("#tableShowDX")[0].checked;
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
const showComment = $("#tableShowComment")[0].checked;
const showSource = $("#tableShowSource")[0].checked;
const showType = $("#tableShowType")[0].checked;
const showRef = $("#tableShowRef")[0].checked;
// Get times for the alert, and convert to local time if necessary.
@@ -232,14 +232,38 @@ function addAlertRowsToTable(tbody, alerts) {
if (a["comment"] != null) {
commentText = escapeHtml(a["comment"]);
}
if (a["url"] != null) {
commentText += ` <a href="${escapeHtml(a['url'])}" target="_new" style="text-decoration: none">🔗</a>`;
// Format extra text, like URL and attribution
let subComment = a["url"] != null || a["source"] === "NG3K" || a["source"] === "WA7BNM Contest Calendar";
if (subComment) {
let subCommentText = ""
if (a["url"] != null) {
subCommentText += `<a href="${escapeHtml(a['url'])}" target="_new" style="text-decoration: none">More info</a>`;
}
if ((a["source"] === "NG3K" || a["source"] === "WA7BNM Contest Calendar")) {
if (subCommentText !== "") {
subCommentText += " | ";
}
subCommentText += `From ${a["source"]}`;
}
commentText += `<div class="mt-2 small text-secondary">${subCommentText}</div>`;
}
// Sig or fallback to source
let sigSourceText = a["source"];
if (a["sig"]) {
sigSourceText = a["sig"];
// Type, SIG or fallback to source
let sigTypeText = a["source"];
if (a["alert_type"] === "CONTEST") {
sigTypeText = "Contest";
} else if (a["alert_type"] === "DXPEDITION") {
sigTypeText = "DXpedition";
} else if (a["alert_type"] === "SATELLITE") {
sigTypeText = "Satellite";
} else if (a["alert_type"] === "XOTA") {
if (a["sig"]) {
sigTypeText = a["sig"];
} else {
sigTypeText = "xOTA";
}
}
// Format sig_refs
@@ -272,8 +296,8 @@ function addAlertRowsToTable(tbody, alerts) {
if (showComment) {
$tr.append(`<td class='hideonmobile'>${commentText}</td>`);
}
if (showSource) {
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${sigSourceText}</td>`);
if (showType) {
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${sigTypeText}</td>`);
}
if (showRef) {
$tr.append(`<td class='hideonmobile'>${sig_refs}</td>`);
@@ -290,7 +314,7 @@ function addAlertRowsToTable(tbody, alerts) {
}
const $td2 = $("<td colspan='100'>");
if (showSource) {
if (showType) {
$td2.append(`<span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> `);
}
if (showRef) {
+1 -1
View File
@@ -77,7 +77,7 @@
</div>
<script src="/static/js/add-spot.js?v=1789116473"></script>
<script src="/static/js/add-spot.js?v=1789134214"></script>
<script>$(document).ready(function () {
$("#nav-link-add-spot").addClass("active");
}); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -83,7 +83,7 @@
</div>
<script src="/static/js/alerts.js?v=1789116474"></script>
<script src="/static/js/alerts.js?v=1789134214"></script>
<script>$(document).ready(function () {
$("#nav-link-alerts").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -76,8 +76,8 @@
</div>
<script src="/static/js/spotsbandsandmap.js?v=1789116473"></script>
<script src="/static/js/bands.js?v=1789116473"></script>
<script src="/static/js/spotsbandsandmap.js?v=1789134214"></script>
<script src="/static/js/bands.js?v=1789134214"></script>
<script>$(document).ready(function () {
$("#nav-link-bands").addClass("active");
}); <!-- highlight active page in nav --></script>
+5 -5
View File
@@ -1,6 +1,6 @@
{% extends "skeleton.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/css/style.css?v=1789116473" type="text/css">
<link rel="stylesheet" href="/static/css/style.css?v=1789134213" type="text/css">
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
@@ -16,10 +16,10 @@
window.fetchEventSource = fetchEventSource;
</script>
<script src="/static/js/utils.js?v=1789116473"></script>
<script src="/static/js/ui-ham.js?v=1789116473"></script>
<script src="/static/js/geo.js?v=1789116473"></script>
<script src="/static/js/common.js?v=1789116473"></script>
<script src="/static/js/utils.js?v=1789134213"></script>
<script src="/static/js/ui-ham.js?v=1789134213"></script>
<script src="/static/js/geo.js?v=1789134213"></script>
<script src="/static/js/common.js?v=1789134213"></script>
{% end %}
{% block body %}
<div class="container">
+3 -3
View File
@@ -39,9 +39,9 @@
</div>
<div class="col">
<div class="form-check">
<input class="form-check-input storeable-checkbox" type="checkbox" id="tableShowSource"
value="tableShowSource" oninput="columnsUpdated();" checked>
<label class="form-check-label" for="tableShowSource">Source</label>
<input class="form-check-input storeable-checkbox" type="checkbox" id="tableShowType"
value="tableShowType" oninput="columnsUpdated();" checked>
<label class="form-check-label" for="tableShowType">Source</label>
</div>
</div>
<div class="col">
+1 -1
View File
@@ -284,7 +284,7 @@
</div>
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
<script src="/static/js/conditions.js?v=1789116473"></script>
<script src="/static/js/conditions.js?v=1789134214"></script>
<script>$(document).ready(function () {
$("#nav-link-conditions").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -113,8 +113,8 @@
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
</script>
<script src="/static/js/spotsbandsandmap.js?v=1789116474"></script>
<script src="/static/js/map.js?v=1789116474"></script>
<script src="/static/js/spotsbandsandmap.js?v=1789134214"></script>
<script src="/static/js/map.js?v=1789134214"></script>
<script>$(document).ready(function () {
$("#nav-link-map").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -113,8 +113,8 @@
</div>
<script src="/static/js/spotsbandsandmap.js?v=1789116473"></script>
<script src="/static/js/spots.js?v=1789116473"></script>
<script src="/static/js/spotsbandsandmap.js?v=1789134213"></script>
<script src="/static/js/spots.js?v=1789134213"></script>
<script>$(document).ready(function () {
$("#nav-link-spots").addClass("active");
}); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -86,7 +86,7 @@
</div>
</div>
<script src="/static/js/status.js?v=1789116473"></script>
<script src="/static/js/status.js?v=1789134214"></script>
<script>
$(document).ready(function () {
$("#nav-link-status").addClass("active");