diff --git a/src/components/HeartbeatBar.vue b/src/components/HeartbeatBar.vue index ad133821e..49377e1bc 100644 --- a/src/components/HeartbeatBar.vue +++ b/src/components/HeartbeatBar.vue @@ -17,7 +17,7 @@ >
@@ -259,9 +259,9 @@ export default { if (seconds < tolerance) { return this.$t("now"); } else if (seconds < 60 * 60) { - return this.$t("time ago", [ (seconds / 60).toFixed(0) + "m" ]); + return this.$t("time ago", [ (seconds / 60).toFixed(0) + "m" ] ); } else { - return this.$t("time ago", [ (seconds / 60 / 60).toFixed(0) + "h" ]); + return this.$t("time ago", [ (seconds / 60 / 60).toFixed(0) + "h" ] ); } } }, @@ -357,6 +357,25 @@ export default { return `${this.$root.datetime(beat.time)}${beat.msg ? ` - ${beat.msg}` : ""}`; }, + /** + * Get CSS classes for a beat element based on its status + * @param {object} beat - Beat object containing status information + * @returns {object} Object with CSS class names as keys and boolean values + */ + getBeatClasses(beat) { + if (beat === 0 || beat === null || beat?.status === null) { + return { empty: true }; + } + + const status = Number(beat.status); + + return { + down: status === DOWN, + pending: status === PENDING, + maintenance: status === MAINTENANCE + }; + }, + /** * Get the aria-label for accessibility * @param {object} beat Beat to get aria-label from