Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/web/src/handlers/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub struct ReportTemplateUnit<'a> {
pub y: f32,
pub w: f32,
pub h: f32,
pub is_linked: bool,
}

#[derive(Serialize, Clone)]
Expand Down Expand Up @@ -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| {
Expand All @@ -606,6 +608,7 @@ fn apply_scope<'a>(
y: 0.0,
w: 0.0,
h: 0.0,
is_linked: linked,
})
})
.collect::<Vec<_>>()
Expand Down Expand Up @@ -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::<Vec<_>>()
Expand Down
1 change: 1 addition & 0 deletions js/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Unit = {
y: number;
w: number;
h: number;
is_linked: boolean;
// Runtime fields
filtered: boolean;
};
Expand Down
7 changes: 7 additions & 0 deletions js/treemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down