-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
api-consistencyAPI consistency improvementsAPI consistency improvementspriority: mediumMedium priority issueMedium priority issuerefactorCode refactoringCode refactoring
Description
Description
Panel functions have inconsistent return types. Standardize on a result struct pattern.
Current State
fn draw_filter_panel(...) -> bool // Returns changed flag
fn draw_details_panel(...) -> DetailsPanelResult // Returns struct
fn draw_legend(...) // Returns nothing
fn draw_group_panel(...) // Returns nothingProposed Solution
Create a unified PanelResult type:
/// Result from drawing a panel, indicating any user actions.
#[derive(Default)]
pub struct PanelResult {
/// Whether panel state was modified (requires graph update, etc.)
pub changed: bool,
/// User action to be handled by the app
pub action: Option<PanelAction>,
}
/// Actions that can be triggered from panels.
pub enum PanelAction {
SelectNode(String),
SelectEdge(SelectedEdge),
ClearSelection,
}
impl PanelResult {
pub fn unchanged() -> Self {
Self::default()
}
pub fn changed() -> Self {
Self { changed: true, action: None }
}
pub fn with_action(action: PanelAction) -> Self {
Self { changed: false, action: Some(action) }
}
}Update all panel functions:
pub fn draw_filter_panel(...) -> PanelResult
pub fn draw_details_panel(...) -> PanelResult
pub fn draw_legend(...) -> PanelResult // Returns unchanged()
pub fn draw_group_panel(...) -> PanelResult
pub fn draw_group_legend(...) -> PanelResultAcceptance Criteria
- Create
PanelResultandPanelActiontypes - Update all panel functions to return
PanelResult - Update
app.rsto handle unified result type - All tests pass
Files Affected
src/ui/panels.rssrc/ui/types.rs(add new types)src/ui/app.rs(update panel result handling)
Metadata
Metadata
Assignees
Labels
api-consistencyAPI consistency improvementsAPI consistency improvementspriority: mediumMedium priority issueMedium priority issuerefactorCode refactoringCode refactoring