Skip to content

Commit 012c4a9

Browse files
committed
fix: allow non-members to open suppress modal to see details.
1 parent 3dabf10 commit 012c4a9

File tree

2 files changed

+50
-45
lines changed

2 files changed

+50
-45
lines changed

src/lib/components/image/ImageVulnerabilities.svelte

+14-14
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,20 @@
175175
{#each vulnz as v (v)}
176176
<Tr>
177177
<Td>
178-
{#if authorized}
179-
<Button
180-
variant="tertiary"
181-
size="xsmall"
182-
onclick={() => {
183-
findingToSuppress = v;
184-
suppressOpen = true;
185-
}}
186-
>
187-
<code>{v.identifier}</code>
188-
</Button>
189-
{:else}
178+
<!--{#if authorized}-->
179+
<Button
180+
variant="tertiary"
181+
size="xsmall"
182+
onclick={() => {
183+
findingToSuppress = v;
184+
suppressOpen = true;
185+
}}
186+
>
190187
<code>{v.identifier}</code>
191-
{/if}
188+
</Button>
189+
<!--{:else}
190+
<code>{v.identifier}</code>
191+
{/if}-->
192192
</Td>
193193
<Td><code>{v.package}</code></Td>
194194
<Td
@@ -236,7 +236,7 @@
236236
}}
237237
/>
238238

239-
{#if findingToSuppress && authorized !== PendingValue && authorized && image.workloadReferences}
239+
{#if findingToSuppress && authorized !== PendingValue && image.workloadReferences}
240240
{#key findingToSuppress.id}
241241
<SuppressFinding
242242
bind:open={suppressOpen}

src/lib/components/image/SuppressFinding.svelte

+36-31
Original file line numberDiff line numberDiff line change
@@ -226,39 +226,44 @@
226226
</Tbody>
227227
</Table>
228228
</div>
229+
{#if authorized}
230+
<div class="wrapper">
231+
{#if errormessage !== ''}
232+
<Alert variant="error">
233+
{errormessage}
234+
</Alert>
235+
{/if}
236+
<p>
237+
Please provide a reason for suppressing this finding. This will be recorded in the analysis
238+
audit log. Suppression will be in effect for all workloads using this image.
239+
</p>
240+
<Select size="small" label="Analysis" bind:value={selectedReason}>
241+
{#each SUPPRESS_OPTIONS as option (option)}
242+
{#if option.value === finding.state}
243+
<option value={option.value}>{option.text} </option>
244+
{:else}
245+
<option value={option.value}>{option.text}</option>
246+
{/if}
247+
{/each}
248+
</Select>
229249

230-
<div class="wrapper">
231-
{#if errormessage !== ''}
232-
<Alert variant="error">
233-
{errormessage}
234-
</Alert>
235-
{/if}
236-
<p>
237-
Please provide a reason for suppressing this finding. This will be recorded in the analysis
238-
audit log. Suppression will be in effect for all workloads using this image.
239-
</p>
240-
<Select size="small" label="Analysis" bind:value={selectedReason}>
241-
{#each SUPPRESS_OPTIONS as option (option)}
242-
{#if option.value === finding.state}
243-
<option value={option.value}>{option.text} </option>
244-
{:else}
245-
<option value={option.value}>{option.text}</option>
246-
{/if}
247-
{/each}
248-
</Select>
249-
250-
<TextField type="text" bind:value={inputText}>
251-
{#snippet label()}
252-
Comment
253-
{/snippet}
254-
</TextField>
255-
<Checkbox bind:checked={suppressed}>Suppress</Checkbox>
256-
</div>
250+
<TextField type="text" bind:value={inputText}>
251+
{#snippet label()}
252+
Comment
253+
{/snippet}
254+
</TextField>
255+
<Checkbox bind:checked={suppressed}>Suppress</Checkbox>
256+
</div>
257+
{/if}
257258
{#snippet footer()}
258-
<Button variant="primary" size="small" onclick={triggerSuppress} disabled={!authorized}
259-
>Update</Button
260-
>
261-
<Button variant="secondary" size="small" onclick={close}>Cancel</Button>
259+
{#if authorized}
260+
<Button variant="primary" size="small" onclick={triggerSuppress} disabled={!authorized}
261+
>Update</Button
262+
>
263+
<Button variant="secondary" size="small" onclick={close}>Cancel</Button>
264+
{:else}
265+
<Button variant="secondary" size="small" onclick={close}>Close</Button>
266+
{/if}
262267
{/snippet}
263268
</Modal>
264269

0 commit comments

Comments
 (0)