From 71d94dda5e7cff5f1689c08af9ed85abee0cd1f4 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Thu, 19 Mar 2026 21:45:27 +0100 Subject: [PATCH] Add file sync status display in LibraryManager --- src/LibraryManager.jsx | 91 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 13 deletions(-) diff --git a/src/LibraryManager.jsx b/src/LibraryManager.jsx index 5073920..3a6d51a 100644 --- a/src/LibraryManager.jsx +++ b/src/LibraryManager.jsx @@ -8,6 +8,48 @@ function statusLabel(job) { return `${type} · ${job.status}${progress ? ` · ${progress}` : ''}${detail}` } +function fileSyncMeta(file) { + const sync = file?.sync || {} + const status = String(sync.status || 'pending') + const progress = Math.max(0, Math.min(100, Number(sync.progress) || 0)) + const detail = String(sync.detail || '').trim() + const error = String(sync.error || '').trim() + + if (status === 'ready') { + return { + status, + progress: 100, + label: 'Available', + detail: detail || 'Ready in chat.' + } + } + + if (status === 'failed') { + return { + status, + progress: 100, + label: 'Sync failed', + detail: error || detail || 'Heimgeist could not finish syncing this file.' + } + } + + if (status === 'syncing') { + return { + status, + progress, + label: progress > 0 ? `Syncing ${Math.round(progress)}%` : 'Syncing', + detail: detail || 'Building corpus, enrichment, embeddings, and indexes.' + } + } + + return { + status: 'pending', + progress: 6, + label: 'Queued', + detail: 'Waiting to start the full sync pipeline.' + } +} + export default function LibraryManager({ apiBase, library, @@ -96,6 +138,7 @@ export default function LibraryManager({ const activeJobs = (jobs || []).filter(job => job.slug === library.slug && (job.status === 'queued' || job.status === 'running')) const isSyncing = activeJobs.length > 0 const isReadyForChat = !!library.states?.is_indexed + const hasFailedFiles = (library.files || []).some(file => file?.sync?.status === 'failed') return (
@@ -149,9 +192,9 @@ export default function LibraryManager({
)} - {library.files?.length > 0 && !isReadyForChat && !isSyncing && ( + {hasFailedFiles && !isSyncing && (
- This database is not ready yet. Add or remove a file to trigger another full sync. + Some files did not finish syncing. Their tiles show the failure state and error details.
)} @@ -169,18 +212,40 @@ export default function LibraryManager({

Files

{library.files?.length ? (
- {library.files.map(file => ( -
-
-
{file.name || file.path}
-
{file.path}
+ {library.files.map(file => { + const sync = fileSyncMeta(file) + return ( +
+
+
{file.name || file.path}
+
{file.path}
+
+
+ {sync.label} + {sync.detail} +
+
+
+
+
+
+
+ + +
-
- - -
-
- ))} + ) + })}
) : (

No files registered yet.