1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 06:28:42 +01:00

Uses from and to find a good time range

This commit is contained in:
Amir
2019-12-18 17:24:21 -08:00
parent 6f3917edb8
commit 04b219236c

View File

@@ -60,11 +60,12 @@ export default {
this.$once("hook:beforeDestroy", () => this.es.close());
},
async loadOlderLogs() {
if (this.messages.length < 100) return;
if (this.messages.length < 300) return;
const to = this.messages[0].date;
const from = new Date(to);
from.setMinutes(from.getMinutes() - 10);
const last = this.messages[299].date;
const delta = to - last;
const from = new Date(to.getTime() + delta);
const logs = await (
await fetch(`/api/logs?id=${this.id}&from=${from.toISOString()}&to=${to.toISOString()}`)
).text();