mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-19 18:56:48 +02:00
cleanup
This commit is contained in:
parent
adc362a2a8
commit
c02301597a
2 changed files with 4 additions and 35 deletions
|
@ -49,7 +49,7 @@ export default {
|
|||
},
|
||||
/** Heartbeat bar days */
|
||||
heartbeatBarDays: {
|
||||
type: [ Number, String ],
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
|
@ -70,8 +70,7 @@ export default {
|
|||
* @returns {number} Number of days for heartbeat bar
|
||||
*/
|
||||
normalizedHeartbeatBarDays() {
|
||||
const num = Number(this.heartbeatBarDays);
|
||||
return isNaN(num) ? 0 : Math.max(0, Math.min(365, Math.floor(num)));
|
||||
return Math.max(0, Math.min(365, Math.floor(this.heartbeatBarDays || 0)));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -241,7 +240,7 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
beatList: {
|
||||
handler(val, oldVal) {
|
||||
handler() {
|
||||
this.move = true;
|
||||
|
||||
setTimeout(() => {
|
||||
|
@ -297,7 +296,6 @@ export default {
|
|||
// If maxBeat changed and we're in configured days mode, notify parent to reload data
|
||||
if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
|
||||
this.maxBeat = newMaxBeat;
|
||||
console.log(`HeartBeat Debug: Container width changed, maxBeat=${newMaxBeat}, notifying parent`);
|
||||
|
||||
// Find the closest parent with reloadHeartbeatData method (StatusPage)
|
||||
let parent = this.$parent;
|
||||
|
@ -324,33 +322,7 @@ export default {
|
|||
return "";
|
||||
}
|
||||
|
||||
// For server-side aggregated beats
|
||||
if (beat._aggregated && beat._counts) {
|
||||
const counts = beat._counts;
|
||||
const total = counts.up + counts.down + counts.maintenance + counts.pending;
|
||||
|
||||
// Use start time for display if available
|
||||
const displayTime = beat._startTime ? beat._startTime : beat.time;
|
||||
|
||||
if (total === 0) {
|
||||
return `${this.$root.datetime(displayTime)}: No Data`;
|
||||
}
|
||||
|
||||
let statusText = "";
|
||||
if (counts.down > 0) {
|
||||
statusText = "Down";
|
||||
} else if (counts.maintenance > 0) {
|
||||
statusText = "Maintenance";
|
||||
} else if (counts.pending > 0) {
|
||||
statusText = "Pending";
|
||||
} else if (counts.up > 0) {
|
||||
statusText = "Up";
|
||||
}
|
||||
|
||||
return `${this.$root.datetime(displayTime)}: ${statusText} (${total} checks)`;
|
||||
}
|
||||
|
||||
// For individual beats, show timestamp
|
||||
// Show timestamp for all beats (both individual and aggregated)
|
||||
return `${this.$root.datetime(beat.time)}${beat.msg ? ` - ${beat.msg}` : ""}`;
|
||||
},
|
||||
|
||||
|
|
|
@ -795,8 +795,6 @@ export default {
|
|||
// Otherwise, use a default that will be updated when components mount
|
||||
const targetMaxBeats = maxBeats || 50; // Default, will be updated by actual container measurement
|
||||
|
||||
console.log(`HeartBeat Debug: Using maxBeats=${targetMaxBeats}, provided=${maxBeats !== null}`);
|
||||
|
||||
return axios.get("/api/status-page/heartbeat/" + this.slug, {
|
||||
params: { maxBeats: targetMaxBeats }
|
||||
}).then((res) => {
|
||||
|
@ -862,7 +860,6 @@ export default {
|
|||
reloadHeartbeatData(maxBeats) {
|
||||
// Only reload if we have configured days (not auto mode)
|
||||
if (this.config && this.config.heartbeatBarDays > 0) {
|
||||
console.log(`HeartBeat Debug: Reloading with maxBeats=${maxBeats} for ${this.config.heartbeatBarDays} days`);
|
||||
this.loadHeartbeatData(maxBeats);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue