mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Adds PowerOutlet.status to detail view
Also fixes color display in list table and detail template
This commit is contained in:
parent
2ae84ce9fb
commit
913405a3ae
@ -498,6 +498,9 @@ class PowerOutlet(ModularComponentModel, CabledObjectModel, PathEndpoint, Tracki
|
||||
_("Parent power port ({power_port}) must belong to the same device").format(power_port=self.power_port)
|
||||
)
|
||||
|
||||
def get_status_color(self):
|
||||
return PowerOutletStatusChoices.colors.get(self.status)
|
||||
|
||||
|
||||
#
|
||||
# Interfaces
|
||||
|
@ -520,6 +520,9 @@ class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
|
||||
verbose_name=_('Power Port'),
|
||||
linkify=True
|
||||
)
|
||||
status = columns.ChoiceFieldColumn(
|
||||
verbose_name=_('Status'),
|
||||
)
|
||||
color = columns.ColorColumn()
|
||||
tags = columns.TagColumn(
|
||||
url_name='dcim:poweroutlet_list'
|
||||
|
@ -36,6 +36,10 @@
|
||||
<th scope="row">{% trans "Type" %}</th>
|
||||
<td>{{ object.get_type_display }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Status" %}</th>
|
||||
<td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Description" %}</th>
|
||||
<td>{{ object.description|placeholder }}</td>
|
||||
|
Loading…
Reference in New Issue
Block a user