From d30874e0de619fef6afcdeba7177a9ab8e01f966 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 23 Sep 2020 15:39:36 -0400 Subject: [PATCH 01/27] 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 148bf8aeb..c1f296699 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -16,7 +16,7 @@ from django.core.validators import URLValidator # Environment setup # -VERSION = '2.9.4' +VERSION = '2.9.5-dev' # Hostname HOSTNAME = platform.node() From 380f59ac0b3bf8270797ae6d50e06753c7d968e1 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 24 Sep 2020 10:01:02 -0400 Subject: [PATCH 02/27] Fixes #5175: Fix toggling of rack elevation order --- docs/release-notes/version-2.9.md | 8 ++++++++ netbox/templates/dcim/rack_elevation_list.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index d0d34e1cc..77dabfab9 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -1,5 +1,13 @@ # NetBox v2.9 +## v2.9.5 (FUTURE) + +### Bug Fixes + +* [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order + +--- + ## v2.9.4 (2020-09-23) **NOTE:** This release removes support for the `DEFAULT_TIMEOUT` parameter under `REDIS` database configuration. Set `RQ_DEFAULT_TIMEOUT` as a global configuration parameter instead. diff --git a/netbox/templates/dcim/rack_elevation_list.html b/netbox/templates/dcim/rack_elevation_list.html index c39bcae75..955bfa066 100644 --- a/netbox/templates/dcim/rack_elevation_list.html +++ b/netbox/templates/dcim/rack_elevation_list.html @@ -12,7 +12,7 @@ Rear From 856500b014f53a04d896888b193536a17c7f3cbc Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 24 Sep 2020 10:11:34 -0400 Subject: [PATCH 03/27] Fixes #5174: Ensure consistent alignment of rack elevations --- docs/release-notes/version-2.9.md | 1 + .../dcim/inc/rack_elevation_header.html | 10 ---------- netbox/templates/dcim/rack_elevation_list.html | 17 +++++++++++++++-- 3 files changed, 16 insertions(+), 12 deletions(-) delete mode 100644 netbox/templates/dcim/inc/rack_elevation_header.html diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 77dabfab9..d9046cfae 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -4,6 +4,7 @@ ### Bug Fixes +* [#5174](https://github.com/netbox-community/netbox/issues/5174) - Ensure consistent alignment of rack elevations * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order --- diff --git a/netbox/templates/dcim/inc/rack_elevation_header.html b/netbox/templates/dcim/inc/rack_elevation_header.html deleted file mode 100644 index 36ac11398..000000000 --- a/netbox/templates/dcim/inc/rack_elevation_header.html +++ /dev/null @@ -1,10 +0,0 @@ -{% load helpers %} -
- {{ rack.name }} - {% if rack.role %} -
{{ rack.role }} - {% endif %} - {% if rack.facility_id %} -
{{ rack.facility_id }} - {% endif %} -
diff --git a/netbox/templates/dcim/rack_elevation_list.html b/netbox/templates/dcim/rack_elevation_list.html index 955bfa066..433053abc 100644 --- a/netbox/templates/dcim/rack_elevation_list.html +++ b/netbox/templates/dcim/rack_elevation_list.html @@ -23,10 +23,23 @@
{% for rack in page %}
- {% include 'dcim/inc/rack_elevation_header.html' %} +
+ {{ rack.name }} + {% if rack.role %} +
{{ rack.role }} + {% endif %} + {% if rack.facility_id %} +
{{ rack.facility_id }} + {% endif %} +
{% include 'dcim/inc/rack_elevation.html' with face=rack_face %}
- {% include 'dcim/inc/rack_elevation_header.html' %} +
+ {{ rack.name }} + {% if rack.facility_id %} + ({{ rack.facility_id }}) + {% endif %} +
{% endfor %}
From ff42c89cc4b33d82beec1e5ca703b13f551d5463 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 24 Sep 2020 10:32:15 -0400 Subject: [PATCH 04/27] Closes #5177: Note permissions required for running reports and custom scripts --- docs/additional-features/custom-scripts.md | 24 +++++++++++++++++++++ docs/additional-features/reports.md | 9 +++++--- docs/media/admin_ui_run_permission.png | Bin 0 -> 8174 bytes 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 docs/media/admin_ui_run_permission.png diff --git a/docs/additional-features/custom-scripts.md b/docs/additional-features/custom-scripts.md index 128739780..28d1bf856 100644 --- a/docs/additional-features/custom-scripts.md +++ b/docs/additional-features/custom-scripts.md @@ -231,6 +231,30 @@ An IPv4 or IPv6 network with a mask. Returns a `netaddr.IPNetwork` object. Two a * `min_prefix_length` - Minimum length of the mask * `max_prefix_length` - Maximum length of the mask +## Running Custom Scripts + +!!! note + To run a custom script, a user must be assigned the `extras.run_script` permission. This is achieved by assigning the user (or group) a permission on the Script object and specifying the `run` action in the admin UI as shown below. + + ![Adding the run action to a permission](../../media/admin_ui_run_permission.png) + +### Via the Web UI + +Custom scripts can be run via the web UI by navigating to the script, completing any required form data, and clicking the "run script" button. + +### Via the API + +To run a script via the REST API, issue a POST request to the script's endpoint specifying the form data and commitment. For example, to run a script named `example.MyReport`, we would make a request such as the following: + +```no-highlight +curl -X POST \ +-H "Authorization: Token $TOKEN" \ +-H "Content-Type: application/json" \ +-H "Accept: application/json; indent=4" \ +http://netbox/api/extras/scripts/example.MyReport/ \ +--data '{"data": {"foo": "somevalue", "bar": 123}, "commit": true}' +``` + ## Example Below is an example script that creates new objects for a planned site. The user is prompted for three variables: diff --git a/docs/additional-features/reports.md b/docs/additional-features/reports.md index e845117c0..9d60f797e 100644 --- a/docs/additional-features/reports.md +++ b/docs/additional-features/reports.md @@ -101,11 +101,14 @@ Once you have created a report, it will appear in the reports list. Initially, r ## Running Reports +!!! note + To run a report, a user must be assigned the `extras.run_report` permission. This is achieved by assigning the user (or group) a permission on the Report object and specifying the `run` action in the admin UI as shown below. + + ![Adding the run action to a permission](../../media/admin_ui_run_permission.png) + ### Via the Web UI -Reports can be run via the web UI by navigating to the report and clicking the "run report" button at top right. Note that a user must have permission to create ReportResults in order to run reports. (Permissions can be assigned through the admin UI.) - -Once a report has been run, its associated results will be included in the report view. +Reports can be run via the web UI by navigating to the report and clicking the "run report" button at top right. Once a report has been run, its associated results will be included in the report view. ### Via the API diff --git a/docs/media/admin_ui_run_permission.png b/docs/media/admin_ui_run_permission.png new file mode 100644 index 0000000000000000000000000000000000000000..a7aaa79b8f985e42f0d7c276aa760b64ba2a13b9 GIT binary patch literal 8174 zcmb`Mbx<6^m&cdjZow@C2_6;}cL)&NLm;@bxCFQ0A;2Pm;2IVd4`gw7*G-n-5+o2T zEEWRX=66?Db#?cvtCN4Grl-4SreDwZecpTXR##huYOS=h@siU*m+pD%R-SIPL^zKnn#_xEk`NyVK$KYRP(zOy6lKD@5Y5|cHWjDp;veIJKR5s&o)wpJ3E z;&Zzq7`YQ|SSuT*J$@0gk`-pK!*Ue_gR2QJ(?TIZIG zB4=K`KZ}vOJSxY$f?Sq!Lf^}({)W)pOQT=nbt9bIz~D%BXk+W?iN)1!yU%fWr0)TP zbl3&s-6>xF)Q78c)yvfD8$2Bd#=1m-ETK@xC5vp#TA=vk@@nf+Z+|b|-Kh`J@3r+( zQ>TE8r>D(ZPg-t1)XfH7Fp4vm+m9Ihy zf#6uF7ChO{r6T`3k zn--(r(FeZhO&~{<_Bpyj zePCk@JH6I7Xb%PrIr{f^fABk<{h)Jl^^G029$WmK$6ddJ<3$ znswwtsaQ)0O&}b^AR#EaF!LMK@~^GB%h-V5m-E@Cj>=F!8*ungFiW`P?UX;5>5m)g z;W?yE_6q%Oi0yrSEiKr&X8?*Stn=iz6luY_vj@xZGCmUV+mh9MG4{_!`ACSw!1^(1 z)Ojtg&ibWPfE=IsR2}T~3?0*k`xfPh|IyY;Fyu49GAntf_+j11;jLMpt5R~w@cReH zIujMBmz$=;~>L?mt(~|3!3gO|oOaNNq!ItqND9MQyu#QY<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097Sy#=x27gCZ8$>Yo|zN?%aUYfh%*lh{!v4&bd-QSTrO z_@Ox?s>69mnxRUeF=DCGZ|*oJHsQ;#h4Zf>>}o!_L+--P4U~KSgX?#_BY>BzcdZQir4_;N14+qGX=4| z0Y1}Aooxh`ks<}}vm@B$RRojiaxq1uM`K)!~2ghrijrf7MGwINeW5(3dG`m9~d0KQ=53D(X~H#9$pbsUlKZSbg?7$H_0Y*REiR z#6K{oUVZli%d{x`%i(8rdY<6oNmQceq3f3eLTHn*qQftCxmRI%{H0oB5E68ZN_c9r zT6eYpCsMa|^R(y7J50Zej*F_KHpIti=b~zwB{X{wT-NjGX7Yhhy3kGwM8@YBVHduL z7}^7QSG=?)WWo%hO>cd9PUMtLaKUNcWlo7px#bqkFpt?>!2LX9YDvFsCtlY3BG6opog~ekWt8* z+bOIxKCq#<2-K}-m)#oRcXFFktMC-z8N|{<#?*+%FZ`|g(*y!=T=XU~^9__nx5g-? z>ZM~AHvl!u=a4e$RvPE2q}dW*M?=g=q&-!0Ao1`W%@UWl#kE(U6uCRzY%xs&SN^x<#BnB1zG{uhu>Tt_7QamcI$nYHh7gdJr`!a$K8%2Q(9~j=r~|QEO0!Frv&b2KDW)RZ_cRz%6geUse@=M0yI6Ab+VFJ@la$+W(`Hx{V~p z%79!K&hxSS!#9ucjsrTi>-8RN$xbNNXX)UX5Njo+7-x8~1SdWAZnau^?Ht_6f<@^~ s`TzDatJ)qM7Z-=FNjy9s+rP&=OH#e0x;0)$|HlWYDQiEgRkVuy7fS$;qyPW_ literal 0 HcmV?d00001 From 5c8694ad65fee33366caec872c6dcc3b99504ca7 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Sun, 27 Sep 2020 16:32:42 -0400 Subject: [PATCH 05/27] Fixes #5184: Fix missing Power Utilization --- docs/release-notes/version-2.9.md | 1 + netbox/templates/dcim/device.html | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index d9046cfae..820af5ca3 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -6,6 +6,7 @@ * [#5174](https://github.com/netbox-community/netbox/issues/5174) - Ensure consistent alignment of rack elevations * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order +* [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization --- diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 34d28179b..477953a97 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -326,7 +326,7 @@ {% plugin_left_page device %}

- {% if power_ports and poweroutlets %} + {% if powerports and poweroutlets %}
Power Utilization @@ -339,7 +339,7 @@ Available Utilization - {% for pp in power_ports %} + {% for pp in powerports %} {% with utilization=pp.get_power_draw powerfeed=pp.connected_endpoint %} {{ pp }} From ee7f43abe1a77458f8b0b633690549142fae0b33 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 29 Sep 2020 14:45:02 -0500 Subject: [PATCH 06/27] Fixes #4523 - Add site vlan to certain scenarios where sites are the same --- netbox/dcim/forms.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index d3c385121..f5c27f7d3 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -2844,6 +2844,24 @@ class InterfaceBulkEditForm( self.fields['untagged_vlan'].widget.add_query_param('site_id', device.site.pk) self.fields['tagged_vlans'].widget.add_query_param('site_id', device.site.pk) else: + # See 4523 + if 'pk' in self.initial: + site = None + interfaces = Interface.objects.filter(pk__in=self.initial['pk']).prefetch_related('device__site') + + # Check interface sites. First interface should set site, further interfaces will either continue the + # loop or reset back to no site and break the loop. + for interface in interfaces: + if site is None: + site = interface.device.site + elif interface.device.site is not site: + site = None + break + + if site is not None: + self.fields['untagged_vlan'].widget.add_query_param('site_id', site.pk) + self.fields['tagged_vlans'].widget.add_query_param('site_id', site.pk) + self.fields['lag'].choices = () self.fields['lag'].widget.attrs['disabled'] = True From 068803dc86492fe8730cd2b25cca4eb55ca38ec8 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 29 Sep 2020 19:55:40 -0500 Subject: [PATCH 07/27] Update 2.9 Release notes with 4523 --- docs/release-notes/version-2.9.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 820af5ca3..750d05782 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -4,6 +4,7 @@ ### Bug Fixes +& [#4523](https://github.com/netbox-community/netbox/issues/4523) - Populate site vlan list when bulk editing interfaces under certain circumstances * [#5174](https://github.com/netbox-community/netbox/issues/5174) - Ensure consistent alignment of rack elevations * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order * [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization From 14ef7fa869847a6bb38937e8e577a68906534c46 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Tue, 29 Sep 2020 19:55:59 -0500 Subject: [PATCH 08/27] Update version-2.9.md --- docs/release-notes/version-2.9.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 750d05782..99fd8ff1c 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -4,7 +4,7 @@ ### Bug Fixes -& [#4523](https://github.com/netbox-community/netbox/issues/4523) - Populate site vlan list when bulk editing interfaces under certain circumstances +* [#4523](https://github.com/netbox-community/netbox/issues/4523) - Populate site vlan list when bulk editing interfaces under certain circumstances * [#5174](https://github.com/netbox-community/netbox/issues/5174) - Ensure consistent alignment of rack elevations * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order * [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization From 22a80c5558391ddb4e86d61e59442f146cb3ca91 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Wed, 30 Sep 2020 08:28:48 -0500 Subject: [PATCH 09/27] Update pre-commit script to support virtual environment within IDE --- scripts/git-hooks/pre-commit | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index 7dfa5e8aa..c704921c5 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -13,6 +13,15 @@ EXIT=0 RED='\033[0;31m' NOCOLOR='\033[0m' +if [ -d ./venv/ ]; then + VENV="$PWD/venv" + if [ -e $VENV/bin/python ]; then + PATH=$VENV/bin:$PATH + elif [ -e $VENV/Scripts/python.exe ]; then + PATH=$VENV/Scripts:$PATH + fi +fi + echo "Validating PEP8 compliance..." pycodestyle --ignore=W504,E501 netbox/ if [ $? != 0 ]; then From 23a9cb2fad6d75302e79e1fee8e6dcb66d6b3a9c Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Thu, 1 Oct 2020 09:25:56 -0500 Subject: [PATCH 10/27] Fixes: #5199 - Change default logging for LDAP to INFO --- docs/release-notes/version-2.9.md | 1 + netbox/netbox/authentication.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 99fd8ff1c..0984f30a3 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -8,6 +8,7 @@ * [#5174](https://github.com/netbox-community/netbox/issues/5174) - Ensure consistent alignment of rack elevations * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order * [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization +* [#5199](https://github.com/netbox-community/netbox/issues/5199) - Change default LDAP logging to INFO --- diff --git a/netbox/netbox/authentication.py b/netbox/netbox/authentication.py index 6057fc08e..48f3d551c 100644 --- a/netbox/netbox/authentication.py +++ b/netbox/netbox/authentication.py @@ -175,6 +175,6 @@ class LDAPBackend: # Enable logging for django_auth_ldap ldap_logger = logging.getLogger('django_auth_ldap') ldap_logger.addHandler(logging.StreamHandler()) - ldap_logger.setLevel(logging.DEBUG) - + ldap_logger.setLevel(logging.INFO if settings.DEBUG is False else logging.DEBUG) + ldap_logger.info('Set Logging') return obj From f2bc824a8ebddcf36d0f0c15ecad37892cb06f4e Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Thu, 1 Oct 2020 09:27:17 -0500 Subject: [PATCH 11/27] Fixes: #5199 - Change default logging for LDAP to INFO --- netbox/netbox/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/netbox/authentication.py b/netbox/netbox/authentication.py index 48f3d551c..cd608bec5 100644 --- a/netbox/netbox/authentication.py +++ b/netbox/netbox/authentication.py @@ -176,5 +176,5 @@ class LDAPBackend: ldap_logger = logging.getLogger('django_auth_ldap') ldap_logger.addHandler(logging.StreamHandler()) ldap_logger.setLevel(logging.INFO if settings.DEBUG is False else logging.DEBUG) - ldap_logger.info('Set Logging') + return obj From 1a43ef82d9aa6cdac8a77691146ba8f85b86d1a5 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Fri, 2 Oct 2020 09:59:16 -0500 Subject: [PATCH 12/27] Fixes: #5201 - Fix bulk "all" operations on VLAN Groups --- docs/release-notes/version-2.9.md | 1 + netbox/ipam/views.py | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 0984f30a3..46f271c82 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -9,6 +9,7 @@ * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order * [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization * [#5199](https://github.com/netbox-community/netbox/issues/5199) - Change default LDAP logging to INFO +* [#5201](https://github.com/netbox-community/netbox/issues/5201) - Fix missing querystring when bulk editing/deleting VLAN Group Vlans when selecting "select all x items matching query" --- diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index c3eac0fd7..4001f147e 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -713,6 +713,7 @@ class VLANGroupVLANsView(ObjectView): return render(request, 'ipam/vlangroup_vlans.html', { 'vlan_group': vlan_group, 'first_available_vlan': vlan_group.get_next_available_vid(), + 'bulk_querystring': 'group_id={}'.format(vlan_group.pk), 'vlan_table': vlan_table, 'permissions': permissions, }) From ae0a481c64e6522c2950305da61331797922bdbf Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 2 Oct 2020 13:54:57 -0400 Subject: [PATCH 13/27] Fixes #5206: Apply user pagination preferences to all paginated object lists --- docs/release-notes/version-2.9.md | 3 ++- netbox/circuits/views.py | 7 +++---- netbox/dcim/views.py | 5 ++--- netbox/extras/views.py | 5 ++--- netbox/ipam/views.py | 16 ++++++++-------- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index 46f271c82..c391f4d27 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -9,7 +9,8 @@ * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order * [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization * [#5199](https://github.com/netbox-community/netbox/issues/5199) - Change default LDAP logging to INFO -* [#5201](https://github.com/netbox-community/netbox/issues/5201) - Fix missing querystring when bulk editing/deleting VLAN Group Vlans when selecting "select all x items matching query" +* [#5201](https://github.com/netbox-community/netbox/issues/5201) - Fix missing querystring when bulk editing/deleting VLAN Group VLANs when selecting "select all x items matching query" +* [#5206](https://github.com/netbox-community/netbox/issues/5206) - Apply user pagination preferences to all paginated object lists --- diff --git a/netbox/circuits/views.py b/netbox/circuits/views.py index 4d02ef011..6c29d41f1 100644 --- a/netbox/circuits/views.py +++ b/netbox/circuits/views.py @@ -1,13 +1,12 @@ -from django.conf import settings from django.contrib import messages from django.db import transaction -from django.db.models import Count, Prefetch +from django.db.models import Count from django.shortcuts import get_object_or_404, redirect, render from django_tables2 import RequestConfig from extras.models import Graph from utilities.forms import ConfirmationForm -from utilities.paginator import EnhancedPaginator +from utilities.paginator import EnhancedPaginator, get_paginate_count from utilities.views import ( BulkDeleteView, BulkEditView, BulkImportView, ObjectView, ObjectDeleteView, ObjectEditView, ObjectListView, ) @@ -45,7 +44,7 @@ class ProviderView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(circuits_table) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index dece687ee..c6c0ced97 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -1,6 +1,5 @@ from collections import OrderedDict -from django.conf import settings from django.contrib import messages from django.contrib.contenttypes.models import ContentType from django.core.paginator import EmptyPage, PageNotAnInteger @@ -20,7 +19,7 @@ from ipam.models import IPAddress, Prefix, Service, VLAN from ipam.tables import InterfaceIPAddressTable, InterfaceVLANTable from secrets.models import Secret from utilities.forms import ConfirmationForm -from utilities.paginator import EnhancedPaginator +from utilities.paginator import EnhancedPaginator, get_paginate_count from utilities.permissions import get_permission_for_model from utilities.utils import csv_format, get_subquery from utilities.views import ( @@ -320,7 +319,7 @@ class RackElevationListView(ObjectListView): racks = racks.reverse() # Pagination - per_page = request.GET.get('per_page', settings.PAGINATE_COUNT) + per_page = get_paginate_count(request) page_number = request.GET.get('page', 1) paginator = EnhancedPaginator(racks, per_page) try: diff --git a/netbox/extras/views.py b/netbox/extras/views.py index 56477a59f..f2c31652c 100644 --- a/netbox/extras/views.py +++ b/netbox/extras/views.py @@ -1,5 +1,4 @@ from django import template -from django.conf import settings from django.contrib import messages from django.contrib.contenttypes.models import ContentType from django.db.models import Count, Prefetch, Q @@ -13,7 +12,7 @@ from rq import Worker from dcim.models import DeviceRole, Platform, Region, Site from tenancy.models import Tenant, TenantGroup from utilities.forms import ConfirmationForm -from utilities.paginator import EnhancedPaginator +from utilities.paginator import EnhancedPaginator, get_paginate_count from utilities.utils import copy_safe_request, shallow_compare_dict from utilities.views import ( BulkDeleteView, BulkEditView, BulkImportView, ObjectView, ObjectDeleteView, ObjectEditView, ObjectListView, @@ -258,7 +257,7 @@ class ObjectChangeLogView(View): # Apply the request context paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(objectchanges_table) diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 4001f147e..c3818d3d0 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, redirect, render from django_tables2 import RequestConfig from dcim.models import Device, Interface -from utilities.paginator import EnhancedPaginator +from utilities.paginator import EnhancedPaginator, get_paginate_count from utilities.utils import get_subquery from utilities.views import ( BulkCreateView, BulkDeleteView, BulkEditView, BulkImportView, ObjectView, ObjectDeleteView, ObjectEditView, @@ -233,7 +233,7 @@ class AggregateView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(prefix_table) @@ -391,7 +391,7 @@ class PrefixPrefixesView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(prefix_table) @@ -435,7 +435,7 @@ class PrefixIPAddressesView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(ip_table) @@ -539,7 +539,7 @@ class IPAddressView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(related_ips_table) @@ -699,7 +699,7 @@ class VLANGroupVLANsView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request), } RequestConfig(request, paginate).configure(vlan_table) @@ -760,7 +760,7 @@ class VLANInterfacesView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(members_table) @@ -781,7 +781,7 @@ class VLANVMInterfacesView(ObjectView): paginate = { 'paginator_class': EnhancedPaginator, - 'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT) + 'per_page': get_paginate_count(request) } RequestConfig(request, paginate).configure(members_table) From 6612e0107e59af80d0eb84a84f8086826b0a8dd8 Mon Sep 17 00:00:00 2001 From: Glenn Matthews Date: Fri, 2 Oct 2020 10:40:05 -0400 Subject: [PATCH 14/27] Limit main IPAddress view to a max of 10 duplicate addresses. Fixes #5197 --- netbox/ipam/views.py | 4 +++- netbox/templates/ipam/ipaddress.html | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index c3eac0fd7..3fbceee53 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -527,7 +527,8 @@ class IPAddressView(ObjectView): # Exclude anycast IPs if this IP is anycast if ipaddress.role == IPAddressRoleChoices.ROLE_ANYCAST: duplicate_ips = duplicate_ips.exclude(role=IPAddressRoleChoices.ROLE_ANYCAST) - duplicate_ips_table = tables.IPAddressTable(list(duplicate_ips), orderable=False) + # Limit to a maximum of 10 duplicates displayed here + duplicate_ips_table = tables.IPAddressTable(duplicate_ips[:10], orderable=False) # Related IP table related_ips = IPAddress.objects.restrict(request.user, 'view').exclude( @@ -547,6 +548,7 @@ class IPAddressView(ObjectView): 'ipaddress': ipaddress, 'parent_prefixes_table': parent_prefixes_table, 'duplicate_ips_table': duplicate_ips_table, + 'more_duplicate_ips': duplicate_ips.count() > 10, 'related_ips_table': related_ips_table, }) diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html index ff83061cf..f213a275a 100644 --- a/netbox/templates/ipam/ipaddress.html +++ b/netbox/templates/ipam/ipaddress.html @@ -3,6 +3,7 @@ {% load custom_links %} {% load helpers %} {% load plugins %} +{% load render_table from django_tables2 %} {% block header %}
@@ -159,7 +160,24 @@
{% include 'panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %} {% if duplicate_ips_table.rows %} - {% include 'panel_table.html' with table=duplicate_ips_table heading='Duplicate IP Addresses' panel_class='danger' %} + {# Custom version of panel_table.html #} +
+
+ Duplicate IP Addresses + {% if more_duplicate_ips %} +
+ Show all +
+ {% endif %} +
+ {% render_table duplicate_ips_table 'inc/table.html' %} +
{% endif %} {% include 'utilities/obj_table.html' with table=related_ips_table table_template='panel_table.html' heading='Related IP Addresses' panel_class='default noprint' %} {% plugin_right_page ipaddress %} From 47ea75348cda28bbd5c0e81f9087fbfad842aa27 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 2 Oct 2020 14:17:55 -0400 Subject: [PATCH 15/27] Changelog for #5197 --- docs/release-notes/version-2.9.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md index c391f4d27..06338cc65 100644 --- a/docs/release-notes/version-2.9.md +++ b/docs/release-notes/version-2.9.md @@ -8,6 +8,7 @@ * [#5174](https://github.com/netbox-community/netbox/issues/5174) - Ensure consistent alignment of rack elevations * [#5175](https://github.com/netbox-community/netbox/issues/5175) - Fix toggling of rack elevation order * [#5184](https://github.com/netbox-community/netbox/issues/5184) - Fix missing Power Utilization +* [#5197](https://github.com/netbox-community/netbox/issues/5197) - Limit duplicate IPs shown on IP address view * [#5199](https://github.com/netbox-community/netbox/issues/5199) - Change default LDAP logging to INFO * [#5201](https://github.com/netbox-community/netbox/issues/5201) - Fix missing querystring when bulk editing/deleting VLAN Group VLANs when selecting "select all x items matching query" * [#5206](https://github.com/netbox-community/netbox/issues/5206) - Apply user pagination preferences to all paginated object lists From 693b32077a1f63a883fbc46ab81f6ecc2ab8ad7b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 7 Oct 2020 08:53:04 -0400 Subject: [PATCH 16/27] Update the netbox-discuss mailing list URL --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 6 +++--- CONTRIBUTING.md | 4 ++-- README.md | 4 ++-- docs/development/index.md | 2 +- docs/development/release-checklist.md | 4 ---- netbox/templates/500.html | 2 +- netbox/utilities/management/commands/makemigrations.py | 2 +- 9 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 54dc5ca8c..fef891803 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -11,7 +11,7 @@ about: Report a reproducible bug in the current release of NetBox NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: - https://groups.google.com/forum/#!forum/netbox-discuss + https://groups.google.com/g/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index ab7d7cdc4..3e1d0167d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,5 +5,5 @@ contact_links: url: https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md about: Please read through our contributing policy before opening an issue or pull request - name: 💬 Discussion Group - url: https://groups.google.com/forum/#!forum/netbox-discuss + url: https://groups.google.com/g/netbox-discuss about: Join our discussion group for assistance with installation issues and other problems diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 2f742d416..af2b1b7b0 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -11,7 +11,7 @@ about: Propose a new NetBox feature or enhancement If you have a general idea or question, please post to our mailing list instead of opening an issue: - https://groups.google.com/forum/#!forum/netbox-discuss + https://groups.google.com/g/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. @@ -21,8 +21,8 @@ about: Propose a new NetBox feature or enhancement before submitting a bug report. --> ### Environment -* Python version: -* NetBox version: +* Python version: +* NetBox version: