mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 09:19:29 +08:00
Added expiry changes to status page and fixes
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
@click="$refs.monitorSettingDialog.show(group, monitor)"
|
||||
/>
|
||||
</span>
|
||||
<p v-if="showCertificateExpiry" class="item-name"> Expiry: {{ formatExpiry(monitor) }} </p>
|
||||
<span class="badge rounded-pill" :class=" 'bg-' + certExpiryColor(monitor)"> {{ $t("Expiry") }}: {{ formattedCertExpiryMessage(monitor) }} </span>
|
||||
</div>
|
||||
<div v-if="showTags" class="tags">
|
||||
<Tag v-for="tag in monitor.element.tags" :key="tag" :item="tag" :size="'sm'" />
|
||||
@@ -165,13 +165,27 @@ export default {
|
||||
* @param {Object} monitor Monitor to show expiry for
|
||||
* @returns {string}
|
||||
*/
|
||||
formatExpiry(monitor) {
|
||||
if (monitor?.element?.validCert) {
|
||||
return monitor.element.certExpiryDaysRemaining + " days";
|
||||
formattedCertExpiryMessage(monitor) {
|
||||
if (monitor?.element?.validCert && monitor?.element?.certExpiryDaysRemaining) {
|
||||
return monitor.element.certExpiryDaysRemaining + " " + this.$tc("day", monitor.element.certExpiryDaysRemaining);
|
||||
} else if (monitor?.element?.validCert === false) {
|
||||
return this.$t("noOrBadCertificate");
|
||||
} else {
|
||||
return monitor.element.certExpiryDaysRemaining;
|
||||
return "";
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns certificate expiry based on days remaining
|
||||
* @param {Object} monitor Monitor to show expiry for
|
||||
* @returns {string}
|
||||
*/
|
||||
certExpiryColor(monitor) {
|
||||
if (monitor?.element?.validCert) {
|
||||
return monitor.element.certExpiryDaysRemaining > 7 ? "primary" : "danger";
|
||||
}
|
||||
return "danger";
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user