Skip to content

Commit 32eed72

Browse files
Merge pull request #8874 from minitriga/issue_8575
Closes: #8575 - Show Racks on Cable Table and Cable Page
2 parents 585b5a2 + 9548cf3 commit 32eed72

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

netbox/dcim/tables/cables.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ class CableTable(BaseTable):
2323
orderable=False,
2424
verbose_name='Side A'
2525
)
26+
rack_a = tables.Column(
27+
accessor=Accessor('termination_a__device__rack'),
28+
orderable=False,
29+
linkify=True,
30+
verbose_name='Rack A'
31+
)
2632
termination_a = tables.Column(
2733
accessor=Accessor('termination_a'),
2834
orderable=False,
@@ -35,6 +41,12 @@ class CableTable(BaseTable):
3541
orderable=False,
3642
verbose_name='Side B'
3743
)
44+
rack_b = tables.Column(
45+
accessor=Accessor('termination_b__device__rack'),
46+
orderable=False,
47+
linkify=True,
48+
verbose_name='Rack B'
49+
)
3850
termination_b = tables.Column(
3951
accessor=Accessor('termination_b'),
4052
orderable=False,
@@ -55,7 +67,7 @@ class CableTable(BaseTable):
5567
class Meta(BaseTable.Meta):
5668
model = Cable
5769
fields = (
58-
'pk', 'id', 'label', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
70+
'pk', 'id', 'label', 'termination_a_parent', 'rack_a', 'termination_a', 'termination_b_parent', 'rack_b', 'termination_b',
5971
'status', 'type', 'tenant', 'color', 'length', 'tags', 'created', 'last_updated',
6072
)
6173
default_columns = (

netbox/templates/dcim/inc/cable_termination.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
<a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
99
</td>
1010
</tr>
11+
{% if termination.device.site %}
12+
<tr>
13+
<td>Site</td>
14+
<td>
15+
<a href="{{ termination.device.site.get_absolute_url }}">{{ termination.device.site }}</a>
16+
</td>
17+
</tr>
18+
{% endif %}
19+
{% if termination.device.rack %}
20+
<tr>
21+
<td>Rack</td>
22+
<td>
23+
<a href="{{ termination.device.rack.get_absolute_url }}">{{ termination.device.rack }}</a>
24+
</td>
25+
</tr>
26+
{% endif %}
1127
<tr>
1228
<td>Type</td>
1329
<td>

0 commit comments

Comments
 (0)