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

Add list view for device components #3719

Merged

Conversation

DanSheps
Copy link
Member

Fixes: #3564

  • Adds list views for: Interfaces, Front Ports, Rear Ports, Console Ports, Console Server Ports, Power Ports, Power Outlets & Device Bays
  • Adds new filter
  • Adds new section in nav menu for device component list view

@DanSheps DanSheps added this to the v2.7 milestone Nov 26, 2019
@DanSheps DanSheps self-assigned this Nov 26, 2019
@DanSheps
Copy link
Member Author

Are we good, as a start, with the generic columns (parent/device, name, type, description, cable)?

@lampwins
Copy link
Contributor

lampwins commented Dec 5, 2019

@DanSheps I think it is fine for all models except interface. The interface model is just to core to the NetBox mission that I think it justifies overriding the table definition with more relevant fields. But if that becomes a line in the sand blocking this from moving forward, I will concede.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! Thanks for doing all this heavy lifting. Just had a few comments/questions regarding cleanup/consistency.

component_type = 'Interfaces'
parent = tables.LinkColumn(order_by=('device', 'virtual_machine'))

class Meta(InterfaceTable.Meta, DeviceComponentDetailTable.Meta):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need to inherit from other Meta classes here, since we're setting the parameters anyway? If there is, inheritance order should be consistent with the other component tables.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we are taking the model from some and the columns from another, but for this one most likely not.

I believe I set it mostly for a "in the future case" and to maintain consistency with the other models but it looks like I goofed on the ordering.


class Meta(BaseTable.Meta):
order_by = ('device', 'name')
fields = ('pk', 'device', 'name', 'type', 'description', 'cable')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend removing type from this table and adding it only to the tables for models where it's a field (similar to how we're handling device).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have adjusted Interface and DeviceBay to instead not inherit the Component meta, as those are the only ones that will have a differing field list.

@DanSheps
Copy link
Member Author

DanSheps commented Dec 5, 2019

@DanSheps I think it is fine for all models except interface. The interface model is just to core to the NetBox mission that I think it justifies overriding the table definition with more relevant fields. But if that becomes a line in the sand blocking this from moving forward, I will concede.

What other fields do you think should be added?

@jeremystretch jeremystretch merged commit 8cbd2f5 into netbox-community:develop-2.7 Dec 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
@DanSheps DanSheps deleted the list-view-for-ports branch December 18, 2020 17:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants