-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Key value separated into own element
- Loading branch information
Thomas Junk
committed
Sep 14, 2023
1 parent
b59cf97
commit 122a9f3
Showing
4 changed files
with
111 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="ts"> | ||
export let keys: Array<String>; | ||
export let values: any; | ||
</script> | ||
|
||
{#each keys as key, index} | ||
<table> | ||
<tbody> | ||
<tr><td class="key">{key}</td><td class="value">{values[index]}</td></tr> | ||
</tbody> | ||
</table> | ||
{/each} | ||
|
||
<style> | ||
.key { | ||
padding: 0.2rem; | ||
width: 21rem; | ||
} | ||
.value { | ||
padding: 0.2rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 23 additions & 32 deletions
55
src/lib/singleview/vulnerabilities/vulnerability/GeneralSection.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,27 @@ | ||
<script lang="ts"> | ||
export let vulnerability: any; | ||
</script> | ||
import KeyValues from "$lib/singleview/KeyValues.svelte"; | ||
<dl> | ||
{#if vulnerability.title} | ||
<dt>Title</dt> | ||
<dd>{vulnerability.title}</dd> | ||
{/if} | ||
{#if vulnerability.cwe} | ||
<dt>CWE ID</dt> | ||
<dd>{vulnerability.cwe.id}</dd> | ||
<dt>CWE Name</dt> | ||
<dd>{vulnerability.cwe.name}</dd> | ||
{/if} | ||
{#if vulnerability.discovery_date} | ||
<dt>Discovery date</dt> | ||
<dd>{vulnerability.discovery_date}</dd> | ||
{/if} | ||
{#if vulnerability.release_date} | ||
<dt>Release date</dt> | ||
<dd>{vulnerability.release_date}</dd> | ||
{/if} | ||
</dl> | ||
|
||
<style> | ||
dt { | ||
float: left; | ||
clear: left; | ||
font-weight: 100; | ||
width: 14rem; | ||
export let vulnerability: any; | ||
const keys: Array<String> = []; | ||
const values: any = []; | ||
if (vulnerability.title) { | ||
keys.push("Title"); | ||
values.push(vulnerability.title); | ||
} | ||
dd { | ||
margin-bottom: 0.1em; | ||
if (vulnerability.cwe) { | ||
keys.push("CWE ID"); | ||
keys.push("CWE Name"); | ||
values.push(vulnerability.cwe.id); | ||
values.push(vulnerability.cwe.name); | ||
} | ||
</style> | ||
if (vulnerability.discovery_date) { | ||
keys.push("Discovery date"); | ||
values.push(vulnerability.discovery_date); | ||
} | ||
if (vulnerability.release_date) { | ||
keys.push("Release date"); | ||
values.push(vulnerability.release_date); | ||
} | ||
</script> | ||
|
||
<KeyValues {keys} {values} /> |
23 changes: 5 additions & 18 deletions
23
src/lib/singleview/vulnerabilities/vulnerability/ID.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
<script lang="ts"> | ||
import Collapsible from "$lib/Collapsible.svelte"; | ||
import KeyValues from "$lib/singleview/KeyValues.svelte"; | ||
export let vulnerability: any; | ||
</script> | ||
|
||
<Collapsible header="IDs" level="4"> | ||
{#each vulnerability.ids as vulnerabilityID} | ||
<dl> | ||
<dt>Systemname</dt> | ||
<dd>{vulnerabilityID.system_name}</dd> | ||
<dt>Text</dt> | ||
<dd>{vulnerabilityID.text}</dd> | ||
</dl> | ||
<KeyValues | ||
keys={["Systemname", "Text"]} | ||
values={[vulnerabilityID.system_name, vulnerabilityID.text]} | ||
/> | ||
{/each} | ||
</Collapsible> | ||
|
||
<style> | ||
dt { | ||
float: left; | ||
clear: left; | ||
font-weight: 100; | ||
width: 14rem; | ||
} | ||
dd { | ||
margin-bottom: 0.1em; | ||
} | ||
</style> |