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:
Ian Renton
2025-10-03 21:48:13 +01:00
parent 50bb07167e
commit 7af7475c5a

View File

@@ -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");