diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 318a9b7ad..6c13631d9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -17,7 +17,7 @@ body: What version of NetBox are you currently running? (If you don't have access to the most recent NetBox release, consider testing on our [demo instance](https://demo.netbox.dev/) before opening a bug report to see if your issue has already been addressed.) - placeholder: v3.0.8 + placeholder: v3.0.9 validations: required: true - type: dropdown diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index be89acfad..a6fc342be 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -14,7 +14,7 @@ body: attributes: label: NetBox version description: What version of NetBox are you currently running? - placeholder: v3.0.8 + placeholder: v3.0.9 validations: required: true - type: dropdown diff --git a/docs/core-functionality/power.md b/docs/core-functionality/power.md index bdefb2afd..4d7d5f0ab 100644 --- a/docs/core-functionality/power.md +++ b/docs/core-functionality/power.md @@ -5,4 +5,4 @@ # Example Power Topology -![Power distribution model](/media/power_distribution.png) +![Power distribution model](../media/power_distribution.png) diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md index cf052f918..df436fe99 100644 --- a/docs/customization/custom-scripts.md +++ b/docs/customization/custom-scripts.md @@ -240,7 +240,7 @@ An IPv4 or IPv6 network with a mask. Returns a `netaddr.IPNetwork` object. Two a !!! 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) + ![Adding the run action to a permission](../media/admin_ui_run_permission.png) ### Via the Web UI @@ -259,6 +259,22 @@ http://netbox/api/extras/scripts/example.MyReport/ \ --data '{"data": {"foo": "somevalue", "bar": 123}, "commit": true}' ``` +### Via the CLI + +Scripts can be run on the CLI by invoking the management command: + +``` +python3 manage.py runscript [--commit] [--loglevel {debug,info,warning,error,critical}] [--data ""] . {# Static resources #} diff --git a/netbox/templates/dcim/location.html b/netbox/templates/dcim/location.html index 434253d43..bb0763875 100644 --- a/netbox/templates/dcim/location.html +++ b/netbox/templates/dcim/location.html @@ -56,6 +56,13 @@ Racks + {% if rack_count %} +
+ + + +
+ {% endif %} {{ rack_count }} diff --git a/netbox/templates/inc/panels/custom_fields.html b/netbox/templates/inc/panels/custom_fields.html index 68665b8d5..b979cc073 100644 --- a/netbox/templates/inc/panels/custom_fields.html +++ b/netbox/templates/inc/panels/custom_fields.html @@ -10,7 +10,7 @@ {% for field, value in custom_fields.items %} - +
{{ field }}{{ field }} {% if field.type == 'longtext' and value %} {{ value|render_markdown }} diff --git a/netbox/tenancy/tables.py b/netbox/tenancy/tables.py index 02c431846..541087cff 100644 --- a/netbox/tenancy/tables.py +++ b/netbox/tenancy/tables.py @@ -62,7 +62,7 @@ class TenantGroupTable(BaseTable): class Meta(BaseTable.Meta): model = TenantGroup - fields = ('pk', 'name', 'tenant_count', 'description', 'slug', 'tags', 'actions') + fields = ('pk', 'id', 'name', 'tenant_count', 'description', 'slug', 'tags', 'actions') default_columns = ('pk', 'name', 'tenant_count', 'description', 'actions') @@ -81,7 +81,7 @@ class TenantTable(BaseTable): class Meta(BaseTable.Meta): model = Tenant - fields = ('pk', 'name', 'slug', 'group', 'description', 'comments', 'tags') + fields = ('pk', 'id', 'name', 'slug', 'group', 'description', 'comments', 'tags') default_columns = ('pk', 'name', 'group', 'description') diff --git a/netbox/utilities/paginator.py b/netbox/utilities/paginator.py index 4cc3ef601..1f07aa42a 100644 --- a/netbox/utilities/paginator.py +++ b/netbox/utilities/paginator.py @@ -68,17 +68,22 @@ def get_paginate_count(request): """ config = get_config() + def _max_allowed(page_size): + if config.MAX_PAGE_SIZE: + return min(page_size, config.MAX_PAGE_SIZE) + return page_size + if 'per_page' in request.GET: try: per_page = int(request.GET.get('per_page')) if request.user.is_authenticated: request.user.config.set('pagination.per_page', per_page, commit=True) - return min(per_page, config.MAX_PAGE_SIZE) + return _max_allowed(per_page) except ValueError: pass if request.user.is_authenticated: per_page = request.user.config.get('pagination.per_page', config.PAGINATE_COUNT) - return min(per_page, config.MAX_PAGE_SIZE) + return _max_allowed(per_page) - return min(config.PAGINATE_COUNT, config.MAX_PAGE_SIZE) + return _max_allowed(config.PAGINATE_COUNT) diff --git a/netbox/utilities/tables.py b/netbox/utilities/tables.py index 42c9ffb56..b92cde47c 100644 --- a/netbox/utilities/tables.py +++ b/netbox/utilities/tables.py @@ -23,6 +23,10 @@ class BaseTable(tables.Table): :param user: Personalize table display for the given user (optional). Has no effect if AnonymousUser is passed. """ + id = tables.Column( + linkify=True, + verbose_name='ID' + ) class Meta: attrs = { diff --git a/netbox/virtualization/tables.py b/netbox/virtualization/tables.py index 0a605267d..28a57c7ef 100644 --- a/netbox/virtualization/tables.py +++ b/netbox/virtualization/tables.py @@ -1,5 +1,4 @@ import django_tables2 as tables -from django.conf import settings from dcim.tables.devices import BaseInterfaceTable from tenancy.tables import TenantColumn from utilities.tables import ( @@ -45,7 +44,7 @@ class ClusterTypeTable(BaseTable): class Meta(BaseTable.Meta): model = ClusterType - fields = ('pk', 'name', 'slug', 'cluster_count', 'description', 'tags', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'cluster_count', 'description', 'tags', 'actions') default_columns = ('pk', 'name', 'cluster_count', 'description', 'actions') @@ -68,7 +67,7 @@ class ClusterGroupTable(BaseTable): class Meta(BaseTable.Meta): model = ClusterGroup - fields = ('pk', 'name', 'slug', 'cluster_count', 'description', 'tags', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'cluster_count', 'description', 'tags', 'actions') default_columns = ('pk', 'name', 'cluster_count', 'description', 'actions') @@ -104,7 +103,7 @@ class ClusterTable(BaseTable): class Meta(BaseTable.Meta): model = Cluster - fields = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'comments', 'device_count', 'vm_count', 'tags') + fields = ('pk', 'id', 'name', 'type', 'group', 'tenant', 'site', 'comments', 'device_count', 'vm_count', 'tags') default_columns = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'device_count', 'vm_count') @@ -144,7 +143,7 @@ class VirtualMachineTable(BaseTable): class Meta(BaseTable.Meta): model = VirtualMachine fields = ( - 'pk', 'name', 'status', 'cluster', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'primary_ip4', + 'pk', 'id', 'name', 'status', 'cluster', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'primary_ip4', 'primary_ip6', 'primary_ip', 'comments', 'tags', ) default_columns = ( @@ -171,7 +170,7 @@ class VMInterfaceTable(BaseInterfaceTable): class Meta(BaseTable.Meta): model = VMInterface fields = ( - 'pk', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', + 'pk', 'id', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', ) default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'description') @@ -193,7 +192,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable): class Meta(BaseTable.Meta): model = VMInterface fields = ( - 'pk', 'name', 'enabled', 'parent', 'bridge', 'mac_address', 'mtu', 'mode', 'description', 'tags', + 'pk', 'id', 'name', 'enabled', 'parent', 'bridge', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions', ) default_columns = ( diff --git a/requirements.txt b/requirements.txt index 1da05d78e..137b2e401 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django==3.2.8 +Django==3.2.9 django-cors-headers==3.10.0 django-debug-toolbar==3.2.2 django-filter==21.1 @@ -18,7 +18,7 @@ gunicorn==20.1.0 Jinja2==3.0.2 Markdown==3.3.4 markdown-include==0.6.0 -mkdocs-material==7.3.4 +mkdocs-material==7.3.6 netaddr==0.8.0 Pillow==8.4.0 psycopg2-binary==2.9.1 @@ -26,7 +26,7 @@ PyYAML==6.0 social-auth-app-django==5.0.0 social-auth-core==4.1.0 svgwrite==1.4.1 -tablib==3.0.0 +tablib==3.1.0 # Workaround for #7401 jsonschema==3.2.0