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

Enable plugins to inject content within object list views #4751

Closed
Tracked by #8333
JulianJacobi opened this issue Jun 12, 2020 · 9 comments
Closed
Tracked by #8333

Enable plugins to inject content within object list views #4751

JulianJacobi opened this issue Jun 12, 2020 · 9 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation topic: plugins Relates to the plugins framework type: feature Introduction of new functionality to the application
Milestone

Comments

@JulianJacobi
Copy link
Contributor

Environment

  • Python version: 3.7
  • NetBox version: 2.8.0

Proposed Functionality

It would be nice to give plugins the capability to not only inject buttons in object detail views, but also inject buttons to object list views.

Use Case

My specific use case is to add an additional button to object list view to give options to preseed the object form with automatically generated values, like in our case names, that follows the company's naming convention.

Here a little example screenshot:
Bildschirmfoto 2020-06-12 um 11 57 30

Database Changes

None.

External Dependencies

None.

@jeremystretch
Copy link
Member

It would be nice to give plugins the capability to not only inject buttons in object detail views, but also inject buttons to object list views.

Please expand your issue to specify exactly what changes you are proposing, including example code that a plugin would use.

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Jun 12, 2020
@JulianJacobi
Copy link
Contributor Author

I would add an additional method to PluginTemplateExtension called list_buttons() that acts similar to buttons() but is not rendered in an object's detail view context but in object's list view.

Plugin example code could be:

from extras.plugins import PluginTemplateExtension

class DeviceListButton(PluginTemplateExtension):
    model = 'dcim.device'

    def list_buttons(self):
        return self.render('sample_netbox_plugin/inc/device_list_buttons.html')

template_extensions = [DeviceListButton]

@jeremystretch jeremystretch removed the status: revisions needed This issue requires additional information to be actionable label Jun 15, 2020
@JulianJacobi
Copy link
Contributor Author

If this would help, I can provide an implementation attempt.

@ozoid
Copy link

ozoid commented Jun 29, 2020

I too would like to see this feature - along with plugin buttons/areas on the interface view - there are some already on the cable view.
p.s. custom fields on interfaces would also be great (https://nifry.com/2020/06/08/custom-fields-on-netbox-interfaces/)
Thank you :-)

@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Jun 30, 2020
@hellerve
Copy link
Contributor

i think this sounds fantastic. What feedback needs to be gathered still?

@jeremystretch jeremystretch added the type: feature Introduction of new functionality to the application label Jul 24, 2020
@jeremystretch
Copy link
Member

What functionality would the buttons provide? Keep in mind that they would not be part of the object selection list: you would not be able to select a few objects and then perform some plugin action, for instance. Bearing this in mind, maybe generic "list header" and "list footer" inclusions would make more sense?

@JulianJacobi
Copy link
Contributor Author

In out (maybe a little bit special) use case, we want to add "shortcuts" to the object creation form with a (vie GET-parameters) preseeded, autogenerated object name. So we can easily create the next unused name that follows a special naming convention, without the need to copy&paste things from netbox to netbox.

So for this use case a button near the "Add" button makes the most sense. But i think i got you point and if you don't want to support both options (what i could understand) i think list header and footer buttons would make more sense in a more generic point of view.

@ozoid
Copy link

ozoid commented Aug 6, 2020

A plugin button on the interface view would allow our plugin to pull/push the data for the specific interface (Observium/SNMP)
We could also link to the interface charts/detail page on our monitoring systems.
We have added the custom fields for interfaces to allow us to store the monitoring system interface UID.
Content areas could allow us to augment the interface view with more data/charts/stats.
The cable detail page allows plugin buttons - we have been using another system for our cable database - buttons here allow us to pull in that data - popup some questions - and update the details from the other system (temporary solution).
overall we are extremely impressed with netbox, I would like to see our whole infrastructure detailed - but getting 2 DCs worth of data into netbox is not just a simple import task, hence the plugin to connect our systems and slowly import/update/push to our devices.

@jeremystretch jeremystretch changed the title Extends plugin core template extension features Enable plugins to inject content within object list views Sep 1, 2020
@jeremystretch
Copy link
Member

I've modified the title of this proposal to be more generic, rather than focusing specifically on buttons.

I'm marking this tentatively accepted (pending milestone assignment) with the assumption that its implementation will be limited to extending the current feature to also support list views.

@jeremystretch jeremystretch added needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Sep 1, 2020
@jeremystretch jeremystretch added the topic: plugins Relates to the plugins framework label Oct 14, 2020
@arthanson arthanson self-assigned this Nov 11, 2022
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed needs milestone Awaiting prioritization for inclusion with a future NetBox release labels Nov 11, 2022
@jeremystretch jeremystretch added this to the v3.4 milestone Nov 11, 2022
jeremystretch added a commit that referenced this issue Nov 14, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2023
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 topic: plugins Relates to the plugins framework type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

5 participants