mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-25 02:08:58 +02:00
fix(dcim): Fix Virtual Chassis Member add action context
Fix context variable references in VirtualChassMembersPanel add action to use 'virtual_chassis' instead of 'object'. Add safe checks for master_id existence to prevent errors when master is not set. Fixes #21810
This commit is contained in:
committed by
Jeremy Stretch
parent
2563122352
commit
9492b55f4b
@@ -420,14 +420,23 @@ class VirtualChassisMembersPanel(panels.ObjectPanel):
|
|||||||
"""
|
"""
|
||||||
A panel which lists all members of a virtual chassis.
|
A panel which lists all members of a virtual chassis.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
template_name = 'dcim/panels/virtual_chassis_members.html'
|
template_name = 'dcim/panels/virtual_chassis_members.html'
|
||||||
title = _('Virtual Chassis Members')
|
title = _('Virtual Chassis Members')
|
||||||
actions = [
|
actions = [
|
||||||
actions.AddObject(
|
actions.AddObject(
|
||||||
'dcim.device',
|
'dcim.device',
|
||||||
url_params={
|
url_params={
|
||||||
'site': lambda ctx: ctx['object'].master.site_id if ctx['object'].master else '',
|
'site': lambda ctx: (
|
||||||
'rack': lambda ctx: ctx['object'].master.rack_id if ctx['object'].master else '',
|
ctx['virtual_chassis'].master.site_id
|
||||||
|
if ctx['virtual_chassis'] and ctx['virtual_chassis'].master_id
|
||||||
|
else ''
|
||||||
|
),
|
||||||
|
'rack': lambda ctx: (
|
||||||
|
ctx['virtual_chassis'].master.rack_id
|
||||||
|
if ctx['virtual_chassis'] and ctx['virtual_chassis'].master_id
|
||||||
|
else ''
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user