Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

✨ Adds support for status txt overrides in uptime widgets (#2321)

Alicia Sykes31dc31fd305e
diff --git a/docs/widgets.md b/docs/widgets.md
index 618dced0..5e0eb7e6 100644
--- a/docs/widgets.md
+++ b/docs/widgets.md
@@ -2811,6 +2811,7 @@ This widget displays the status of your Uptime Kuma monitors from a given status
| **`hideHistory`** | `boolean` | _Optional_ | Optionally hide the strip of recent heartbeats |
| **`hideUptime`** | `boolean` | _Optional_ | Optionally hide the 24-hour uptime percentage |
| **`hideStatus`** | `boolean` | _Optional_ | Optionally hide the up/ down status pill |
+| **`statusLabels`** | `object` | _Optional_ | Optional text overrides for the status pill, keyed by status: `up`, `down`, `pending`, `maintenance`, `unknown` |
#### Example
@@ -2845,6 +2846,7 @@ This widget displays the status of your Uptime Kuma monitors from a given status
| **`hideStatus`** | `boolean` | _Optional_ | Optionally hide the up/ down status pill |
| **`hideResponseTime`** | `boolean` | _Optional_ | Optionally hide the response time |
| **`hideUptime`** | `boolean` | _Optional_ | Optionally hide the 24-hour uptime percentage |
+| **`statusLabels`** | `object` | _Optional_ | Optional text overrides for the status pill, keyed by status: `up`, `down`, `pending`, `maintenance`, `unknown` |
Each monitor shows its status, response time and 24-hour uptime. Hover a monitor for its 30-day and 1-year uptime, and average response times. Hide any of the columns with the options above.
diff --git a/src/components/Widgets/UptimeKuma.vue b/src/components/Widgets/UptimeKuma.vue
index e125616e..3cbf4b53 100644
--- a/src/components/Widgets/UptimeKuma.vue
+++ b/src/components/Widgets/UptimeKuma.vue
@@ -77,6 +77,10 @@ export default {
hideUptime() {
return this.options.hideUptime || false;
},
+ /* Optional status pill text overrides, keyed by status (e.g. `down: Error`) */
+ statusLabels() {
+ return this.options.statusLabels || {};
+ },
/* Create authorisation header for the instance from the apiKey */
authHeaders() {
if (!this.apiKey) {
@@ -88,7 +92,8 @@ export default {
},
methods: {
getStatusText(status) {
- return (STATUSES[status] || UNKNOWN).text;
+ const { text, class: key } = STATUSES[status] || UNKNOWN;
+ return this.statusLabels[key] || text;
},
getStatusClass(status) {
return (STATUSES[status] || UNKNOWN).class;
diff --git a/src/components/Widgets/UptimeKumaStatusPage.vue b/src/components/Widgets/UptimeKumaStatusPage.vue
index 67e0c029..7eacb58e 100644
--- a/src/components/Widgets/UptimeKumaStatusPage.vue
+++ b/src/components/Widgets/UptimeKumaStatusPage.vue
@@ -79,6 +79,10 @@ export default {
hideStatus() {
return this.options.hideStatus || false;
},
+ /* Status pill text overrides */
+ statusLabels() {
+ return this.options.statusLabels || {};
+ },
endpoint() {
return `${this.host}/api/status-page/heartbeat/${this.slug}`;
},
@@ -91,7 +95,8 @@ export default {
},
methods: {
getStatusText(status) {
- return (STATUSES[status] || UNKNOWN).text;
+ const { text, class: key } = STATUSES[status] || UNKNOWN;
+ return this.statusLabels[key] || text;
},
getStatusClass(status) {
return (STATUSES[status] || UNKNOWN).class;