mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Prevent opening the status and filters panel at the same time, and fix a bug where status area got appended to rather than replaced
This commit is contained in:
@@ -164,6 +164,7 @@ function updateTable() {
|
||||
// Load server status
|
||||
function loadStatus() {
|
||||
$.getJSON('/api/status', function(jsonData) {
|
||||
$("#status-container").empty();
|
||||
$("#status-container").append(generateStatusCard("Server Information", [
|
||||
`Software Version: ${jsonData["software-version"]}`,
|
||||
`Server Owner Callsign: ${jsonData["server-owner-callsign"]}`,
|
||||
@@ -340,9 +341,13 @@ function loadSettings() {
|
||||
// Set up UI element event listeners, after the document is ready
|
||||
function setUpEventListeners() {
|
||||
$("#status-button").click(function() {
|
||||
// If we are going to display status, load the data for the status panel
|
||||
// If we are going to display status, load the data for the status panel, and hide the filters panel
|
||||
if (!$("#status-area").is(":visible")) {
|
||||
loadStatus();
|
||||
if ($("#filters-area").is(":visible")) {
|
||||
$("#filters-area").hide();
|
||||
$("#filters-button").button("toggle");
|
||||
}
|
||||
}
|
||||
$("#status-area").toggle();
|
||||
});
|
||||
@@ -351,7 +356,12 @@ function setUpEventListeners() {
|
||||
$("#status-area").hide();
|
||||
});
|
||||
$("#filters-button").click(function() {
|
||||
$("#filters-area").toggle();
|
||||
// If we are going to display filters, hide the filters panel
|
||||
if (!$("#filters-area").is(":visible") && $("#status-area").is(":visible")) {
|
||||
$("#status-area").hide();
|
||||
$("#status-button").button("toggle");
|
||||
}
|
||||
$("#filters-area").toggle();
|
||||
});
|
||||
$("#close-filters-button").click(function() {
|
||||
$("#filters-button").button("toggle");
|
||||
|
||||
Reference in New Issue
Block a user