-
+
An error occured while installing Home Assistant, check the logs below for more information.
diff --git a/rootfs/usr/share/www/static/scripts.js b/rootfs/usr/share/www/static/scripts.js
index c7b4032..07a17ab 100644
--- a/rootfs/usr/share/www/static/scripts.js
+++ b/rootfs/usr/share/www/static/scripts.js
@@ -70,24 +70,25 @@ function testAvailable() {
}, scheduleTry);
}
+var errorCheck = /^[\d -:]+ERROR(.*)/gm
+
function fetchLogs() {
fetch("/observer/logs").then(function (res) {
if (res.ok) {
res.text().then(function (text) {
var logElement = document.getElementById("log");
- if (text.includes("ERROR")) {
+ if (errorCheck.test(text)) {
document.body.classList.add("error");
- document.getElementById("show_logs").classList.add("hidden");
+ document.getElementById("show_logs").innerText = "Download raw logs";
logElement.showFull = true;
}
if (!logElement.showFull) {
return;
}
var scrolledDown = logElement.scrollTop + logElement.clientHeight === logElement.scrollHeight;
- logElement.innerText = text
- .replace(/\s[A-Z]+\s\(\w+\)\s\[[\w.]+\]/gi, "")
- .replace(/\d{2}-\d{2}-\d{2}\s/gi, "")
- .replace(/\d{2}:\d{2}:\d{2}\s/gi, "");
+ logElement.innerHTML = text
+ .replace(/^[\[\d \-:\]]*/gm, "")
+ .replace(/^(INFO|WARNING|ERROR)\s\(\w+\)\s(.*)\n/gm, "
$2\n")
if (scrolledDown) {
// Scroll content down if it was already scrolled down
logElement.scrollTop = logElement.scrollHeight;
@@ -113,6 +114,17 @@ fetchLogs();
document.getElementById("show_logs").addEventListener("click", toggleLogs);
function toggleLogs(event) {
+ if (document.body.classList.contains("error")) {
+ const a = document.createElement("a");
+ a.target = "_blank";
+ a.href = "/observer/logs";
+ a.download = "logs.txt";
+
+ document.body.appendChild(a);
+ a.dispatchEvent(new MouseEvent("click"));
+ document.body.removeChild(a);
+ return;
+ }
var logElement = document.getElementById("log");
logElement.showFull = !logElement.showFull;
if (logElement.showFull) {
diff --git a/rootfs/usr/share/www/static/styles.css b/rootfs/usr/share/www/static/styles.css
index 6108be5..ccfe0e0 100644
--- a/rootfs/usr/share/www/static/styles.css
+++ b/rootfs/usr/share/www/static/styles.css
@@ -45,6 +45,7 @@ body {
display: flex;
align-items: center;
}
+
.alert::after {
position: absolute;
top: 0;
@@ -57,11 +58,13 @@ body {
border-radius: 4px;
background-color: #db4437;
}
+
.alert-icon {
fill: #db4437;
width: 24px;
flex-shrink: 0;
}
+
.alert-content {
font-size: 14px;
text-align: left;
@@ -69,10 +72,6 @@ body {
margin-right: 0;
}
-.hidden {
- display: none;
-}
-
.header {
text-align: center;
margin-top: 32px;
@@ -276,9 +275,11 @@ button.icon {
.block:after {
border-radius: 12px;
}
+
.link-list {
padding: 8px 0;
}
+
.link {
width: 100%;
height: 100%;
@@ -343,6 +344,18 @@ pre:empty {
display: none;
}
+pre .INFO {
+ color: #039be5;
+}
+
+pre .ERROR {
+ color: #db4437;
+}
+
+pre .WARNING {
+ color: #ffa600;
+}
+
dialog {
background-color: #ffffff;
border: none !important;
@@ -359,9 +372,9 @@ dialog::backdrop {
dialog button {
width: 48px;
- height: 48px;
- padding: 12px;
- margin: -12px;
+ height: 48px;
+ padding: 12px;
+ margin: -12px;
border-radius: 50%;
}
@@ -417,7 +430,8 @@ dialog button svg {
gap: 16px;
}
-.app-qr a, .app-qr img {
+.app-qr a,
+.app-qr img {
flex: 1;
}
@@ -427,7 +441,8 @@ dialog button svg {
background-color: #111111;
}
- .content {
+ .content,
+ pre {
background-color: #1c1c1c;
border-color: rgba(225, 225, 225, 0.12);
}