mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
69 lines
1.6 KiB
Python
69 lines
1.6 KiB
Python
from netbox.search import SearchIndex, register_search
|
|
from . import models
|
|
|
|
|
|
@register_search
|
|
class ClusterIndex(SearchIndex):
|
|
model = models.Cluster
|
|
fields = (
|
|
('name', 100),
|
|
('description', 500),
|
|
('comments', 5000),
|
|
)
|
|
display_attrs = ('type', 'group', 'status', 'tenant', 'site', 'description')
|
|
|
|
|
|
@register_search
|
|
class ClusterGroupIndex(SearchIndex):
|
|
model = models.ClusterGroup
|
|
fields = (
|
|
('name', 100),
|
|
('slug', 110),
|
|
('description', 500),
|
|
)
|
|
display_attrs = ('description',)
|
|
|
|
|
|
@register_search
|
|
class ClusterTypeIndex(SearchIndex):
|
|
model = models.ClusterType
|
|
fields = (
|
|
('name', 100),
|
|
('slug', 110),
|
|
('description', 500),
|
|
)
|
|
display_attrs = ('description',)
|
|
|
|
|
|
@register_search
|
|
class VirtualMachineIndex(SearchIndex):
|
|
model = models.VirtualMachine
|
|
fields = (
|
|
('name', 100),
|
|
('description', 500),
|
|
('comments', 5000),
|
|
)
|
|
display_attrs = ('site', 'cluster', 'device', 'tenant', 'platform', 'status', 'role', 'description')
|
|
|
|
|
|
@register_search
|
|
class VMInterfaceIndex(SearchIndex):
|
|
model = models.VMInterface
|
|
fields = (
|
|
('name', 100),
|
|
('mac_address', 300),
|
|
('description', 500),
|
|
('mtu', 2000),
|
|
)
|
|
display_attrs = ('virtual_machine', 'mac_address', 'description')
|
|
|
|
|
|
@register_search
|
|
class VirtualDiskIndex(SearchIndex):
|
|
model = models.VirtualDisk
|
|
fields = (
|
|
('name', 100),
|
|
('description', 500),
|
|
)
|
|
display_attrs = ('virtual_machine', 'size', 'description')
|