Implement the password-store tree sidebar

This commit is contained in:
Hermes Agent
2026-08-10 06:07:05 +00:00
parent 42e6a82b2d
commit 91f58bae3a
7 changed files with 1097 additions and 114 deletions

View File

@@ -21,11 +21,43 @@ pub enum TreeNodeKind {
Entry,
}
/// Presentation-safe state calculated by storage services for a tree object.
/// Frontends render these flags and never infer them from names or paths.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct TreeNodeIndicators {
locked: bool,
changed: bool,
conflict: bool,
}
impl TreeNodeIndicators {
pub const fn new(locked: bool, changed: bool, conflict: bool) -> Self {
Self {
locked,
changed,
conflict,
}
}
pub const fn is_locked(self) -> bool {
self.locked
}
pub const fn is_changed(self) -> bool {
self.changed
}
pub const fn has_conflict(self) -> bool {
self.conflict
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TreeNode {
name: String,
path: String,
kind: TreeNodeKind,
indicators: TreeNodeIndicators,
children: Vec<TreeNode>,
}
@@ -42,6 +74,10 @@ impl TreeNode {
self.kind
}
pub fn indicators(&self) -> TreeNodeIndicators {
self.indicators
}
pub fn children(&self) -> &[TreeNode] {
&self.children
}
@@ -592,6 +628,7 @@ fn finalize_children(node: MutableNode, parent: &Path) -> Result<Vec<TreeNode>,
name,
path: path_text(&path)?,
kind,
indicators: TreeNodeIndicators::default(),
children,
})
})