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
15.77k stars 2.54k forks source link

Component type filters to replace is_* filters #2583

Closed lampwins closed 5 years ago

lampwins commented 5 years ago

Environment

Proposed Functionality

Create new filters in the UI and API for device component types. These new filters should take the general form has_interfaces, has_console_ports, has_power_ports, etc. These will replace the now deprecated and removed is_* filters in 2.5-beta1. There should be a has_* filter for each component type and those filters should be available on the Device and DeviceType models in both the UI list views and the API.

Use Case

With the removal of the is_* fields from the DeviceType model in 2.5-beta1, we have lost some filtering functionality on the Device and DeviceType models related to components like interfaces, power ports, etc. Users wish to filter for devices and device types based on the boolean presence of different combinations of components.

Database Changes

None

External Dependencies

None

lampwins commented 5 years ago

Had I looked, I have known this was mostly already implemented in af95ba48aa6d0b93cbea37d743213c4892dd6b96. I have cleaned this up a little bit to make them NullBooleanField's to make filtering on False possible from the UI. Also exposed the fields to the Device form.