feat: update_identity_status command + People ignore action
This commit is contained in:
@@ -171,8 +171,10 @@ async fn get_people(_page: usize, _per_page: usize) -> Result<Vec<PersonInfo>, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eprintln!("[get_people] page {} got {} identities", page, identities.len());
|
eprintln!("[get_people] page {} got {} identities, total so far: {}", page, identities.len(), all_people.len());
|
||||||
if identities.len() < 100 { break; }
|
|
||||||
|
// API max is 20 per page, keep fetching until we get fewer than 20
|
||||||
|
if identities.len() < 20 { break; }
|
||||||
page += 1;
|
page += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,6 +299,20 @@ async fn update_identity_name(uuid: String, name: String) -> Result<(), String>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command(rename_all = "camelCase")]
|
||||||
|
async fn update_identity_status(uuid: String, status: String) -> Result<(), String> {
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
let url = format!("{}/api/v1/identity/{}?api_key={}", CORE_API, uuid, API_KEY);
|
||||||
|
let resp = client.patch(&url)
|
||||||
|
.json(&serde_json::json!({"status": status}))
|
||||||
|
.send().await
|
||||||
|
.map_err(|e| format!("Request failed: {}", e))?;
|
||||||
|
if !resp.status().is_success() {
|
||||||
|
return Err(format!("Update failed: {}", resp.status()));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command(rename_all = "camelCase")]
|
#[tauri::command(rename_all = "camelCase")]
|
||||||
async fn delete_identity(uuid: String) -> Result<(), String> {
|
async fn delete_identity(uuid: String) -> Result<(), String> {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
@@ -415,6 +431,7 @@ fn main() {
|
|||||||
get_video_stream,
|
get_video_stream,
|
||||||
get_identity_profile,
|
get_identity_profile,
|
||||||
update_identity_name,
|
update_identity_name,
|
||||||
|
update_identity_status,
|
||||||
delete_identity,
|
delete_identity,
|
||||||
search_identities,
|
search_identities,
|
||||||
get_face_candidates,
|
get_face_candidates,
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
|
|
||||||
<div v-if="ctxMenu.show" class="ctx-menu" :style="{ left: ctxMenu.x + 'px', top: ctxMenu.y + 'px' }">
|
<div v-if="ctxMenu.show" class="ctx-menu" :style="{ left: ctxMenu.x + 'px', top: ctxMenu.y + 'px' }">
|
||||||
<div class="ctx-item" @click="ctxAction('star')">{{ ctxMenu.person?.starred ? '☆ Unstar' : '★ Star' }}</div>
|
<div class="ctx-item" @click="ctxAction('star')">{{ ctxMenu.person?.starred ? '☆ Unstar' : '★ Star' }}</div>
|
||||||
|
<div class="ctx-item" @click="ctxAction('ignore')">{{ ctxMenu.person?.ignored ? '↺ Unignore' : '⊘ Ignore' }}</div>
|
||||||
<div class="ctx-item" @click="ctxAction('rename')">✎ Rename</div>
|
<div class="ctx-item" @click="ctxAction('rename')">✎ Rename</div>
|
||||||
<div class="ctx-item" @click="ctxAction('merge')">⇄ Merge</div>
|
<div class="ctx-item" @click="ctxAction('merge')">⇄ Merge</div>
|
||||||
<div class="ctx-divider"></div>
|
<div class="ctx-divider"></div>
|
||||||
@@ -265,6 +266,10 @@ function ctxAction(action: string) {
|
|||||||
p.starred = !p.starred
|
p.starred = !p.starred
|
||||||
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 === 'ignore') {
|
||||||
|
invoke('update_identity_status', { uuid: p.identity_uuid, status: 'skipped' }).then(() => {
|
||||||
|
people.value = people.value.filter((x: any) => x.identity_uuid !== p.identity_uuid)
|
||||||
|
}).catch(e => console.error('Ignore failed:', e))
|
||||||
} else if (action === 'rename') {
|
} else if (action === 'rename') {
|
||||||
selectPerson(p)
|
selectPerson(p)
|
||||||
setTimeout(() => startEditName(), 100)
|
setTimeout(() => startEditName(), 100)
|
||||||
|
|||||||
Reference in New Issue
Block a user