fix: trace debug — show Stranger_NNN for unnamed traces instead of unknown

This commit is contained in:
Accusys
2026-05-14 15:12:21 +08:00
parent 8f013cbdbc
commit c90394897d
42 changed files with 1806 additions and 1722 deletions

View File

@@ -42,6 +42,13 @@
已完成
</button>
</div>
<!-- Search input -->
<input
v-model="searchQuery"
type="text"
placeholder="搜尋檔名..."
class="bg-gray-700 border border-gray-600 rounded-lg px-3 py-2 text-white text-sm w-full md:w-48 focus:outline-none focus:border-blue-500"
/>
</div>
</div>
@@ -174,24 +181,36 @@ function setStatusFilter(status: string) {
async function fetchFiles() {
loading.value = true
error.value = null
try {
const config = getCurrentConfig()
// Call the scan endpoint to get list of files with status
// Note: /api/v1/files/scan returns unregistered files.
// We might need a combined list or call /api/v1/files for registered ones.
// For now, let's assume /api/v1/files/scan returns all files with is_registered flag.
const response: any = await httpFetch(`${config.api_base_url}/api/v1/files/scan`)
// Map scan response to our expected format
// Scan returns: { files: [ { file_uuid, file_name, is_registered, status... } ] }
files.value = response.files?.map((f: any) => ({
const scanResp = await httpFetch<any>(`${config.api_base_url}/api/v1/files/scan`)
const scanFiles: any[] = (scanResp?.files || []).map((f: any) => ({
...f,
status: f.status || (f.is_registered ? 'pending' : 'unregistered')
})) || []
// To get actual processing status, we might need to cross reference with /api/v1/files
// But for Demo, let's rely on the scan endpoint providing status.
status: f.is_registered ? 'registered_scan' : 'unregistered'
}))
// Get registered files with real processing status
let regFiles: any[] = []
try {
const regResp = await httpFetch<any>(`${config.api_base_url}/api/v1/files?page=1&page_size=100`)
regFiles = (regResp?.files || regResp?.data || []).map((f: any) => ({
...f,
status: f.status || 'pending'
}))
} catch {
// Registered files API may not be available; use scan data only
}
// Merge: scan results first, then overlay with registered statuses
const merged = new Map<string, any>()
for (const f of scanFiles) {
merged.set(f.file_path, f)
}
for (const f of regFiles) {
merged.set(f.file_path, f)
}
files.value = Array.from(merged.values())
} catch (e) {
console.error('Failed to fetch files:', e)
error.value = String(e)
@@ -201,6 +220,7 @@ async function fetchFiles() {
}
async function registerFile(filePath: string) {
if (!filePath) { alert('無法註冊:缺少檔案路徑'); return }
try {
await registerVideo(filePath)
// Refresh list
@@ -212,7 +232,9 @@ async function registerFile(filePath: string) {
}
async function unregisterFile(fileUuid: string, fileName: string) {
if (!confirm(`確定要取消註冊 "${fileName}" 嗎?這將刪除資料庫中的相關記錄。`)) {
if (!fileUuid) { alert('無法取消註冊:缺少 UUID'); return }
const displayName = fileName || '未知檔案'
if (!confirm(`確定要取消註冊 "${displayName}" 嗎?這將刪除資料庫中的相關記錄。`)) {
return
}
@@ -226,6 +248,7 @@ async function unregisterFile(fileUuid: string, fileName: string) {
}
async function startProcessing(fileUuid: string) {
if (!fileUuid) { alert('無法處理:缺少 UUID'); return }
if (!confirm('確定要開始分析處理此檔案嗎?')) return
try {
@@ -245,8 +268,8 @@ async function startProcessing(fileUuid: string) {
}
function enterWorkbench(fileUuid: string) {
// Navigate to the new Face Workbench view
router.push(`/video-detail/${fileUuid}`)
if (!fileUuid) { alert('無法開啟工作台:缺少 UUID'); return }
router.push(`/file/${fileUuid}`)
}
onMounted(fetchFiles)