Skip to content

Commit

Permalink
fix: Open collapsible with 1 entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Junk committed Feb 8, 2024
1 parent 309b4a7 commit 5115e53
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@
<div>
<GeneralSection {vulnerability} />
{#if vulnerability.acknowledgments}
<Collapsible header="Acknowledgments" level="4">
<Collapsible
header="Acknowledgments"
level="4"
open={vulnerability.acknowledgments.length === 1}
>
<Acknowledgments acknowledegments={vulnerability.acknowledgments} />
</Collapsible>
{/if}
Expand All @@ -80,7 +84,7 @@
<ProductStatus {vulnerability} />
{/if}
{#if vulnerability.references}
<Collapsible header="References" level="4">
<Collapsible header="References" level="4" open={vulnerability.references.length === 1}>
<References references={vulnerability.references} />
</Collapsible>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
export let vulnerability: Vulnerability;
</script>

<Collapsible header="Flags" level="4">
<Collapsible
header="Flags"
level="4"
open={vulnerability.flags && vulnerability.flags.length === 1}
>
<div class="spacer" />
{#if vulnerability.flags}
{#each vulnerability.flags as flag}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
import Collapsible from "$lib/Collapsible.svelte";
import type { Vulnerability } from "$lib/types";
import ValueField from "$lib/ValueField.svelte";
import Vulnerabilities from "../../Vulnerabilities.svelte";
export let vulnerability: Vulnerability;
$: vulnerabilities = vulnerability.involvements ? vulnerability.involvements : [];
</script>

<Collapsible header="Involvements" level="4">
<Collapsible header="Involvements" level="4" open={Vulnerabilities.length === 1}>
{#each vulnerabilities as involvement}
{#if involvement.date}
<ValueField label="Date" value={involvement.date} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@
export let vulnerability: Vulnerability;
</script>

<Collapsible header="Remediations" level="4">
<Collapsible
header="Remediations"
level="4"
open={vulnerability.remediations && vulnerability.remediations.length === 1}
>
{#if vulnerability.remediations}
{#each vulnerability.remediations as remediation}
<Collapsible header="Category: {remediation.category}" level="4">
<Collapsible
header="Category: {remediation.category}"
level="4"
open={vulnerability.remediations.length === 1}
>
<Remediation {remediation} />
</Collapsible>
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
export let vulnerability: Vulnerability;
</script>

<Collapsible header="Scores" level="4">
<Collapsible
header="Scores"
level="4"
open={vulnerability.scores && vulnerability.scores.length === 1}
>
{#if vulnerability.scores}
{#each vulnerability.scores as score, index}
<Collapsible header="Score {index + 1}" level="4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$: threats = vulnerability.threats ? vulnerability.threats : [];
</script>

<Collapsible header="Threats" level="4">
<Collapsible header="Threats" level="4" open={threats.length === 1}>
<div class="spacer" />
{#each threats as threat, index}
<Threat {threat} />
Expand Down

0 comments on commit 5115e53

Please sign in to comment.