Skip to content

Commit

Permalink
fix: open vulnerabilities section when CVE is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Junk committed Sep 5, 2023
1 parent e2ef21b commit ffe5fa1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/lib/Collapsible.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
export let open: boolean = false;
export let index: string = "2";
export let class_: string = "";
let visibility = open ? "block" : "none";
let visibility = "none";
$: if (open) {
visibility = "block";
} else {
visibility = "none";
}
let icon = "bx-chevron-down";
const toggle = (e: Event) => {
if (visibility === "block") visibility = "none";
Expand Down
9 changes: 4 additions & 5 deletions src/lib/singleview/vulnerabilities/Vulnerability.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
export let vulnerability: any;
export let index: number = 1;
let header = `Vulnerability ${index}`;
let header = vulnerability.cve ? vulnerability.cve : `Vulnerability ${index}`;
let open = false;
$: if (vulnerability.cve) {
header = vulnerability.cve;
}
$: if (vulnerability.cve && $appStore.ui.selectedCVE === vulnerability.cve) {
$: if ($appStore.ui.selectedCVE === vulnerability.cve) {
open = true;
} else {
open = false;
}
</script>

Expand Down
13 changes: 12 additions & 1 deletion src/lib/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function createStore() {
}),
setSelectedCVE: (cve: string) => {
update((settings) => {
console.log(cve);
settings.ui.selectedCVE = cve;
return settings;
});
Expand All @@ -53,6 +52,18 @@ function createStore() {
return settings;
});
},
setVulnerabilitiesSectionVisible: () => {
update((settings) => {
settings.ui.isVulnerabilisiesSectionVisible = true;
return settings;
});
},
setVulnerabilitiesSectionInvisible: () => {
update((settings) => {
settings.ui.isVulnerabilisiesSectionVisible = false;
return settings;
});
},
reset: () => set({ ...appDefault })
};
}
Expand Down

0 comments on commit ffe5fa1

Please sign in to comment.