[Status Page] WIP: Checkpoint

This commit is contained in:
LouisLam
2021-09-11 19:40:03 +08:00
parent 4b0a8087a2
commit 3e25f0e9d9
7 changed files with 159 additions and 18 deletions

View File

@@ -1,10 +1,11 @@
import { io } from "socket.io-client";
import { useToast } from "vue-toastification";
import axios from "axios";
const toast = useToast()
let socket;
const noSocketIOPage = [
const noSocketIOPages = [
"/status-page",
];
@@ -19,7 +20,6 @@ export default {
connected: false,
connectCount: 0,
initedSocketIO: false,
},
remember: (localStorage.remember !== "0"),
allowLoginDialog: false, // Allowed to show login dialog, but "loggedIn" have to be true too. This exists because prevent the login dialog show 0.1s in first before the socket server auth-ed.
@@ -49,7 +49,7 @@ export default {
}
// No need to connect to the socket.io for status page
if (! bypass && noSocketIOPage.includes(location.pathname)) {
if (! bypass && noSocketIOPages.includes(location.pathname)) {
return;
}
@@ -359,7 +359,7 @@ export default {
// Reconnect the socket io, if status-page to dashboard
"$route.fullPath"(newValue, oldValue) {
if (noSocketIOPage.includes(newValue)) {
if (noSocketIOPages.includes(newValue)) {
return;
}
this.initSocketIO();

View File

@@ -5,6 +5,8 @@ export default {
system: (window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light",
userTheme: localStorage.theme,
userHeartbeatBar: localStorage.heartbeatBarTheme,
statusPageTheme: "dark",
path: "",
};
},
@@ -25,14 +27,22 @@ export default {
computed: {
theme() {
if (this.userTheme === "auto") {
return this.system;
if (this.path === "/status-page") {
return this.statusPageTheme;
} else {
if (this.userTheme === "auto") {
return this.system;
}
return this.userTheme;
}
return this.userTheme;
}
},
watch: {
"$route.fullPath"(path) {
this.path = path;
},
userTheme(to, from) {
localStorage.theme = to;
},