chore: Fix various bugs in calendar log handling
This commit is contained in:
parent
7f83b67a28
commit
7920ffa28a
|
|
@ -21,6 +21,7 @@
|
|||
"standard": "^17.1.2",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.3.1",
|
||||
"vue": "^3.5.26",
|
||||
"vue-i18n": "^11.2.8",
|
||||
"vue-router": "^4.6.4"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
"standard": "^17.1.2",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.3.1",
|
||||
"vue": "^3.5.26",
|
||||
"vue-i18n": "^11.2.8",
|
||||
"vue-router": "^4.6.4"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,14 +77,40 @@ async function fetchLogs() {
|
|||
error.value = null
|
||||
|
||||
try {
|
||||
// Fetch a large number of logs to populate the calendar
|
||||
// We'll fetch more than a single page to get better calendar coverage
|
||||
const args = {
|
||||
"startOffset": BigInt(0),
|
||||
}
|
||||
// Currently fetches only the default page (startOffset: 0)
|
||||
// Multi-page fetching: loop through pages until no more logs or limit reached
|
||||
const allLogs = []
|
||||
let startOffset = BigInt(0)
|
||||
const maxLogs = 10000 // Reasonable limit to prevent excessive API calls
|
||||
const pageSize = 100 // Typical page size, will be updated from API response
|
||||
|
||||
while (allLogs.length < maxLogs) {
|
||||
const args = {
|
||||
"startOffset": startOffset,
|
||||
}
|
||||
|
||||
const response = await window.client.getLogs(args)
|
||||
logs.value = response.logs || []
|
||||
const response = await window.client.getLogs(args)
|
||||
const pageLogs = response.logs || []
|
||||
|
||||
// If no logs returned, we've reached the end
|
||||
if (pageLogs.length === 0) {
|
||||
break
|
||||
}
|
||||
|
||||
// Append logs from this page
|
||||
allLogs.push(...pageLogs)
|
||||
|
||||
// Update offset for next page
|
||||
const currentPageSize = Number(response.pageSize) || pageLogs.length
|
||||
startOffset += BigInt(currentPageSize)
|
||||
|
||||
// If we got fewer logs than the page size, we've reached the end
|
||||
if (pageLogs.length < currentPageSize) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
logs.value = allLogs
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch logs:', err)
|
||||
error.value = 'Failed to load logs'
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<Section :title="t('logs.title')" :padding="false">
|
||||
<template #toolbar>
|
||||
<router-link to="/logs/calendar" class="button neutral">
|
||||
Calendar
|
||||
{{ t('logs.calendar') }}
|
||||
</router-link>
|
||||
<label class="input-with-icons">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
|
||||
|
|
@ -130,7 +130,8 @@ const filteredLogs = computed(() => {
|
|||
result = result.filter(log => {
|
||||
if (!log.datetimeStarted) return false
|
||||
const logDate = new Date(log.datetimeStarted)
|
||||
const logDateString = `${logDate.getFullYear()}-${String(logDate.getMonth() + 1).padStart(2, '0')}-${String(logDate.getDate()).padStart(2, '0')}`
|
||||
// Normalize to UTC ISO date string (YYYY-MM-DD) for comparison
|
||||
const logDateString = logDate.toISOString().split('T')[0]
|
||||
return logDateString === selectedDate.value
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@
|
|||
"logs.action": "Aktion",
|
||||
"logs.back-to-list": "Zurück zur Liste",
|
||||
"logs.blocked": "Blockiert",
|
||||
"logs.calendar": "Kalender",
|
||||
"logs.calendar-title": "Protokoll-Kalender",
|
||||
"logs.clear-date-filter": "Datumsfilter löschen",
|
||||
"logs.clear-filter": "Suchfilter löschen",
|
||||
"logs.completed": "Abgeschlossen",
|
||||
"logs.exit-code": "Ausführungscode",
|
||||
|
|
@ -77,7 +79,9 @@
|
|||
"logs.action": "Action",
|
||||
"logs.back-to-list": "Back to List",
|
||||
"logs.blocked": "Blocked",
|
||||
"logs.calendar": "Calendar",
|
||||
"logs.calendar-title": "Logs Calendar",
|
||||
"logs.clear-date-filter": "Clear date filter",
|
||||
"logs.clear-filter": "Clear search filter",
|
||||
"logs.completed": "Completed",
|
||||
"logs.exit-code": "Exit code",
|
||||
|
|
@ -125,7 +129,9 @@
|
|||
"logs.action": "Acción",
|
||||
"logs.back-to-list": "Volver a la Lista",
|
||||
"logs.blocked": "Bloqueado",
|
||||
"logs.calendar": "Calendario",
|
||||
"logs.calendar-title": "Calendario de Registros",
|
||||
"logs.clear-date-filter": "Limpiar filtro de fecha",
|
||||
"logs.clear-filter": "Limpiar filtro de búsqueda",
|
||||
"logs.completed": "Completado",
|
||||
"logs.exit-code": "Código de salida",
|
||||
|
|
@ -173,7 +179,9 @@
|
|||
"logs.action": "Azione",
|
||||
"logs.back-to-list": "Torna all'Elenco",
|
||||
"logs.blocked": "Bloccato",
|
||||
"logs.calendar": "Calendario",
|
||||
"logs.calendar-title": "Calendario dei Registri",
|
||||
"logs.clear-date-filter": "Cancella filtro data",
|
||||
"logs.clear-filter": "Cancella filtro di ricerca",
|
||||
"logs.completed": "Completato",
|
||||
"logs.exit-code": "Codice di uscita",
|
||||
|
|
@ -221,7 +229,9 @@
|
|||
"logs.action": "动作",
|
||||
"logs.back-to-list": "返回列表",
|
||||
"logs.blocked": "阻塞",
|
||||
"logs.calendar": "日历",
|
||||
"logs.calendar-title": "日志日历",
|
||||
"logs.clear-date-filter": "清除日期筛选器",
|
||||
"logs.clear-filter": "清除搜索筛选器",
|
||||
"logs.completed": "完成",
|
||||
"logs.exit-code": "退出代码",
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ translations:
|
|||
logs.exit-code: Ausführungscode
|
||||
logs.completed: Abgeschlossen
|
||||
logs.clear-filter: Suchfilter löschen
|
||||
logs.clear-date-filter: Datumsfilter löschen
|
||||
logs.calendar: Kalender
|
||||
logs.calendar-title: Protokoll-Kalender
|
||||
logs.back-to-list: Zurück zur Liste
|
||||
diagnostics.get-support: Unterstützung erhalten
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ translations:
|
|||
logs.exit-code: Exit code
|
||||
logs.completed: Completed
|
||||
logs.clear-filter: Clear search filter
|
||||
logs.clear-date-filter: Clear date filter
|
||||
logs.calendar: Calendar
|
||||
logs.calendar-title: Logs Calendar
|
||||
logs.back-to-list: Back to List
|
||||
diagnostics.get-support: Get support
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ translations:
|
|||
logs.exit-code: Código de salida
|
||||
logs.completed: Completado
|
||||
logs.clear-filter: Limpiar filtro de búsqueda
|
||||
logs.clear-date-filter: Limpiar filtro de fecha
|
||||
logs.calendar: Calendario
|
||||
logs.calendar-title: Calendario de Registros
|
||||
logs.back-to-list: Volver a la Lista
|
||||
diagnostics.get-support: Obtener soporte
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ translations:
|
|||
logs.exit-code: Codice di uscita
|
||||
logs.completed: Completato
|
||||
logs.clear-filter: Cancella filtro di ricerca
|
||||
logs.clear-date-filter: Cancella filtro data
|
||||
logs.calendar: Calendario
|
||||
logs.calendar-title: Calendario dei Registri
|
||||
logs.back-to-list: Torna all'Elenco
|
||||
diagnostics.get-support: Ottenere supporto
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ translations:
|
|||
logs.exit-code: 退出代码
|
||||
logs.completed: 完成
|
||||
logs.clear-filter: 清除搜索筛选器
|
||||
logs.clear-date-filter: 清除日期筛选器
|
||||
logs.calendar: 日历
|
||||
logs.calendar-title: 日志日历
|
||||
logs.back-to-list: 返回列表
|
||||
diagnostics.get-support: 获取支持
|
||||
|
|
|
|||
Loading…
Reference in New Issue