Skip to content

Commit 7c8b646

Browse files
authored
Merge pull request aboutcode-org#2314 from aboutcode-org/todo-curation-queue
feat: add UI to expose curation curation
2 parents f641395 + c919921 commit 7c8b646

27 files changed

Lines changed: 343 additions & 17 deletions

vulnerabilities/forms.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from django.core.validators import validate_email
1313
from django_altcha import AltchaField
1414

15+
from vulnerabilities.models import ISSUE_TYPE_CHOICES
1516
from vulnerabilities.models import ApiUser
1617

1718

@@ -103,3 +104,32 @@ class PipelineSchedulePackageForm(forms.Form):
103104

104105
class AdminLoginForm(AdminAuthenticationForm):
105106
captcha = AltchaField(floating=True, hidefooter=True)
107+
108+
109+
class AdvisoryToDoForm(forms.Form):
110+
search = forms.CharField(
111+
required=False,
112+
label=False,
113+
widget=forms.TextInput(
114+
attrs={
115+
"placeholder": "Search ToDos...",
116+
"class": "input",
117+
},
118+
),
119+
)
120+
121+
resolved = forms.ChoiceField(
122+
required=False,
123+
choices=[
124+
("", "All"),
125+
("True", "Yes"),
126+
("False", "No"),
127+
],
128+
widget=forms.Select(attrs={"class": "select"}),
129+
)
130+
131+
issue_type = forms.ChoiceField(
132+
required=False,
133+
choices=[("", "All")] + ISSUE_TYPE_CHOICES,
134+
widget=forms.Select(attrs={"class": "select"}),
135+
)

vulnerabilities/pipelines/v2_importers/fireeye_importer_v2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class FireeyeImporterPipeline(VulnerableCodeBaseImporterPipelineV2):
4343

4444
precedence = 200
4545

46+
exclude_from_package_todo = True
47+
4648
@classmethod
4749
def steps(cls):
4850
return (

vulnerabilities/pipelines/v2_importers/linux_kernel_importer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class LinuxKernelPipeline(VulnerableCodeBaseImporterPipelineV2):
3535
license_url = "https://github.com/nluedtke/linux_kernel_cves/blob/master/LICENSE"
3636
run_once = True
3737

38+
exclude_from_package_todo = True
39+
3840
@classmethod
3941
def steps(cls):
4042
return (

vulnerabilities/pipelines/v2_importers/vulnrichment_importer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class VulnrichImporterPipeline(VulnerableCodeBaseImporterPipelineV2):
3535
repo_url = "git+https://github.com/cisagov/vulnrichment.git"
3636

3737
precedence = 100
38+
exclude_from_package_todo = True
3839

3940
@classmethod
4041
def steps(cls):

vulnerabilities/pipelines/v2_importers/xen_importer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class XenImporterPipeline(VulnerableCodeBaseImporterPipelineV2):
5757
"""
5858

5959
precedence = 200
60+
exclude_from_package_todo = True
6061

6162
_cached_data = None # Class-level cache
6263

vulnerabilities/templates/advisory_detail.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{% block content %}
1313

1414
{% if advisory %}
15-
<section class="section pt-0">
15+
<section class="section pt-4">
1616
<div class="details-container">
1717
<article class="panel is-info panel-header-only">
1818
<div class="panel-heading py-2 is-size-6">

vulnerabilities/templates/advisory_package_details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{% block content %}
1313

1414
{% if advisoryv2 %}
15-
<section class="section pt-0">
15+
<section class="section pt-4">
1616
<div class="details-container">
1717
<article class="panel is-info panel-header-only">
1818
<div class="panel-heading py-2 is-size-6">
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
{% extends "base.html" %}
2+
{% load utils %}
3+
4+
{% block title %}
5+
Advisory To-Dos
6+
{% endblock %}
7+
8+
{% block extrahead %}
9+
<style>
10+
thead th {
11+
border-bottom: none !important;
12+
}
13+
14+
tbody tr:hover {
15+
background-color: #e0e0e0 !important;
16+
cursor: pointer;
17+
}
18+
19+
tbody tr:nth-child(even):hover {
20+
background-color: #d3d3d3 !important;
21+
}
22+
23+
.column {
24+
word-break: break-word;
25+
}
26+
</style>
27+
{% endblock %}
28+
29+
30+
{% block content %}
31+
<div class="columns mt-4">
32+
<div class="column">
33+
</div>
34+
35+
<div class="column is-four-fifths">
36+
<div class="content is-normal">
37+
<h1>Advisory To-Dos</h1>
38+
<hr />
39+
</div>
40+
<form method="get" class="box px-6 mx-0">
41+
42+
<div class="field has-addons">
43+
<div class="control is-expanded has-icons-right">
44+
{{ form.search }}
45+
46+
{% if form.search.value %}
47+
<a href="?{% querystring request search='' %}"
48+
class="icon is-right"
49+
style="pointer-events: auto; cursor: pointer;">
50+
51+
</a>
52+
{% endif %}
53+
</div>
54+
55+
<div class="control">
56+
<button type="submit" class="button is-info">
57+
<i class="fa fa-search mx-1"></i>
58+
</button>
59+
</div>
60+
</div>
61+
</form>
62+
63+
<div class="box">
64+
<table class="table is-striped is-hoverable is-fullwidth">
65+
<thead>
66+
<tr>
67+
<th colspan="4">
68+
<div class="box is-small">
69+
<div class="columns is-vcentered">
70+
<div class="column has-text-left" style="flex: 0 0 20%; font-weight: bold;">Aliases</div>
71+
<div class="column has-text-left" style="flex: 0 0 20%; font-weight: bold;">Date</div>
72+
<div class="column has-text-left" style="flex: 0 0 10%; font-weight: bold;">Resolved</div>
73+
<div class="column has-text-left" style="flex: 0 0 10%; font-weight: bold;"># Advisories</div>
74+
<div class="column has-text-left" style="flex: 0 0 40%; font-weight: bold;">Issue Type</div>
75+
</div>
76+
</div>
77+
</th>
78+
</tr>
79+
<tr>
80+
<th colspan="4">
81+
<form method="get">
82+
<input type="hidden" name="search" value="{{ form.search.value|default:'' }}">
83+
84+
<div class="columns is-vcentered px-1">
85+
<div class="column has-text-left" style="flex: 0 0 20%;"></div>
86+
<div class="column has-text-left" style="flex: 0 0 20%;"></div>
87+
88+
<div class="column " style="flex: 0 0 10%;">
89+
<div class="select is-half">
90+
<select name="resolved" onchange="this.form.submit()">
91+
{% for val, label in form.fields.resolved.choices %}
92+
<option value="{{ val }}"
93+
{% if form.resolved.value == val %}selected{% endif %}>
94+
{{ label }}
95+
</option>
96+
{% endfor %}
97+
</select>
98+
</div>
99+
</div>
100+
101+
<div class="column has-text-left" style="flex: 0 0 10%;"></div>
102+
103+
<div class="column" style="flex: 0 0 40%;">
104+
<div class="select is-half">
105+
<select name="issue_type" onchange="this.form.submit()">
106+
{% for val, label in form.fields.issue_type.choices %}
107+
<option value="{{ val }}"
108+
{% if form.issue_type.value == val %}selected{% endif %}>
109+
{{ label }}
110+
</option>
111+
{% endfor %}
112+
</select>
113+
</div>
114+
</div>
115+
</div>
116+
</form>
117+
</th>
118+
</tr>
119+
</thead>
120+
121+
<tbody>
122+
{% for todo in todo_list %}
123+
<tr>
124+
<td colspan="4">
125+
<div class="columns px-1 is-vcentered">
126+
<div class="column has-text-left" style="flex: 0 0 20%;">
127+
{{ todo.alias }}
128+
</div>
129+
<div class="column has-text-left" style="flex: 0 0 20%;">
130+
{{ todo.oldest_advisory_date|default:"NA" }}
131+
</div>
132+
<div class="column has-text-centered has-text-grey" style="flex: 0 0 10%;">
133+
{{ todo.is_resolved|yesno:"Yes,No" }}
134+
</div>
135+
<div class="column has-text-centered has-text-grey" style="flex: 0 0 10%;">
136+
{{ todo.advisories_count }}
137+
</div>
138+
<div class="column has-text-left has-text-grey" style="flex: 0 0 40%;">
139+
{{ todo.get_issue_type_display }}
140+
</div>
141+
</div>
142+
</td>
143+
</tr>
144+
{% empty %}
145+
<tr>
146+
<td colspan="4" class="has-text-centered">No To-Dos found.</td>
147+
</tr>
148+
{% endfor %}
149+
</tbody>
150+
</table>
151+
</div>
152+
{% include "includes/pagination_v2.html" with page_obj=page_obj %}
153+
</div>
154+
<div class="column"></div>
155+
</div>
156+
{% endblock %}
157+

vulnerabilities/templates/fixing_advisories.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% load widget_tweaks %}
44

55
{% block content %}
6-
<div class="is-max-desktop mb-3">
6+
<div class="is-max-desktop mb-3 mt-4">
77
<section class="mx-5">
88
<div class="is-flex" style="justify-content: space-between;">
99
<div>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{% load utils %}
2+
3+
{% if page_obj.has_other_pages %}
4+
<nav class="pagination is-centered px-5" role="navigation" aria-label="pagination">
5+
6+
{% if page_obj.has_previous %}
7+
<a class="pagination-previous"
8+
href="?{% querystring request page=page_obj.previous_page_number %}">
9+
Previous
10+
</a>
11+
{% else %}
12+
<a class="pagination-previous" disabled>Previous</a>
13+
{% endif %}
14+
15+
{% if page_obj.has_next %}
16+
<a class="pagination-next"
17+
href="?{% querystring request page=page_obj.next_page_number %}">
18+
Next
19+
</a>
20+
{% else %}
21+
<a class="pagination-next" disabled>Next</a>
22+
{% endif %}
23+
24+
<ul class="pagination-list">
25+
26+
{% if page_obj.number > 3 %}
27+
<li>
28+
<a class="pagination-link"
29+
href="?{% querystring request page=1 %}">1</a>
30+
</li>
31+
{% if page_obj.number > 4 %}
32+
<li><span class="pagination-ellipsis">&hellip;</span></li>
33+
{% endif %}
34+
{% endif %}
35+
36+
{% for i in page_obj.paginator.page_range %}
37+
{% if i >= page_obj.number|add:-2 and i <= page_obj.number|add:2 %}
38+
{% if i == page_obj.number %}
39+
<li><a class="pagination-link is-current">{{ i }}</a></li>
40+
{% else %}
41+
<li>
42+
<a class="pagination-link"
43+
href="?{% querystring request page=i %}">
44+
{{ i }}
45+
</a>
46+
</li>
47+
{% endif %}
48+
{% endif %}
49+
{% endfor %}
50+
51+
{% if page_obj.number < page_obj.paginator.num_pages|add:-2 %}
52+
{% if page_obj.number < page_obj.paginator.num_pages|add:-3 %}
53+
<li><span class="pagination-ellipsis">&hellip;</span></li>
54+
{% endif %}
55+
<li>
56+
<a class="pagination-link"
57+
href="?{% querystring request page=page_obj.paginator.num_pages %}">
58+
{{ page_obj.paginator.num_pages }}
59+
</a>
60+
</li>
61+
{% endif %}
62+
63+
</ul>
64+
</nav>
65+
{% endif %}

0 commit comments

Comments
 (0)