Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPRanges bulk options within Prefix view are missing #7113

Closed
sdktr opened this issue Sep 1, 2021 · 1 comment · Fixed by #7115
Closed

IPRanges bulk options within Prefix view are missing #7113

sdktr opened this issue Sep 1, 2021 · 1 comment · Fixed by #7115
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@sdktr
Copy link
Contributor

sdktr commented Sep 1, 2021

NetBox version

v3.0.0

Python version

3.8

Steps to Reproduce

  1. Open the IP Ranges tab within a prefix example

Expected Behavior

The 'edit selected' and 'delete selected' buttons should appear

Observed Behavior

No bulk options available.

This is due to the same reason as #7092. I replicated the changes @thatmattlove made on that. Additionally, the actions tied to the buttons is incorrectly set to the wrong bulk edit page.

I have a patch ready for this if needed.

@sdktr sdktr added the type: bug A confirmed report of unexpected behavior in the application label Sep 1, 2021
@sdktr
Copy link
Contributor Author

sdktr commented Sep 1, 2021

Fix missing permissions on the view:

diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py
index b33947f4e..7bb8bcc7d 100644
--- a/netbox/ipam/views.py
+++ b/netbox/ipam/views.py
@@ -427,8 +427,16 @@ class PrefixIPRangesView(generic.ObjectView):

         bulk_querystring = 'vrf_id={}&parent={}'.format(instance.vrf.pk if instance.vrf else '0', instance.prefix)

+        # Compile permissions list for rendering the object table
+        permissions = {
+            'add': request.user.has_perm('ipam.add_iprange'),
+            'change': request.user.has_perm('ipam.change_iprange'),
+            'delete': request.user.has_perm('ipam.delete_iprange'),
+        }
+
         return {
             'table': table,
+            'permissions': permissions,
             'bulk_querystring': bulk_querystring,
             'active_tab': 'ip-ranges',
         }

Fix the links to the wrong bulk action urls:

diff --git a/netbox/templates/ipam/prefix/ip_ranges.html b/netbox/templates/ipam/prefix/ip_ranges.html
index 18b53d945..3d15624bf 100644
--- a/netbox/templates/ipam/prefix/ip_ranges.html
+++ b/netbox/templates/ipam/prefix/ip_ranges.html
@@ -6,7 +6,7 @@
   <div class="row">
     <div class="col col-md-12">
       {% include 'inc/table_controls.html' with table_modal="IPRangeTable_config" %}
-      {% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
+      {% include 'utilities/obj_table.html' with heading='Child IP Ranges' bulk_edit_url='ipam:iprange_bulk_edit' bulk_delete_url='ipam:iprange_bulk_delete' parent=prefix %}
     </div>
   </div>
   {% table_config_form table table_name="IPRangeTable" %}

sdktr added a commit to sdktr/netbox that referenced this issue Sep 1, 2021
sdktr added a commit to sdktr/netbox that referenced this issue Sep 1, 2021
sdktr added a commit to sdktr/netbox that referenced this issue Sep 1, 2021
@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Sep 1, 2021
jeremystretch added a commit that referenced this issue Sep 1, 2021
Fixes #7113: iprange bulk options within Prefix view
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants