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

Template variable access for custom links on device page #969

Closed
lampwins opened this issue Mar 16, 2017 · 10 comments
Closed

Template variable access for custom links on device page #969

lampwins opened this issue Mar 16, 2017 · 10 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation
Milestone

Comments

@lampwins
Copy link
Contributor

Issue type: feature request

To mirror our conversation on the networktocode slack, I would love to be able to create custom links to external systems that show up on the device pages. Similar to the context surrounding interface graphs, I want access to the templating variables to create the links.

For example, a link to a configuration management system with the context of the given device:
http://my.nms.local/config/?device={{ device.name }}

I would also want access to the custom attributes for the device, as I store important information that would be used in this links.

I was also thinking buttons instead of standard links would be cool but not a strict requirement. I do want control over the target attribute for the link, so I can define if it would open in the same window or new tab, etc.

The overall goal is to be able to go to a device page in netbox and have a link I can click to go to another related system with that device's context.

Please let me know if more information is needed, happy to discus further.

@jeremystretch
Copy link
Member

An important consideration is whether we want to simply expose device attributes to the comment field, or whether an additional model is necessary. The former would offer the most flexibility; the later would be needed to add links or buttons elsewhere on the device page.

@cimnine
Copy link
Contributor

cimnine commented Aug 30, 2017

An important consideration is whether we want to simply expose device attributes to the comment field, or whether an additional model is necessary.

My only input to this is to prefix each of these possibilities with their own prefix, so that eventually both can be supported. And ideally the prefix is not the model's name, because custom fields can be defined on multiple models at the same time. So instead of {{ device.name }} it would better be {{ attributes.name }}.

I do want control over the target attribute for the link, so I can define if it would open in the same window or new tab, etc.

This is considered 'oldschool' thinking among my peers, as it robs the user from his freedom to choose how he or she would like to open the linked content. Without the target set, every user can decide (with ctrl or shift) if he or she would like to open the link in a new tab, a new window or if he or she would just like to navigate away in the same window. With the target set, at least one choice is taken away.

@mf69
Copy link

mf69 commented Jan 2, 2018

Another great use case for this...
Dell support has predicable URLs for obtaining the as-shipped system configuration like
http://www.dell.com/support/home/us/en/19/product-support/servicetag/dvc6b42/configuration
where dvc6b42 is the service tag or serial number.

@mryauch
Copy link
Contributor

mryauch commented Jan 8, 2018

This seems similar to #600. However it is solved, I currently have a custom URL field on my prefixes/aggregates and would love to populate it with a link to ARIN or a routing registry.

@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Jan 26, 2018
@girlpunk
Copy link

girlpunk commented Feb 8, 2018

I would be in favour of an additional model, and making the links global (or at least device-/prefix-/etc-wide). Anything device-specific can go in the comments anyway.

Example of what this could look like, from a duplicate feature request I just raised:

image

@girlpunk
Copy link

girlpunk commented Feb 9, 2018

I've started working on this here. Still needs a bit of work, but that should have most of it done. At this point, just needs UIs and some testing.

@NEOhidra
Copy link

I suppose that my idea to allow markdown in services description is somehow connected with this feature request.

Would you add a functionality to render hyperlinks to external knowledgeable in each service description?

@mmahacek
Copy link
Contributor

I created a new file in netbox/templates/inc and add an include on the device page. This creates a button that includes links to connect to the device, but could also have links to other systems as well.

https://gist.github.com/mmahacek/3f69b10d2c6709e8e9ea91768282bca9

@bdlamprecht
Copy link
Contributor

That is a very clever "hack" @mmahacek . I kind of like it in weird sort-of-way. 😄

@jeremystretch jeremystretch added this to the v2.6 milestone Apr 15, 2019
@jeremystretch jeremystretch self-assigned this Apr 15, 2019
jeremystretch added a commit that referenced this issue Apr 16, 2019
@chicks-net
Copy link

https://github.com/netbox-community/netbox/wiki/Frequently-Asked-Questions#user-content-why-does-netbox-support-only-image-attachments indicates that this issue is still in progress, but it seems to be done.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 15, 2020
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
Projects
None yet
Development

No branches or pull requests

10 participants