Skip to content

Commit

Permalink
Closes #2898: Enable filtering cables list by connection status
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Feb 20, 2019
1 parent c8366ef commit fba1543
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ v2.5.7 (FUTURE)

* [#2357](https://github.com/digitalocean/netbox/issues/2357) - Enable filtering of devices by rack face
* [#2878](https://github.com/digitalocean/netbox/issues/2878) - Add cable types for OS1/OS2 singlemode fiber
* [#2898](https://github.com/digitalocean/netbox/issues/2898) - Enable filtering cables list by connection status
* [#2903](https://github.com/digitalocean/netbox/issues/2903) - Clarify purpose of tags field on interface edit form

## Bug Fixes
Expand Down
5 changes: 5 additions & 0 deletions netbox/dcim/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions netbox/dcim/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,9 @@ def to_csv(self):
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
Expand Down
3 changes: 3 additions & 0 deletions netbox/dcim/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit fba1543

Please sign in to comment.