mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #1198: Allow filtering unracked devices on device list
This commit is contained in:
@ -821,13 +821,15 @@ class DeviceFilterForm(BootstrapMixin, CustomFieldFilterForm):
|
|||||||
rack_id = FilterChoiceField(
|
rack_id = FilterChoiceField(
|
||||||
queryset=Rack.objects.annotate(filter_count=Count('devices')),
|
queryset=Rack.objects.annotate(filter_count=Count('devices')),
|
||||||
label='Rack',
|
label='Rack',
|
||||||
|
null_option=(0, 'None'),
|
||||||
)
|
)
|
||||||
role = FilterChoiceField(
|
role = FilterChoiceField(
|
||||||
queryset=DeviceRole.objects.annotate(filter_count=Count('devices')),
|
queryset=DeviceRole.objects.annotate(filter_count=Count('devices')),
|
||||||
to_field_name='slug',
|
to_field_name='slug',
|
||||||
)
|
)
|
||||||
tenant = FilterChoiceField(
|
tenant = FilterChoiceField(
|
||||||
queryset=Tenant.objects.annotate(filter_count=Count('devices')), to_field_name='slug',
|
queryset=Tenant.objects.annotate(filter_count=Count('devices')),
|
||||||
|
to_field_name='slug',
|
||||||
null_option=(0, 'None'),
|
null_option=(0, 'None'),
|
||||||
)
|
)
|
||||||
manufacturer_id = FilterChoiceField(queryset=Manufacturer.objects.all(), label='Manufacturer')
|
manufacturer_id = FilterChoiceField(queryset=Manufacturer.objects.all(), label='Manufacturer')
|
||||||
|
@ -76,6 +76,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Update rack options
|
// Update rack options
|
||||||
rack_list.empty();
|
rack_list.empty();
|
||||||
|
rack_list.append($("<option></option>").attr("value", "0").text("None"));
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: netbox_api_path + 'dcim/racks/?limit=500&site=' + selected_sites.join('&site='),
|
url: netbox_api_path + 'dcim/racks/?limit=500&site=' + selected_sites.join('&site='),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
Reference in New Issue
Block a user