Show description disabled by default. Added IFACE_STATUS_CLASSES for labels.

This commit is contained in:
Joseph Kennedy 2017-08-28 20:24:51 -04:00
parent 79eda3a55d
commit 88095c020d
5 changed files with 11 additions and 5 deletions

View File

@ -56,6 +56,11 @@ IFACE_ENABLED_CHOICES = [
[IFACE_ENABLED, 'Enabled'], [IFACE_ENABLED, 'Enabled'],
] ]
IFACE_STATUS_CLASSES = {
0: 'disabled',
1: 'enabled',
}
# Interface form factors # Interface form factors
# Virtual # Virtual
IFACE_FF_VIRTUAL = 0 IFACE_FF_VIRTUAL = 0

View File

@ -1623,8 +1623,9 @@ class InterfaceListFilterForm(BootstrapMixin, forms.Form):
device = forms.CharField(required=False, label='Device name') device = forms.CharField(required=False, label='Device name')
enabled = forms.ChoiceField(choices=add_blank_choice(IFACE_ENABLED_CHOICES), required=False) enabled = forms.ChoiceField(choices=add_blank_choice(IFACE_ENABLED_CHOICES), required=False)
role = FilterChoiceField( role = FilterChoiceField(
required=False,
queryset=DeviceRole.objects.annotate(filter_count=Count('devices')), queryset=DeviceRole.objects.annotate(filter_count=Count('devices')),
to_field_name='slug', to_field_name='slug'
) )
mac_address = forms.CharField(required=False, label='MAC address') mac_address = forms.CharField(required=False, label='MAC address')

View File

@ -1235,7 +1235,7 @@ class Interface(models.Model):
return None return None
def get_status_class(self): def get_status_class(self):
return IFACE_ENABLED_CHOICES[self.enabled] return IFACE_STATUS_CLASSES[self.enabled]
# Used for export # Used for export
def to_csv(self): def to_csv(self):

View File

@ -388,8 +388,8 @@
<button class="btn btn-default btn-xs toggle-ips" selected="selected"> <button class="btn btn-default btn-xs toggle-ips" selected="selected">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span> Show IPs <span class="glyphicon glyphicon-check" aria-hidden="true"></span> Show IPs
</button> </button>
<button class="btn btn-default btn-xs toggle-description" selected="selected"> <button class="btn btn-default btn-xs toggle-description">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span> Show Description <span class="glyphicon glyphicon-check" aria-hidden="true"></span> Show Descriptions
</button> </button>
{% if perms.dcim.change_interface and interfaces|length > 1 %} {% if perms.dcim.change_interface and interfaces|length > 1 %}
<button class="btn btn-default btn-xs toggle"> <button class="btn btn-default btn-xs toggle">

View File

@ -11,7 +11,7 @@
<span class="label label-primary">{{ iface.lag.name }}</span> <span class="label label-primary">{{ iface.lag.name }}</span>
{% endif %} {% endif %}
{% if iface.description %} {% if iface.description %}
<i class="fa fa-fw fa-comment-o" hidden="true" title="{{ iface.description }}"></i> <i class="fa fa-fw fa-comment-o" aria-hidden="true" title="{{ iface.description }}"></i>
{% endif %} {% endif %}
<td> <td>
{% if iface.description %} {% if iface.description %}