Closes: #8575 Implement rack_a and rack_b for cable table

This commit is contained in:
Alex Gittings 2022-03-15 00:02:16 +00:00
parent 1add5accf2
commit a143eca57d
2 changed files with 31 additions and 3 deletions

View File

@ -23,6 +23,12 @@ class CableTable(BaseTable):
orderable=False,
verbose_name='Side A'
)
rack_a = tables.Column(
accessor=Accessor('termination_a__device__rack'),
orderable=False,
linkify=True,
verbose_name='Rack A'
)
termination_a = tables.Column(
accessor=Accessor('termination_a'),
orderable=False,
@ -35,6 +41,12 @@ class CableTable(BaseTable):
orderable=False,
verbose_name='Side B'
)
rack_b = tables.Column(
accessor=Accessor('termination_b__device__rack'),
orderable=False,
linkify=True,
verbose_name='Rack B'
)
termination_b = tables.Column(
accessor=Accessor('termination_b'),
orderable=False,
@ -55,10 +67,10 @@ class CableTable(BaseTable):
class Meta(BaseTable.Meta):
model = Cable
fields = (
'pk', 'id', 'label', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
'pk', 'id', 'label', 'termination_a_parent', 'rack_a', 'termination_a', 'termination_b_parent', 'rack_b', 'termination_b',
'status', 'type', 'tenant', 'color', 'length', 'tags', 'created', 'last_updated',
)
default_columns = (
'pk', 'id', 'label', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
'status', 'type',
)
)

View File

@ -8,6 +8,22 @@
<a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
</td>
</tr>
{% if termination.device.site %}
<tr>
<td>Site</td>
<td>
<a href="{{ termination.device.site.get_absolute_url }}">{{ termination.device.site }}</a>
</td>
</tr>
{% endif %}
{% if termination.device.rack %}
<tr>
<td>Rack</td>
<td>
<a href="{{ termination.device.rack.get_absolute_url }}">{{ termination.device.rack }}</a>
</td>
</tr>
{% endif %}
<tr>
<td>Type</td>
<td>
@ -35,4 +51,4 @@
</td>
</tr>
{% endif %}
</table>
</table>