Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 57 additions & 53 deletions vulnerabilities/templates/package_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@

<div id="tab-content">
<div class="tab-div is-active" data-content="essentials">
<div class="tab-nested-div">
<div class="pl-3 pr-3 mb-5 floating-purl">
<div class="tab-nested-div mb-1 pb-0">
{% if affected_by_vulnerabilities|length == 0 %}
<div class="pl-3 pr-3 mb-5 floating-purl pb-0">
{% else %}
<div class="pl-3 pr-3 mb-5 floating-purl pb-2">
{% endif %}
<table class="table vcio-table width-100-pct mt-2">
<tbody>
<tr>
Expand All @@ -61,10 +65,10 @@
</tbody>
</table>
</div>
{% if affected_by_vulnerabilities|length != 0 %}
{% if affected_by_vulnerabilities|length == 0 %}

<div class="pl-3 pr-3 mb-5 non-vuln">
<table class="table vcio-table width-100-pct mt-2">
<div class="pl-3 pr-3 mb-6 non-vuln pb-0">
<table class="table vcio-table width-100-pct">
<tbody>
<tr>
<td class="two-col-left">
Expand Down Expand Up @@ -98,8 +102,8 @@

{% endif %}

<div class="content ml-3 mr-3">
<div class="has-text-weight-bold ml-1 mb-0">
<div class="content ml-3 mr-3 pb-1">
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
<span class="affected-fixed">Vulnerabilities affecting</span> this package ({{ affected_by_vulnerabilities|length }})
</div>

Expand Down Expand Up @@ -145,56 +149,56 @@
class="affected-fixed">fixed by</span> versions.</span>
{% else %}
{% for fixed_pkg in vuln.fixed_by_package_details %}
<div>
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length == 0 %}
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
<br />
<span class="emphasis-not-vulnerable"><span class="affected-fixed">Affected
by</span> 0 other vulnerabilities.</span>
{% else %}
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length != 1 %}
<br />
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
vulnerabilities.</span>
{% else %}
<br />
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
vulnerability.</span>
{% endif %}

<div class="dropdown is-hoverable has-text-weight-normal is-right">
<div class="dropdown-trigger">
<i
class="fa fa-question-circle ml-0 fa-sm has-background-white has-text-link"></i>
</div>
<div class="dropdown-menu dropdown-vuln-list-width" id="dropdown-menu4"
role="menu">
<div class="dropdown-content dropdown-instructions-box-shadow">
<div class="dropdown-item">
<div style="max-height: 200px; overflow-y: auto;">
This version is <span class="affected-fixed">affected
by</span> these other vulnerabilities:
<div style="padding-top: 5px;">
{% for fixed_by_vuln in fixed_pkg.fixed_by_purl_vulnerabilities %}
<div>
<a href="/vulnerabilities/{{ fixed_by_vuln.vulnerability_id }}"
target="_self">{{
fixed_by_vuln.vulnerability_id }}</a>
<section>
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length == 0 %}
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
<br />
<span class="emphasis-not-vulnerable"><span class="affected-fixed">Affected
by</span> 0 other vulnerabilities.</span>
{% else %}
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length != 1 %}
<br />
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
vulnerabilities.</span>
{% else %}
<br />
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
vulnerability.</span>
{% endif %}

<div class="dropdown is-hoverable has-text-weight-normal is-right">
<div class="dropdown-trigger">
<i
class="fa fa-question-circle ml-0 fa-sm has-background-white has-text-link"></i>
</div>
<div class="dropdown-menu dropdown-vuln-list-width" id="dropdown-menu4"
role="menu">
<div class="dropdown-content dropdown-instructions-box-shadow">
<div class="dropdown-item">
<div style="max-height: 200px; overflow-y: auto;">
This version is <span class="affected-fixed">affected
by</span> these other vulnerabilities:
<div style="padding-top: 5px;">
{% for fixed_by_vuln in fixed_pkg.fixed_by_purl_vulnerabilities %}
<div>
<a href="/vulnerabilities/{{ fixed_by_vuln.vulnerability_id }}"
target="_self">{{
fixed_by_vuln.vulnerability_id }}</a>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
</section>
{% endfor %}
{% endif %}
{% endif %}
Expand All @@ -216,8 +220,8 @@
</table>
</div>

<div class="content ml-3 mr-3">
<div class="has-text-weight-bold ml-1 mb-0">
<div class="content ml-3 mr-3 pb-0 mb-0">
<div class="has-text-weight-bold ml-1 mb-0 pb-0">
<span class="affected-fixed">Vulnerabilities fixed by</span> this package ({{ fixing_vulnerabilities|length }})
</div>

Expand Down
1 change: 0 additions & 1 deletion vulnerabilities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class PackageDetails(DetailView):

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
print(context)
package = self.object
context["package"] = package
context["affected_by_vulnerabilities"] = package.affected_by.order_by("vulnerability_id")
Expand Down