|
@@ -2,7 +2,7 @@ import django_tables2 as tables
|
|
|
from django_tables2.utils import Accessor
|
|
from django_tables2.utils import Accessor
|
|
|
|
|
|
|
|
from tenancy.tables import COL_TENANT
|
|
from tenancy.tables import COL_TENANT
|
|
|
-from utilities.tables import BaseTable, BooleanColumn, ColorColumn, TagColumn, ToggleColumn
|
|
|
|
|
|
|
+from utilities.tables import BaseTable, BooleanColumn, ColorColumn, ColoredLabelColumn, TagColumn, ToggleColumn
|
|
|
from .models import (
|
|
from .models import (
|
|
|
Cable, ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
|
|
Cable, ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
|
|
|
DeviceBayTemplate, DeviceRole, DeviceType, FrontPort, FrontPortTemplate, Interface, InterfaceTemplate,
|
|
DeviceBayTemplate, DeviceRole, DeviceType, FrontPort, FrontPortTemplate, Interface, InterfaceTemplate,
|
|
@@ -72,15 +72,6 @@ RACKROLE_ACTIONS = """
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
-RACK_ROLE = """
|
|
|
|
|
-{% if record.role %}
|
|
|
|
|
- {% load helpers %}
|
|
|
|
|
- <label class="label" style="color: {{ record.role.color|fgcolor }}; background-color: #{{ record.role.color }}">{{ value }}</label>
|
|
|
|
|
-{% else %}
|
|
|
|
|
- —
|
|
|
|
|
-{% endif %}
|
|
|
|
|
-"""
|
|
|
|
|
-
|
|
|
|
|
RACK_DEVICE_COUNT = """
|
|
RACK_DEVICE_COUNT = """
|
|
|
<a href="{% url 'dcim:device_list' %}?rack_id={{ record.pk }}">{{ value }}</a>
|
|
<a href="{% url 'dcim:device_list' %}?rack_id={{ record.pk }}">{{ value }}</a>
|
|
|
"""
|
|
"""
|
|
@@ -137,11 +128,6 @@ PLATFORM_ACTIONS = """
|
|
|
{% endif %}
|
|
{% endif %}
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
-DEVICE_ROLE = """
|
|
|
|
|
-{% load helpers %}
|
|
|
|
|
-<label class="label" style="color: {{ record.device_role.color|fgcolor }}; background-color: #{{ record.device_role.color }}">{{ value }}</label>
|
|
|
|
|
-"""
|
|
|
|
|
-
|
|
|
|
|
STATUS_LABEL = """
|
|
STATUS_LABEL = """
|
|
|
<span class="label label-{{ record.get_status_class }}">{{ record.get_status_display }}</span>
|
|
<span class="label label-{{ record.get_status_class }}">{{ record.get_status_display }}</span>
|
|
|
"""
|
|
"""
|
|
@@ -325,9 +311,7 @@ class RackTable(BaseTable):
|
|
|
status = tables.TemplateColumn(
|
|
status = tables.TemplateColumn(
|
|
|
template_code=STATUS_LABEL
|
|
template_code=STATUS_LABEL
|
|
|
)
|
|
)
|
|
|
- role = tables.TemplateColumn(
|
|
|
|
|
- template_code=RACK_ROLE
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ role = ColoredLabelColumn()
|
|
|
u_height = tables.TemplateColumn(
|
|
u_height = tables.TemplateColumn(
|
|
|
template_code="{{ record.u_height }}U",
|
|
template_code="{{ record.u_height }}U",
|
|
|
verbose_name='Height'
|
|
verbose_name='Height'
|
|
@@ -806,8 +790,7 @@ class DeviceTable(BaseTable):
|
|
|
viewname='dcim:rack',
|
|
viewname='dcim:rack',
|
|
|
args=[Accessor('rack.pk')]
|
|
args=[Accessor('rack.pk')]
|
|
|
)
|
|
)
|
|
|
- device_role = tables.TemplateColumn(
|
|
|
|
|
- template_code=DEVICE_ROLE,
|
|
|
|
|
|
|
+ device_role = ColoredLabelColumn(
|
|
|
verbose_name='Role'
|
|
verbose_name='Role'
|
|
|
)
|
|
)
|
|
|
device_type = tables.LinkColumn(
|
|
device_type = tables.LinkColumn(
|