Skip to content

Commit 20a8b28

Browse files
committed
Fix SeedDB Patch and Cable pages so the search filters all visible columns
1 parent 40e206f commit 20a8b28

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

changelog.d/3760.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Filtering on SeedDB Patch and Cable pages now searches all visible columns instead of only the jack field

python/nav/web/api/v1/views.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ class PatchViewSet(NAVAPIMixin, viewsets.ReadOnlyModelViewSet):
577577
578578
Search
579579
------
580-
Searches in the cables *jack*-field
580+
Searches in *jack*, *room*, *sysname*, *ifname*, *ifalias*
581581
582582
Filters
583583
-------
@@ -597,15 +597,21 @@ class PatchViewSet(NAVAPIMixin, viewsets.ReadOnlyModelViewSet):
597597
).all()
598598
serializer_class = serializers.PatchSerializer
599599
filterset_fields = ('cabling', 'cabling__room', 'interface', 'interface__netbox')
600-
search_fields = ('cabling__jack',)
600+
search_fields = (
601+
'cabling__jack',
602+
'cabling__room__id',
603+
'interface__netbox__sysname',
604+
'interface__ifname',
605+
'interface__ifalias',
606+
)
601607

602608

603609
class CablingViewSet(NAVAPIMixin, viewsets.ReadOnlyModelViewSet):
604610
"""Lists all cables.
605611
606612
Search
607613
------
608-
Searches in *jack*, *target_room*, *building*
614+
Searches in *jack*, *target_room*, *building*, *description*, *category*, *room*
609615
610616
Filters
611617
-------
@@ -620,7 +626,14 @@ class CablingViewSet(NAVAPIMixin, viewsets.ReadOnlyModelViewSet):
620626

621627
serializer_class = serializers.CablingSerializer
622628
filterset_fields = ('room', 'jack', 'building', 'target_room', 'category')
623-
search_fields = ('jack', 'target_room', 'building')
629+
search_fields = (
630+
'jack',
631+
'target_room',
632+
'building',
633+
'description',
634+
'category',
635+
'room__id',
636+
)
624637

625638
def get_queryset(self):
626639
queryset = cabling.Cabling.objects.all()

0 commit comments

Comments
 (0)