mirror of https://github.com/louislam/uptime-kuma
fix: HeartbeatBar DOWN status showing green instead of red (#6081)
Co-authored-by: Frank Elsinga <frank@elsinga.de>pull/6079/head
parent
7587269b62
commit
bc2db2e36e
|
@ -17,7 +17,7 @@
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="beat"
|
class="beat"
|
||||||
:class="{ 'empty': (beat === 0 || beat === null || beat.status === null), 'down': (beat.status === DOWN), 'pending': (beat.status === PENDING), 'maintenance': (beat.status === MAINTENANCE) }"
|
:class="getBeatClasses(beat)"
|
||||||
:style="beatStyle"
|
:style="beatStyle"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -259,9 +259,9 @@ export default {
|
||||||
if (seconds < tolerance) {
|
if (seconds < tolerance) {
|
||||||
return this.$t("now");
|
return this.$t("now");
|
||||||
} else if (seconds < 60 * 60) {
|
} 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 {
|
} 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}` : ""}`;
|
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
|
* Get the aria-label for accessibility
|
||||||
* @param {object} beat Beat to get aria-label from
|
* @param {object} beat Beat to get aria-label from
|
||||||
|
|
Loading…
Reference in New Issue