debug: add console logs to PeopleView onMounted
This commit is contained in:
@@ -161,11 +161,14 @@ const skippedPeople = computed(() => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const result: any = await invoke('get_people', { page: 1, perPage: 1000 })
|
console.log('PeopleView: calling getPeople...')
|
||||||
|
const result: any = await invoke('getPeople', { page: 1, perPage: 1000 })
|
||||||
|
console.log('PeopleView: getPeople result:', Array.isArray(result) ? result.length : typeof result)
|
||||||
people.value = (Array.isArray(result) ? result : []).map((p: any) => ({
|
people.value = (Array.isArray(result) ? result : []).map((p: any) => ({
|
||||||
...p,
|
...p,
|
||||||
status: p.status || 'confirmed'
|
status: p.status || 'confirmed'
|
||||||
}))
|
}))
|
||||||
|
console.log('PeopleView: people.value length:', people.value.length)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to load people:', e)
|
console.error('Failed to load people:', e)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -190,7 +193,7 @@ function onSearch() {
|
|||||||
searchTimer = setTimeout(async () => {
|
searchTimer = setTimeout(async () => {
|
||||||
if (!searchQuery.value.trim()) { isSearching.value = false; return }
|
if (!searchQuery.value.trim()) { isSearching.value = false; return }
|
||||||
try {
|
try {
|
||||||
const results: any = await invoke('search_identities', { query: searchQuery.value, limit: 50 })
|
const results: any = await invoke('searchIdentities', { query: searchQuery.value, limit: 50 })
|
||||||
searchResults.value = Array.isArray(results) ? results : []
|
searchResults.value = Array.isArray(results) ? results : []
|
||||||
isSearching.value = true
|
isSearching.value = true
|
||||||
} catch (e) { console.error('Search failed:', e) }
|
} catch (e) { console.error('Search failed:', e) }
|
||||||
@@ -199,12 +202,12 @@ function onSearch() {
|
|||||||
|
|
||||||
async function loadProfile(uuid: string) {
|
async function loadProfile(uuid: string) {
|
||||||
if (profiles.value[uuid]) return
|
if (profiles.value[uuid]) return
|
||||||
try { profiles.value[uuid] = await invoke('get_identity_profile', { uuid }) } catch {}
|
try { profiles.value[uuid] = await invoke('getIdentityProfile', { uuid }) } catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadCandidateThumb(uuid: string) {
|
async function loadCandidateThumb(uuid: string) {
|
||||||
if (!uuid || candidateThumbs.value[uuid]) return
|
if (!uuid || candidateThumbs.value[uuid]) return
|
||||||
try { candidateThumbs.value[uuid] = await invoke('get_thumbnail', { uuid, frame: 30 }) } catch {}
|
try { candidateThumbs.value[uuid] = await invoke('getThumbnail', { uuid, frame: 30 }) } catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectPerson(p: any) {
|
function selectPerson(p: any) {
|
||||||
@@ -221,7 +224,7 @@ async function toggleStar() {
|
|||||||
async function confirmDelete() {
|
async function confirmDelete() {
|
||||||
if (!confirm(`Delete "${selected.value.name}"?`)) return
|
if (!confirm(`Delete "${selected.value.name}"?`)) return
|
||||||
try {
|
try {
|
||||||
await invoke('delete_identity', { uuid: selected.value.identity_uuid })
|
await invoke('deleteIdentity', { uuid: selected.value.identity_uuid })
|
||||||
people.value = people.value.filter((p: any) => p.identity_uuid !== selected.value.identity_uuid)
|
people.value = people.value.filter((p: any) => p.identity_uuid !== selected.value.identity_uuid)
|
||||||
selected.value = null
|
selected.value = null
|
||||||
} catch (e) { console.error('Failed to delete:', e) }
|
} catch (e) { console.error('Failed to delete:', e) }
|
||||||
@@ -237,7 +240,7 @@ async function loadCandidates() {
|
|||||||
async function bindCandidate(c: any) {
|
async function bindCandidate(c: any) {
|
||||||
if (!selected.value) return
|
if (!selected.value) return
|
||||||
try {
|
try {
|
||||||
await invoke('bind_face', { uuid: selected.value.identity_uuid, faceId: String(c.id), fileUuid: c.file_uuid })
|
await invoke('bindFace', { uuid: selected.value.identity_uuid, faceId: String(c.id), fileUuid: c.file_uuid })
|
||||||
showCandidates.value = false
|
showCandidates.value = false
|
||||||
if (selected.value) selectPerson(selected.value)
|
if (selected.value) selectPerson(selected.value)
|
||||||
} catch (e) { console.error('Bind failed:', e) }
|
} catch (e) { console.error('Bind failed:', e) }
|
||||||
@@ -246,7 +249,7 @@ async function bindCandidate(c: any) {
|
|||||||
async function confirmMerge() {
|
async function confirmMerge() {
|
||||||
if (!selected.value || !mergeTarget.value) return
|
if (!selected.value || !mergeTarget.value) return
|
||||||
try {
|
try {
|
||||||
await invoke('merge_identities', { uuid: selected.value.identity_uuid, intoUuid: mergeTarget.value })
|
await invoke('mergeIdentities', { uuid: selected.value.identity_uuid, intoUuid: mergeTarget.value })
|
||||||
showMerge.value = false
|
showMerge.value = false
|
||||||
people.value = people.value.filter((p: any) => p.identity_uuid !== selected.value.identity_uuid)
|
people.value = people.value.filter((p: any) => p.identity_uuid !== selected.value.identity_uuid)
|
||||||
selected.value = null
|
selected.value = null
|
||||||
@@ -282,12 +285,12 @@ function ctxAction(action: string) {
|
|||||||
const idx = people.value.findIndex((x: any) => x.identity_uuid === p.identity_uuid)
|
const idx = people.value.findIndex((x: any) => x.identity_uuid === p.identity_uuid)
|
||||||
if (idx >= 0) people.value[idx].starred = p.starred
|
if (idx >= 0) people.value[idx].starred = p.starred
|
||||||
} else if (action === 'skip') {
|
} else if (action === 'skip') {
|
||||||
invoke('update_identity_status', { uuid: p.identity_uuid, status: 'skipped' }).then(() => {
|
invoke('updateIdentityStatus', { uuid: p.identity_uuid, status: 'skipped' }).then(() => {
|
||||||
const idx = people.value.findIndex((x: any) => x.identity_uuid === p.identity_uuid)
|
const idx = people.value.findIndex((x: any) => x.identity_uuid === p.identity_uuid)
|
||||||
if (idx >= 0) people.value[idx].status = 'skipped'
|
if (idx >= 0) people.value[idx].status = 'skipped'
|
||||||
}).catch(e => console.error('Skip failed:', e))
|
}).catch(e => console.error('Skip failed:', e))
|
||||||
} else if (action === 'confirm') {
|
} else if (action === 'confirm') {
|
||||||
invoke('update_identity_status', { uuid: p.identity_uuid, status: 'confirmed' }).then(() => {
|
invoke('updateIdentityStatus', { uuid: p.identity_uuid, status: 'confirmed' }).then(() => {
|
||||||
const idx = people.value.findIndex((x: any) => x.identity_uuid === p.identity_uuid)
|
const idx = people.value.findIndex((x: any) => x.identity_uuid === p.identity_uuid)
|
||||||
if (idx >= 0) people.value[idx].status = 'confirmed'
|
if (idx >= 0) people.value[idx].status = 'confirmed'
|
||||||
}).catch(e => console.error('Confirm failed:', e))
|
}).catch(e => console.error('Confirm failed:', e))
|
||||||
|
|||||||
Reference in New Issue
Block a user