diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-09-18 16:29:55 +0200 |
---|---|---|
committer | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-09-18 16:30:32 +0200 |
commit | 5418c6291a39d27aeee471673adba742080e1ccb (patch) | |
tree | 177eb97c9aeb217231e3eafae29483a9936b41b2 | |
parent | ae1b04d1c4db540cead1dd10c458f720ae3ab99c (diff) | |
download | homer-5418c6291a39d27aeee471673adba742080e1ccb.tar.gz homer-5418c6291a39d27aeee471673adba742080e1ccb.tar.zst homer-5418c6291a39d27aeee471673adba742080e1ccb.zip |
Fix UptimeKuma status message when all sites are down #503
-rw-r--r-- | src/App.vue | 4 | ||||
-rw-r--r-- | src/components/services/UptimeKuma.vue | 24 |
2 files changed, 22 insertions, 6 deletions
diff --git a/src/App.vue b/src/App.vue index 5ab5c0d..f2089ee 100644 --- a/src/App.vue +++ b/src/App.vue | |||
@@ -207,7 +207,9 @@ export default { | |||
207 | this.currentPage = window.location.hash.substring(1) || "default"; | 207 | this.currentPage = window.location.hash.substring(1) || "default"; |
208 | 208 | ||
209 | if (this.currentPage !== "default") { | 209 | if (this.currentPage !== "default") { |
210 | let pageConfig = await this.getConfig(`assets/${this.currentPage}.yml`); | 210 | let pageConfig = await this.getConfig( |
211 | `assets/${this.currentPage}.yml` | ||
212 | ); | ||
211 | config = Object.assign(config, pageConfig); | 213 | config = Object.assign(config, pageConfig); |
212 | } | 214 | } |
213 | } catch (error) { | 215 | } catch (error) { |
diff --git a/src/components/services/UptimeKuma.vue b/src/components/services/UptimeKuma.vue index 5117a05..55232af 100644 --- a/src/components/services/UptimeKuma.vue +++ b/src/components/services/UptimeKuma.vue | |||
@@ -85,9 +85,22 @@ export default { | |||
85 | if (this.incident.incident) { | 85 | if (this.incident.incident) { |
86 | return this.incident.incident.title; | 86 | return this.incident.incident.title; |
87 | } | 87 | } |
88 | return this.pageStatus == "warn" | 88 | |
89 | ? "Partially Degraded Service" | 89 | let message = ""; |
90 | : "All Systems Operational"; | 90 | switch (this.pageStatus) { |
91 | case "good": | ||
92 | message = "All Systems Operational"; | ||
93 | break; | ||
94 | case "warn": | ||
95 | message = "Partially Degraded Service"; | ||
96 | break; | ||
97 | case "bad": | ||
98 | message = "Degraded Service"; | ||
99 | break; | ||
100 | default: | ||
101 | message = "Unknown service status"; | ||
102 | } | ||
103 | return message; | ||
91 | }, | 104 | }, |
92 | uptime: function () { | 105 | uptime: function () { |
93 | if (!this.heartbeat) { | 106 | if (!this.heartbeat) { |
@@ -105,12 +118,13 @@ export default { | |||
105 | }, | 118 | }, |
106 | methods: { | 119 | methods: { |
107 | fetchStatus: function () { | 120 | fetchStatus: function () { |
108 | this.fetch(`/api/status-page/${this.dashboard}?cachebust=${Date.now()}`) | 121 | const now = Date.now() |
122 | this.fetch(`/api/status-page/${this.dashboard}?cachebust=${now}`) | ||
109 | .catch((e) => console.error(e)) | 123 | .catch((e) => console.error(e)) |
110 | .then((resp) => (this.incident = resp)); | 124 | .then((resp) => (this.incident = resp)); |
111 | 125 | ||
112 | this.fetch( | 126 | this.fetch( |
113 | `/api/status-page/heartbeat/${this.dashboard}?cachebust=${Date.now()}` | 127 | `/api/status-page/heartbeat/${this.dashboard}?cachebust=${now}` |
114 | ) | 128 | ) |
115 | .catch((e) => console.error(e)) | 129 | .catch((e) => console.error(e)) |
116 | .then((resp) => (this.heartbeat = resp)); | 130 | .then((resp) => (this.heartbeat = resp)); |