Fix rear-face image-only labels, click-to-add units, cable concept devices
- 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>
This commit is contained in:
@@ -11,10 +11,10 @@ from netbox.api.viewsets import NetBoxModelViewSet
|
||||
from .. import filtersets
|
||||
from .. import deploy as deploy_utils
|
||||
from ..elevation import get_elevations
|
||||
from ..models import ConceptDevice, RackConcept
|
||||
from ..models import ConceptCable, ConceptComponent, ConceptDevice, RackConcept
|
||||
from .serializers import (
|
||||
ConceptDeploySerializer, ConceptDeviceSerializer, MergeConceptsSerializer, RackConceptCloneSerializer,
|
||||
RackConceptSerializer, RackCopySerializer,
|
||||
ConceptCableSerializer, ConceptComponentSerializer, ConceptDeploySerializer, ConceptDeviceSerializer,
|
||||
MergeConceptsSerializer, RackConceptCloneSerializer, RackConceptSerializer, RackCopySerializer,
|
||||
)
|
||||
|
||||
__all__ = (
|
||||
@@ -204,3 +204,17 @@ class ConceptDeviceViewSet(NetBoxModelViewSet):
|
||||
)
|
||||
serializer_class = ConceptDeviceSerializer
|
||||
filterset_class = filtersets.ConceptDeviceFilterSet
|
||||
|
||||
|
||||
class ConceptComponentViewSet(NetBoxModelViewSet):
|
||||
queryset = ConceptComponent.objects.prefetch_related('tags').select_related('device', 'device__concept')
|
||||
serializer_class = ConceptComponentSerializer
|
||||
filterset_class = filtersets.ConceptComponentFilterSet
|
||||
|
||||
|
||||
class ConceptCableViewSet(NetBoxModelViewSet):
|
||||
queryset = ConceptCable.objects.prefetch_related('tags').select_related(
|
||||
'termination_a', 'termination_a__device', 'termination_b', 'termination_b__device'
|
||||
)
|
||||
serializer_class = ConceptCableSerializer
|
||||
filterset_class = filtersets.ConceptCableFilterSet
|
||||
|
||||
Reference in New Issue
Block a user