Skip to content

Commit be23791

Browse files
authored
Fix package details view template (#1384)
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 1600811 commit be23791

2 files changed

Lines changed: 57 additions & 54 deletions

File tree

vulnerabilities/templates/package_details.html

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@
4242

4343
<div id="tab-content">
4444
<div class="tab-div is-active" data-content="essentials">
45-
<div class="tab-nested-div">
46-
<div class="pl-3 pr-3 mb-5 floating-purl">
45+
<div class="tab-nested-div mb-1 pb-0">
46+
{% if affected_by_vulnerabilities|length == 0 %}
47+
<div class="pl-3 pr-3 mb-5 floating-purl pb-0">
48+
{% else %}
49+
<div class="pl-3 pr-3 mb-5 floating-purl pb-2">
50+
{% endif %}
4751
<table class="table vcio-table width-100-pct mt-2">
4852
<tbody>
4953
<tr>
@@ -61,10 +65,10 @@
6165
</tbody>
6266
</table>
6367
</div>
64-
{% if affected_by_vulnerabilities|length != 0 %}
68+
{% if affected_by_vulnerabilities|length == 0 %}
6569

66-
<div class="pl-3 pr-3 mb-5 non-vuln">
67-
<table class="table vcio-table width-100-pct mt-2">
70+
<div class="pl-3 pr-3 mb-6 non-vuln pb-0">
71+
<table class="table vcio-table width-100-pct">
6872
<tbody>
6973
<tr>
7074
<td class="two-col-left">
@@ -98,8 +102,8 @@
98102

99103
{% endif %}
100104

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

@@ -145,56 +149,56 @@
145149
class="affected-fixed">fixed by</span> versions.</span>
146150
{% else %}
147151
{% for fixed_pkg in vuln.fixed_by_package_details %}
148-
<div>
149-
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length == 0 %}
150-
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
151-
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
152-
<br />
153-
<span class="emphasis-not-vulnerable"><span class="affected-fixed">Affected
154-
by</span> 0 other vulnerabilities.</span>
155-
{% else %}
156-
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
157-
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
158-
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length != 1 %}
159-
<br />
160-
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
161-
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
162-
vulnerabilities.</span>
163-
{% else %}
164-
<br />
165-
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
166-
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
167-
vulnerability.</span>
168-
{% endif %}
169-
170-
<div class="dropdown is-hoverable has-text-weight-normal is-right">
171-
<div class="dropdown-trigger">
172-
<i
173-
class="fa fa-question-circle ml-0 fa-sm has-background-white has-text-link"></i>
174-
</div>
175-
<div class="dropdown-menu dropdown-vuln-list-width" id="dropdown-menu4"
176-
role="menu">
177-
<div class="dropdown-content dropdown-instructions-box-shadow">
178-
<div class="dropdown-item">
179-
<div style="max-height: 200px; overflow-y: auto;">
180-
This version is <span class="affected-fixed">affected
181-
by</span> these other vulnerabilities:
182-
<div style="padding-top: 5px;">
183-
{% for fixed_by_vuln in fixed_pkg.fixed_by_purl_vulnerabilities %}
184-
<div>
185-
<a href="/vulnerabilities/{{ fixed_by_vuln.vulnerability_id }}"
186-
target="_self">{{
187-
fixed_by_vuln.vulnerability_id }}</a>
152+
<section>
153+
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length == 0 %}
154+
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
155+
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
156+
<br />
157+
<span class="emphasis-not-vulnerable"><span class="affected-fixed">Affected
158+
by</span> 0 other vulnerabilities.</span>
159+
{% else %}
160+
<a href="/packages/{{ fixed_pkg.fixed_by_purl }}?search={{ fixed_pkg.fixed_by_purl }}"
161+
target="_self">{{ fixed_pkg.fixed_by_purl.version }}</a>
162+
{% if fixed_pkg.fixed_by_purl_vulnerabilities|length != 1 %}
163+
<br />
164+
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
165+
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
166+
vulnerabilities.</span>
167+
{% else %}
168+
<br />
169+
<span class="emphasis-vulnerable"><span class="affected-fixed">Affected
170+
by</span> {{ fixed_pkg.fixed_by_purl_vulnerabilities|length }} other
171+
vulnerability.</span>
172+
{% endif %}
173+
174+
<div class="dropdown is-hoverable has-text-weight-normal is-right">
175+
<div class="dropdown-trigger">
176+
<i
177+
class="fa fa-question-circle ml-0 fa-sm has-background-white has-text-link"></i>
178+
</div>
179+
<div class="dropdown-menu dropdown-vuln-list-width" id="dropdown-menu4"
180+
role="menu">
181+
<div class="dropdown-content dropdown-instructions-box-shadow">
182+
<div class="dropdown-item">
183+
<div style="max-height: 200px; overflow-y: auto;">
184+
This version is <span class="affected-fixed">affected
185+
by</span> these other vulnerabilities:
186+
<div style="padding-top: 5px;">
187+
{% for fixed_by_vuln in fixed_pkg.fixed_by_purl_vulnerabilities %}
188+
<div>
189+
<a href="/vulnerabilities/{{ fixed_by_vuln.vulnerability_id }}"
190+
target="_self">{{
191+
fixed_by_vuln.vulnerability_id }}</a>
192+
</div>
193+
{% endfor %}
188194
</div>
189-
{% endfor %}
190195
</div>
191196
</div>
192197
</div>
193198
</div>
194199
</div>
195-
</div>
196-
{% endif %}
197-
</div>
200+
{% endif %}
201+
</section>
198202
{% endfor %}
199203
{% endif %}
200204
{% endif %}
@@ -216,8 +220,8 @@
216220
</table>
217221
</div>
218222

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

vulnerabilities/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class PackageDetails(DetailView):
8686

8787
def get_context_data(self, **kwargs):
8888
context = super().get_context_data(**kwargs)
89-
print(context)
9089
package = self.object
9190
context["package"] = package
9291
context["affected_by_vulnerabilities"] = package.affected_by.order_by("vulnerability_id")

0 commit comments

Comments
 (0)