Skip to content

Commit ae871fb

Browse files
committed
Add affected/fixed package data to vulnerability details
Reference: #798 Signed-off-by: John M. Horan <johnmhoran@gmail.com>
1 parent 441852f commit ae871fb

14 files changed

Lines changed: 11028 additions & 347 deletions

vulnerabilities/templates/base.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<link rel="stylesheet" href="{% static 'css/font-awesome.css' %}" />
1414
<link rel="stylesheet" href="{% static 'css/bulma-tooltip.css' %}" />
1515

16+
<script type="text/javascript" src="{% static 'js/jquery-3.6.0.js' %}"></script>
17+
1618
{% block extrahead %}{% endblock %}
1719
</head>
1820

@@ -33,7 +35,9 @@
3335
</footer>
3436
</div>
3537

36-
{% block scripts %}{% endblock %}
38+
{% block scripts %}
39+
40+
{% endblock %}
3741
</body>
3842

3943
</html>

vulnerabilities/templates/index.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
{% if package_search %}
6767
<div class="notification" style="border: solid 1px #ff9999; padding: 20px; margin-top: 20px; background-color: #ffffff; color: #ff0000; z-index: 10;">
6868
<button class=" delete"></button>
69-
<!-- <h6 class="title is-6" style="margin-bottom: 10px;"><span style="color: #ff0000; font-weight: bold;">Search for packages:</span></h6> -->
7069
{{ package_search }}
7170
</div>
7271
{% endif %}
@@ -124,7 +123,6 @@
124123
{% if vuln_search %}
125124
<div class="notification" style="border: solid 1px #ff9999; padding: 20px; margin-top: 20px; background-color: #ffffff; color: #ff0000; z-index: 10;">
126125
<button class=" delete"></button>
127-
<!-- <h6 class="title is-6" style="margin-bottom: 10px;"><span style="color: #ff0000; font-weight: bold;">Search for vulnerabilities:</span></h6> -->
128126
{{ vuln_search }}
129127
</div>
130128
{% endif %}
@@ -138,9 +136,6 @@
138136
{% endblock %}
139137

140138
{% block scripts %}
141-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
142-
<!-- The 1st script below is from https://bulma.io/documentation/elements/notification/ and
143-
handles error notifications -->
144139
<script>
145140
document.addEventListener('DOMContentLoaded', () => {
146141
(document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {

vulnerabilities/templates/navbar.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
</div>
2020
<div class="navbar-end mr-3">
2121
<div class="navbar-item navbar-item is-cursor-help">
22+
{% if debug_ui %}
2223
<span class="tag is-warning is-normal" style="margin-right: 20px;">{{template_name}}</span>
24+
{% endif %}
2325
<div class="dropdown is-right is-hoverable">
2426
<div class="dropdown-trigger has-text-grey-light">
2527
v{{ VULNERABLECODE_VERSION }}

vulnerabilities/templates/package_update.html

Lines changed: 23 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
{% if package_search %}
6060
<div class="notification" style="border: solid 1px #ff9999; padding: 20px; margin-top: 20px; background-color: #ffffff; color: #ff0000; z-index: 10;">
6161
<button class=" delete"></button>
62-
<!-- <h6 class="title is-6" style="margin-bottom: 10px;"><span style="color: #ff0000; font-weight: bold;">Search for packages:</span></h6> -->
6362
{{ package_search }}
6463
</div>
6564
{% endif %}
@@ -69,18 +68,9 @@
6968
</article>
7069
</section>
7170

72-
<!-- 8/6/2022 Saturday 3:24:01 PM. Add an if condition here to display this section only if there's a record; -- packages uses `if package_name` -->
7371
{% if package %}
7472

75-
<!-- <section class="section01">
76-
<h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
77-
</section> -->
78-
79-
8073
<section class="section01">
81-
<!-- <div style="margin-bottom: 10px;">
82-
<span class="tag is-info is-medium has-text-weight-bold" style="margin-right: 10px;">Package Details</span>
83-
</div> -->
8474
<article class="panel is-info panel-header-only">
8575
<p class="panel-heading py-2 is-size-6">
8676
Package Details
@@ -166,23 +156,21 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
166156
{{resolved_vuln|length}}
167157
</td>
168158
</tr>
159+
{% if debug_ui %}
169160
<tr>
170-
<td class="two-col-left">Packages with no reported unresolved vulnerabilities</td>
161+
<td class="two-col-left" style="color: #009900;">Packages with no reported unresolved vulnerabilities</td>
171162
<td class="two-col-right">
172-
<!-- {% if package %} -->
173163
{% if no_reported_vulns_packages|length > 0 %}
174164
{% for pkg in no_reported_vulns_packages %}
175-
<!-- {% if pkg %} -->
176165
<span><a href="{% url 'package_view' pkg.pk %}?type={{package_type}}&name={{pkg.package_url}}" target="_self">{{pkg.package_url}}</a></span>
177166
<br />
178-
<!-- {% endif %} -->
179167
{% endfor %}
180168
{% else %}
181169
We are unable to identify such a package.
182170
{% endif %}
183-
<!-- {% endif %} -->
184171
</td>
185172
</tr>
173+
{% endif %}
186174
</tbody>
187175
</table>
188176

@@ -205,31 +193,14 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
205193
{% for vuln in impacted_vuln %}
206194
<tr>
207195
<td>
208-
{{ vuln.vulnerability_id }}
209-
<span style="font-size: 13px;">
210-
(<a href="{% url 'vulnerability_view' vuln.pk %}" target="_self">HTML</a>)
211-
</span>
212-
196+
<a href="{% url 'vulnerability_view' vuln.pk %}" target="_self">{{ vuln.vulnerability_id }}</a>
213197
</td>
214198
<td>
215199
{{ vuln.summary }}
216200
</td>
217201
<td>
218202
{% for alias in vuln.alias %}
219203
{{alias}}
220-
221-
<!-- {% if object_list %}
222-
{% for ref in object_list %}
223-
{% if ref.reference_id %}
224-
{% if ref.reference_id == alias %}
225-
{% if ref.url %}
226-
{{ref.url}}
227-
{% endif %}
228-
{% endif %}
229-
{% endif %}
230-
{% endfor %}
231-
{% endif %} -->
232-
233204
<br />
234205
{% endfor %}
235206
</td>
@@ -239,13 +210,13 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
239210
{% else %}
240211
<tr>
241212
<td>
242-
none
213+
None
243214
</td>
244215
<td>
245-
--
216+
246217
</td>
247218
<td>
248-
--
219+
249220
</td>
250221
</tr>
251222
{% endif %}
@@ -268,10 +239,7 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
268239
{% for vuln in resolved_vuln %}
269240
<tr>
270241
<td>
271-
{{ vuln.vulnerability_id }}
272-
<span style="font-size: 13px;">
273-
(<a href="{% url 'vulnerability_view' vuln.pk %}" target="_self">HTML</a>)
274-
</span>
242+
<a href="{% url 'vulnerability_view' vuln.pk %}" target="_self">{{ vuln.vulnerability_id }}</a>
275243
</td>
276244
<td>
277245
{{ vuln.summary }}
@@ -288,13 +256,13 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
288256
{% else %}
289257
<tr>
290258
<td>
291-
none
259+
None
292260
</td>
293261
<td>
294-
--
262+
295263
</td>
296264
<td>
297-
--
265+
298266
</td>
299267
</tr>
300268
{% endif %}
@@ -304,6 +272,7 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
304272

305273
</div>
306274

275+
{% if debug_ui %}
307276
{% if package %}
308277
<div class="columns">
309278
<span class="tag is-danger is-medium" style="margin-bottom: 10px;">Test view query data</span>
@@ -457,17 +426,25 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
457426
</div>
458427
</div>
459428
{% endif %}
460-
461-
462429
</section>
463430

431+
{% endif %}
464432
{% endif %}
465433

466434
{% endblock %}
467435

468436
{% block scripts %}
469-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
470437
<script>
438+
document.addEventListener('DOMContentLoaded', () => {
439+
(document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
440+
const $notification = $delete.parentNode;
441+
442+
$delete.addEventListener('click', () => {
443+
$notification.parentNode.removeChild($notification);
444+
});
445+
});
446+
});
447+
471448
$(document).ready(function () {
472449
$('#tabs li').on('click', function () {
473450
var tab = $(this).data('tab');
@@ -480,16 +457,6 @@ <h4 class="title is-4" style="margin-bottom: 0px;">Package Details</h4>
480457
});
481458
});
482459

483-
document.addEventListener('DOMContentLoaded', () => {
484-
(document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
485-
const $notification = $delete.parentNode;
486-
487-
$delete.addEventListener('click', () => {
488-
$notification.parentNode.removeChild($notification);
489-
});
490-
});
491-
});
492-
493460
$(document).ready(function () {
494461
$('#submit_pkg').click(function () {
495462
if ($('#id_name').val().trim().length === 0) {

vulnerabilities/templates/packages.html

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
{% if package_search %}
6262
<div class="notification" style="border: solid 1px #ff9999; padding: 20px; margin-top: 20px; background-color: #ffffff; color: #ff0000; z-index: 10;">
6363
<button class=" delete"></button>
64-
<!-- <h6 class="title is-6" style="margin-bottom: 10px;"><span style="color: #ff0000; font-weight: bold;">Search for packages:</span></h6> -->
6564
{{ package_search }}
6665
</div>
6766
{% endif %}
@@ -106,43 +105,6 @@
106105
</section>
107106
</div>
108107

109-
<!-- <div class="is-field is-horizontal">
110-
<span class="step-links">
111-
{% if packages.has_previous %}
112-
<a class="button paging is-normal" href="?{{ searched_for }}&page=1">&laquo; first</a>
113-
<a class="button paging is-normal" href="?{{ searched_for }}&page={{ packages.previous_page_number }}">previous</a>
114-
<a href="?{{ searched_for }}&page={{ packages.previous_page_number }}">&laquo;</a>
115-
{% else %}
116-
<button class="button is-normal" title="disabled" disabled>&laquo; first</button>
117-
<button class="button is-normal" title="disabled" disabled>previous</button>
118-
&laquo;
119-
{% endif %}
120-
121-
<span class="current02">
122-
(page {{ packages.number }} of {{ packages.paginator.num_pages }})
123-
</span>
124-
125-
{% if packages.has_next %}
126-
<a class="button paging is-normal" href="?{{ searched_for }}&page={{ packages.next_page_number }}">next</a>
127-
<a class="button paging is-normal" href="?{{ searched_for }}&page={{ packages.paginator.num_pages }}">last &raquo;</a>
128-
<a href="?{{ searched_for }}&page={{ packages.next_page_number }}">&raquo;</a>
129-
{% else %}
130-
<button class="button is-normal" title="disabled" disabled>next</button>
131-
<button class="button is-normal" title="disabled" disabled>last &raquo;</button>
132-
&raquo;
133-
{% endif %}
134-
</span>
135-
</div> -->
136-
137-
<!-- close section was here and prevented footer from staying at visible page bottom -->
138-
139-
<!-- {% if packages %}
140-
<div>This is packages: {{packages}}</div>
141-
{% for package in packages %}
142-
<div>This is a package: {{package}} | {{package.version}}</div>
143-
{% endfor %}
144-
{% endif %} -->
145-
146108
{% if packages %}
147109

148110
<section class="section01">
@@ -159,10 +121,7 @@
159121
{% for package in packages %}
160122
<tr>
161123
<td style="word-break: break-all;">
162-
{{package.package_url}}
163-
<span style="font-size: 13px;">
164-
(<a href="{% url 'package_view' package.pk %}?type={{package_type}}&name={{package.package_url}}" target="_self">HTML</a>)
165-
</span>
124+
<a href="{% url 'package_view' package.pk %}?type={{package_type}}&name={{package.package_url}}" target="_self">{{package.package_url}}</a>
166125
</td>
167126
<td>{{package.vulnerability_count}}</td>
168127
<td>{{package.patched_vulnerability_count}}</td>
@@ -197,7 +156,7 @@
197156
{% endif %}
198157
{% endif %}
199158
<li>
200-
<a class="pagination-link is-current" aria-label="Page {{ packages.number }}" aria-current="page">{{ packages.number|intcomma }}</a>
159+
<a class="pagination-link is-current" disabled aria-label="Page {{ packages.number }}" aria-current="page">{{ packages.number|intcomma }}</a>
201160
</li>
202161
{% if packages.number != packages.paginator.num_pages %}
203162
{% if packages.next_page_number != packages.paginator.num_pages %}
@@ -214,20 +173,13 @@
214173

215174
</section>
216175

217-
<!-- else -->
218-
219176
{% endif %}
220177

221-
<!-- else -->
222-
223178
{% endif %}
224179

225180
{% endblock %}
226181

227182
{% block scripts %}
228-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
229-
<!-- The 1st script below is from https://bulma.io/documentation/elements/notification/ and
230-
handles error notifications -->
231183
<script>
232184
document.addEventListener('DOMContentLoaded', () => {
233185
(document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {

0 commit comments

Comments
 (0)