Skip to content

Commit 8d7e213

Browse files
committed
Simplified with slicing, because resizing and reloading data from the server becomes way too complex for a feature like this.
1 parent 8589c63 commit 8d7e213

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

src/components/HeartbeatBar.vue

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,15 @@ export default {
144144
return [];
145145
}
146146
147-
// If heartbeat days is configured (not auto), data is already aggregated from server
148-
if (this.normalizedHeartbeatBarDays > 0 && this.beatList.length > 0) {
149-
// Show all beats from server - they are already properly aggregated
150-
return this.beatList;
151-
}
152-
153-
// Original logic for auto mode (heartbeatBarDays = 0)
154-
let placeholders = [];
155-
156147
// Handle case where maxBeat is -1 (no limit)
157148
if (this.maxBeat <= 0) {
158149
return this.beatList;
159150
}
160151
152+
// For both configured days and auto mode, show only what fits on screen
153+
// The server provides consistent data (300 buckets for configured days, 100 beats for auto)
154+
// We slice to show only what fits in the current container width
155+
let placeholders = [];
161156
let start = this.beatList.length - this.maxBeat;
162157
163158
if (this.move) {
@@ -323,22 +318,7 @@ export default {
323318
resize() {
324319
if (this.$refs.wrap) {
325320
const newMaxBeat = Math.floor(this.$refs.wrap.clientWidth / (this.beatWidth + this.beatHoverAreaPadding * 2));
326-
327-
// If maxBeat changed and we're in configured days mode, notify parent to reload data
328-
if (newMaxBeat !== this.maxBeat && this.normalizedHeartbeatBarDays > 0) {
329-
this.maxBeat = newMaxBeat;
330-
331-
// Find the closest parent with reloadHeartbeatData method (StatusPage)
332-
let parent = this.$parent;
333-
while (parent && !parent.reloadHeartbeatData) {
334-
parent = parent.$parent;
335-
}
336-
if (parent && parent.reloadHeartbeatData) {
337-
parent.reloadHeartbeatData(newMaxBeat);
338-
}
339-
} else {
340-
this.maxBeat = newMaxBeat;
341-
}
321+
this.maxBeat = newMaxBeat;
342322
}
343323
},
344324

0 commit comments

Comments
 (0)