feat: add thumbnails for unregistered files

- Added getUnregFilePath() helper to construct full path for unregistered files
- Updated template to use getUnregFilePath() for thumbnail loading
- Updated loadFiles() to load thumbnails for unregistered files with constructed paths
- Unregistered files now show thumbnails instead of placeholder icons
This commit is contained in:
2026-10-30 10:34:35 +08:00
parent 12c85ed125
commit 81f11d4294

View File

@@ -232,13 +232,13 @@
<div class="ms-fm-thumb-wrap">
<div class="ms-fm-badge">{{ isVideo(f) ? 'VIDEO' : (isPhoto(f) ? 'PHOTO' : 'DOC') }}</div>
<img v-if="thumbnails[unregThumbKey(f.file_path)]"
class="ms-fm-thumb ms-fm-thumb-unreg"
:src="thumbnails[unregThumbKey(f.file_path)]"
alt=""
@error="handleThumbError">
<div v-else-if="isPhoto(f) || isVideo(f)" class="ms-fm-thumb-loading ms-fm-thumb-unreg-loading" v-observe="() => loadUnregisteredThumbnail(f.file_path)">⟳</div>
<img v-if="thumbnails[unregThumbKey(getUnregFilePath(f))]"
class="ms-fm-thumb ms-fm-thumb-unreg"
:src="thumbnails[unregThumbKey(getUnregFilePath(f))]"
alt=""
@error="handleThumbError">
<div v-else-if="isPhoto(f) || isVideo(f)" class="ms-fm-thumb-loading ms-fm-thumb-unreg-loading" v-observe="() => loadUnregisteredThumbnail(getUnregFilePath(f))">⟳</div>
<div v-else class="ms-fm-doc-thumb">
<span class="ms-fm-doc-icon">📄</span>
@@ -798,6 +798,11 @@ const thumbnails = computed(() => thumbnailsCache.value)
const thumbKey = (uuid: string) => `${uuid}:30`
const unregThumbKey = (path: string) => `unreg:${path}:30`
// Get full file path for unregistered files
function getUnregFilePath(f: any): string {
return f.file_path || `/Users/accusys/momentry/var/sftpgo/data/demo/${f.file_name}`
}
function hasFaceData(f: any) {
return ['completed', 'face_mgmt_ready', 'agent_ready'].includes(f?.status)
}
@@ -1031,7 +1036,11 @@ async function loadFiles() {
if ((isPhoto(f) || isVideo(f)) && f.file_uuid) loadThumbnail(f.file_uuid)
}
for (const f of files.value) {
if ((isPhoto(f) || isVideo(f)) && !f.isRegistered && f.file_path) loadUnregisteredThumbnail(f.file_path)
if ((isPhoto(f) || isVideo(f)) && !f.isRegistered) {
// Construct full path if missing
const filePath = f.file_path || `/Users/accusys/momentry/var/sftpgo/data/demo/${f.file_name}`
if (filePath) loadUnregisteredThumbnail(filePath)
}
}
// Start status loading in background (non-blocking)
loadAllStatus()