1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #2898: Enable filtering cables list by connection status

This commit is contained in:
Jeremy Stretch
2019-02-20 11:36:55 -05:00
parent c8366eff8f
commit fba154386e
4 changed files with 12 additions and 0 deletions

View File

@ -2757,6 +2757,11 @@ class CableFilterForm(BootstrapMixin, forms.Form):
required=False,
widget=StaticSelect2()
)
status = forms.ChoiceField(
required=False,
choices=add_blank_choice(CONNECTION_STATUS_CHOICES),
widget=StaticSelect2()
)
color = forms.CharField(
max_length=6,
required=False,

View File

@ -2651,6 +2651,9 @@ class Cable(ChangeLoggedModel):
self.length_unit,
)
def get_status_class(self):
return 'success' if self.status else 'info'
def get_path_endpoints(self):
"""
Traverse both ends of a cable path and return its connected endpoints. Note that one or both endpoints may be

View File

@ -647,6 +647,9 @@ class CableTable(BaseTable):
orderable=False,
verbose_name=''
)
status = tables.TemplateColumn(
template_code=STATUS_LABEL
)
length = tables.TemplateColumn(
template_code=CABLE_LENGTH,
order_by='_abs_length'