Skip to content

Bulk edit fails when modifying URL to expand search parameters #16871

Closed
@einhirn

Description

@einhirn

Deployment Type

Self-hosted

NetBox Version

v4.0.6

Python Version

3.10

Steps to Reproduce

  1. Click "Devices"->"Device Components"->"Interfaces"
  2. Try to search for a number of interfaces on a number of switches that all need to be configured the same way
  3. Fail using the UI, modify URL to contain multiple mentions of "name" and "device" like so: https://netbox.selfhosted/dcim/interfaces/?device=dc-l1-3-leaf1&device=dc-l1-3-leaf2&name=1/21&name=1/22&name=1/23&name=1/24
  4. Successfully be presented with required list of Ports across multiple switches and select all of them
  5. Click on "Edit selected"
  6. Receive a 500 server error

Expected Behavior

A Bulk edit page should have opened for the selected ports

Observed Behavior

<class 'ValueError'>

Field 'id' expected a number but got 'dc-l1-3-leaf2'.

is reported

Additional Context

The request contains the list of pks for the selected interfaces as "Form data".

Inspecting the "Edit selected" button, I noticed that formaction for _rename Button doesn't contain parameters from the URL, while formaction for _edit (and _delete) Button contains full URL including manually added parameters:

<button type="submit" name="_edit" formaction="/dcim/interfaces/edit/?device=dc-l1-3-leaf1&amp;device=dc-l1-3-leaf2&amp;name=1%2F21&amp;name=1%2F22&amp;name=1%2F23&amp;name=1%2F24" class="btn btn-yellow">
    <i class="mdi mdi-pencil" aria-hidden="true"></i> Edit Selected
  </button>
<button type="submit" name="_rename" formaction="/dcim/interfaces/rename/" class="btn btn-outline-warning">
          <i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename Selected
        </button>
<button type="submit" name="_delete" formaction="/dcim/interfaces/delete/?device=dc-l1-3-leaf1&amp;device=dc-l1-3-leaf2&amp;name=1%2F21&amp;name=1%2F22&amp;name=1%2F23&amp;name=1%2F24" class="btn btn-red">
    <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete Selected
  </button>

I modified the form action on the fly to remove the additional parameters and the button worked as expected - a bulk edit form was opened and the changes were applied to all selected interfaces. I also was returned to the search result page/URL with additional parameters as expected, so I could see the changes on the selected interfaces

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions