Skip to content

Commit

Permalink
Closes #14503: Include additional display attributes for search indexers
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Dec 21, 2023
1 parent 3905ddf commit 92c7f6b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
1 change: 1 addition & 0 deletions netbox/core/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ class DataFileIndex(SearchIndex):
fields = (
('path', 200),
)
display_attrs = ('source',)
29 changes: 16 additions & 13 deletions netbox/dcim/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ConsolePortIndex(SearchIndex):
('description', 500),
('speed', 2000),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'description')


@register_search
Expand All @@ -34,7 +34,7 @@ class ConsoleServerPortIndex(SearchIndex):
('description', 500),
('speed', 2000),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'description')


@register_search
Expand All @@ -48,7 +48,8 @@ class DeviceIndex(SearchIndex):
('comments', 5000),
)
display_attrs = (
'site', 'location', 'rack', 'device_type', 'role', 'tenant', 'platform', 'serial', 'asset_tag', 'description',
'site', 'location', 'rack', 'status', 'device_type', 'role', 'tenant', 'platform', 'serial', 'asset_tag',
'description',
)


Expand Down Expand Up @@ -94,7 +95,7 @@ class FrontPortIndex(SearchIndex):
('label', 200),
('description', 500),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'description')


@register_search
Expand All @@ -109,7 +110,7 @@ class InterfaceIndex(SearchIndex):
('mtu', 2000),
('speed', 2000),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'mac_address', 'wwn', 'description')


@register_search
Expand All @@ -123,7 +124,7 @@ class InventoryItemIndex(SearchIndex):
('description', 500),
('part_id', 2000),
)
display_attrs = ('device', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description')
display_attrs = ('device', 'manufacturer', 'parent', 'part_id', 'serial', 'asset_tag', 'description')


@register_search
Expand Down Expand Up @@ -213,7 +214,7 @@ class PowerOutletIndex(SearchIndex):
('label', 200),
('description', 500),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'description')


@register_search
Expand All @@ -237,7 +238,7 @@ class PowerPortIndex(SearchIndex):
('maximum_draw', 2000),
('allocated_draw', 2000),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'description')


@register_search
Expand All @@ -251,7 +252,9 @@ class RackIndex(SearchIndex):
('description', 500),
('comments', 5000),
)
display_attrs = ('site', 'location', 'facility_id', 'tenant', 'status', 'role', 'description')
display_attrs = (
'site', 'location', 'facility_id', 'tenant', 'status', 'role', 'serial', 'asset_tag', 'description',
)


@register_search
Expand All @@ -272,7 +275,7 @@ class RackRoleIndex(SearchIndex):
('slug', 110),
('description', 500),
)
display_attrs = ('device', 'label', 'description',)
display_attrs = ('description',)


@register_search
Expand All @@ -283,7 +286,7 @@ class RearPortIndex(SearchIndex):
('label', 200),
('description', 500),
)
display_attrs = ('device', 'label', 'description')
display_attrs = ('device', 'label', 'type', 'description')


@register_search
Expand All @@ -309,7 +312,7 @@ class SiteIndex(SearchIndex):
('shipping_address', 2000),
('comments', 5000),
)
display_attrs = ('region', 'group', 'status', 'description')
display_attrs = ('region', 'group', 'status', 'tenant', 'facility', 'description')


@register_search
Expand Down Expand Up @@ -344,4 +347,4 @@ class VirtualDeviceContextIndex(SearchIndex):
('description', 500),
('comments', 5000),
)
display_attrs = ('device', 'status', 'identifier', 'description')
display_attrs = ('device', 'status', 'identifier', 'tenant', 'description')
2 changes: 2 additions & 0 deletions netbox/extras/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class JournalEntryIndex(SearchIndex):
('comments', 5000),
)
category = 'Journal'
display_attrs = ('kind', 'created_by')


@register_search
Expand All @@ -18,3 +19,4 @@ class WebhookEntryIndex(SearchIndex):
('name', 100),
('description', 500),
)
display_attrs = ('description',)
4 changes: 2 additions & 2 deletions netbox/virtualization/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class VMInterfaceIndex(SearchIndex):
('description', 500),
('mtu', 2000),
)
display_attrs = ('virtual_machine', 'description')
display_attrs = ('virtual_machine', 'mac_address', 'description')


@register_search
Expand All @@ -65,4 +65,4 @@ class VirtualDiskIndex(SearchIndex):
('name', 100),
('description', 500),
)
display_attrs = ('virtual_machine', 'description')
display_attrs = ('virtual_machine', 'size', 'description')
2 changes: 1 addition & 1 deletion netbox/vpn/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TunnelIndex(SearchIndex):
('description', 500),
('comments', 5000),
)
display_attrs = ('status', 'encapsulation', 'tenant', 'description')
display_attrs = ('group', 'status', 'encapsulation', 'tenant', 'tunnel_id', 'description')


@register_search
Expand Down

0 comments on commit 92c7f6b

Please sign in to comment.