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 */
|
/** Heartbeat bar days */
|
||||||
heartbeatBarDays: {
|
heartbeatBarDays: {
|
||||||
type: [ Number, String ],
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -70,8 +70,7 @@ export default {
|
||||||
* @returns {number} Number of days for heartbeat bar
|
* @returns {number} Number of days for heartbeat bar
|
||||||
*/
|
*/
|
||||||
normalizedHeartbeatBarDays() {
|
normalizedHeartbeatBarDays() {
|
||||||
const num = Number(this.heartbeatBarDays);
|
return Math.max(0, Math.min(365, Math.floor(this.heartbeatBarDays || 0)));
|
||||||
return isNaN(num) ? 0 : Math.max(0, Math.min(365, Math.floor(num)));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -241,7 +240,7 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
beatList: {
|
beatList: {
|
||||||
handler(val, oldVal) {
|
handler() {
|
||||||
this.move = true;
|
this.move = true;
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -297,7 +296,6 @@ export default {
|
||||||
// If maxBeat changed and we're in configured days mode, notify parent to reload data
|
// If maxBeat changed and we're in configured days mode, notify parent to reload data
|
||||||
if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
|
if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
|
||||||
this.maxBeat = newMaxBeat;
|
this.maxBeat = newMaxBeat;
|
||||||
console.log(`HeartBeat Debug: Container width changed, maxBeat=${newMaxBeat}, notifying parent`);
|
|
||||||
|
|
||||||
// Find the closest parent with reloadHeartbeatData method (StatusPage)
|
// Find the closest parent with reloadHeartbeatData method (StatusPage)
|
||||||
let parent = this.$parent;
|
let parent = this.$parent;
|
||||||
|
@ -324,33 +322,7 @@ export default {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// For server-side aggregated beats
|
// Show timestamp for all beats (both individual and aggregated)
|
||||||
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
|
|
||||||
return `${this.$root.datetime(beat.time)}${beat.msg ? ` - ${beat.msg}` : ""}`;
|
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
|
// Otherwise, use a default that will be updated when components mount
|
||||||
const targetMaxBeats = maxBeats || 50; // Default, will be updated by actual container measurement
|
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, {
|
return axios.get("/api/status-page/heartbeat/" + this.slug, {
|
||||||
params: { maxBeats: targetMaxBeats }
|
params: { maxBeats: targetMaxBeats }
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
@ -862,7 +860,6 @@ export default {
|
||||||
reloadHeartbeatData(maxBeats) {
|
reloadHeartbeatData(maxBeats) {
|
||||||
// Only reload if we have configured days (not auto mode)
|
// Only reload if we have configured days (not auto mode)
|
||||||
if (this.config && this.config.heartbeatBarDays > 0) {
|
if (this.config && this.config.heartbeatBarDays > 0) {
|
||||||
console.log(`HeartBeat Debug: Reloading with maxBeats=${maxBeats} for ${this.config.heartbeatBarDays} days`);
|
|
||||||
this.loadHeartbeatData(maxBeats);
|
this.loadHeartbeatData(maxBeats);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue