Enhance log display behavior and menu state management
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -29,9 +29,18 @@ function showLogs(bottom:boolean) {
|
||||
|
||||
var logs = SERVER["log"]["log"]
|
||||
var div = document.getElementById("content_log")
|
||||
var wrapper = document.getElementById("box-wrapper") as HTMLElement
|
||||
var shouldStickToBottom:boolean = bottom
|
||||
|
||||
div.innerHTML = ""
|
||||
|
||||
if (wrapper != null && shouldStickToBottom == false) {
|
||||
var distanceToBottom:number = wrapper.scrollHeight - wrapper.scrollTop - wrapper.clientHeight
|
||||
if (distanceToBottom < 80) {
|
||||
shouldStickToBottom = true
|
||||
}
|
||||
}
|
||||
|
||||
var keys = getObjKeys(logs)
|
||||
|
||||
keys.forEach(logID => {
|
||||
@@ -44,9 +53,8 @@ function showLogs(bottom:boolean) {
|
||||
|
||||
setTimeout(function(){
|
||||
|
||||
if (bottom == true) {
|
||||
if (shouldStickToBottom == true && wrapper != null) {
|
||||
|
||||
var wrapper = document.getElementById("box-wrapper");
|
||||
wrapper.scrollTop = wrapper.scrollHeight;
|
||||
|
||||
}
|
||||
@@ -62,4 +70,4 @@ function resetLogs() {
|
||||
var server:Server = new Server(cmd)
|
||||
server.request(data)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,8 +871,27 @@ function setActiveMenu(menuID:string) {
|
||||
}
|
||||
|
||||
var activeItem = document.getElementById(ACTIVE_MENU_ID)
|
||||
var activeMenuKey:string = ""
|
||||
if (activeItem != null) {
|
||||
activeItem.classList.add("menu-active")
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -983,6 +1002,9 @@ function PageReady() {
|
||||
}, true);
|
||||
|
||||
setInterval(function(){
|
||||
if (document.hidden == true) {
|
||||
return
|
||||
}
|
||||
updateLog()
|
||||
}, 10000);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class Server {
|
||||
}
|
||||
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.")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user