|
26 | 26 | const categories = ['critical', 'high', 'medium', 'low', 'unassigned'] as const;
|
27 | 27 | </script>
|
28 | 28 |
|
29 |
| -<div class="vulnerability-summary"> |
| 29 | +<div class="wrapper"> |
| 30 | + <div class="vulnerability-summary"> |
| 31 | + {#if summary !== PendingValue} |
| 32 | + {#each categories as category (category)} |
| 33 | + <BodyShort |
| 34 | + class="vulnerability-count" |
| 35 | + style="background-color: {severityToColor(category)}" |
| 36 | + > |
| 37 | + {summary[category]} |
| 38 | + </BodyShort> |
| 39 | + <div class="category">{category}</div> |
| 40 | + {/each} |
| 41 | + {:else} |
| 42 | + <Loader /> |
| 43 | + {/if} |
| 44 | + </div> |
| 45 | + |
30 | 46 | {#if summary !== PendingValue}
|
31 |
| - {#each categories as category (category)} |
32 |
| - <BodyShort class="vulnerability-count" style="background-color: {severityToColor(category)}"> |
33 |
| - {summary[category]} |
34 |
| - </BodyShort> |
35 |
| - <div class="category">{category}</div> |
36 |
| - {/each} |
37 |
| - {:else} |
38 |
| - <Loader /> |
39 |
| - {/if} |
40 |
| -</div> |
41 |
| -{#if summary !== PendingValue} |
42 |
| - <div class="container"> |
43 |
| - <dl> |
| 47 | + <BodyShort> |
44 | 48 | {#if summary['riskScore']}
|
45 |
| - <dt>Risk score:</dt> |
46 |
| - <dd> |
47 |
| - <span class={summary['riskScore'] > 100 ? 'red' : 'green'}>{summary['riskScore']}</span> |
48 |
| - </dd> |
49 |
| - <!--HelpText title="Risk score" |
50 |
| - >The risk score is a calculated value based on the severity of the vulnerabilities |
51 |
| - discovered within the workloads. A higher risk score indicates a higher risk of |
52 |
| - exploitation. Algorithms may vary, but a common approach is to assign a score based on the |
53 |
| - severity of the vulnerabilities found. The Score is calculated: "((critical * 10) + (high * |
54 |
| - 5) + (medium * 3) + (low * 1) + (unassigned * 5))". |
55 |
| - </HelpText--> |
| 49 | + <strong>Risk score:</strong> |
| 50 | + {#if summary['coverage']} |
| 51 | + {summary['riskScore']} |
| 52 | + {:else if summary['riskScore'] > 100} |
| 53 | + <span class="red">{summary['riskScore']}</span> (above defined threshold of 100) |
| 54 | + {:else} |
| 55 | + <span class="green">{summary['riskScore']}</span> |
| 56 | + {/if} |
56 | 57 | {/if}
|
57 |
| - |
| 58 | + </BodyShort> |
| 59 | + <BodyShort> |
58 | 60 | {#if summary['coverage']}
|
59 |
| - <dt>Coverage:</dt> |
60 |
| - <dd> |
61 |
| - <span class={summary['coverage'] < 100 ? 'red' : 'green'} |
62 |
| - >{percentageFormatter(summary['coverage'] ? summary['coverage'] : 0, 0)}</span |
63 |
| - > |
64 |
| - </dd> |
| 61 | + <strong>Coverage:</strong> |
| 62 | + <span class={summary['coverage'] < 100 ? 'red' : 'green'} |
| 63 | + >{percentageFormatter(summary['coverage'] ? summary['coverage'] : 0, 0)}</span |
| 64 | + > |
65 | 65 | {/if}
|
66 |
| - </dl> |
67 |
| - </div> |
68 |
| -{/if} |
| 66 | + </BodyShort> |
| 67 | + {/if} |
| 68 | +</div> |
69 | 69 |
|
70 | 70 | <style>
|
| 71 | + .wrapper { |
| 72 | + display: grid; |
| 73 | + row-gap: var(--a-spacing-2); |
| 74 | + } |
71 | 75 | .category {
|
72 | 76 | text-transform: capitalize;
|
73 | 77 | }
|
|
95 | 99 | }
|
96 | 100 | }
|
97 | 101 |
|
98 |
| - .container { |
99 |
| - display: flex; |
100 |
| - gap: 0.5rem; |
101 |
| - justify-content: space-between; |
102 |
| - } |
103 |
| -
|
104 | 102 | .red {
|
105 | 103 | color: var(--a-surface-danger);
|
106 | 104 | }
|
107 | 105 |
|
108 | 106 | .green {
|
109 | 107 | color: var(--a-surface-success);
|
110 | 108 | }
|
111 |
| -
|
112 |
| - dl { |
113 |
| - display: grid; |
114 |
| - grid-template-columns: 90px auto; |
115 |
| - margin-block-start: 0; |
116 |
| - margin-block-end: 0; |
117 |
| - padding-top: var(--a-spacing-4); |
118 |
| - } |
119 |
| -
|
120 |
| - dt { |
121 |
| - font-weight: bold; |
122 |
| - text-align: left; |
123 |
| - } |
124 |
| -
|
125 |
| - dd { |
126 |
| - margin: 0; |
127 |
| - } |
128 | 109 | </style>
|
0 commit comments