Feat: Show elapsed time in HeartbeatBar (#3219)

* Feat: Show elapsed time in HeartbeatBar

* Chore: Fix lint

* Feat: Fix calculation & improve efficiency

* Fix: Fix getting tolerance in statusPage

* Chore: Improve comments & apply suggestions

* Optional elapsed time

---------

Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
Nelson Chan
2023-08-08 03:00:40 +08:00
committed by GitHub
parent ceb5708bfd
commit ced576feba
5 changed files with 162 additions and 7 deletions

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);