From 3324f397d9eae585cd6c606c26941ad4972e8fcd Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 10 Aug 2016 17:48:14 -0400 Subject: [PATCH 1/9] Post-release version bump --- netbox/netbox/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 4891d5ce5..392ed785b 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -12,7 +12,7 @@ except ImportError: "the documentation.") -VERSION = '1.5.0' +VERSION = '1.5.1-dev' # Import local configuration for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']: From 74528c6036dd9c460fbb0c470281da1a52f94b08 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 10 Aug 2016 22:20:09 -0400 Subject: [PATCH 2/9] Colorized roles in rack and device lists --- netbox/dcim/tables.py | 26 +++++++++++++++++++++----- netbox/templates/dcim/device.html | 2 +- netbox/templates/dcim/rack.html | 10 ++++++++++ netbox/utilities/tables.py | 7 ------- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py index 0a049ce94..9906a398e 100644 --- a/netbox/dcim/tables.py +++ b/netbox/dcim/tables.py @@ -1,7 +1,7 @@ import django_tables2 as tables from django_tables2.utils import Accessor -from utilities.tables import BaseTable, ColorColumn, ToggleColumn +from utilities.tables import BaseTable, ToggleColumn from .models import ( ConsolePort, ConsolePortTemplate, ConsoleServerPortTemplate, Device, DeviceBayTemplate, DeviceRole, DeviceType, @@ -10,6 +10,10 @@ from .models import ( ) +COLOR_LABEL = """ + +""" + DEVICE_LINK = """ {{ record.name|default:'Unnamed device' }} @@ -28,6 +32,14 @@ RACKROLE_ACTIONS = """ {% endif %} """ +RACK_ROLE = """ +{% if record.role %} + +{% else %} + — +{% endif %} +""" + DEVICEROLE_ACTIONS = """ {% if perms.dcim.change_devicerole %} @@ -46,6 +58,10 @@ PLATFORM_ACTIONS = """ {% endif %} """ +DEVICE_ROLE = """ + +""" + STATUS_ICON = """ {% if record.status %} @@ -108,7 +124,7 @@ class RackRoleTable(BaseTable): pk = ToggleColumn() name = tables.LinkColumn(verbose_name='Name') rack_count = tables.Column(verbose_name='Racks') - color = ColorColumn(verbose_name='Color') + color = tables.TemplateColumn(COLOR_LABEL, verbose_name='Color') slug = tables.Column(verbose_name='Slug') actions = tables.TemplateColumn(template_code=RACKROLE_ACTIONS, attrs={'td': {'class': 'text-right'}}, verbose_name='') @@ -129,7 +145,7 @@ class RackTable(BaseTable): group = tables.Column(accessor=Accessor('group.name'), verbose_name='Group') facility_id = tables.Column(verbose_name='Facility ID') tenant = tables.LinkColumn('tenancy:tenant', args=[Accessor('tenant.slug')], verbose_name='Tenant') - role = tables.Column(verbose_name='Role') + role = tables.TemplateColumn(RACK_ROLE, verbose_name='Role') u_height = tables.TemplateColumn("{{ record.u_height }}U", verbose_name='Height') devices = tables.Column(accessor=Accessor('device_count'), verbose_name='Devices') u_consumed = tables.TemplateColumn("{{ record.u_consumed|default:'0' }}U", verbose_name='Used') @@ -258,7 +274,7 @@ class DeviceRoleTable(BaseTable): pk = ToggleColumn() name = tables.LinkColumn(verbose_name='Name') device_count = tables.Column(verbose_name='Devices') - color = ColorColumn(verbose_name='Color') + color = tables.TemplateColumn(COLOR_LABEL, verbose_name='Color') slug = tables.Column(verbose_name='Slug') actions = tables.TemplateColumn(template_code=DEVICEROLE_ACTIONS, attrs={'td': {'class': 'text-right'}}, verbose_name='') @@ -295,7 +311,7 @@ class DeviceTable(BaseTable): tenant = tables.LinkColumn('tenancy:tenant', args=[Accessor('tenant.slug')], verbose_name='Tenant') site = tables.Column(accessor=Accessor('rack.site'), verbose_name='Site') rack = tables.LinkColumn('dcim:rack', args=[Accessor('rack.pk')], verbose_name='Rack') - device_role = tables.Column(verbose_name='Role') + device_role = tables.TemplateColumn(DEVICE_ROLE, verbose_name='Role') device_type = tables.Column(verbose_name='Type') primary_ip = tables.TemplateColumn(orderable=False, verbose_name='IP Address', template_code="{{ record.primary_ip.address.ip }}") diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index a25944262..cb2354c28 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -87,7 +87,7 @@ Role - {{ device.device_role }} + {{ device.device_role }} diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html index 4996a80c2..16a4731b6 100644 --- a/netbox/templates/dcim/rack.html +++ b/netbox/templates/dcim/rack.html @@ -96,6 +96,16 @@ {% endif %} + + Role + + {% if rack.role %} + {{ rack.role }} + {% else %} + None + {% endif %} + + Type diff --git a/netbox/utilities/tables.py b/netbox/utilities/tables.py index 90714b357..724e96056 100644 --- a/netbox/utilities/tables.py +++ b/netbox/utilities/tables.py @@ -28,10 +28,3 @@ class ToggleColumn(tables.CheckBoxColumn): @property def header(self): return mark_safe('') - - -class ColorColumn(tables.Column): - - def render(self, record): - html = ''.format(record.color, record.get_color_display()) - return mark_safe(html) From 098ff961e3c660964fcd36d637a5561057ae03a7 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 10 Aug 2016 22:27:27 -0400 Subject: [PATCH 3/9] Fixes #454: Correct typecasting on rack export --- netbox/dcim/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 537d33087..3da9bb443 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -373,7 +373,7 @@ class Rack(CreatedUpdatedModel): self.tenant.name if self.tenant else '', self.role.name if self.role else '', self.get_type_display() if self.type else '', - self.width, + str(self.width), str(self.u_height), ]) From 6f12297dcf6c725f8cb4fc4e2410d5f53f6566eb Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 10 Aug 2016 22:37:51 -0400 Subject: [PATCH 4/9] Fixes #441: Added openssl-devel to list of dependencies --- docs/installation/netbox.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index dbfc23133..b5b96d034 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -10,9 +10,10 @@ NetBox requires following system dependencies: * libffi-dev * graphviz * libpq-dev +* libssl-dev ``` -# sudo apt-get install -y python2.7 python-dev git python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev +# sudo apt-get install -y python2.7 python-dev python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev ``` You may opt to install NetBox either from a numbered release or by cloning the master branch of its repository on GitHub. From 219f0848052308dbdc44812eb528f0a4e92061e5 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 11 Aug 2016 10:19:50 -0400 Subject: [PATCH 5/9] Fixes #457: Added role field to rack edit form --- netbox/templates/dcim/rack_edit.html | 1 + 1 file changed, 1 insertion(+) diff --git a/netbox/templates/dcim/rack_edit.html b/netbox/templates/dcim/rack_edit.html index 166c052f6..83dfaf581 100644 --- a/netbox/templates/dcim/rack_edit.html +++ b/netbox/templates/dcim/rack_edit.html @@ -10,6 +10,7 @@ {% render_field form.name %} {% render_field form.facility_id %} {% render_field form.tenant %} + {% render_field form.role %} {% render_field form.type %} {% render_field form.width %} {% render_field form.u_height %} From e2ad1d4be0ccf6de0c3c0a257c674e9aa82bf437 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 11 Aug 2016 11:06:56 -0400 Subject: [PATCH 6/9] Closes #456: Added IP search box to home page --- netbox/templates/home.html | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/netbox/templates/home.html b/netbox/templates/home.html index 8825d88a0..f502bfa11 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -3,9 +3,9 @@ {% block content %}