Browse Source

fix logs page not updating group headers if left open for a day.

main
Gisle Aune 4 years ago
parent
commit
73855ffdd1
  1. 4
      svelte-ui/src/pages/LogsPage.svelte

4
svelte-ui/src/pages/LogsPage.svelte

@ -6,12 +6,14 @@
import EmptyList from "../components/EmptyList.svelte"; import EmptyList from "../components/EmptyList.svelte";
import RefreshSelection from "../components/RefreshSelection.svelte"; import RefreshSelection from "../components/RefreshSelection.svelte";
import DateRangeSelect from "../components/DateRangeSelect.svelte"; import DateRangeSelect from "../components/DateRangeSelect.svelte";
import EveryMinute from "../components/EveryMinute.svelte";
let groupedLogs: {day: number, text: string, logs: LogResult[]}[] = []; let groupedLogs: {day: number, text: string, logs: LogResult[]}[] = [];
let minTime = formatFormTime($logStore.filter.minTime || startOfWeek(new Date())); let minTime = formatFormTime($logStore.filter.minTime || startOfWeek(new Date()));
let maxTime = formatFormTime(endOfWeek(new Date())); let maxTime = formatFormTime(endOfWeek(new Date()));
let emptyMessage = `No logs since ${formatWeekdayDate(minTime)}.`; let emptyMessage = `No logs since ${formatWeekdayDate(minTime)}.`;
let error = ""; let error = "";
let now = new Date();
$: { $: {
const min = new Date(minTime); const min = new Date(minTime);
@ -48,7 +50,6 @@
groupedLogs = []; groupedLogs = [];
if ($logStore.logs.length > 0) { if ($logStore.logs.length > 0) {
const now = new Date();
const firstUtc = Math.floor(Date.parse($logStore.logs[0].loggedTime) / 86400000) * 86400000; const firstUtc = Math.floor(Date.parse($logStore.logs[0].loggedTime) / 86400000) * 86400000;
const todayUtc = Math.floor(now.getTime() / 86400000) * 86400000; const todayUtc = Math.floor(now.getTime() / 86400000) * 86400000;
const first = firstUtc + (now.getTimezoneOffset() * 60000); const first = firstUtc + (now.getTimezoneOffset() * 60000);
@ -107,6 +108,7 @@
</div> </div>
</div> </div>
<RefreshSelection /> <RefreshSelection />
<EveryMinute bind:now={now} />
<style> <style>
div.error { div.error {

Loading…
Cancel
Save