Skip to content

Commit f3937d7

Browse files
committed
feat(covmanager): modify all report filters to be case insensitive
1 parent d89b40f commit f3937d7

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

server/covmanager/views.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def tools_search_api(request):
519519

520520
if "name" in request.GET:
521521
name = request.GET["name"]
522-
results = Tool.objects.filter(name__contains=name).values_list(
522+
results = Tool.objects.filter(name__icontains=name).values_list(
523523
"name", flat=True
524524
)
525525

@@ -669,15 +669,15 @@ def filter_queryset(self, request, queryset, view):
669669

670670
filters = {}
671671
exactFilterKeys = [
672-
"description__contains",
672+
"description__icontains",
673673
"repository__name",
674-
"repository__name__contains",
674+
"repository__name__icontains",
675675
"revision",
676-
"revision__contains",
676+
"revision__icontains",
677677
"branch",
678-
"branch__contains",
678+
"branch__icontains",
679679
"tools__name",
680-
"tools__name__contains",
680+
"tools__name__icontains",
681681
]
682682

683683
for key in exactFilterKeys:

server/frontend/src/components/Covmanager/Collections.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ export default defineComponent({
230230
search_initialized: false,
231231
232232
search: {
233-
branch: { value: "", contains: true },
234-
description: { value: "", contains: true },
235-
repository: { value: "", contains: true, postfix: "__name" },
236-
revision: { value: "", contains: true },
237-
tools: { value: "", contains: true, postfix: "__name" },
233+
branch: { value: "", icontains: true },
234+
description: { value: "", icontains: true },
235+
repository: { value: "", icontains: true, postfix: "__name" },
236+
revision: { value: "", icontains: true },
237+
tools: { value: "", icontains: true, postfix: "__name" },
238238
limit: { value: "10", contains: false },
239239
},
240240
@@ -281,6 +281,7 @@ export default defineComponent({
281281
// TODO: This is a shortcut that saves us iterating through this.search
282282
// for every key that we are trying to map to a field in our search
283283
// object, but this won't work once we have more postfixes.
284+
k = k.replace(/__icontains$/, "");
284285
k = k.replace(/__contains$/, "");
285286
k = k.replace(/__name$/, "");
286287
@@ -304,7 +305,9 @@ export default defineComponent({
304305
k += obj.postfix;
305306
}
306307
307-
if ("contains" in obj && obj.contains) {
308+
if ("icontains" in obj && obj.icontains) {
309+
k += "__icontains";
310+
} else if ("contains" in obj && obj.contains) {
308311
k += "__contains";
309312
}
310313

0 commit comments

Comments
 (0)