From 02969d334f058b04f617d02f35345b9fa2694f1d Mon Sep 17 00:00:00 2001 From: bellwood Date: Fri, 15 Jul 2016 14:30:27 -0400 Subject: [PATCH] update for rack utilization / space used --- netbox/dcim/tables.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py index dc66c3ab1..aa325c27c 100644 --- a/netbox/dcim/tables.py +++ b/netbox/dcim/tables.py @@ -48,6 +48,16 @@ STATUS_ICON = """ {% endif %} """ +UTILIZATION_GRAPH = """ +{% with record.get_utilization as percentage %} +
+ {% if percentage < 15 %}{{ percentage }}%{% endif %} +
+ {% if percentage >= 15 %}{{ percentage }}%{% endif %} +
+
+{% # # Sites @@ -98,6 +108,8 @@ class RackTable(BaseTable): facility_id = tables.Column(verbose_name='Facility ID') u_height = tables.Column(verbose_name='Height (U)') devices = tables.Column(accessor=Accessor('device_count'), verbose_name='Devices') + u_used = tables.Column(accessor=Accessor('get_used_units'), verbose_name='Space Used') + utilization = tables.TemplateColumn(UTILIZATION_GRAPH, orderable=False, verbose_name='Utilization') class Meta(BaseTable.Meta): model = Rack