Skip to content

Commit

Permalink
Add filter selection for missing node sub type
Browse files Browse the repository at this point in the history
  • Loading branch information
hlxid committed Jan 31, 2024
1 parent a2d1dec commit 497185b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/features/gdprElements/filterUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class GdprFilterUI extends AbstractUIExtension implements KeyListener {
// Rebuild the sub type select element based on the selected node type.
this.nodeSubtypeSelectElement.innerHTML = "";
this.nodeSubtypeSelectElement.options.add(new Option("All", "All"));
this.nodeSubtypeSelectElement.options.add(new Option("None", "None"));
GdprFilterUI.nodeTypes[this.nodeTypeSelectElement.value]?.forEach((nodeSubtype) => {
this.nodeSubtypeSelectElement.options.add(new Option(nodeSubtype, nodeSubtype));
});
Expand Down Expand Up @@ -162,7 +163,13 @@ export class GdprFilterUI extends AbstractUIExtension implements KeyListener {

// Filter node direction (if a filter is set)
if (element instanceof GdprSubTypeNodeImpl && this.nodeSubtypeSelectElement.value !== "All") {
if (element.subType !== this.nodeSubtypeSelectElement.value) {
const subTypeSelection = this.nodeSubtypeSelectElement.value;
// When subTypeSelection is not "None" then the element sub type must match the filter
// When subTypeSelection is "None" then the element sub type must be undefined
if (
(subTypeSelection !== "None" && element.subType !== subTypeSelection) ||
(subTypeSelection === "None" && element.subType)
) {
// Node sub type does not match the filter => skip
return;
}
Expand Down

0 comments on commit 497185b

Please sign in to comment.