Skip to content

Commit 4cc8ee0

Browse files
committed
fix: show trivy result only if there is a result
1 parent ada90d2 commit 4cc8ee0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

server/routes/frontend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def count_trivy_findings(host) -> TrivyFindings:
4444

4545
def count_trivy_findings_image(image):
4646
if not image or not image.status_trivy:
47-
return TrivyFindings(0, 0, 0)
47+
return None
4848
trivy_findings = TrivyFindings(0, 0, 0)
4949
status_trivy = image.status_trivy
5050
results = status_trivy["Results"]

server/templates/images.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
{% endif %}
3131
</td>
3232
<td>
33+
{% if image.trivy_findings %}
3334
<span class="text-error">{{ image.trivy_findings['high'] }}</span> |
3435
<span class="text-warning">{{ image.trivy_findings['medium'] }}</span> |
3536
<span class="text-info">{{ image.trivy_findings['low'] }}</span>
37+
{% endif %}
3638
</td>
3739
<td>{{ image.usage_count }}</td>
3840
</tr>

0 commit comments

Comments
 (0)