Enhance log display behavior and menu state management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-11 14:37:02 +11:00
parent 9bd2b32003
commit ffd43d5217
9 changed files with 166 additions and 52 deletions

View File

@@ -21,15 +21,22 @@ function showLogs(bottom) {
var log = new Log();
var logs = SERVER["log"]["log"];
var div = document.getElementById("content_log");
var wrapper = document.getElementById("box-wrapper");
var shouldStickToBottom = bottom;
div.innerHTML = "";
if (wrapper != null && shouldStickToBottom == false) {
var distanceToBottom = wrapper.scrollHeight - wrapper.scrollTop - wrapper.clientHeight;
if (distanceToBottom < 80) {
shouldStickToBottom = true;
}
}
var keys = getObjKeys(logs);
keys.forEach(function (logID) {
var entry = log.createLog(logs[logID]);
div.append(entry);
});
setTimeout(function () {
if (bottom == true) {
var wrapper = document.getElementById("box-wrapper");
if (shouldStickToBottom == true && wrapper != null) {
wrapper.scrollTop = wrapper.scrollHeight;
}
}, 10);

View File

@@ -895,9 +895,28 @@ function setActiveMenu(menuID) {
items[i].removeAttribute("aria-current");
}
var activeItem = document.getElementById(ACTIVE_MENU_ID);
var activeMenuKey = "";
if (activeItem != null) {
activeItem.classList.add("menu-active");
activeItem.setAttribute("aria-current", "page");
var menuKeyValue = activeItem.getAttribute("data-menu");
if (menuKeyValue != null) {
activeMenuKey = menuKeyValue;
}
}
if (document.body != null) {
if (activeMenuKey.length > 0) {
document.body.setAttribute("data-active-menu", activeMenuKey);
}
else {
document.body.removeAttribute("data-active-menu");
}
if (activeMenuKey == "log") {
document.body.classList.add("menu-log-focus");
}
else {
document.body.classList.remove("menu-log-focus");
}
}
}
function renderStatusCards() {
@@ -989,6 +1008,9 @@ function PageReady() {
calculateWrapperHeight();
}, true);
setInterval(function () {
if (document.hidden == true) {
return;
}
updateLog();
}, 10000);
return;

View File

@@ -88,7 +88,7 @@ var Server = /** @class */ (function () {
errorState = "idle";
}
finishRequest(errorState, false);
if (WS_AVAILABLE == false) {
if (WS_AVAILABLE == false && isLogUpdate == false) {
alert("No websocket connection to xTeVe could be established. Check your network configuration.");
}
};