X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fcomponents%2Fservices%2FUptimeKuma.vue;h=55232af3ffc094e0c0568dd1561b6580d90d303a;hb=51ba5ff503605194516b81e322e98263f60e58b2;hp=3be53b8b9d44a6fa3863fd1fc9a9a73fc55b209e;hpb=2b48d1c057bf24776fb0538c7db0a0b156e667c5;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/src/components/services/UptimeKuma.vue b/src/components/services/UptimeKuma.vue index 3be53b8..55232af 100644 --- a/src/components/services/UptimeKuma.vue +++ b/src/components/services/UptimeKuma.vue @@ -85,9 +85,22 @@ export default { if (this.incident.incident) { return this.incident.incident.title; } - return this.pageStatus == "warn" - ? "Partially Degraded Service" - : "All Systems Operational"; + + let message = ""; + switch (this.pageStatus) { + case "good": + message = "All Systems Operational"; + break; + case "warn": + message = "Partially Degraded Service"; + break; + case "bad": + message = "Degraded Service"; + break; + default: + message = "Unknown service status"; + } + return message; }, uptime: function () { if (!this.heartbeat) { @@ -99,17 +112,19 @@ export default { }, }, created() { + /* eslint-disable */ this.item.url = `${this.item.url}/status/${this.dashboard}`; this.fetchStatus(); }, methods: { fetchStatus: function () { - this.fetch(`/api/status-page/${this.dashboard}?cachebust=${Date.now()}`) + const now = Date.now() + this.fetch(`/api/status-page/${this.dashboard}?cachebust=${now}`) .catch((e) => console.error(e)) .then((resp) => (this.incident = resp)); this.fetch( - `/api/status-page/heartbeat/${this.dashboard}?cachebust=${Date.now()}` + `/api/status-page/heartbeat/${this.dashboard}?cachebust=${now}` ) .catch((e) => console.error(e)) .then((resp) => (this.heartbeat = resp));