mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Alerts now displays a "Type" in the table not just the source. Closes #142
This commit is contained in:
@@ -22,11 +22,18 @@ class Hamsat(HTTPAlertProvider):
|
|||||||
# Iterate through source data
|
# Iterate through source data
|
||||||
for source_alert in http_response.json()["data"]:
|
for source_alert in http_response.json()["data"]:
|
||||||
# Convert to our alert format
|
# 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(
|
alert = Alert(
|
||||||
source=self.name,
|
source=self.name,
|
||||||
source_id=source_alert["id"],
|
source_id=source_alert["id"],
|
||||||
dx_calls=[source_alert["callsign"].upper()],
|
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"],
|
comment=source_alert["comment"],
|
||||||
# Fudge a SIG ref to provide the remaining bits of data we need: the satellite and the operator's grid
|
# Fudge a SIG ref to provide the remaining bits of data we need: the satellite and the operator's grid
|
||||||
sig_refs=[
|
sig_refs=[
|
||||||
|
|||||||
+35
-11
@@ -54,7 +54,7 @@ function updateTable() {
|
|||||||
const showDX = $("#tableShowDX")[0].checked;
|
const showDX = $("#tableShowDX")[0].checked;
|
||||||
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
|
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
|
||||||
const showComment = $("#tableShowComment")[0].checked;
|
const showComment = $("#tableShowComment")[0].checked;
|
||||||
const showSource = $("#tableShowSource")[0].checked;
|
const showType = $("#tableShowType")[0].checked;
|
||||||
const showRef = $("#tableShowRef")[0].checked;
|
const showRef = $("#tableShowRef")[0].checked;
|
||||||
|
|
||||||
// Populate table with headers
|
// Populate table with headers
|
||||||
@@ -75,8 +75,8 @@ function updateTable() {
|
|||||||
if (showComment) {
|
if (showComment) {
|
||||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Comment</th>`);
|
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Comment</th>`);
|
||||||
}
|
}
|
||||||
if (showSource) {
|
if (showType) {
|
||||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Source</th>`);
|
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Type</th>`);
|
||||||
}
|
}
|
||||||
if (showRef) {
|
if (showRef) {
|
||||||
table.find('thead tr').append(`<th class='bg-primary-subtle hideonmobile'>Ref.</th>`);
|
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 showDX = $("#tableShowDX")[0].checked;
|
||||||
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
|
const showFreqsModes = $("#tableShowFreqsModes")[0].checked;
|
||||||
const showComment = $("#tableShowComment")[0].checked;
|
const showComment = $("#tableShowComment")[0].checked;
|
||||||
const showSource = $("#tableShowSource")[0].checked;
|
const showType = $("#tableShowType")[0].checked;
|
||||||
const showRef = $("#tableShowRef")[0].checked;
|
const showRef = $("#tableShowRef")[0].checked;
|
||||||
|
|
||||||
// Get times for the alert, and convert to local time if necessary.
|
// Get times for the alert, and convert to local time if necessary.
|
||||||
@@ -232,14 +232,38 @@ function addAlertRowsToTable(tbody, alerts) {
|
|||||||
if (a["comment"] != null) {
|
if (a["comment"] != null) {
|
||||||
commentText = escapeHtml(a["comment"]);
|
commentText = escapeHtml(a["comment"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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) {
|
if (a["url"] != null) {
|
||||||
commentText += ` <a href="${escapeHtml(a['url'])}" target="_new" style="text-decoration: none">🔗</a>`;
|
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"];
|
// 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"]) {
|
if (a["sig"]) {
|
||||||
sigSourceText = a["sig"];
|
sigTypeText = a["sig"];
|
||||||
|
} else {
|
||||||
|
sigTypeText = "xOTA";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format sig_refs
|
// Format sig_refs
|
||||||
@@ -272,8 +296,8 @@ function addAlertRowsToTable(tbody, alerts) {
|
|||||||
if (showComment) {
|
if (showComment) {
|
||||||
$tr.append(`<td class='hideonmobile'>${commentText}</td>`);
|
$tr.append(`<td class='hideonmobile'>${commentText}</td>`);
|
||||||
}
|
}
|
||||||
if (showSource) {
|
if (showType) {
|
||||||
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${sigSourceText}</td>`);
|
$tr.append(`<td class='nowrap hideonmobile'><span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> ${sigTypeText}</td>`);
|
||||||
}
|
}
|
||||||
if (showRef) {
|
if (showRef) {
|
||||||
$tr.append(`<td class='hideonmobile'>${sig_refs}</td>`);
|
$tr.append(`<td class='hideonmobile'>${sig_refs}</td>`);
|
||||||
@@ -290,7 +314,7 @@ function addAlertRowsToTable(tbody, alerts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const $td2 = $("<td colspan='100'>");
|
const $td2 = $("<td colspan='100'>");
|
||||||
if (showSource) {
|
if (showType) {
|
||||||
$td2.append(`<span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> `);
|
$td2.append(`<span class='icon-wrapper'><i class='fa-solid ${a["icon"]}'></i></span> `);
|
||||||
}
|
}
|
||||||
if (showRef) {
|
if (showRef) {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
</div>
|
</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 () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-add-spot").addClass("active");
|
$("#nav-link-add-spot").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/alerts.js?v=1789116474"></script>
|
<script src="/static/js/alerts.js?v=1789134214"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-alerts").addClass("active");
|
$("#nav-link-alerts").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789116473"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789134214"></script>
|
||||||
<script src="/static/js/bands.js?v=1789116473"></script>
|
<script src="/static/js/bands.js?v=1789134214"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-bands").addClass("active");
|
$("#nav-link-bands").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
{% extends "skeleton.html" %}
|
{% extends "skeleton.html" %}
|
||||||
{% block head_extra %}
|
{% 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/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/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||||
<link href="/static/vendor/css/solid-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;
|
window.fetchEventSource = fetchEventSource;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/utils.js?v=1789116473"></script>
|
<script src="/static/js/utils.js?v=1789134213"></script>
|
||||||
<script src="/static/js/ui-ham.js?v=1789116473"></script>
|
<script src="/static/js/ui-ham.js?v=1789134213"></script>
|
||||||
<script src="/static/js/geo.js?v=1789116473"></script>
|
<script src="/static/js/geo.js?v=1789134213"></script>
|
||||||
<script src="/static/js/common.js?v=1789116473"></script>
|
<script src="/static/js/common.js?v=1789134213"></script>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -39,9 +39,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input storeable-checkbox" type="checkbox" id="tableShowSource"
|
<input class="form-check-input storeable-checkbox" type="checkbox" id="tableShowType"
|
||||||
value="tableShowSource" oninput="columnsUpdated();" checked>
|
value="tableShowType" oninput="columnsUpdated();" checked>
|
||||||
<label class="form-check-label" for="tableShowSource">Source</label>
|
<label class="form-check-label" for="tableShowType">Source</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
<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 () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-conditions").addClass("active");
|
$("#nav-link-conditions").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+2
-2
@@ -113,8 +113,8 @@
|
|||||||
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789116474"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789134214"></script>
|
||||||
<script src="/static/js/map.js?v=1789116474"></script>
|
<script src="/static/js/map.js?v=1789134214"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-map").addClass("active");
|
$("#nav-link-map").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -113,8 +113,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789116473"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789134213"></script>
|
||||||
<script src="/static/js/spots.js?v=1789116473"></script>
|
<script src="/static/js/spots.js?v=1789134213"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-spots").addClass("active");
|
$("#nav-link-spots").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/status.js?v=1789116473"></script>
|
<script src="/static/js/status.js?v=1789134214"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#nav-link-status").addClass("active");
|
$("#nav-link-status").addClass("active");
|
||||||
|
|||||||
Reference in New Issue
Block a user