Skip to content

Commit ee98ff1

Browse files
committed
fix(ui): add cancel button to search field
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent ae55496 commit ee98ff1

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎vulnerabilities/templates/pipeline_dashboard.html‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@ <h1>Pipeline Dashboard</h1>
5252
</div>
5353
<form method="get" class="box px-6 mx-0" action="">
5454
<div class="field has-addons">
55-
<div class="control is-expanded">
55+
<div class="control is-expanded has-icons-right">
5656
{{ form.search }}
57+
58+
{% if form.search.value %}
59+
<a href="{{ request.path }}"
60+
class="icon is-right"
61+
style="pointer-events: auto; cursor: pointer;">
62+
<i class="fa fa-close" style="color:gray"></i>
63+
</a>
64+
{% endif %}
5765
</div>
5866
<div class="control">
5967
<button type="submit" class="button is-info"><i class="fa fa-search mx-1"></i></button>

‎vulnerabilities/views.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,11 @@ class PipelineScheduleListView(VulnerableCodeListView, FormMixin):
10021002
paginate_by = 20
10031003
form_class = PipelineSchedulePackageForm
10041004

1005+
def get_form_kwargs(self):
1006+
kwargs = super().get_form_kwargs()
1007+
kwargs["data"] = self.request.GET
1008+
return kwargs
1009+
10051010
def get_queryset(self):
10061011
form = self.form_class(self.request.GET)
10071012
if form.is_valid():

0 commit comments

Comments
 (0)