mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 03:56:53 -06:00
Closes #8163: Add bridge members panel to interface view
This commit is contained in:
parent
894665b067
commit
b7e2ea1ca5
@ -762,6 +762,10 @@ class Interface(ComponentModel, BaseInterface, LinkTermination, PathEndpoint):
|
|||||||
def is_lag(self):
|
def is_lag(self):
|
||||||
return self.type == InterfaceTypeChoices.TYPE_LAG
|
return self.type == InterfaceTypeChoices.TYPE_LAG
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_bridge(self):
|
||||||
|
return self.type == InterfaceTypeChoices.TYPE_BRIDGE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def link(self):
|
def link(self):
|
||||||
return self.cable or self.wireless_link
|
return self.cable or self.wireless_link
|
||||||
|
@ -1776,6 +1776,14 @@ class InterfaceView(generic.ObjectView):
|
|||||||
orderable=False
|
orderable=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Get bridge interfaces
|
||||||
|
bridge_interfaces = Interface.objects.restrict(request.user, 'view').filter(bridge=instance)
|
||||||
|
bridge_interfaces_tables = tables.InterfaceTable(
|
||||||
|
bridge_interfaces,
|
||||||
|
exclude=('device', 'parent'),
|
||||||
|
orderable=False
|
||||||
|
)
|
||||||
|
|
||||||
# Get child interfaces
|
# Get child interfaces
|
||||||
child_interfaces = Interface.objects.restrict(request.user, 'view').filter(parent=instance)
|
child_interfaces = Interface.objects.restrict(request.user, 'view').filter(parent=instance)
|
||||||
child_interfaces_tables = tables.InterfaceTable(
|
child_interfaces_tables = tables.InterfaceTable(
|
||||||
@ -1800,6 +1808,7 @@ class InterfaceView(generic.ObjectView):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'ipaddress_table': ipaddress_table,
|
'ipaddress_table': ipaddress_table,
|
||||||
|
'bridge_interfaces_table': bridge_interfaces_tables,
|
||||||
'child_interfaces_table': child_interfaces_tables,
|
'child_interfaces_table': child_interfaces_tables,
|
||||||
'vlan_table': vlan_table,
|
'vlan_table': vlan_table,
|
||||||
}
|
}
|
||||||
|
@ -467,6 +467,13 @@
|
|||||||
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
|
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if object.is_bridge %}
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col col-md-12">
|
||||||
|
{% include 'inc/panel_table.html' with table=bridge_interfaces_table heading="Bridge Interfaces" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
{% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
|
{% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
|
||||||
|
Loading…
Reference in New Issue
Block a user