mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 09:14:30 +00:00
Starting to implement Run/Pause switch #3
This commit is contained in:
@@ -10,13 +10,20 @@
|
|||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
<div id="settingsButtonRow" class="row">
|
<div id="settingsButtonRow" class="row">
|
||||||
<div class="col-auto me-auto pt-3">
|
<div class="col-lg-6 me-auto pt-3">
|
||||||
<p id="timing-container">Loading...</p>
|
<p id="timing-container">Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-lg-6 text-end">
|
||||||
<p class="d-inline-flex gap-1">
|
<p class="d-inline-flex gap-1">
|
||||||
|
<span class="btn-group" role="group">
|
||||||
|
<input type="radio" class="btn-check" name="runPause" id="runButton" autocomplete="off" checked>
|
||||||
|
<label class="btn btn-outline-primary" for="runButton"><i class="fa-solid fa-play"></i> Run</label>
|
||||||
|
|
||||||
|
<input type="radio" class="btn-check" name="runPause" id="pauseButton" autocomplete="off">
|
||||||
|
<label class="btn btn-outline-primary" for="pauseButton"><i class="fa-solid fa-pause"></i> Pause</label>
|
||||||
|
</span>
|
||||||
<span style="position: relative;">
|
<span style="position: relative;">
|
||||||
<i class="fa-solid fa-magnifying-glass" style="position: absolute; left: 0px; top: 2px; padding: 10px; pointer-events: none;"></i>
|
<i id="searchicon" class="fa-solid fa-magnifying-glass"></i>
|
||||||
<input id="search" type="search" class="form-control" oninput="filtersUpdated();" placeholder="Search">
|
<input id="search" type="search" class="form-control" oninput="filtersUpdated();" placeholder="Search">
|
||||||
</span>
|
</span>
|
||||||
<button id="filters-button" type="button" class="btn btn-outline-primary" data-bs-toggle="button" onclick="toggleFiltersPanel();"><i class="fa-solid fa-filter"></i> Filters</button>
|
<button id="filters-button" type="button" class="btn btn-outline-primary" data-bs-toggle="button" onclick="toggleFiltersPanel();"><i class="fa-solid fa-filter"></i> Filters</button>
|
||||||
|
|||||||
@@ -82,10 +82,19 @@ div.container {
|
|||||||
|
|
||||||
input#search {
|
input#search {
|
||||||
max-width: 12em;
|
max-width: 12em;
|
||||||
|
margin-left: 1rem;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i#searchicon {
|
||||||
|
position: absolute;
|
||||||
|
left: 1rem;
|
||||||
|
top: 2px;
|
||||||
|
padding: 10px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
div.appearing-panel {
|
div.appearing-panel {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -336,10 +345,12 @@ div.band-spot:hover span.band-spot-info {
|
|||||||
max-height: 26em;
|
max-height: 26em;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
/* Filter/search DX Call field should be smaller on mobile */
|
/* No search on mobile */
|
||||||
input#search {
|
input#search {
|
||||||
max-width: 9em;
|
display: none;
|
||||||
margin-right: 0;
|
}
|
||||||
|
i#searchicon {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ function toggleFilterButtons(filterQuery, state) {
|
|||||||
function updateRefreshDisplay() {
|
function updateRefreshDisplay() {
|
||||||
if (lastUpdateTime != null) {
|
if (lastUpdateTime != null) {
|
||||||
let secSinceUpdate = moment.duration(moment().diff(lastUpdateTime)).asSeconds();
|
let secSinceUpdate = moment.duration(moment().diff(lastUpdateTime)).asSeconds();
|
||||||
if (typeof REFRESH_INTERVAL_SEC !== 'undefined' && REFRESH_INTERVAL_SEC != null) {
|
|
||||||
let count = REFRESH_INTERVAL_SEC;
|
let count = REFRESH_INTERVAL_SEC;
|
||||||
let updatingString = "Updating..."
|
let updatingString = "Updating..."
|
||||||
if (secSinceUpdate < REFRESH_INTERVAL_SEC) {
|
if (secSinceUpdate < REFRESH_INTERVAL_SEC) {
|
||||||
@@ -131,9 +130,6 @@ function updateRefreshDisplay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#timing-container").html("Last updated at " + lastUpdateTime.format('HH:mm') + " UTC. " + updatingString);
|
$("#timing-container").html("Last updated at " + lastUpdateTime.format('HH:mm') + " UTC. " + updatingString);
|
||||||
} else {
|
|
||||||
$("#timing-container").html("Connected to live spot server. Last spot received at " + lastUpdateTime.format('HH:mm') + " UTC.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function loadSpots() {
|
|||||||
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
|
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
|
||||||
// Store last updated time
|
// Store last updated time
|
||||||
lastUpdateTime = moment.utc();
|
lastUpdateTime = moment.utc();
|
||||||
updateRefreshDisplay();
|
updateTimingDisplayRunPause();
|
||||||
// Store data
|
// Store data
|
||||||
spots = jsonData;
|
spots = jsonData;
|
||||||
// Update table
|
// Update table
|
||||||
@@ -32,7 +32,7 @@ function startSSEConnection() {
|
|||||||
evtSource.onmessage = function(event) {
|
evtSource.onmessage = function(event) {
|
||||||
// Store last updated time
|
// Store last updated time
|
||||||
lastUpdateTime = moment.utc();
|
lastUpdateTime = moment.utc();
|
||||||
updateRefreshDisplay();
|
updateTimingDisplayRunPause();
|
||||||
// Get the new spot
|
// Get the new spot
|
||||||
newSpot = JSON.parse(event.data);
|
newSpot = JSON.parse(event.data);
|
||||||
// Awful fudge to ensure new incoming spots at the top of the list don't have timestamps that make them look
|
// Awful fudge to ensure new incoming spots at the top of the list don't have timestamps that make them look
|
||||||
@@ -64,10 +64,16 @@ function startSSEConnection() {
|
|||||||
|
|
||||||
evtSource.onerror = function(err) {
|
evtSource.onerror = function(err) {
|
||||||
evtSource.close();
|
evtSource.close();
|
||||||
setTimeout(restartSSEConnection, 1000);
|
setTimeout(startSSEConnection, 1000);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the special timing display for the live spots page, which varies depending on run/pause selection.
|
||||||
|
function updateTimingDisplayRunPause() {
|
||||||
|
// todo run/pause
|
||||||
|
$("#timing-container").html("Last spot received at " + lastUpdateTime.format('HH:mm') + " UTC.");
|
||||||
|
}
|
||||||
|
|
||||||
// Build a query string for the API, based on the filters that the user has selected.
|
// Build a query string for the API, based on the filters that the user has selected.
|
||||||
function buildQueryString() {
|
function buildQueryString() {
|
||||||
var str = "?";
|
var str = "?";
|
||||||
|
|||||||
Reference in New Issue
Block a user