From 98e60502b28327947d407f15dec111ba04adcad0 Mon Sep 17 00:00:00 2001 From: Sylvain Rabot Date: Mon, 22 May 2017 12:06:14 +0200 Subject: [PATCH] Improve prefixes description visibility CIDR notation is not that human readable so when you have a lot of prefixes and children prefixes, descriptions are really helpful to understand your network infrastructure. Current displays kind of hide descriptions instead of highlighting it. This patch tries to fix that. Signed-off-by: Sylvain Rabot --- netbox/ipam/tables.py | 16 +++++++++++++--- netbox/templates/ipam/inc/prefix_header.html | 4 ++++ netbox/templates/ipam/prefix_edit.html | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py index 562713f5b..2283dd5d4 100644 --- a/netbox/ipam/tables.py +++ b/netbox/ipam/tables.py @@ -48,13 +48,23 @@ PREFIX_LINK = """ {% else %} {% endif %} - {{ record.prefix }} + +{% if record.description %} +{{ record.prefix }} - {{ record.description }} +{% else %} +{{ record.prefix }} +{% endif %} """ PREFIX_LINK_BRIEF = """ - {{ record.prefix }} + +{% if record.description %} +{{ record.prefix }} - {{ record.description }} +{% else %} +{{ record.prefix }} +{% endif %} """ @@ -247,7 +257,7 @@ class PrefixTable(BaseTable): class Meta(BaseTable.Meta): model = Prefix - fields = ('pk', 'prefix', 'status', 'vrf', 'tenant', 'site', 'vlan', 'role', 'description') + fields = ('pk', 'prefix', 'status', 'vrf', 'tenant', 'site', 'vlan', 'role') row_attrs = { 'class': lambda record: 'success' if not record.pk else '', } diff --git a/netbox/templates/ipam/inc/prefix_header.html b/netbox/templates/ipam/inc/prefix_header.html index 6deb10e57..87356e6c5 100644 --- a/netbox/templates/ipam/inc/prefix_header.html +++ b/netbox/templates/ipam/inc/prefix_header.html @@ -41,7 +41,11 @@ {% endif %} +{% if prefix.description %} +

{{ prefix }} - {{ prefix.description }}

+{% else %}

{{ prefix }}

+{% endif %} {% include 'inc/created_updated.html' with obj=prefix %}