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 b062ddcb5..7d5598bbc 100644 --- a/netbox/templates/dcim/location.html +++ b/netbox/templates/dcim/location.html @@ -43,6 +43,13 @@ Racks + {% if rack_count %} +
+ + + +
+ {% endif %} {{ rack_count }} diff --git a/netbox/templates/inc/custom_fields_panel.html b/netbox/templates/inc/custom_fields_panel.html index fd0379961..91fca103e 100644 --- a/netbox/templates/inc/custom_fields_panel.html +++ b/netbox/templates/inc/custom_fields_panel.html @@ -8,7 +8,7 @@ {% for field, value in custom_fields.items %} - +
{{ field }}{{ field }} {% if field.type == 'boolean' and value == True %} diff --git a/netbox/tenancy/tables.py b/netbox/tenancy/tables.py index f39ca1b18..a7bb087d8 100644 --- a/netbox/tenancy/tables.py +++ b/netbox/tenancy/tables.py @@ -55,7 +55,7 @@ class TenantGroupTable(BaseTable): class Meta(BaseTable.Meta): model = TenantGroup - fields = ('pk', 'name', 'tenant_count', 'description', 'slug', 'actions') + fields = ('pk', 'id', 'name', 'tenant_count', 'description', 'slug', 'actions') default_columns = ('pk', 'name', 'tenant_count', 'description', 'actions') @@ -78,5 +78,5 @@ 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 e46af4b3e..85ceab73d 100644 --- a/netbox/utilities/paginator.py +++ b/netbox/utilities/paginator.py @@ -57,17 +57,22 @@ def get_paginate_count(request): Return the lesser of the calculated value and MAX_PAGE_SIZE. """ + def _max_allowed(page_size): + if settings.MAX_PAGE_SIZE: + return min(page_size, settings.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, settings.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', settings.PAGINATE_COUNT) - return min(per_page, settings.MAX_PAGE_SIZE) + return _max_allowed(per_page) - return min(settings.PAGINATE_COUNT, settings.MAX_PAGE_SIZE) + return _max_allowed(settings.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 b0e922e71..cb6e64043 100644 --- a/netbox/virtualization/tables.py +++ b/netbox/virtualization/tables.py @@ -44,7 +44,7 @@ class ClusterTypeTable(BaseTable): class Meta(BaseTable.Meta): model = ClusterType - fields = ('pk', 'name', 'slug', 'cluster_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'cluster_count', 'description', 'actions') default_columns = ('pk', 'name', 'cluster_count', 'description', 'actions') @@ -64,7 +64,7 @@ class ClusterGroupTable(BaseTable): class Meta(BaseTable.Meta): model = ClusterGroup - fields = ('pk', 'name', 'slug', 'cluster_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'cluster_count', 'description', 'actions') default_columns = ('pk', 'name', 'cluster_count', 'description', 'actions') @@ -100,7 +100,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') @@ -140,7 +140,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 = ( @@ -170,7 +170,7 @@ class VMInterfaceTable(BaseInterfaceTable): class Meta(BaseTable.Meta): model = VMInterface fields = ( - 'pk', 'name', 'virtual_machine', 'enabled', 'parent', 'mac_address', 'mtu', 'mode', 'description', 'tags', + 'pk', 'id', 'name', 'virtual_machine', 'enabled', 'parent', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', ) default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'parent', 'description') @@ -186,7 +186,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable): class Meta(BaseTable.Meta): model = VMInterface fields = ( - 'pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', + 'pk', 'id', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions', ) default_columns = ( diff --git a/requirements.txt b/requirements.txt index 7cad262b7..c537a39c3 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,13 +18,13 @@ 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 PyYAML==6.0 svgwrite==1.4.1 -tablib==3.0.0 +tablib==3.1.0 # Workaround for #7401 jsonschema==3.2.0