From 8d86e97247a9971057a96dd6b74cae7b194c4653 Mon Sep 17 00:00:00 2001 From: Brian Candler Date: Wed, 13 Feb 2019 08:54:04 +0000 Subject: [PATCH 01/14] Clarify use of "runreport" CLI --- docs/additional-features/reports.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/additional-features/reports.md b/docs/additional-features/reports.md index 2c73850eb..33c3d95ae 100644 --- a/docs/additional-features/reports.md +++ b/docs/additional-features/reports.md @@ -128,4 +128,4 @@ Reports can be run on the CLI by invoking the management command: python3 manage.py runreport ``` -One or more report modules may be specified. +where ```` is the name of the python file in the ``reports`` directory without the ``.py`` extension. One or more report modules may be specified. From 1ee6d16d78e2ad3d465c353498319106ec62ac8b Mon Sep 17 00:00:00 2001 From: Guillaume de Lafond Date: Thu, 14 Feb 2019 10:17:25 +0100 Subject: [PATCH 02/14] add port type LC/APC, SC/APC, LSH/APC --- netbox/dcim/constants.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index 22d4468fc..755c28ea9 100644 --- a/netbox/dcim/constants.py +++ b/netbox/dcim/constants.py @@ -270,11 +270,14 @@ PORT_TYPE_8P8C = 1000 PORT_TYPE_110_PUNCH = 1100 PORT_TYPE_ST = 2000 PORT_TYPE_SC = 2100 +PORT_TYPE_SC_APC = 2110 PORT_TYPE_FC = 2200 PORT_TYPE_LC = 2300 +PORT_TYPE_LC_APC = 2310 PORT_TYPE_MTRJ = 2400 PORT_TYPE_MPO = 2500 PORT_TYPE_LSH = 2600 +PORT_TYPE_LSH_APC = 2610 PORT_TYPE_CHOICES = [ [ 'Copper', @@ -288,10 +291,13 @@ PORT_TYPE_CHOICES = [ [ [PORT_TYPE_FC, 'FC'], [PORT_TYPE_LC, 'LC'], + [PORT_TYPE_LC_APC, 'LC/APC'], [PORT_TYPE_LSH, 'LSH'], + [PORT_TYPE_LSH_APC, 'LSH/APC'], [PORT_TYPE_MPO, 'MPO'], [PORT_TYPE_MTRJ, 'MTRJ'], [PORT_TYPE_SC, 'SC'], + [PORT_TYPE_SC_APC, 'SC/APC'], [PORT_TYPE_ST, 'ST'], ] ] From 40cb47868f9a7f873b1e35c911c2a4dcd4ca545c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 10:13:36 -0500 Subject: [PATCH 03/14] Fixes #2914: Fix empty connected circuit link on device interfaces list --- CHANGELOG.md | 1 + netbox/templates/dcim/inc/interface.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a36f7c21b..800dec26d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ v2.5.7 (FUTURE) * [#2895](https://github.com/digitalocean/netbox/issues/2895) - Fix filtering of nullable character fields * [#2901](https://github.com/digitalocean/netbox/issues/2901) - Fix ordering regions by site count * [#2910](https://github.com/digitalocean/netbox/issues/2910) - Fix config context list and edit forms to use Select2 elements +* [#2914](https://github.com/digitalocean/netbox/issues/2914) - Fix empty connected circuit link on device interfaces list v2.5.6 (2019-02-13) diff --git a/netbox/templates/dcim/inc/interface.html b/netbox/templates/dcim/inc/interface.html index f84fef678..088f8f5cf 100644 --- a/netbox/templates/dcim/inc/interface.html +++ b/netbox/templates/dcim/inc/interface.html @@ -96,7 +96,7 @@ {{ peer_termination.connected_endpoint.device }}
via - + {{ iface.connected_endpoint.circuit.provider }} {{ iface.connected_endpoint.circuit }} From fadc9521f019e3d812238e2e881923282a61b38b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 10:17:36 -0500 Subject: [PATCH 04/14] Fixes #2913: Fix assigned prefixes link on VRF view --- CHANGELOG.md | 1 + netbox/templates/ipam/vrf.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 800dec26d..55e9506b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ v2.5.7 (FUTURE) * [#2895](https://github.com/digitalocean/netbox/issues/2895) - Fix filtering of nullable character fields * [#2901](https://github.com/digitalocean/netbox/issues/2901) - Fix ordering regions by site count * [#2910](https://github.com/digitalocean/netbox/issues/2910) - Fix config context list and edit forms to use Select2 elements +* [#2913](https://github.com/digitalocean/netbox/issues/2913) - Fix assigned prefixes link on VRF view * [#2914](https://github.com/digitalocean/netbox/issues/2914) - Fix empty connected circuit link on device interfaces list v2.5.6 (2019-02-13) diff --git a/netbox/templates/ipam/vrf.html b/netbox/templates/ipam/vrf.html index 4929e3b39..0ed534aa3 100644 --- a/netbox/templates/ipam/vrf.html +++ b/netbox/templates/ipam/vrf.html @@ -87,7 +87,7 @@ Prefixes - {{ prefix_count }} + {{ prefix_count }} From 161d9ed512087d6ccba5e35b42f6dac7bfa4535b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 10:21:34 -0500 Subject: [PATCH 05/14] Fixes #2912: Cable type in filter form should be blank by default --- CHANGELOG.md | 1 + netbox/dcim/forms.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55e9506b7..f4ad9d44b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ v2.5.7 (FUTURE) * [#2895](https://github.com/digitalocean/netbox/issues/2895) - Fix filtering of nullable character fields * [#2901](https://github.com/digitalocean/netbox/issues/2901) - Fix ordering regions by site count * [#2910](https://github.com/digitalocean/netbox/issues/2910) - Fix config context list and edit forms to use Select2 elements +* [#2912](https://github.com/digitalocean/netbox/issues/2912) - Cable type in filter form should be blank by default * [#2913](https://github.com/digitalocean/netbox/issues/2913) - Fix assigned prefixes link on VRF view * [#2914](https://github.com/digitalocean/netbox/issues/2914) - Fix empty connected circuit link on device interfaces list diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index bf774dfcb..455a36db0 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -2753,7 +2753,7 @@ class CableFilterForm(BootstrapMixin, forms.Form): label='Search' ) type = forms.MultipleChoiceField( - choices=CABLE_TYPE_CHOICES, + choices=add_blank_choice(CABLE_TYPE_CHOICES), required=False, widget=StaticSelect2() ) From c8366eff8f0e85f2de1a59cf90fdd0a6a6c2910a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 11:13:43 -0500 Subject: [PATCH 06/14] Fixes #2915: Fix bulk editing of pass-through ports --- CHANGELOG.md | 1 + netbox/dcim/forms.py | 4 ++-- netbox/templates/utilities/obj_bulk_edit.html | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ad9d44b..839116a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ v2.5.7 (FUTURE) * [#2912](https://github.com/digitalocean/netbox/issues/2912) - Cable type in filter form should be blank by default * [#2913](https://github.com/digitalocean/netbox/issues/2913) - Fix assigned prefixes link on VRF view * [#2914](https://github.com/digitalocean/netbox/issues/2914) - Fix empty connected circuit link on device interfaces list +* [#2915](https://github.com/digitalocean/netbox/issues/2915) - Fix bulk editing of pass-through ports v2.5.6 (2019-02-13) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 455a36db0..44e61db2d 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -2362,7 +2362,7 @@ class FrontPortCreateForm(ComponentForm): class FrontPortBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm): pk = forms.ModelMultipleChoiceField( - queryset=Interface.objects.all(), + queryset=FrontPort.objects.all(), widget=forms.MultipleHiddenInput() ) type = forms.ChoiceField( @@ -2436,7 +2436,7 @@ class RearPortCreateForm(ComponentForm): class RearPortBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm): pk = forms.ModelMultipleChoiceField( - queryset=Interface.objects.all(), + queryset=RearPort.objects.all(), widget=forms.MultipleHiddenInput() ) type = forms.ChoiceField( diff --git a/netbox/templates/utilities/obj_bulk_edit.html b/netbox/templates/utilities/obj_bulk_edit.html index abdbec261..2b12f2a07 100644 --- a/netbox/templates/utilities/obj_bulk_edit.html +++ b/netbox/templates/utilities/obj_bulk_edit.html @@ -4,6 +4,14 @@ {% block content %}

{% block title %}Editing {{ table.rows|length }} {{ obj_type_plural|bettertitle }}{% endblock %}

+{% if form.errors %} +
+
Errors
+
+ {{ form.errors }} +
+
+{% endif %}
{% csrf_token %} {% if request.POST.return_url %} From fba154386ece22e68b4236aad539e5db44c6a7e3 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 11:36:55 -0500 Subject: [PATCH 07/14] Closes #2898: Enable filtering cables list by connection status --- CHANGELOG.md | 1 + netbox/dcim/forms.py | 5 +++++ netbox/dcim/models.py | 3 +++ netbox/dcim/tables.py | 3 +++ 4 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 839116a31..311e1aa3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ v2.5.7 (FUTURE) * [#2357](https://github.com/digitalocean/netbox/issues/2357) - Enable filtering of devices by rack face * [#2878](https://github.com/digitalocean/netbox/issues/2878) - Add cable types for OS1/OS2 singlemode fiber +* [#2898](https://github.com/digitalocean/netbox/issues/2898) - Enable filtering cables list by connection status * [#2903](https://github.com/digitalocean/netbox/issues/2903) - Clarify purpose of tags field on interface edit form ## Bug Fixes diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 44e61db2d..ad209c516 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -2757,6 +2757,11 @@ class CableFilterForm(BootstrapMixin, forms.Form): required=False, widget=StaticSelect2() ) + status = forms.ChoiceField( + required=False, + choices=add_blank_choice(CONNECTION_STATUS_CHOICES), + widget=StaticSelect2() + ) color = forms.CharField( max_length=6, required=False, diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index f7892b2af..49879beb1 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -2651,6 +2651,9 @@ class Cable(ChangeLoggedModel): self.length_unit, ) + def get_status_class(self): + return 'success' if self.status else 'info' + def get_path_endpoints(self): """ Traverse both ends of a cable path and return its connected endpoints. Note that one or both endpoints may be diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py index 3cbd9378d..5649c10ef 100644 --- a/netbox/dcim/tables.py +++ b/netbox/dcim/tables.py @@ -647,6 +647,9 @@ class CableTable(BaseTable): orderable=False, verbose_name='' ) + status = tables.TemplateColumn( + template_code=STATUS_LABEL + ) length = tables.TemplateColumn( template_code=CABLE_LENGTH, order_by='_abs_length' From b9f1d14d4e2e7e404e425adef3c9091b9fa310e7 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 11:48:11 -0500 Subject: [PATCH 08/14] Closes #2870: Add Markdown rendering for provider NOC/admin contact fields --- CHANGELOG.md | 1 + netbox/templates/circuits/provider.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 311e1aa3c..a70644fd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ v2.5.7 (FUTURE) ## Enhancements * [#2357](https://github.com/digitalocean/netbox/issues/2357) - Enable filtering of devices by rack face +* [#2870](https://github.com/digitalocean/netbox/issues/2870) - Add Markdown rendering for provider NOC/admin contact fields * [#2878](https://github.com/digitalocean/netbox/issues/2878) - Add cable types for OS1/OS2 singlemode fiber * [#2898](https://github.com/digitalocean/netbox/issues/2898) - Enable filtering cables list by connection status * [#2903](https://github.com/digitalocean/netbox/issues/2903) - Clarify purpose of tags field on interface edit form diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html index 46fd8afc7..a31f093c9 100644 --- a/netbox/templates/circuits/provider.html +++ b/netbox/templates/circuits/provider.html @@ -85,11 +85,11 @@ NOC Contact - {{ provider.noc_contact|linebreaksbr|placeholder }} + {{ provider.noc_contact|gfm|placeholder }} Admin Contact - {{ provider.admin_contact|linebreaksbr|placeholder }} + {{ provider.admin_contact|gfm|placeholder }} Circuits From 8961a54a03145f3e4bd32b0baba4039689a29ef0 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 20 Feb 2019 12:01:37 -0500 Subject: [PATCH 09/14] Chnagelog for #2890 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a70644fd0..ddd464b9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ v2.5.7 (FUTURE) * [#2357](https://github.com/digitalocean/netbox/issues/2357) - Enable filtering of devices by rack face * [#2870](https://github.com/digitalocean/netbox/issues/2870) - Add Markdown rendering for provider NOC/admin contact fields * [#2878](https://github.com/digitalocean/netbox/issues/2878) - Add cable types for OS1/OS2 singlemode fiber +* [#2890](https://github.com/digitalocean/netbox/issues/2890) - Add port types for APC fiber * [#2898](https://github.com/digitalocean/netbox/issues/2898) - Enable filtering cables list by connection status * [#2903](https://github.com/digitalocean/netbox/issues/2903) - Clarify purpose of tags field on interface edit form From 993e94c00cd392a48c5bd9b17b00ae67cf2fcb58 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 21 Feb 2019 10:26:31 -0500 Subject: [PATCH 10/14] Fixes #2852: Allow filtering devices by null rack position --- CHANGELOG.md | 1 + netbox/dcim/constants.py | 6 ++++++ netbox/dcim/filters.py | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd464b9b..460b7d7e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ v2.5.7 (FUTURE) ## Bug Fixes +* [#2852](https://github.com/digitalocean/netbox/issues/2852) - Allow filtering devices by null rack position * [#2884](https://github.com/digitalocean/netbox/issues/2884) - Don't display connect button for wireless interfaces * [#2888](https://github.com/digitalocean/netbox/issues/2888) - Correct foreground color of device roles in rack elevations * [#2893](https://github.com/digitalocean/netbox/issues/2893) - Remove duplicate display of VRF RD on IP address view diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index d3ac9b426..0b81e68bf 100644 --- a/netbox/dcim/constants.py +++ b/netbox/dcim/constants.py @@ -43,6 +43,12 @@ RACK_STATUS_CHOICES = [ [RACK_STATUS_DEPRECATED, 'Deprecated'], ] +# Device rack position +DEVICE_POSITION_CHOICES = [ + # Rack.u_height is limited to 100 + (i, 'Unit {}'.format(i)) for i in range(1, 101) +] + # Parent/child device roles SUBDEVICE_ROLE_PARENT = True SUBDEVICE_ROLE_CHILD = False diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index 4974c3b4d..96ecefafd 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -543,6 +543,10 @@ class DeviceFilter(CustomFieldFilterSet): queryset=Rack.objects.all(), label='Rack (ID)', ) + position = django_filters.ChoiceFilter( + choices=DEVICE_POSITION_CHOICES, + null_label='Non-racked' + ) cluster_id = django_filters.ModelMultipleChoiceFilter( queryset=Cluster.objects.all(), label='VM cluster (ID)', @@ -602,7 +606,7 @@ class DeviceFilter(CustomFieldFilterSet): class Meta: model = Device - fields = ['serial', 'position', 'face'] + fields = ['serial', 'face'] def search(self, queryset, name, value): if not value.strip(): From 298152bc5094fbbfee4c150609195fd687f29329 Mon Sep 17 00:00:00 2001 From: hSaria <34197532+hSaria@users.noreply.github.com> Date: Thu, 21 Feb 2019 18:26:19 +0000 Subject: [PATCH 11/14] Closes #2638: Copy Button for Secrets (#2860) * Added clipboard.min.js * Added copy button to secrets * renamed clipboard JS library --- netbox/project-static/clipboard-2.0.4.min.js | 7 +++++++ netbox/project-static/js/secrets.js | 4 ++++ netbox/templates/_base.html | 1 + netbox/templates/secrets/inc/secret_tr.html | 3 +++ netbox/templates/secrets/secret.html | 7 +++++-- 5 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 netbox/project-static/clipboard-2.0.4.min.js diff --git a/netbox/project-static/clipboard-2.0.4.min.js b/netbox/project-static/clipboard-2.0.4.min.js new file mode 100755 index 000000000..02c549e35 --- /dev/null +++ b/netbox/project-static/clipboard-2.0.4.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.4 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n +