netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.33k stars 2.6k forks source link

Add UI URL pattern for scripts to allow a specific script to be accessed by module and class in addition to ID #18024

Open atownson opened 1 week ago

atownson commented 1 week ago

NetBox version

v4.1.6

Feature type

New functionality

Triage priority

I volunteer to perform this work (if approved)

Proposed functionality

Related to #16145, proposing to allow a URL pattern for scripts to reference them by <module>.<class>. The scope of this request is simply to allow this new URL pattern in addition to the existing scripts/<int:pk>/, scripts/<int:pk>/source/, and scripts/<int:pk>/jobs/ patterns. The templates and Script.get_absolute_url() would still reference the pk. The suggested URL pattern should match the allowed pattern for the API resolved in #16145.

Use case

When using Custom Links to link to a specific script, using the pk is problematic because it's subject to change as the scripts are updated over time. By allowing the <module>.<class> pattern, the custom links could be configured to use that pattern and return the correct script.

Database changes

None

External dependencies

None