Tags on the desktop app
A Tags group in the sidebar filters the list, the item page shows its tags with an Edit tags action, new logins take tags, and search matches tags. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+18
-1
@@ -68,6 +68,7 @@ struct Summary {
|
||||
urls: Vec<String>,
|
||||
favorite: bool,
|
||||
has_totp: bool,
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -79,6 +80,7 @@ struct Detail {
|
||||
urls: Vec<String>,
|
||||
totp: Option<String>,
|
||||
notes: Option<String>,
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -88,6 +90,8 @@ struct NewLogin {
|
||||
password: Option<String>,
|
||||
urls: Vec<String>,
|
||||
totp: Option<String>,
|
||||
#[serde(default)]
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -228,6 +232,7 @@ fn list_items(app: State<'_, App>) -> CmdResult<Vec<Summary>> {
|
||||
urls: s.urls,
|
||||
favorite: s.favorite,
|
||||
has_totp: s.has_totp,
|
||||
tags: s.tags,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
@@ -243,9 +248,20 @@ fn get_item(app: State<'_, App>, id: String) -> CmdResult<Detail> {
|
||||
urls: d.urls,
|
||||
totp: d.totp,
|
||||
notes: d.notes,
|
||||
tags: d.tags,
|
||||
})
|
||||
}
|
||||
|
||||
/// Replaces an item's tags (the core normalises them); everything else about the item stays.
|
||||
#[tauri::command]
|
||||
fn set_tags(app: State<'_, App>, id: String, tags: Vec<String>) -> CmdResult<()> {
|
||||
let mut item = app.core.get_item(id).map_err(err)?;
|
||||
item.tags = tags;
|
||||
app.core.save_item(item).map_err(err)?;
|
||||
app.sync.request_sync();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn save_item(app: State<'_, App>, item: NewLogin) -> CmdResult<String> {
|
||||
app.core
|
||||
@@ -259,7 +275,7 @@ fn save_item(app: State<'_, App>, item: NewLogin) -> CmdResult<String> {
|
||||
totp: item.totp.filter(|t| !t.trim().is_empty()),
|
||||
notes: None,
|
||||
favorite: false,
|
||||
tags: vec![],
|
||||
tags: item.tags,
|
||||
modified_at: 0,
|
||||
})
|
||||
.map_err(err)
|
||||
@@ -684,6 +700,7 @@ fn main() {
|
||||
revoke_pairing,
|
||||
pending_saves,
|
||||
pending_passkeys,
|
||||
set_tags,
|
||||
resolve_passkey,
|
||||
resolve_save,
|
||||
sync_status,
|
||||
|
||||
Reference in New Issue
Block a user