Search for interface is not working when creating connection #2274

Closed
opened 2025-12-29 17:24:24 +01:00 by adam · 5 comments
Owner

Originally created by @Simonpiro on GitHub (Jan 10, 2019).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.5.2

Steps to Reproduce

If i pick any interface on the device and click connect, i will get to interface connection page.
When i am trying to search for terminating interface in side B form, dropdown list is unpopulated.

Expected Behavior

Expected is to see list of all interfaces on terminating device.

Observed Behavior

Seems like API URL is not created correctly with new choices added to Port Type.
Broken URL:
/api/dcim/18s/?device_id=74&limit=0&brief=1

Correct URL:
/api/dcim/interfaces/?device_id=74&limit=0&brief=1

Looks like it should be taking api-value to url and its taking value from "termination_b_type" option:
<option value="18" api-value="interface">Interface</option>

dcim/forms.py :

termination_b_id = forms.IntegerField( label='Name', widget=APISelect( api_url='/api/dcim/{{termination_b_type}}s/?device_id={{termination_b_device}}', disabled_indicator='cable', url_conditional_append={ 'termination_b_type__interface': '&type=physical', } )

Originally created by @Simonpiro on GitHub (Jan 10, 2019). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with 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 Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.8 * NetBox version: 2.5.2 <!-- Describe in detail the steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). --> ### Steps to Reproduce If i pick any interface on the device and click connect, i will get to interface connection page. When i am trying to search for terminating interface in side B form, dropdown list is unpopulated. <!-- What did you expect to happen? --> ### Expected Behavior Expected is to see list of all interfaces on terminating device. <!-- What happened instead? --> ### Observed Behavior Seems like API URL is not created correctly with new choices added to Port Type. Broken URL: /api/dcim/18s/?device_id=74&limit=0&brief=1 Correct URL: /api/dcim/interfaces/?device_id=74&limit=0&brief=1 Looks like it should be taking api-value to url and its taking value from "termination_b_type" option: `<option value="18" api-value="interface">Interface</option>` dcim/forms.py : `termination_b_id = forms.IntegerField( label='Name', widget=APISelect( api_url='/api/dcim/{{termination_b_type}}s/?device_id={{termination_b_device}}', disabled_indicator='cable', url_conditional_append={ 'termination_b_type__interface': '&type=physical', } )`
adam closed this issue 2025-12-29 17:24:25 +01:00
Author
Owner

@MarcHagen commented on GitHub (Jan 10, 2019):

I can't reproduce it, have you reloaded you're browsers cache?
Maybe this is just a jQuery thing because it was changed.

@MarcHagen commented on GitHub (Jan 10, 2019): I can't reproduce it, have you reloaded you're browsers cache? Maybe this is just a jQuery thing because it was changed.
Author
Owner

@jeremystretch commented on GitHub (Jan 10, 2019):

Also check that you remembered to run ./manage.py collectstatic as part of the last upgrade. (The upgrade script will handle this for you.)

@jeremystretch commented on GitHub (Jan 10, 2019): Also check that you remembered to run `./manage.py collectstatic` as part of the last upgrade. (The upgrade script will handle this for you.)
Author
Owner

@Simonpiro commented on GitHub (Jan 10, 2019):

Hello, i tried to run ./manage.py collectstatic again. But it didnt copy anything new.
I also cleared cache and tried other browsers and computers.
I still think its caused by {{termination_b_type}} taking value from form option instead of api-value for URL creation.

@Simonpiro commented on GitHub (Jan 10, 2019): Hello, i tried to run `./manage.py collectstatic` again. But it didnt copy anything new. I also cleared cache and tried other browsers and computers. I still think its caused by `{{termination_b_type}}` taking `value` from form option instead of `api-value` for URL creation.
Author
Owner

@Simonpiro commented on GitHub (Jan 10, 2019):

You are right. Seems like our JS files did not get upgraded. We are running netbox in docker image. Is there a way to upgrade files when ./manage.py collectstatic didnt help?
Thank you

@Simonpiro commented on GitHub (Jan 10, 2019): You are right. Seems like our JS files did not get upgraded. We are running netbox in docker image. Is there a way to upgrade files when `./manage.py collectstatic` didnt help? Thank you
Author
Owner

@Simonpiro commented on GitHub (Jan 11, 2019):

Its all set now. Just deleted all old static files.
Thank you for your help.

@Simonpiro commented on GitHub (Jan 11, 2019): Its all set now. Just deleted all old static files. Thank you for your help.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2274