- Fix "images only" leaving plain labels visible on faces where a device has no image for that side (e.g. no rear_image set): the view selector now hides every plain label outright in that mode, not just the ones an image happens to sit on top of. - Remove the "Add planned device" button from the elevation card. Empty units are now click targets themselves - clicking one opens the add-device form pre-filled with that position and face, exactly like a real rack's elevation. Occupancy is computed per unit per face from the existing device blocks. - Add cabling for concept devices: ConceptComponent (interfaces, front/rear ports, power ports/outlets, console ports) and ConceptCable (a connection between two components, restricted to devices in the same concept). components.sync_components() populates a device's components from its device type's templates, including the front/rear port pass-through mapping copied from DeviceType.port_mappings - so a device with front/rear port templates (a patch panel being the common case) behaves exactly like a real one, without hardcoding anything role-specific. Placeholder devices without a device type get components added by hand. Full CRUD views, tables, filtersets, API endpoints and a "Connect" action wired in from the device detail page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
50 lines
1.1 KiB
Python
50 lines
1.1 KiB
Python
from netbox.search import SearchIndex, register_search
|
|
|
|
from .models import ConceptCable, ConceptComponent, ConceptDevice, RackConcept
|
|
|
|
|
|
@register_search
|
|
class RackConceptIndex(SearchIndex):
|
|
model = RackConcept
|
|
fields = (
|
|
('name', 100),
|
|
('description', 500),
|
|
('comments', 5000),
|
|
)
|
|
display_attrs = ('status', 'tenant', 'description')
|
|
|
|
|
|
@register_search
|
|
class ConceptDeviceIndex(SearchIndex):
|
|
model = ConceptDevice
|
|
fields = (
|
|
('name', 100),
|
|
('label', 110),
|
|
('serial', 120),
|
|
('description', 500),
|
|
('comments', 5000),
|
|
)
|
|
display_attrs = ('concept', 'status', 'device_type', 'role', 'description')
|
|
|
|
|
|
@register_search
|
|
class ConceptComponentIndex(SearchIndex):
|
|
model = ConceptComponent
|
|
fields = (
|
|
('name', 100),
|
|
('label', 110),
|
|
('description', 500),
|
|
)
|
|
display_attrs = ('device', 'component_type', 'port_type')
|
|
|
|
|
|
@register_search
|
|
class ConceptCableIndex(SearchIndex):
|
|
model = ConceptCable
|
|
fields = (
|
|
('label', 100),
|
|
('description', 500),
|
|
('comments', 5000),
|
|
)
|
|
display_attrs = ('status', 'type', 'description')
|