pub struct ViewApp { /* private fields */ }Expand description
Main application state for single SBOM viewing.
Implementations§
Source§impl ViewApp
impl ViewApp
Sourcepub fn new(
sbom: NormalizedSbom,
raw_content: &str,
bom_profile: BomProfile,
) -> Self
pub fn new( sbom: NormalizedSbom, raw_content: &str, bom_profile: BomProfile, ) -> Self
Create a new ViewApp for the given SBOM.
Sourcepub fn with_cra_sidecar(self, sidecar: CraSidecarMetadata) -> Self
pub fn with_cra_sidecar(self, sidecar: CraSidecarMetadata) -> Self
Set the CRA sidecar metadata on this ViewApp. Stored so the
compliance tab can render OSS-Steward / EUCC / Article 14 /
product-class checks against the same sidecar the CLI uses.
Sourcepub fn ensure_compliance_results(&mut self)
pub fn ensure_compliance_results(&mut self)
Lazily compute compliance results for all standards when first needed.
Sourcepub fn select_tab(&mut self, tab: ViewTab)
pub fn select_tab(&mut self, tab: ViewTab)
Select a specific tab, resetting focus to the left (list) panel.
Sourcepub fn active_crypto_selected(&self) -> usize
pub fn active_crypto_selected(&self) -> usize
Get the selection index for the active CBOM tab.
Sourcepub fn active_crypto_selected_mut(&mut self) -> &mut usize
pub fn active_crypto_selected_mut(&mut self) -> &mut usize
Get a mutable reference to the selection index for the active CBOM tab.
Sourcepub fn crypto_count_for_tab(&self) -> usize
pub fn crypto_count_for_tab(&self) -> usize
Count crypto components for the active tab (filtered by asset type).
Sourcepub fn ml_model_count(&self) -> usize
pub fn ml_model_count(&self) -> usize
Count MachineLearningModel components (Models tab).
Sourcepub fn dataset_count(&self) -> usize
pub fn dataset_count(&self) -> usize
Count Data components (Datasets tab).
Sourcepub fn get_sort_key(&self, id: &CanonicalId) -> Option<&ComponentSortKey>
pub fn get_sort_key(&self, id: &CanonicalId) -> Option<&ComponentSortKey>
Get the sort key for a component using the cached index.
Returns pre-computed lowercase strings to avoid repeated allocations during sorting.
Sourcepub fn get_dependencies(&self, id: &CanonicalId) -> Vec<&DependencyEdge>
pub fn get_dependencies(&self, id: &CanonicalId) -> Vec<&DependencyEdge>
Get dependencies of a component using the cached index (O(k) instead of O(edges)).
Sourcepub fn get_dependents(&self, id: &CanonicalId) -> Vec<&DependencyEdge>
pub fn get_dependents(&self, id: &CanonicalId) -> Vec<&DependencyEdge>
Get dependents of a component using the cached index (O(k) instead of O(edges)).
Sourcepub fn search_components_by_name(&self, query: &str) -> Vec<&Component>
pub fn search_components_by_name(&self, query: &str) -> Vec<&Component>
Search components by name using the cached index.
Sourcepub const fn toggle_focus(&mut self)
pub const fn toggle_focus(&mut self)
Toggle focus between left and right panels.
Sourcepub fn start_search(&mut self)
pub fn start_search(&mut self)
Start search mode.
Sourcepub const fn stop_search(&mut self)
pub const fn stop_search(&mut self)
Stop search mode.
Sourcepub fn execute_search(&mut self)
pub fn execute_search(&mut self)
Execute search with current query.
Sourcepub fn get_selected_component(&self) -> Option<&Component>
pub fn get_selected_component(&self) -> Option<&Component>
Get the currently selected component.
Sourcepub fn jump_to_component_in_tree(&mut self, component_id: &str) -> bool
pub fn jump_to_component_in_tree(&mut self, component_id: &str) -> bool
Jump tree selection to a component, expanding its group if needed.
Sourcepub fn jump_to_vuln_by_id(&mut self, vuln_id: &str) -> bool
pub fn jump_to_vuln_by_id(&mut self, vuln_id: &str) -> bool
Jump to a vulnerability by its ID (e.g., “CVE-2024-1234”) in the Vulnerabilities tab.
Returns true if the vulnerability was found and selected.
Sourcepub fn find_source_item_for_ref(&mut self, ref_value: &str) -> Option<usize>
pub fn find_source_item_for_ref(&mut self, ref_value: &str) -> Option<usize>
Find a source tree item whose value matches a given reference string (bom-ref, CVE ID, etc.)
and return its index in cached_flat_items.
Sourcepub fn get_selected_group_info(&self) -> Option<(String, Vec<String>)>
pub fn get_selected_group_info(&self) -> Option<(String, Vec<String>)>
Get the currently selected tree node info (Group label + children component IDs, or None if a component is selected or nothing is selected).
Sourcepub fn toggle_bookmark(&mut self)
pub fn toggle_bookmark(&mut self)
Toggle bookmark on the currently selected component.
Sourcepub fn toggle_tree_grouping(&mut self)
pub fn toggle_tree_grouping(&mut self)
Toggle tree grouping mode.
Sourcepub fn toggle_tree_filter(&mut self)
pub fn toggle_tree_filter(&mut self)
Toggle tree filter.
Sourcepub fn start_tree_search(&mut self)
pub fn start_tree_search(&mut self)
Start tree search mode.
Sourcepub const fn stop_tree_search(&mut self)
pub const fn stop_tree_search(&mut self)
Stop tree search mode.
Sourcepub fn clear_tree_search(&mut self)
pub fn clear_tree_search(&mut self)
Clear tree search and exit search mode.
Sourcepub fn tree_search_push_char(&mut self, c: char)
pub fn tree_search_push_char(&mut self, c: char)
Add character to tree search query.
Sourcepub fn tree_search_pop_char(&mut self)
pub fn tree_search_pop_char(&mut self)
Remove character from tree search query.
Sourcepub const fn next_component_tab(&mut self)
pub const fn next_component_tab(&mut self)
Cycle to next component detail tab.
Sourcepub const fn prev_component_tab(&mut self)
pub const fn prev_component_tab(&mut self)
Cycle to previous component detail tab.
Sourcepub const fn toggle_help(&mut self)
pub const fn toggle_help(&mut self)
Toggle help overlay.
Sourcepub const fn toggle_export(&mut self)
pub const fn toggle_export(&mut self)
Toggle export dialog.
Sourcepub const fn toggle_legend(&mut self)
pub const fn toggle_legend(&mut self)
Toggle legend overlay.
Sourcepub const fn close_overlays(&mut self)
pub const fn close_overlays(&mut self)
Close all overlays.
Sourcepub const fn has_overlay(&self) -> bool
pub const fn has_overlay(&self) -> bool
Check if any overlay is open.
Sourcepub fn set_status_message(&mut self, msg: impl Into<String>)
pub fn set_status_message(&mut self, msg: impl Into<String>)
Set a temporary status message.
Sourcepub fn clear_status_message(&mut self)
pub fn clear_status_message(&mut self)
Clear the status message.
If status_sticky is set the message is kept for one extra keypress,
then cleared on the subsequent call.
Sourcepub fn export(&mut self, format: ExportFormat)
pub fn export(&mut self, format: ExportFormat)
Export the current SBOM to a file.
The export is scoped to the active tab: e.g. if the user is on the Vulnerabilities tab only vulnerability data is included.
Sourcepub fn export_compliance(&mut self, format: ExportFormat)
pub fn export_compliance(&mut self, format: ExportFormat)
Export compliance results from the compliance tab
Handle navigation in current view.
Handle navigation in current view.
Sourcepub fn handle_enter(&mut self)
pub fn handle_enter(&mut self)
Handle enter/select action.
Sourcepub fn handle_source_map_enter(&mut self)
pub fn handle_source_map_enter(&mut self)
Jump the source panel to the section selected in the map.
Sourcepub fn get_map_context_component_id(&self) -> Option<String>
pub fn get_map_context_component_id(&self) -> Option<String>
Get the component ID currently shown in the source map context footer. Returns the canonical ID value string if inside the “components” section.
Sourcepub fn get_selected_dependency_node_id(&self) -> Option<String>
pub fn get_selected_dependency_node_id(&self) -> Option<String>
Get the currently selected dependency node ID (if any).
Sourcepub fn ensure_tree_cache(&mut self)
pub fn ensure_tree_cache(&mut self)
Ensure tree node cache is valid, rebuilding if needed.
Sourcepub fn build_tree_nodes(&self) -> &[TreeNode]
pub fn build_tree_nodes(&self) -> &[TreeNode]
Get tree nodes from cache (returns empty slice if cache not yet built).
For render paths, call ensure_tree_cache() first.
For event handlers that only need to read, the cache is always warm after first render.
Auto Trait Implementations§
impl Freeze for ViewApp
impl RefUnwindSafe for ViewApp
impl Send for ViewApp
impl Sync for ViewApp
impl Unpin for ViewApp
impl UnsafeUnpin for ViewApp
impl UnwindSafe for ViewApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more