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,9 +11,11 @@ from tenancy.api.serializers import TenantGroupSerializer, TenantSerializer
|
||||
from tenancy.models import Tenant
|
||||
|
||||
from ..choices import ConceptStatusChoices
|
||||
from ..models import ConceptDeployment, ConceptDevice, RackConcept
|
||||
from ..models import ConceptCable, ConceptComponent, ConceptDeployment, ConceptDevice, RackConcept
|
||||
|
||||
__all__ = (
|
||||
'ConceptCableSerializer',
|
||||
'ConceptComponentSerializer',
|
||||
'ConceptDeploySerializer',
|
||||
'ConceptDeploymentSerializer',
|
||||
'ConceptDeviceSerializer',
|
||||
@@ -81,6 +83,38 @@ class ConceptDeploymentSerializer(serializers.ModelSerializer):
|
||||
fields = ('id', 'rack', 'rack_name', 'device_count', 'user', 'created')
|
||||
|
||||
|
||||
class ConceptComponentSerializer(NetBoxModelSerializer):
|
||||
url = serializers.HyperlinkedIdentityField(
|
||||
view_name='plugins-api:netbox_rack_concept-api:conceptcomponent-detail'
|
||||
)
|
||||
device = ConceptDeviceSerializer(nested=True)
|
||||
is_connected = serializers.BooleanField(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = ConceptComponent
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'device', 'component_type', 'name', 'label', 'port_type',
|
||||
'positions', 'color', 'description', 'is_connected', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'component_type', 'device')
|
||||
|
||||
|
||||
class ConceptCableSerializer(NetBoxModelSerializer):
|
||||
url = serializers.HyperlinkedIdentityField(
|
||||
view_name='plugins-api:netbox_rack_concept-api:conceptcable-detail'
|
||||
)
|
||||
termination_a = ConceptComponentSerializer(nested=True)
|
||||
termination_b = ConceptComponentSerializer(nested=True)
|
||||
|
||||
class Meta:
|
||||
model = ConceptCable
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'termination_a', 'termination_b', 'status', 'type', 'color',
|
||||
'label', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'label', 'termination_a', 'termination_b')
|
||||
|
||||
|
||||
#
|
||||
# Action payloads
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user