diff --git a/crates/web/src/handlers/report.rs b/crates/web/src/handlers/report.rs index 1d61e6d..ad12a06 100644 --- a/crates/web/src/handlers/report.rs +++ b/crates/web/src/handlers/report.rs @@ -77,6 +77,7 @@ pub struct ReportTemplateUnit<'a> { pub y: f32, pub w: f32, pub h: f32, + pub is_linked: bool, } #[derive(Serialize, Clone)] @@ -587,6 +588,7 @@ fn apply_scope<'a>( } let (w, h) = query.size(); let mut units = if let Some(unit) = current_unit { + let linked = unit.metadata.as_ref().is_some_and(|m| m.complete.is_some_and(|c| c)); unit.functions .iter() .filter_map(|f| { @@ -606,6 +608,7 @@ fn apply_scope<'a>( y: 0.0, w: 0.0, h: 0.0, + is_linked: linked, }) }) .collect::>() @@ -636,6 +639,10 @@ fn apply_scope<'a>( y: 0.0, w: 0.0, h: 0.0, + is_linked: unit + .metadata + .as_ref() + .is_some_and(|m| m.complete.is_some_and(|c| c)), }) }) .collect::>() diff --git a/js/env.d.ts b/js/env.d.ts index 646de22..9160233 100644 --- a/js/env.d.ts +++ b/js/env.d.ts @@ -9,6 +9,7 @@ type Unit = { y: number; w: number; h: number; + is_linked: boolean; // Runtime fields filtered: boolean; }; diff --git a/js/treemap.ts b/js/treemap.ts index 4b35e11..b9a5c0a 100644 --- a/js/treemap.ts +++ b/js/treemap.ts @@ -409,7 +409,14 @@ const SPECIAL_TERM_REGEXP = new RegExp( ); const checkFilterTermMatches = (term: string, unit: Unit): boolean => { + if (term === "is:linked") { + return unit.is_linked; + } else if (term === "is:unlinked") { + return !unit.is_linked; + } + const match = term.match(SPECIAL_TERM_REGEXP); + if (match) { // Filter based on match percent or size. const operator = match[1];