Merge branch 'master' into 2.0.X

# Conflicts:
#	package-lock.json
#	server/database.js
#	server/util-server.js
This commit is contained in:
Louis Lam
2023-08-09 20:09:56 +08:00
82 changed files with 2872 additions and 464 deletions

View File

@@ -57,7 +57,8 @@ export default {
message: "",
errorMessage: "",
currentPassword: "",
}
},
faviconUpdateDebounce: null,
};
},
@@ -186,16 +187,18 @@ export default {
// Also toast
if (data.important) {
if (data.status === 0) {
toast.error(`[${this.monitorList[data.monitorID].name}] [DOWN] ${data.msg}`, {
timeout: false,
});
} else if (data.status === 1) {
toast.success(`[${this.monitorList[data.monitorID].name}] [Up] ${data.msg}`, {
timeout: 20000,
});
} else {
toast(`[${this.monitorList[data.monitorID].name}] ${data.msg}`);
if (this.monitorList[data.monitorID] !== undefined) {
if (data.status === 0) {
toast.error(`[${this.monitorList[data.monitorID].name}] [DOWN] ${data.msg}`, {
timeout: false,
});
} else if (data.status === 1) {
toast.success(`[${this.monitorList[data.monitorID].name}] [Up] ${data.msg}`, {
timeout: 20000,
});
} else {
toast(`[${this.monitorList[data.monitorID].name}] ${data.msg}`);
}
}
if (! (data.monitorID in this.importantHeartbeatList)) {
@@ -765,7 +768,12 @@ export default {
// Update Badge
"stats.down"(to, from) {
if (to !== from) {
favicon.badge(to);
if (this.faviconUpdateDebounce != null) {
clearTimeout(this.faviconUpdateDebounce);
}
this.faviconUpdateDebounce = setTimeout(() => {
favicon.badge(to);
}, 1000);
}
},

View File

@@ -5,6 +5,7 @@ export default {
system: (window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light",
userTheme: localStorage.theme,
userHeartbeatBar: localStorage.heartbeatBarTheme,
styleElapsedTime: localStorage.styleElapsedTime,
statusPageTheme: "light",
forceStatusPageTheme: false,
path: "",
@@ -22,6 +23,11 @@ export default {
this.userHeartbeatBar = "normal";
}
// Default Elapsed Time Style
if (!this.styleElapsedTime) {
this.styleElapsedTime = "no-line";
}
document.body.classList.add(this.theme);
this.updateThemeColorMeta();
},
@@ -68,6 +74,10 @@ export default {
localStorage.theme = to;
},
styleElapsedTime(to, from) {
localStorage.styleElapsedTime = to;
},
theme(to, from) {
document.body.classList.remove(from);
document.body.classList.add(this.theme);