mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-24 16:24:32 +00:00
First attempt at converting "sig" to "activity" for v3
This commit is contained in:
+13
-13
@@ -45,7 +45,7 @@ function loadSpots() {
|
||||
// 3) Subscribe to the SSE endpoint (with credentials if we have them) so that updates come with augmented
|
||||
// data if they can.
|
||||
$.ajax({
|
||||
url: '/api/v2/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
|
||||
url: '/api/v3/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
|
||||
// Store data
|
||||
spots = jsonData;
|
||||
// Update map
|
||||
@@ -58,7 +58,7 @@ function loadSpots() {
|
||||
// OK, we have credentials and have loaded once without them so the user has a basic map. Now reload
|
||||
// with the credentials and replace what's on the map, so we can improve the data.
|
||||
$.ajax({
|
||||
url: '/api/v2/spots' + buildQueryString(),
|
||||
url: '/api/v3/spots' + buildQueryString(),
|
||||
dataType: 'json',
|
||||
headers: getCredentialHeaders(),
|
||||
success: function (jsonData2) {
|
||||
@@ -85,7 +85,7 @@ function startSSEConnection() {
|
||||
sseAbortController = new AbortController();
|
||||
|
||||
// SSE is going to fetch only a few spots at a time, so now we include QRZ/HamQTH credentials because the delay won't be significant.
|
||||
fetchEventSource('/api/v2/spots/stream' + buildQueryString(), {
|
||||
fetchEventSource('/api/v3/spots/stream' + buildQueryString(), {
|
||||
headers: getCredentialHeaders(),
|
||||
signal: sseAbortController.signal,
|
||||
openWhenHidden: true,
|
||||
@@ -183,7 +183,7 @@ function removeSpotFromMap(key) {
|
||||
// Build a query string for the API, based on the filters that the user has selected.
|
||||
function buildQueryString() {
|
||||
let str = "?";
|
||||
["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => {
|
||||
["dx_continent", "de_continent", "mode", "source", "band", "activity"].forEach(fn => {
|
||||
if (!allFilterOptionsSelected(fn)) {
|
||||
str = str + getQueryStringFor(fn) + "&";
|
||||
}
|
||||
@@ -276,19 +276,19 @@ function getTooltipText(s) {
|
||||
|
||||
// Activity or fallback to source
|
||||
let activitySourceText = s["source"];
|
||||
if (s["sig"]) {
|
||||
activitySourceText = s["sig"];
|
||||
if (s["activity"]) {
|
||||
activitySourceText = s["activity"];
|
||||
}
|
||||
|
||||
// Format activity refs
|
||||
let activityRefs = "";
|
||||
if (s["sig_refs"] != null) {
|
||||
if (s["activity_refs"] != null) {
|
||||
const items = [];
|
||||
for (let i = 0; i < s["sig_refs"].length; i++) {
|
||||
if (s["sig_refs"][i]["url"] != null) {
|
||||
items[i] = `<a href='${s["sig_refs"][i]["url"]}' title='${s["sig_refs"][i]["name"]}' target='_new' class='activity-ref-link'>${s["sig_refs"][i]["id"]}</a>`
|
||||
for (let i = 0; i < s["activity_refs"].length; i++) {
|
||||
if (s["activity_refs"][i]["url"] != null) {
|
||||
items[i] = `<a href='${s["activity_refs"][i]["url"]}' title='${s["activity_refs"][i]["name"]}' target='_new' class='activity-ref-link'>${s["activity_refs"][i]["id"]}</a>`
|
||||
} else {
|
||||
items[i] = `${s["sig_refs"][i]["id"]}`
|
||||
items[i] = `${s["activity_refs"][i]["id"]}`
|
||||
}
|
||||
}
|
||||
activityRefs = items.join(", ");
|
||||
@@ -325,7 +325,7 @@ function getTooltipText(s) {
|
||||
// Load server options. Once a successful callback is made from this, we then query spots and set up the timer to query
|
||||
// spots repeatedly.
|
||||
function loadOptions() {
|
||||
$.getJSON('/api/v2/options', function (jsonData) {
|
||||
$.getJSON('/api/v3/options', function (jsonData) {
|
||||
// Store options
|
||||
options = jsonData;
|
||||
|
||||
@@ -339,7 +339,7 @@ function loadOptions() {
|
||||
|
||||
// Populate the filters panel
|
||||
generateBandsMultiToggleFilterCard(options["bands"]);
|
||||
generateActivitiesMultiToggleFilterCard(options["sigs"]);
|
||||
generateActivitiesMultiToggleFilterCard(options["activities"]);
|
||||
generateMultiToggleFilterCard("#dx_continent_options", "dx_continent", options["continents"]);
|
||||
generateMultiToggleFilterCard("#de_continent_options", "de_continent", options["continents"]);
|
||||
generateModesMultiToggleFilterCard(options["modes"]);
|
||||
|
||||
Reference in New Issue
Block a user