From 439f45d91e24dd1fd3ca3eb78bba178a8e4594c0 Mon Sep 17 00:00:00 2001 From: LouisLam Date: Thu, 23 Sep 2021 13:57:24 +0800 Subject: [PATCH] [status page] improve the entry --- src/layouts/Layout.vue | 17 ++--------------- src/mixins/socket.js | 1 + src/mixins/theme.js | 10 ++++++++-- src/pages/Entry.vue | 33 +++++++++++++++++++++++++++++++++ src/router.js | 8 ++++++-- 5 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 src/pages/Entry.vue diff --git a/src/layouts/Layout.vue b/src/layouts/Layout.vue index 69970689a..2cd9649dd 100644 --- a/src/layouts/Layout.vue +++ b/src/layouts/Layout.vue @@ -111,28 +111,15 @@ export default { }, watch: { - $route(to, from) { - this.init(); - }, + }, mounted() { - this.init(); + }, methods: { - async init() { - if (this.$route.name === "root") { - let entryPage = (await axios.get("/api/entry-page")).data; - - if (entryPage === "statusPage") { - this.$router.push("/status-page"); - } else { - this.$router.push("/dashboard"); - } - } - }, }, }; diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 0757dead6..badef41b4 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -6,6 +6,7 @@ let socket; const noSocketIOPages = [ "/status-page", + "/" ]; export default { diff --git a/src/mixins/theme.js b/src/mixins/theme.js index 38b6ffcac..e35f3a21e 100644 --- a/src/mixins/theme.js +++ b/src/mixins/theme.js @@ -5,7 +5,7 @@ export default { system: (window.matchMedia("(prefers-color-scheme: dark)").matches) ? "dark" : "light", userTheme: localStorage.theme, userHeartbeatBar: localStorage.heartbeatBarTheme, - statusPageTheme: "dark", + statusPageTheme: "light", path: "", }; }, @@ -27,6 +27,12 @@ export default { computed: { theme() { + + // Entry no need dark + if (this.path === "") { + return "light"; + } + if (this.path === "/status-page") { return this.statusPageTheme; } else { @@ -72,5 +78,5 @@ export default { } } } -} +}; diff --git a/src/pages/Entry.vue b/src/pages/Entry.vue new file mode 100644 index 000000000..876313ed9 --- /dev/null +++ b/src/pages/Entry.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/router.js b/src/router.js index bf5272ae3..8fc533955 100644 --- a/src/router.js +++ b/src/router.js @@ -9,20 +9,24 @@ import List from "./pages/List.vue"; import Settings from "./pages/Settings.vue"; import Setup from "./pages/Setup.vue"; import StatusPage from "./pages/StatusPage.vue"; +import Entry from "./pages/Entry.vue"; const routes = [ { path: "/", + component: Entry, + }, + { + path: "/dashboard", component: Layout, children: [ { - name: "root", path: "", component: Dashboard, children: [ { name: "DashboardHome", - path: "/dashboard", + path: "", component: DashboardHome, children: [ {