mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-09 21:17:06 +03:00
* Temporarily disable data file writing as it can cause crashs, see https://github.com/jomjol/AI-on-the-edge-device/issues/1225 * removed edit function in graph as we don't need that in a release * . * improve log viewer * replaced logfile enable/disable with enum to select log level. At least errors always will be logged (as before) * . * . * colorize log * scroll down * improve log reload
101 lines
3.1 KiB
HTML
101 lines
3.1 KiB
HTML
<html>
|
|
<head>
|
|
<style>
|
|
html,
|
|
body {
|
|
height: 100%;
|
|
margin: 2px;
|
|
}
|
|
|
|
.box {
|
|
display: flex;
|
|
flex-flow: column;
|
|
height: 100%;
|
|
}
|
|
|
|
.box .row.header {
|
|
flex: 0 1 auto;
|
|
}
|
|
|
|
.box .row.content {
|
|
flex: 1 1 auto;
|
|
}
|
|
|
|
.box .row.footer {
|
|
flex: 0 1 auto;
|
|
}
|
|
|
|
#log {
|
|
font-family: 'Courier New', Courier, monospace;
|
|
font-size: small;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="box">
|
|
<div class="row header">
|
|
<button onClick="reload();">Reload</button>
|
|
<button onClick="window.open('logfileact');">Show full log</button>
|
|
<button onClick="window.location.href = 'fileserver/log/message/'">Show older log files</button>
|
|
</div>
|
|
<div class="row content" id="log"><br><br><br><b>Loading Logfile, please wait...</b></div>
|
|
<div class="row footer">
|
|
<button onClick="reload();">Reload</button>
|
|
<button onClick="window.open('logfileact');">Show full log</button>
|
|
<button onClick="window.location.href = 'fileserver/log/message/'">Show older log files</button>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
<script>
|
|
function reload() {
|
|
// document.getElementById('log').innerHTML += "<br><b>Reloading...<b><br><br>";
|
|
document.getElementById('log').innerHTML += "<b>Reloading...</b>";
|
|
window.scrollBy(0,document.body.scrollHeight);
|
|
funcRequest('log');
|
|
}
|
|
|
|
|
|
function processLogLine(line, index, arr) {
|
|
if (line.includes("<WRN>")) {
|
|
arr[index] = "<span style=\"color:#e83c00\">" + line + "</span>";
|
|
}
|
|
else if (line.includes("<ERR>")) {
|
|
arr[index] = "<span style=\"color:red\"><b>" + line + "</b></span>";
|
|
}
|
|
else if (line.includes("<DBG>")) {
|
|
arr[index] = "<span style=\"color:gray\">" + line + "</span>";
|
|
}
|
|
|
|
arr[index] += "<br>";
|
|
}
|
|
|
|
async function funcRequest(url){
|
|
await fetch(url)
|
|
.then((res) => {
|
|
if (!res.ok) {
|
|
document.getElementById("log").innerHTML = "HTTP error " + res.status;
|
|
}
|
|
|
|
return res.text();
|
|
})
|
|
.then((log) => {
|
|
log = log.replace(/</g, "<").replace(/>/g, ">");
|
|
logArr = log.split("\n");
|
|
logArr.forEach(processLogLine);
|
|
|
|
document.getElementById('log').innerHTML = "<br>" + logArr.join("\n") + " ";
|
|
|
|
window.scrollBy(0,document.body.scrollHeight);
|
|
|
|
})
|
|
.catch((err) => {
|
|
document.getElementById("log").innerHTML = err;
|
|
});
|
|
}
|
|
|
|
funcRequest('log');
|
|
|
|
</script>
|
|
</html>
|