- 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>
90 lines
3.0 KiB
Python
90 lines
3.0 KiB
Python
from django.utils.translation import gettext_lazy as _
|
|
|
|
from netbox.choices import ButtonColorChoices
|
|
from netbox.plugins import PluginMenu, PluginMenuButton, PluginMenuItem
|
|
|
|
concept_buttons = [
|
|
PluginMenuButton(
|
|
link='plugins:netbox_rack_concept:rackconcept_add',
|
|
title=_('Add'),
|
|
icon_class='mdi mdi-plus-thick',
|
|
color=ButtonColorChoices.GREEN,
|
|
permissions=['netbox_rack_concept.add_rackconcept']
|
|
),
|
|
PluginMenuButton(
|
|
link='plugins:netbox_rack_concept:rackconcept_bulk_import',
|
|
title=_('Import'),
|
|
icon_class='mdi mdi-upload',
|
|
color=ButtonColorChoices.CYAN,
|
|
permissions=['netbox_rack_concept.add_rackconcept']
|
|
),
|
|
PluginMenuButton(
|
|
link='plugins:netbox_rack_concept:rackconcept_merge',
|
|
title=_('Merge'),
|
|
icon_class='mdi mdi-call-merge',
|
|
color=ButtonColorChoices.PURPLE,
|
|
permissions=['netbox_rack_concept.add_rackconcept']
|
|
),
|
|
]
|
|
|
|
device_buttons = [
|
|
PluginMenuButton(
|
|
link='plugins:netbox_rack_concept:conceptdevice_add',
|
|
title=_('Add'),
|
|
icon_class='mdi mdi-plus-thick',
|
|
color=ButtonColorChoices.GREEN,
|
|
permissions=['netbox_rack_concept.add_conceptdevice']
|
|
),
|
|
PluginMenuButton(
|
|
link='plugins:netbox_rack_concept:conceptdevice_bulk_import',
|
|
title=_('Import'),
|
|
icon_class='mdi mdi-upload',
|
|
color=ButtonColorChoices.CYAN,
|
|
permissions=['netbox_rack_concept.add_conceptdevice']
|
|
),
|
|
]
|
|
|
|
cable_buttons = [
|
|
PluginMenuButton(
|
|
link='plugins:netbox_rack_concept:conceptcable_add',
|
|
title=_('Add'),
|
|
icon_class='mdi mdi-plus-thick',
|
|
color=ButtonColorChoices.GREEN,
|
|
permissions=['netbox_rack_concept.add_conceptcable']
|
|
),
|
|
]
|
|
|
|
menu = PluginMenu(
|
|
label=_('Rack Concepts'),
|
|
icon_class='mdi mdi-view-grid-plus-outline',
|
|
groups=(
|
|
(_('Planning'), (
|
|
PluginMenuItem(
|
|
link='plugins:netbox_rack_concept:rackconcept_list',
|
|
link_text=_('Rack Concepts'),
|
|
permissions=['netbox_rack_concept.view_rackconcept'],
|
|
buttons=concept_buttons
|
|
),
|
|
PluginMenuItem(
|
|
link='plugins:netbox_rack_concept:conceptdevice_list',
|
|
link_text=_('Planned Devices'),
|
|
permissions=['netbox_rack_concept.view_conceptdevice'],
|
|
buttons=device_buttons
|
|
),
|
|
)),
|
|
(_('Cabling'), (
|
|
PluginMenuItem(
|
|
link='plugins:netbox_rack_concept:conceptcomponent_list',
|
|
link_text=_('Components'),
|
|
permissions=['netbox_rack_concept.view_conceptcomponent'],
|
|
),
|
|
PluginMenuItem(
|
|
link='plugins:netbox_rack_concept:conceptcable_list',
|
|
link_text=_('Cables'),
|
|
permissions=['netbox_rack_concept.view_conceptcable'],
|
|
buttons=cable_buttons
|
|
),
|
|
)),
|
|
)
|
|
)
|