Skip to content

Commit

Permalink
refactor: Remediations
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Junk committed Sep 14, 2023
1 parent cda96c2 commit a164ae4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script lang="ts">
import KeyValue from "$lib/singleview/KeyValue.svelte";
import ValueField from "$lib/singleview/ValueField.svelte";
import ValueList from "$lib/singleview/ValueList.svelte";
export let remediation: any;
const keys: Array<String> = [];
const values: Array<String> = [];
if (remediation.date) {
keys.push("Date");
values.push(remediation.date);
}
if (remediation.url) {
keys.push("URL");
values.push(remediation.url);
}
</script>

<p>
<KeyValue {keys} {values} />
</p>
<ValueField label="Details" value={remediation.details} />
{#if remediation.entitlements}
<ValueList label="Entitlements" values={remediation.entitlements} />
{/if}
{#if remediation.group_ids}
<ValueList label="Group IDs" values={remediation.group_ids} />
{/if}
{#if remediation.product_ids}
<ValueList label="Product IDs" values={remediation.product_ids} />
{/if}
{#if remediation.restart_required}
<div class="">
<h6>Restart_required</h6>
<p>{remediation.restart_required.category}</p>
{#if remediation.restart_required.details}
<p>{remediation.restart_required.details}</p>
{/if}
</div>
{/if}
Original file line number Diff line number Diff line change
@@ -1,54 +1,14 @@
<script lang="ts">
import Collapsible from "$lib/Collapsible.svelte";
import ValueField from "$lib/singleview/ValueField.svelte";
import ValueList from "$lib/singleview/ValueList.svelte";
import Remediation from "./Remediation.svelte";
export let vulnerability: any;
</script>

<Collapsible header="Remediations" level="4">
{#each vulnerability.remediations as remediation}
<Collapsible header="Category: {remediation.category}" level="5">
<div class="spacer" />
{#if remediation.date}
<ValueField label="Date" value={remediation.date} />
{/if}
<div class="">
<ValueField label="Details" value={remediation.details} />
</div>
{#if remediation.entitlements}
<ValueList label="Entitlements" values={remediation.entitlements} />
{/if}
{#if remediation.group_ids}
<ValueList label="Group IDs" values={remediation.group_ids} />
{/if}
{#if remediation.product_ids}
<ValueList label="Product IDs" values={remediation.product_ids} />
{/if}
{#if remediation.restart_required}
<div class="">
<h6>Restart_required</h6>
<p>{remediation.restart_required.category}</p>
{#if remediation.restart_required.details}
<p>{remediation.restart_required.details}</p>
{/if}
</div>
{/if}
{#if remediation.url}
<ValueField label="Url" value={remediation.url} />
{/if}
<Remediation {remediation} />
</Collapsible>
{/each}
</Collapsible>

<style>
.spacer {
margin-top: 2em;
}
h6 {
line-height: 0.3em;
font-size: large;
}
p {
margin-left: 4rem;
}
</style>

0 comments on commit a164ae4

Please sign in to comment.