Convert device/VM component templates to tables #3805

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

Originally created by @jeremystretch on GitHub (Jun 24, 2020).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

When viewing a device, its associated components (console ports, power outlets, interfaces, etc.) are displayed in tables, however each row is rendered using a static template (e.g. dcim/inc/interface.html). The same goes for virtual machine interfaces. This issue proposes replacing these static templates with Table objects, similar to how the global component lists are rendered.

Justification

This change would have several benefits:

  • Reduce template footprint
  • Enable ordering components by field
  • Enable toggling the display of certain fields (user preference)
  • Potentially support pagination
Originally created by @jeremystretch on GitHub (Jun 24, 2020). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes When viewing a device, its associated components (console ports, power outlets, interfaces, etc.) are displayed in tables, however each row is rendered using a static template (e.g. `dcim/inc/interface.html`). The same goes for virtual machine interfaces. This issue proposes replacing these static templates with Table objects, similar to how the global component lists are rendered. ### Justification This change would have several benefits: - Reduce template footprint - Enable ordering components by field - Enable toggling the display of certain fields (user preference) - Potentially support pagination
adam added the status: acceptedtype: housekeeping labels 2025-12-29 18:31:17 +01:00
adam closed this issue 2025-12-29 18:31:18 +01:00
Author
Owner

@DanSheps commented on GitHub (Jun 26, 2020):

Would this be a good time to look at something like datatables for this?

@DanSheps commented on GitHub (Jun 26, 2020): Would this be a good time to look at something like datatables for this?
Author
Owner

@jeremystretch commented on GitHub (Jun 26, 2020):

I opened this primarily as a reminder to myself, but recall that #4193 was opened a while back and as you mention datatables was suggested. However, that was before we introduced the ability to toggle and order table columns. I'm not necessarily opposed to implementing datatables, but I'd prefer to avoid the dependency and UI overhead if we can. I also don't want to risk putting too much effort into a frontend component that will potentially be replaced in a v3.0 world anyway.

It should be fairly straightforward to convert the existing templates to Table objects. Let me dig into it a bit more and if it seems to be a reasonable amount of effort for a few quick wins (enumerated above) I'd be happy with that for now.

@jeremystretch commented on GitHub (Jun 26, 2020): I opened this primarily as a reminder to myself, but recall that #4193 was opened a while back and as you mention datatables was suggested. However, that was before we introduced the ability to toggle and order table columns. I'm not necessarily opposed to implementing datatables, but I'd prefer to avoid the dependency and UI overhead if we can. I also don't want to risk putting too much effort into a frontend component that will potentially be replaced in a v3.0 world anyway. It should be fairly straightforward to convert the existing templates to Table objects. Let me dig into it a bit more and if it seems to be a reasonable amount of effort for a few quick wins (enumerated above) I'd be happy with that for now.
Author
Owner

@whitej6 commented on GitHub (Jul 20, 2020):

@jeremystretch please assign to me

@whitej6 commented on GitHub (Jul 20, 2020): @jeremystretch please assign to me
Author
Owner

@jeremystretch commented on GitHub (Jul 20, 2020):

@whitej6 Are you sure? This is going to be fairly involved: each of the device component tables employed under the component list views (e.g. dcim.tables.ConsolePortTable) needs to be extended so that it can be used under individual devices views as well, to replace the inclusion templates. It will also be necessary to convert the display of IP addresses attached to interfaces to table columns (rather than subtables as they currently exist). These changes need to be made while ensuring none of the existing functionality is lost.

As we're getting ready to make the jump to v2.9, these changes will need to be made against the develop-2.9 branch. However, as it should be a fairly transparent opaque change to the user, it doesn't necessarily need to be done in time for the v2.9.0 release.

@jeremystretch commented on GitHub (Jul 20, 2020): @whitej6 Are you sure? This is going to be fairly involved: each of the device component tables employed under the component list views (e.g. `dcim.tables.ConsolePortTable`) needs to be extended so that it can be used under individual devices views as well, to replace the inclusion templates. It will also be necessary to convert the display of IP addresses attached to interfaces to table columns (rather than subtables as they currently exist). These changes need to be made while ensuring none of the existing functionality is lost. As we're getting ready to make the jump to v2.9, these changes will need to be made against the `develop-2.9` branch. However, as it should be a fairly ~transparent~ opaque change to the user, it doesn't necessarily need to be done in time for the v2.9.0 release.
Author
Owner

@jeremystretch commented on GitHub (Sep 9, 2020):

@whitej6 Can you share what progress you've made on this?

@jeremystretch commented on GitHub (Sep 9, 2020): @whitej6 Can you share what progress you've made on this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3805