Explorar o código

Closes #9347: Include services in global search

jeremystretch %!s(int64=3) %!d(string=hai) anos
pai
achega
662b02e2d8
Modificáronse 2 ficheiros con 11 adicións e 3 borrados
  1. 1 0
      docs/release-notes/version-3.2.md
  2. 10 3
      netbox/netbox/constants.py

+ 1 - 0
docs/release-notes/version-3.2.md

@@ -8,6 +8,7 @@
 * [#8922](https://github.com/netbox-community/netbox/issues/8922) - Add service list to IP address view
 * [#9098](https://github.com/netbox-community/netbox/issues/9098) - Add "other" types for power ports/outlets, pass-through ports
 * [#9239](https://github.com/netbox-community/netbox/issues/9239) - Enable filtering by contact group for all models which support contact assignment
+* [#9347](https://github.com/netbox-community/netbox/issues/9347) - Include services in global search
 * [#9379](https://github.com/netbox-community/netbox/issues/9379) - Redirect to virtual chassis view after adding a member device
 
 ### Bug Fixes

+ 10 - 3
netbox/netbox/constants.py

@@ -16,10 +16,11 @@ from dcim.tables import (
     RackReservationTable, SiteTable, VirtualChassisTable,
 )
 from ipam.filtersets import (
-    AggregateFilterSet, ASNFilterSet, IPAddressFilterSet, PrefixFilterSet, VLANFilterSet, VRFFilterSet,
+    AggregateFilterSet, ASNFilterSet, IPAddressFilterSet, PrefixFilterSet, ServiceFilterSet, VLANFilterSet,
+    VRFFilterSet,
 )
-from ipam.models import Aggregate, ASN, IPAddress, Prefix, VLAN, VRF
-from ipam.tables import AggregateTable, ASNTable, IPAddressTable, PrefixTable, VLANTable, VRFTable
+from ipam.models import Aggregate, ASN, IPAddress, Prefix, Service, VLAN, VRF
+from ipam.tables import AggregateTable, ASNTable, IPAddressTable, PrefixTable, ServiceTable, VLANTable, VRFTable
 from tenancy.filtersets import ContactFilterSet, TenantFilterSet
 from tenancy.models import Contact, Tenant, ContactAssignment
 from tenancy.tables import ContactTable, TenantTable
@@ -191,6 +192,12 @@ IPAM_TYPES = OrderedDict(
             'table': ASNTable,
             'url': 'ipam:asn_list',
         }),
+        ('service', {
+            'queryset': Service.objects.prefetch_related('device', 'virtual_machine'),
+            'filterset': ServiceFilterSet,
+            'table': ServiceTable,
+            'url': 'ipam:service_list',
+        }),
     )
 )