- Fix elevation rendering bug: device blocks were drawn MARGIN px further right than the rack frame/unit slots, causing them to overlap and extend past the right border. All three now share one RACK_X origin. - Show the device type's front/rear image inside each elevation block (clipped to the block, translucent label bar on top for legibility) when one is set on the device type; falls back to a plain colour block with text otherwise. - Add "Merge" action to combine two concepts into one taller one (e.g. two half-height racks stacked into a full-height rack): the top concept's devices are shifted up by the bottom concept's height, neither source is modified. Available from the plugin menu, from a concept's detail page, and via POST /concepts/merge/. - Copying a real rack into a concept can now target a different width, height and/or starting unit than the source rack; devices that no longer fit at the chosen size are skipped and reported as warnings instead of aborting the copy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
67 lines
2.2 KiB
Python
67 lines
2.2 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']
|
|
),
|
|
]
|
|
|
|
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
|
|
),
|
|
)),
|
|
)
|
|
)
|