mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-14 05:00:13 +02:00
feat(ui): Add colored rendering for related object attributes
Introduce `colored` parameter to `RelatedObjectAttr`, `NestedObjectAttr`, and `ObjectListAttr` to render objects as colored badges when they expose a `color` attribute. Update badge template tag to support hex colors and optional URLs. Apply colored rendering to circuit types, device roles, rack roles, inventory item roles, and VM roles. Fixes #21430
This commit is contained in:
committed by
Jeremy Stretch
parent
296e708e09
commit
7ff7c6d17e
@@ -17,7 +17,7 @@ class VirtualMachinePanel(panels.ObjectAttributesPanel):
|
||||
name = attrs.TextAttr('name')
|
||||
status = attrs.ChoiceAttr('status')
|
||||
start_on_boot = attrs.ChoiceAttr('start_on_boot')
|
||||
role = attrs.RelatedObjectAttr('role', linkify=True)
|
||||
role = attrs.RelatedObjectAttr('role', linkify=True, colored=True)
|
||||
platform = attrs.NestedObjectAttr('platform', linkify=True, max_depth=3)
|
||||
description = attrs.TextAttr('description')
|
||||
serial = attrs.TextAttr('serial', label=_('Serial number'), style='font-monospace', copy_button=True)
|
||||
|
||||
Reference in New Issue
Block a user